fix(ludic.physics): buoyant bodies in a table made with the state (256), a sink taking the last row - floating and sinking push nothing

ludic deps --allocs (25.2) found phys_float's five pushes per drop reaching the water and
phys_sink's filtered copies per removal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 15:56:12 +03:00
parent 58f0dbbc84
commit 7f973f9a4f
3 changed files with 24 additions and 30 deletions

View file

@ -46,10 +46,9 @@ export state PhysicsState {
ph_steps: int = 0
ph_gen: int = 0 # how many worlds have been opened: an id from an older one is stale
ph_hard: float = 2.0 # metres a second: a contact under this is not a fact
ph_floats: []int = new []int # buoyant bodies' ids
ph_float_k: []float = new []float # and theirs: buoyancy, linear drag, angular drag, wet
ph_floats2: []int = new []int # the spare pair phys_sink filters into
ph_float_k2: []float = new []float
ph_floats: words = words(256) # buoyant bodies' ids, the first ph_nf of them
ph_float_k: floats = floats(256 * 4) # and theirs: buoyancy, linear drag, angular drag, wet
ph_nf: int = 0
ph_rx: float = 0.0 # where the last phys_resolve put a body
ph_rz: float = 0.0
ph_walkers: []pointer = new []pointer # a walker id is its place here; null once removed