fix(leaks): the compass's capture reuses its list and a pool of marks; what is caught is good until the next capture

The guide captured the story's marks every frame into a new list of new marks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 00:58:45 +03:00
parent c2a5df4be8
commit 7b0deda1a6
4 changed files with 33 additions and 27 deletions

View file

@ -30,6 +30,8 @@ export state CompassState {
cmp_used: int = 0
cmp_capturing: bool = false
cmp_caught: []CompassMark = null # what providers said while someone was listening
cmp_cpool: []CompassMark = null # the capture's marks, reused from one capture to the next
cmp_cused: int = 0
cmp_ranges: []float = null
cmp_radar_from: int = 2 # marks of at least this tier are blips; the tracked one always is
}
@ -40,8 +42,8 @@ export function compass_config(compass_st: mut CompassState, cap: int) -> void {
compass_begin(compass_st)
}
function cmp_new(x: float, z: float, icon: int, colour: int, tier: int, prio: int, label: string) -> CompassMark {
let m = new CompassMark
# a pooled mark filled in place
function cmp_fill(m: CompassMark, x: float, z: float, icon: int, colour: int, tier: int, prio: int, label: string) -> CompassMark {
m.x = x
m.z = z
m.icon = icon