ludic.wildlife: the table a guest draws the host's animals into is made once and emptied per join, not new each time

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:00:18 +03:00
parent 07a6c35470
commit 3f32bfda7c
2 changed files with 10 additions and 1 deletions

View file

@ -4,13 +4,21 @@
export function wildlife_put_away(wildlife_st: mut WildlifeState) -> void {
if wildlife_st.wl_own != null { return }
wildlife_st.wl_own = wildlife_st.wl
wildlife_st.wl = wl__new()
wl__empty(wildlife_st.wl_host)
wildlife_st.wl = wildlife_st.wl_host
}
export function wildlife_bring_back(wildlife_st: mut WildlifeState) -> void {
if wildlife_st.wl_own == null { return }
wildlife_st.wl_host = wildlife_st.wl
wildlife_st.wl = wildlife_st.wl_own
wildlife_st.wl_own = null
}
export function wildlife_away(wildlife_st: WildlifeState) -> bool { return wildlife_st.wl_own != null }
# every animal gone from a table, keeping its rows' room for the next party
function wl__empty(w: WildTable) -> void {
tb_clear(w.tab)
imap_clear(w.nids)
}

View file

@ -39,6 +39,7 @@ export state WildlifeState {
wl_ffree: []WildFact = new []WildFact # of those, the ones free at the last look
wl_fnext: []int = words(1) # the next of them to hand out
wl_own: WildTable = null # a guest's own animals, put away whole while it draws the host's
wl_host: WildTable = wl__new() # the table the host's are drawn into: made once, cleared per join
wl_px: float = 0.0
wl_pz: float = 0.0
wl_ask: WildLure = new WildLure