fix(ludic.npc): the facts' records and the queue's lists made at their size at the start (64), so a frame with a new peak of facts makes nothing
The fence found np_fact_record making a record in five frames of every scenario: the pool grew to each new peak of facts held at once, and q_unheld's free list and the queue's two lists grew with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f74738a4e0
commit
7fdd6582be
4 changed files with 32 additions and 5 deletions
26
packages/ludic.npc/pool.ludic
Normal file
26
packages/ludic.npc/pool.ludic
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# ludic.npc/pool.ludic - the facts' records and the queue's lists made at their size once, at the
|
||||
# start: a frame's facts are reused records, and a frame with more than it has seen before still
|
||||
# makes none until NP_FACTS are held at once
|
||||
const NP_FACTS: int = 64
|
||||
|
||||
function np_pool_new() -> []NpcFact {
|
||||
let l = new []NpcFact
|
||||
for i in 0 .. NP_FACTS { push(l, new NpcFact) }
|
||||
return l
|
||||
}
|
||||
# an empty list with room for them all: q_unheld fills it without growing it
|
||||
function np_list_sized() -> []NpcFact {
|
||||
let l = np_pool_new()
|
||||
List.clear(l)
|
||||
return l
|
||||
}
|
||||
function np_queue_sized(q: Queue<NpcFact>) -> Queue<NpcFact> {
|
||||
let f = new NpcFact
|
||||
for i in 0 .. NP_FACTS {
|
||||
push(q.items, f)
|
||||
push(q.spare, f)
|
||||
}
|
||||
List.clear(q.items)
|
||||
List.clear(q.spare)
|
||||
return q
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue