fix(ludic.wildlife): a newcomer takes the record of one of its species removed for good - its row, its key and so the game's drawing, every other field as new
Each morning's repopulation made a new WildAnimal (and the game a new drawing, actor and skeleton, keyed by an ever-rising key) for every animal that had gone. A legend's record is never taken, nor one still in a crowd. reuse_test: a hundred removes and makes are one record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3311269b23
commit
0e2d2a6fab
5 changed files with 158 additions and 5 deletions
|
|
@ -29,9 +29,9 @@ export function wildlife_seed(wildlife_st: WildlifeState, seed: int) -> void { r
|
|||
export function wildlife_make(wildlife_st: mut WildlifeState, sp: int, x: float, z: float, legend: bool, yaw: float, variant: int, scale: float, nid: int) -> WildAnimal {
|
||||
let s = wildlife_species(wildlife_st, sp)
|
||||
if s == null { return null }
|
||||
let a = new WildAnimal
|
||||
wildlife_st.wl_keys += 1
|
||||
a.key = wildlife_st.wl_keys
|
||||
var a = wl_reusable(wildlife_st.wl, sp)
|
||||
let again = a != null
|
||||
if again { wl_forget(wildlife_st.wl, a) } else { a = wl_record(wildlife_st) }
|
||||
a.nid = nid
|
||||
a.sp = sp
|
||||
a.x = x
|
||||
|
|
@ -46,7 +46,7 @@ export function wildlife_make(wildlife_st: mut WildlifeState, sp: int, x: float,
|
|||
a.scale = scale
|
||||
a.legend = legend
|
||||
a.state = WILD_IDLE
|
||||
wl_file(wildlife_st.wl, a)
|
||||
if again { wl_refile_one(wildlife_st.wl, a) } else { wl_file(wildlife_st.wl, a) }
|
||||
WildlifeWorld.born(a)
|
||||
return a
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue