From a0f60e529630c0e660a1a3780eb15d61858bab4a Mon Sep 17 00:00:00 2001 From: Orkuncakilkaya Date: Mon, 28 Sep 2026 21:45:55 +0300 Subject: [PATCH] ludic.wildlife: wildlife_reserve sizes both animal tables and their id maps at a world's start Co-Authored-By: Claude Opus 5.5 --- packages/ludic.wildlife/store.ludic | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/ludic.wildlife/store.ludic b/packages/ludic.wildlife/store.ludic index 105924ce..b5f9bdbe 100644 --- a/packages/ludic.wildlife/store.ludic +++ b/packages/ludic.wildlife/store.ludic @@ -94,3 +94,12 @@ export function wildlife_count(wildlife_st: WildlifeState, sp: int) -> int { for k in 0 .. len(rows) { if not wildlife_st.wl.tab.rec[rows[k]].legend { n += 1 } } return n } + +# room for `n` animals (both tables: this player's and the host's it draws) before anything grows: +# a world that spawns in play sizes its table once, at the start +export function wildlife_reserve(wildlife_st: mut WildlifeState, n: int) -> void { + tb_reserve(wildlife_st.wl.tab, n) + imap_reserve(wildlife_st.wl.nids, n) + tb_reserve(wildlife_st.wl_host.tab, n) + imap_reserve(wildlife_st.wl_host.nids, n) +}