ludic.compass, inventory, shop, base, things: the compass's lists are state defaults and push through kept_push; the pack clears in place; setup, bind and load paths say so in @alloc_ok
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cd71da9330
commit
bdfe3f18fe
13 changed files with 26 additions and 12 deletions
|
|
@ -75,6 +75,7 @@ export function imap_clear(m: IntMap) -> void {
|
|||
}
|
||||
|
||||
# room for `n` keys before the map grows, made now
|
||||
@alloc_ok("at a world's start: the keys it will need")
|
||||
export function imap_reserve(m: IntMap, n: int) -> void {
|
||||
if (m.mask + 1) * 3 >= n * 4 { return }
|
||||
var cap = m.mask + 1
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# ludic.base/ecs_table_reserve.ludic - room made at the start: a table sized for its busiest moment
|
||||
# never grows in play, and nothing that grows is ever given back. What does grow past it is here
|
||||
@alloc_ok("at a world's start: the rows it will need")
|
||||
export function tb_reserve<T>(tb: Table<T>, rows: int) -> void {
|
||||
let k = rows - tb.n
|
||||
if k <= 0 { return }
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ export function save_section(root: Val, key: string, version: int, v: Val) -> vo
|
|||
}
|
||||
|
||||
# the section at root[key]: found false (and an empty object) when there is none
|
||||
@alloc_ok("on load: a section read from the file")
|
||||
export function load_section(root: Val, key: string) -> SaveNode {
|
||||
let n = new SaveNode
|
||||
n.data = Value.object()
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ export function sv_str(v: Val, key: string, fallback: string) -> string {
|
|||
}
|
||||
|
||||
# a list of ints; a missing key or a non-list is the empty list
|
||||
@alloc_ok("on load: a saved list read back")
|
||||
export function sv_ints(v: Val, key: string) -> []int {
|
||||
let out = new []int
|
||||
if not sv_has(v, key) { return out }
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ function cs_all(base_st: mut BaseState) -> []System {
|
|||
return base_st.cs_list
|
||||
}
|
||||
|
||||
@alloc_ok("at start: a system made for the runner")
|
||||
export function system_new(key: string, phase: int) -> System {
|
||||
let s = new System
|
||||
s.key = key
|
||||
|
|
@ -35,6 +36,7 @@ export function system_new(key: string, phase: int) -> System {
|
|||
}
|
||||
|
||||
# a key is a save section's name, so two systems may not share one
|
||||
@alloc_ok("at start: a system added to the runner")
|
||||
export function core_add(base_st: mut BaseState, s: System) -> void {
|
||||
let all = cs_all(base_st)
|
||||
for i in 0 .. len(all) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue