ludic.base: a queue's fact records come round again (q_rec / q_ring_add), used by effects, clock, wallet, weather, tracks, needs, fire, settings, update, steps, crafting, shop, gear, hints, session and photo instead of a new record per fact; the minimap's marks cleared and rubbed out in place, its scale steps without a list; the clock's dice seeded again, not made again; once-per-join, per-save and pool-miss paths declared
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5be2422c84
commit
d9612ba2a6
31 changed files with 215 additions and 25 deletions
|
|
@ -75,6 +75,7 @@ function mm_land_count(minimap_st: mut MinimapState) -> void {
|
|||
export function minimap_land_changed(minimap_st: mut MinimapState) -> void { minimap_st.mm_land_n = 0 }
|
||||
|
||||
# the grid as one string of 0 / 1, row by row, and back (a shorter string leaves the rest unseen)
|
||||
@alloc_ok("on a save: the explored grid written out")
|
||||
export function minimap_seen_text(minimap_st: mut MinimapState) -> string {
|
||||
mm_grid(minimap_st)
|
||||
var s = ""
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ export function minimap_config(minimap_st: mut MinimapState, cells: int, cell_m:
|
|||
minimap_st.mm_cell_m = Math.max(cell_m, 0.001)
|
||||
minimap_st.mm_core0 = 0
|
||||
minimap_st.mm_core_n = minimap_st.mm_cells
|
||||
@alloc_ok("once per map configured: its explored grid")
|
||||
minimap_st.mm_seen = new []int
|
||||
for i in 0 .. minimap_st.mm_cells * minimap_st.mm_cells { push(minimap_st.mm_seen, 0) }
|
||||
minimap_st.mm_land_n = 0
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
# and which followed, and whether the map is waiting for a place to drop the next
|
||||
export function minimap_pin_remove(minimap_st: mut MinimapState, i: int) -> void {
|
||||
if i < 0 or i >= minimap_pin_count(minimap_st) { return }
|
||||
let rest = new []MinimapPin
|
||||
for k in 0 .. len(minimap_st.mm_pins) { if k != i { push(rest, minimap_st.mm_pins[k]) } }
|
||||
minimap_st.mm_pins = rest
|
||||
let l = minimap_st.mm_pins
|
||||
for k in i .. len(l) - 1 { l[k] = l[k + 1] }
|
||||
List.pop(l)
|
||||
if minimap_st.mm_open == i { minimap_st.mm_open = -1 } else if minimap_st.mm_open > i { minimap_st.mm_open -= 1 }
|
||||
if minimap_st.mm_followed == i { minimap_st.mm_followed = -1 } else if minimap_st.mm_followed > i { minimap_st.mm_followed -= 1 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@ export function minimap_config_pins(minimap_st: mut MinimapState, max: int, symb
|
|||
}
|
||||
|
||||
export function minimap_pins_clear(minimap_st: mut MinimapState) -> void {
|
||||
minimap_st.mm_pins = new []MinimapPin
|
||||
if minimap_st.mm_pins == null {
|
||||
@alloc_ok("once: the marks' list, cleared after")
|
||||
minimap_st.mm_pins = new []MinimapPin
|
||||
} else { List.clear(minimap_st.mm_pins) }
|
||||
minimap_st.mm_open = -1
|
||||
minimap_st.mm_followed = -1
|
||||
minimap_st.mm_last = 0
|
||||
|
|
@ -38,6 +41,7 @@ export function minimap_pin_full(minimap_st: MinimapState) -> bool { return mini
|
|||
export function minimap_pin_add(minimap_st: mut MinimapState, x: float, z: float, icon: int, label: string) -> int {
|
||||
if minimap_st.mm_pins == null { minimap_pins_clear(minimap_st) }
|
||||
if minimap_pin_full(minimap_st) { return -1 }
|
||||
@alloc_ok("a mark put down: kept, and the map holds at most its most")
|
||||
let p = new MinimapPin
|
||||
p.x = x
|
||||
p.z = z
|
||||
|
|
@ -53,6 +57,7 @@ export function minimap_pin_add(minimap_st: mut MinimapState, x: float, z: float
|
|||
export function minimap_pin_put(minimap_st: mut MinimapState, x: float, z: float, icon: int, colour: int, day: int, label: string) -> int {
|
||||
if minimap_st.mm_pins == null { minimap_pins_clear(minimap_st) }
|
||||
if minimap_pin_full(minimap_st) { return -1 }
|
||||
@alloc_ok("a mark put down: kept, and the map holds at most its most")
|
||||
let p = new MinimapPin
|
||||
p.x = x
|
||||
p.z = z
|
||||
|
|
|
|||
|
|
@ -40,8 +40,10 @@ export function minimap_wz(minimap_st: MinimapState, ry: float) -> float { retur
|
|||
|
||||
# a round distance whose bar is no wider than a quarter of the window
|
||||
export function minimap_scale_metres(minimap_st: MinimapState) -> int {
|
||||
let steps = [2000, 1000, 500, 250, 100, 50, 25]
|
||||
for k in 0 .. len(steps) { if float(steps[k]) * minimap_scale(minimap_st) <= minimap_st.mm_size / 4.0 { return steps[k] } }
|
||||
for k in 0 .. 7 {
|
||||
let m = mm_scale_step(k)
|
||||
if float(m) * minimap_scale(minimap_st) <= minimap_st.mm_size / 4.0 { return m }
|
||||
}
|
||||
return 25
|
||||
}
|
||||
|
||||
|
|
@ -68,3 +70,14 @@ export function minimap_focus(minimap_st: mut MinimapState, on_you: bool) -> voi
|
|||
minimap_recentre(minimap_st, on_you)
|
||||
if minimap_st.mm_zoom < minimap_st.mm_zoom_focus { minimap_st.mm_zoom = Math.clamp(minimap_st.mm_zoom_focus, minimap_st.mm_zoom_min, minimap_st.mm_zoom_max) }
|
||||
}
|
||||
|
||||
# the round distances a scale bar can show, largest first
|
||||
function mm_scale_step(k: int) -> int {
|
||||
if k == 0 { return 2000 }
|
||||
if k == 1 { return 1000 }
|
||||
if k == 2 { return 500 }
|
||||
if k == 3 { return 250 }
|
||||
if k == 4 { return 100 }
|
||||
if k == 5 { return 50 }
|
||||
return 25
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue