refactor(packages): 0.R5 - a question no longer starts its state - 64 lazy starts ('if st.x == null { st.x = ... }' inside a getter) are the state's defaults, gear__ensure is gone, and ludic migrate state --tighten took mut off 208 package parameters: things_all, thing_find, gear_charge, gear_level, jobs_state and the rest read
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
54f5efb23f
commit
9862ec82e3
102 changed files with 320 additions and 351 deletions
|
|
@ -33,47 +33,47 @@ export property WildSpecies {
|
|||
}
|
||||
|
||||
export state WildlifeState {
|
||||
wl_facts: Queue<WildFact> = null
|
||||
wl_facts: Queue<WildFact> = wl_facts__new()
|
||||
wl_own: []WildAnimal = null
|
||||
wl_px: float = 0.0
|
||||
wl_pz: float = 0.0
|
||||
wl_ask: WildLure = null
|
||||
wl_best: WildLure = null
|
||||
wl_ask: WildLure = new WildLure
|
||||
wl_best: WildLure = new WildLure
|
||||
wl_seed_any: bool = false
|
||||
wl_seed_t: float = 0.0
|
||||
wl_ids: int = 0
|
||||
wl_ranges: []WildRange = null
|
||||
wl_ranges: []WildRange = new []WildRange
|
||||
wl_found: []int = null # found flags a load brought before the ranges were set out
|
||||
wl_seen: int = 0
|
||||
wl_fed: int = 0
|
||||
wl_fed_any: bool = false
|
||||
wl_near_i: int = 0
|
||||
wl_species: []WildSpecies = null
|
||||
wl_list: []WildAnimal = null
|
||||
wl_species: []WildSpecies = new []WildSpecies
|
||||
wl_list: []WildAnimal = new []WildAnimal
|
||||
wl_keys: int = 0
|
||||
wl_dice: Rng = null
|
||||
wl_dice: Rng = rng_new(97)
|
||||
wl_hold: bool = false # staged: nobody thinks, everybody keeps their speed
|
||||
wl_spot_ask: WildSpot = null
|
||||
wl_spot_ask: WildSpot = new WildSpot
|
||||
}
|
||||
|
||||
function wl_sp_all(wildlife_st: mut WildlifeState) -> []WildSpecies {
|
||||
if wildlife_st.wl_species == null { wildlife_st.wl_species = new []WildSpecies }
|
||||
function wl_sp_all(wildlife_st: WildlifeState) -> []WildSpecies {
|
||||
return wildlife_st.wl_species
|
||||
}
|
||||
|
||||
export function wildlife_species_clear(wildlife_st: mut WildlifeState) -> void { wildlife_st.wl_species = new []WildSpecies }
|
||||
|
||||
# the next species; returns its number
|
||||
export function wildlife_species_add(wildlife_st: mut WildlifeState, s: WildSpecies) -> int {
|
||||
export function wildlife_species_add(wildlife_st: WildlifeState, s: WildSpecies) -> int {
|
||||
push(wl_sp_all(wildlife_st), s)
|
||||
return len(wl_sp_all(wildlife_st)) - 1
|
||||
}
|
||||
|
||||
export function wildlife_species_count(wildlife_st: mut WildlifeState) -> int { return len(wl_sp_all(wildlife_st)) }
|
||||
export function wildlife_species_count(wildlife_st: WildlifeState) -> int { return len(wl_sp_all(wildlife_st)) }
|
||||
|
||||
export function wildlife_species(wildlife_st: mut WildlifeState, sp: int) -> WildSpecies {
|
||||
export function wildlife_species(wildlife_st: WildlifeState, sp: int) -> WildSpecies {
|
||||
if sp < 0 or sp >= len(wl_sp_all(wildlife_st)) { return null }
|
||||
return wl_sp_all(wildlife_st)[sp]
|
||||
}
|
||||
|
||||
function wl_sp(wildlife_st: mut WildlifeState, sp: int) -> WildSpecies { return wl_sp_all(wildlife_st)[sp] }
|
||||
function wl_sp(wildlife_st: WildlifeState, sp: int) -> WildSpecies { return wl_sp_all(wildlife_st)[sp] }
|
||||
function wl_facts__new() -> Queue<WildFact> { return queue_new("wildlife.facts") }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue