ludic/packages/ludic.wildlife/record.ludic
Orkuncakilkaya 19fcf60599 wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
  1804 vars into 126 states, 64 into lets; 23498 edits in 460 files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 15:31:34 +03:00

31 lines
1.5 KiB
Text

# record.ludic - what this player has met: the species seen up close and the species fed, as masks
# by species number, and whether anything has been fed at all
export function wildlife_seen(wildlife_st: WildlifeState, sp: int) -> bool { return (wildlife_st.wl_seen & (1 << sp)) != 0 }
export function wildlife_seen_mask(wildlife_st: WildlifeState) -> int { return wildlife_st.wl_seen }
export function wildlife_fed_mask(wildlife_st: WildlifeState) -> int { return wildlife_st.wl_fed }
export function wildlife_fed_any(wildlife_st: WildlifeState) -> bool { return wildlife_st.wl_fed_any }
# seen up close (a guest's own pass, droppings read, a sighting here); true the first time
export function wildlife_saw(wildlife_st: mut WildlifeState, sp: int) -> bool {
if wildlife_seen(wildlife_st, sp) { return false }
wildlife_st.wl_seen = wildlife_st.wl_seen | (1 << sp)
return true
}
export function wildlife_set_seen(wildlife_st: mut WildlifeState, mask: int) -> void { wildlife_st.wl_seen = mask }
# a species fed, credited to this player
export function wildlife_mark_fed(wildlife_st: mut WildlifeState, sp: int) -> void {
wildlife_st.wl_fed = wildlife_st.wl_fed | (1 << sp)
wildlife_st.wl_fed_any = true
}
# nothing fed yet (a test that feeds again), or the flag as given
export function wildlife_set_fed_any(wildlife_st: mut WildlifeState, on: bool) -> void { wildlife_st.wl_fed_any = on }
function wl_record_reset(wildlife_st: mut WildlifeState) -> void {
wildlife_st.wl_seen = 0
wildlife_st.wl_fed = 0
wildlife_st.wl_fed_any = false
}