diff --git a/packages/ludic.npc/census.ludic b/packages/ludic.npc/census.ludic index 5b48a5b6..fabcb699 100644 --- a/packages/ludic.npc/census.ludic +++ b/packages/ludic.npc/census.ludic @@ -9,6 +9,7 @@ export function npc_spawn(npc_st: mut NpcState, kind: int) -> NpcPerson { break } } + @alloc_ok("a walker for each of np_max at most; one who left is reused") if p == null { if len(npc_st.np_walkers) >= npc_st.np_max { return null } p = new NpcPerson diff --git a/packages/ludic.npc/mirror.ludic b/packages/ludic.npc/mirror.ludic index a2026cf7..02f8dd8d 100644 --- a/packages/ludic.npc/mirror.ludic +++ b/packages/ludic.npc/mirror.ludic @@ -14,6 +14,7 @@ export function npc_mirroring(npc_st: NpcState) -> bool { return npc_st.np_mirro # the host's slot: somebody new in it (born), or nobody (gone) export function npc_put(npc_st: mut NpcState, slot: int, id: int, kind: int, look: int, seed: float, name: string, hx: float, hz: float) -> NpcPerson { if slot < 0 or slot >= npc_st.np_max or kind < 0 or kind >= NPCK_COUNT { return null } + @alloc_ok("a guest's copy of the host's slots, no more than np_max") while len(npc_st.np_walkers) <= slot { let q = new NpcPerson q.slot = len(npc_st.np_walkers) diff --git a/packages/ludic.physics/owned.ludic b/packages/ludic.physics/owned.ludic index 78f7c879..68b49eb8 100644 --- a/packages/ludic.physics/owned.ludic +++ b/packages/ludic.physics/owned.ludic @@ -4,6 +4,7 @@ const PH_INDEX: int = 8388607 # a body id's low 23 bits are its index (Jolt's BodyID) # every body owns nothing: at a world's opening, the table made once at its size and kept after +@alloc_ok("the body table made at its size when a world opens, kept after") function ph_own_reset(physics_st: mut PhysicsState, max_bodies: int) -> void { if len(physics_st.ph_own) < max_bodies { List.clear(physics_st.ph_own) diff --git a/packages/ludic.physics/shape_ids.ludic b/packages/ludic.physics/shape_ids.ludic index 199bc482..eaacf08a 100644 --- a/packages/ludic.physics/shape_ids.ludic +++ b/packages/ludic.physics/shape_ids.ludic @@ -10,6 +10,7 @@ function ph_keep(physics_st: mut PhysicsState, s: pointer) -> int { physics_st.ph_shapes[id] = s return id } + @alloc_ok("the id table grows to the most shapes held at once; a freed id is handed out again") push(physics_st.ph_shapes, s) return len(physics_st.ph_shapes) - 1 } @@ -26,6 +27,7 @@ export function phys_shape_free(physics_st: mut PhysicsState, id: int) -> void { if s == null { return } jph_shape_free(s) physics_st.ph_shapes[id] = null + @alloc_ok("the spare ids, no more than the most shapes ever held") push(physics_st.ph_spare, id) } diff --git a/packages/ludic.physics/walker.ludic b/packages/ludic.physics/walker.ludic index c77c5776..dd381101 100644 --- a/packages/ludic.physics/walker.ludic +++ b/packages/ludic.physics/walker.ludic @@ -35,6 +35,7 @@ export function phys_walker_add(physics_st: mut PhysicsState, r: float, h: float return i } } + @alloc_ok("a slot for the most walkers at once; a removed one's slot is reused") push(physics_st.ph_walkers, k) return len(physics_st.ph_walkers) - 1 } diff --git a/packages/ludic.vehicles/call.ludic b/packages/ludic.vehicles/call.ludic index 12ed5764..bb39b736 100644 --- a/packages/ludic.vehicles/call.ludic +++ b/packages/ludic.vehicles/call.ludic @@ -1,5 +1,6 @@ # call.ludic - a player's boat or horse brought to a place: made there the first time, fetched there # after; gone when its player leaves +@alloc_ok("a player's own boat or horse, made the first time it is called and fetched after") function ve_add(vehicles_st: VehiclesState, kind: int, owner: int, x: float, z: float, yaw: float) -> Vehicle { if kind != VEHICLE_HORSE and kind != VEHICLE_BOAT { return null } let v = new Vehicle diff --git a/packages/ludic.wildlife/table.ludic b/packages/ludic.wildlife/table.ludic index 46782ddb..032aea8d 100644 --- a/packages/ludic.wildlife/table.ludic +++ b/packages/ludic.wildlife/table.ludic @@ -14,6 +14,7 @@ export property WildTable { nids: IntMap = null } +@alloc_ok("a table of animals: a load, or a guest taking the host's") function wl__new() -> WildTable { let w = new WildTable let tb: Table = table_new(2, 2)