ludic.compass, inventory, shop, base, things: the compass's lists are state defaults and push through kept_push; the pack clears in place; setup, bind and load paths say so in @alloc_ok

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:29:33 +03:00
parent cd71da9330
commit bdfe3f18fe
13 changed files with 26 additions and 12 deletions

View file

@ -9,7 +9,10 @@ function th_spare_put(things_st: mut ThingsState, t: Thing) -> void { kept_push(
# a record for a Thing about to be placed: the oldest spare past the lag, or a new one
function th_record(things_st: mut ThingsState) -> Thing {
let l = things_st.th_spare
if len(l) - things_st.th_spare_at <= TH_SPARE_LAG { return new Thing }
if len(l) - things_st.th_spare_at <= TH_SPARE_LAG {
@alloc_ok("a spare miss: only until things_spare_warm's records and the removed ones come round")
return new Thing
}
let t = l[things_st.th_spare_at]
things_st.th_spare_at += 1
if things_st.th_spare_at >= 64 { th_spare_pack(things_st) }

View file

@ -44,6 +44,7 @@ export function things_load(things_st: mut ThingsState, v: Val, version: int) ->
for i in 0 .. Value.count(l) { th_from_json(things_st, Value.at(l, i)) }
}
@alloc_ok("on load: a saved Thing read back")
function th_from_json(things_st: mut ThingsState, o: Val) -> void {
let k = thing_kind_by_key(sv_str(o, "kind", ""))
if k < 0 { return }