ludic.fishing, net, clock: their dice made once and seeded again, never made again per reset; ludic.minimap's near list kept, its marks and grid declared
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4bca5dfa92
commit
4fc9d2616a
6 changed files with 26 additions and 8 deletions
|
|
@ -42,7 +42,7 @@ export function fishing_config(fishing_st: mut FishingState, min_depth: float, d
|
|||
fishing_st.fishing_min_depth = min_depth
|
||||
fishing_st.fishing_deep = deep
|
||||
fishing_st.fishing_seed_n = seed
|
||||
fishing_st.fishing_dice = rng_new(seed)
|
||||
fishing_dice_seed(fishing_st, seed)
|
||||
}
|
||||
|
||||
export function fishing_facts(fishing_st: FishingState) -> Queue<FishingFact> {
|
||||
|
|
@ -50,10 +50,21 @@ export function fishing_facts(fishing_st: FishingState) -> Queue<FishingFact> {
|
|||
}
|
||||
|
||||
function fishing_rand(fishing_st: mut FishingState) -> float {
|
||||
if fishing_st.fishing_dice == null { fishing_st.fishing_dice = rng_new(fishing_st.fishing_seed_n) }
|
||||
if fishing_st.fishing_dice == null { fishing_dice_seed(fishing_st, fishing_st.fishing_seed_n) }
|
||||
return rng_float(fishing_st.fishing_dice)
|
||||
}
|
||||
|
||||
# the line's dice: made the first time, seeded again after (a reset, a new trip)
|
||||
function fishing_dice_seed(fishing_st: mut FishingState, seed: int) -> void {
|
||||
if fishing_st.fishing_dice != null {
|
||||
rng_seed(fishing_st.fishing_dice, seed)
|
||||
return
|
||||
}
|
||||
fishing_st.fishing_dice = fishing_dice_new(seed)
|
||||
}
|
||||
@alloc_ok("once: the line's dice")
|
||||
function fishing_dice_new(seed: int) -> Rng { return rng_new(seed) }
|
||||
|
||||
function fishing_say(fishing_st: mut FishingState, what: int) -> void {
|
||||
let f = fishing_fact_record(fishing_st)
|
||||
f.what = what
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export function fishing_reset(fishing_st: mut FishingState) -> void {
|
|||
fishing_st.fishing_n = 0
|
||||
fishing_st.fishing_big = 0
|
||||
fishing_st.fishing_leg = false
|
||||
fishing_st.fishing_dice = rng_new(fishing_st.fishing_seed_n)
|
||||
fishing_dice_seed(fishing_st, fishing_st.fishing_seed_n)
|
||||
q_clear(fishing_facts(fishing_st))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue