read the compared distances through the casts

A cast as the object of `.' keeps its parentheses now (sex#61), so
the comparator takes the two distances straight from its arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 18:10:24 +03:00
parent b74c445b25
commit d40455d824

View File

@@ -47,11 +47,9 @@
(record region-order ((rx int) (rz int) (distance double))) (record region-order ((rx int) (rz int) (distance double)))
(fn by-distance ((pa (* const void)) (pb (* const void))) int (fn by-distance ((pa (* const void)) (pb (* const void))) int
;; TODO sex#61: cast inside the field access once a cast as the object (var a _ (. (cast pa (* const region-order)) distance))
;; of . keeps its parentheses. (var b _ (. (cast pb (* const region-order)) distance))
(var a (* const region-order) pa) (return (- (> a b) (< a b))))
(var b (* const region-order) pb)
(return (- (> (. a distance) (. b distance)) (< (. a distance) (. b distance)))))
;;; A thread's generators, and the searched mineral's ore map of the ;;; A thread's generators, and the searched mineral's ore map of the
;;; region it last scanned in. ;;; region it last scanned in.