diff --git a/packages/ludic.character/fact_pool.ludic b/packages/ludic.character/fact_pool.ludic index fcb7dfa5..2b9b2d9d 100644 --- a/packages/ludic.character/fact_pool.ludic +++ b/packages/ludic.character/fact_pool.ludic @@ -12,3 +12,10 @@ function chr_ffree_new() -> []CharacterFact { List.clear(l) return l } +# past them: a record for the new peak, kept in the pool for good +@alloc_ok("a new peak of facts held at once, past the 64 made at the start; kept and reused") +function chr_fact_more(character_st: mut CharacterState) -> CharacterFact { + let f = new CharacterFact + push(character_st.chr_fpool, f) + return f +} diff --git a/packages/ludic.character/state.ludic b/packages/ludic.character/state.ludic index f70e3e7f..99f21200 100644 --- a/packages/ludic.character/state.ludic +++ b/packages/ludic.character/state.ludic @@ -25,9 +25,7 @@ function chr_fact_record(character_st: mut CharacterState) -> CharacterFact { character_st.chr_fnext += 1 return f } - let f = new CharacterFact - push(character_st.chr_fpool, f) - return f + return chr_fact_more(character_st) } function chr_say(character_st: mut CharacterState, what: int, v: float) -> void { let f = chr_fact_record(character_st) diff --git a/packages/ludic.npc/pool.ludic b/packages/ludic.npc/pool.ludic index b33c43db..4c9dc012 100644 --- a/packages/ludic.npc/pool.ludic +++ b/packages/ludic.npc/pool.ludic @@ -24,3 +24,10 @@ function np_queue_sized(q: Queue) -> Queue { List.clear(q.spare) return q } +# past them: a record for the new peak, kept in the pool for good +@alloc_ok("a new peak of facts held at once, past the 64 made at the start; kept and reused") +function np_fact_more(npc_st: mut NpcState) -> NpcFact { + let f = new NpcFact + push(npc_st.np_fpool, f) + return f +} diff --git a/packages/ludic.npc/way.ludic b/packages/ludic.npc/way.ludic index dd50e908..c6256992 100644 --- a/packages/ludic.npc/way.ludic +++ b/packages/ludic.npc/way.ludic @@ -94,9 +94,7 @@ function np_fact_record(npc_st: mut NpcState) -> NpcFact { f.z = 0.0 return f } - let f = new NpcFact - push(npc_st.np_fpool, f) - return f + return np_fact_more(npc_st) } # how many fact records have ever been made: the peak held at once, not the facts pushed export function npc_fact_records(npc_st: NpcState) -> int { return len(npc_st.np_fpool) } diff --git a/packages/ludic.physics/fact_pool.ludic b/packages/ludic.physics/fact_pool.ludic index 77bdfc79..990de92a 100644 --- a/packages/ludic.physics/fact_pool.ludic +++ b/packages/ludic.physics/fact_pool.ludic @@ -12,3 +12,10 @@ function ph_ffree_new() -> []PhysFact { List.clear(l) return l } +# past them: a record for the new peak, kept in the pool for good +@alloc_ok("a new peak of facts held at once, past the 64 made at the start; kept and reused") +function ph_fact_more(physics_st: mut PhysicsState) -> PhysFact { + let f = new PhysFact + push(physics_st.ph_fpool, f) + return f +} diff --git a/packages/ludic.physics/system.ludic b/packages/ludic.physics/system.ludic index e0c2e682..c2a06a95 100644 --- a/packages/ludic.physics/system.ludic +++ b/packages/ludic.physics/system.ludic @@ -45,9 +45,7 @@ function ph_fact_record(physics_st: mut PhysicsState) -> PhysFact { physics_st.ph_fnext += 1 return f } - let f = new PhysFact - push(physics_st.ph_fpool, f) - return f + return ph_fact_more(physics_st) } function ph_contacts(physics_st: mut PhysicsState) -> void { let n = jph_contacts_drain(physics_st.ph_world, physics_st.ph_ids, physics_st.ph_vals, PH_CAP) diff --git a/packages/ludic.vehicles/fact_pool.ludic b/packages/ludic.vehicles/fact_pool.ludic index 84e6d0e9..f57b3276 100644 --- a/packages/ludic.vehicles/fact_pool.ludic +++ b/packages/ludic.vehicles/fact_pool.ludic @@ -12,3 +12,10 @@ function ve_ffree_new() -> []VehicleFact { List.clear(l) return l } +# past them: a record for the new peak, kept in the pool for good +@alloc_ok("a new peak of facts held at once, past the 64 made at the start; kept and reused") +function ve_fact_more(vehicles_st: mut VehiclesState) -> VehicleFact { + let f = new VehicleFact + push(vehicles_st.ve_fpool, f) + return f +} diff --git a/packages/ludic.vehicles/state.ludic b/packages/ludic.vehicles/state.ludic index e5606dc7..8e4aa8b3 100644 --- a/packages/ludic.vehicles/state.ludic +++ b/packages/ludic.vehicles/state.ludic @@ -18,9 +18,7 @@ function ve_fact_record(vehicles_st: mut VehiclesState) -> VehicleFact { vehicles_st.ve_fnext += 1 return f } - let f = new VehicleFact - push(vehicles_st.ve_fpool, f) - return f + return ve_fact_more(vehicles_st) } # how many fact records have ever been made: the peak held at once, not the facts pushed export function vehicle_fact_records(vehicles_st: VehiclesState) -> int { return len(vehicles_st.ve_fpool) } diff --git a/packages/ludic.wildlife/fact_pool.ludic b/packages/ludic.wildlife/fact_pool.ludic index bf300903..99cd472a 100644 --- a/packages/ludic.wildlife/fact_pool.ludic +++ b/packages/ludic.wildlife/fact_pool.ludic @@ -12,3 +12,10 @@ function wl_ffree_new() -> []WildFact { List.clear(l) return l } +# past them: a record for the new peak, kept in the pool for good +@alloc_ok("a new peak of facts held at once, past the 64 made at the start; kept and reused") +function wl_fact_more(wildlife_st: mut WildlifeState) -> WildFact { + let f = new WildFact + push(wildlife_st.wl_fpool, f) + return f +} diff --git a/packages/ludic.wildlife/facts.ludic b/packages/ludic.wildlife/facts.ludic index 32330109..fe393914 100644 --- a/packages/ludic.wildlife/facts.ludic +++ b/packages/ludic.wildlife/facts.ludic @@ -48,9 +48,7 @@ function wl_fact_record(wildlife_st: mut WildlifeState) -> WildFact { f.diet = 0 return f } - let f = new WildFact - push(wildlife_st.wl_fpool, f) - return f + return wl_fact_more(wildlife_st) } # how many fact records have ever been made: the peak held at once, not the facts pushed export function wildlife_fact_records(wildlife_st: WildlifeState) -> int { return len(wildlife_st.wl_fpool) }