fix(ludic.fishing): fact records pooled (the ludic.wildlife idiom) - a record made per cast, bite and crossing was never given back

tests: fifty fish, their facts drained each time, make 5 records.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 13:17:12 +03:00
parent 968030535e
commit 36358e7a43
4 changed files with 41 additions and 2 deletions

View file

@ -25,6 +25,9 @@ export state FishingState {
fishing_run_next: float = 0.0
fishing_dice: Rng = null
fishing_fact_q: Queue<FishingFact> = fishing_fact_q__new()
fishing_fpool: []FishingFact = new []FishingFact # every fact record made, reused once no drain holds it (facts.ludic)
fishing_ffree: []FishingFact = new []FishingFact
fishing_fnext: []int = words(1)
fishing_n: int = 0 # the record: caught, the biggest (cm), a legend landed
fishing_big: int = 0
fishing_leg: bool = false
@ -51,8 +54,8 @@ function fishing_rand(fishing_st: mut FishingState) -> float {
return rng_float(fishing_st.fishing_dice)
}
function fishing_say(fishing_st: FishingState, what: int) -> void {
let f = new FishingFact
function fishing_say(fishing_st: mut FishingState, what: int) -> void {
let f = fishing_fact_record(fishing_st)
f.what = what
f.species = fishing_st.fishing_sp
f.cm = fishing_st.fishing_len