put conditional operands back where they are used

A conditional expression as an operand keeps its parentheses now
(sex#59), so the clamps and offsets are written inline again. The
story's z direction stays a local: it is drawn before the distances,
and inlining it would reorder the draws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 18:11:17 +03:00
parent d40455d824
commit e4ab3e875f
5 changed files with 9 additions and 32 deletions

View File

@@ -342,19 +342,9 @@
(if (== d 0) (++ matched))
(if (!= d 0)
(do
;; TODO sex#59: sum two (if ...)s once a conditional
;; operand keeps its parentheses.
(var cls int 0)
(if (< d 0) (+= cls 2))
(if (>= got (. t sea-level)) (+= cls 1))
(++ [by-class cls])))
(++ [by-class (+ (if (< d 0) 2 0) (if (>= got (. t sea-level)) 1 0))])))
;; -4..+4, the ends counting everything beyond
;; TODO sex#59: clamp inline once a conditional operand keeps its
;; parentheses.
(var clamped int d)
(if (< clamped -4) (= clamped -4))
(if (> clamped 4) (= clamped 4))
(var bucket int (+ clamped 4))
(var bucket int (+ (if (< d -4) -4 (if (> d 4) 4 d)) 4))
(++ [by-delta bucket])
(var colour u32 (grey (/ (* got 255) (. g settings size-y))))
(if (> d 0) (= colour 16719904))