fix(leaks): effects_live_into / effects_live_count and hints_rail_into - a HUD's read-outs into lists it keeps
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6c663cc87b
commit
7a637967fe
5 changed files with 33 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ import "ludic.base"
|
|||
import "defs.ludic"
|
||||
import "port.ludic"
|
||||
import "rail.ludic"
|
||||
import "rail_into.ludic"
|
||||
import "card.ludic"
|
||||
import "mute.ludic"
|
||||
import "system.ludic"
|
||||
|
|
|
|||
7
packages/ludic.hints/rail_into.ludic
Normal file
7
packages/ludic.hints/rail_into.ludic
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# rail_into.ludic - the rail into a list the caller keeps: a HUD asks every frame, and a list made
|
||||
# each time is never given back
|
||||
export function hints_rail_into(hints_st: HintsState, out: []int) -> void {
|
||||
List.clear(out)
|
||||
if not HintsWorld.showing() { return }
|
||||
for k in 0 .. hints_st.hn_n { push(out, hints_st.hn_top[k]) }
|
||||
}
|
||||
|
|
@ -74,6 +74,11 @@ program HintsTest {
|
|||
hints_test_st.showing = true
|
||||
hints_sort(hints_st)
|
||||
expect_eq(len(hints_rail(hints_st)), 1)
|
||||
let kept = new []int
|
||||
hints_rail_into(hints_st, kept)
|
||||
hints_rail_into(hints_st, kept)
|
||||
expect_eq(len(kept), 1)
|
||||
expect_eq(kept[0], hints_rail(hints_st)[0])
|
||||
}
|
||||
|
||||
test "the key opens the picked chip, the arrows walk round, the key puts it down" (hints_st: mut HintsState, hints_test_st: mut HintsTestState) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue