chunked tables: a key is unique across its map and the slot's own, not interned - a slot keeps row i's key in its own buffer i, rewritten when the slot is refilled (interning ~92k map-unique keys as a player walks would fill the bounded intern table and keep them all); ludicc --check refuses a key written in two of a map's chunk files, naming both; reseeded

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 21:43:20 +03:00
parent 0634116d59
commit 49e32f9b47
11 changed files with 75842 additions and 74646 deletions

View file

@ -208,6 +208,7 @@ function pmk_map(md: pointer) -> void {
r += 1
}
pmk_dups()
pmk_chunk_dups()
var e = 0
while e < len(g_pmk_rec) {
let rr = g_pmk_reg[e]
@ -237,6 +238,30 @@ function pmk_dups() -> void {
i += 1
}
}
# a chunked table's key is unique across its map (a row's id is (map, key), and a tree moved into
# another chunk keeps it): a key in two of a map's chunk files is refused, naming both
function pmk_chunk_dups() -> void {
let xs = new []int
let keys = new []pointer
var i = 0
while i < len(g_pmk_key) {
if g_rg_chunk[g_pmk_reg[i]] > 0 {
push(xs, i)
push(keys, `{g_rg_name[g_pmk_reg[i]]}\n{g_pmk_key[i]}`)
} else { push(keys, "") }
i += 1
}
sc_sort(xs, keys)
i = 1
while i < len(xs) {
let a = xs[i - 1]
let k = xs[i]
if (keys[k] == keys[a]) and not (g_pmk_file[k] == g_pmk_file[a]) {
pmk_err(g_pmk_file[k], g_pmk_kline[k], g_pmk_kcol[k], `the key {g_pmk_key[k]} is also written at {g_pmk_file[a]}:{itoa(g_pmk_kline[a])} - a chunked table's key is unique across its map`)
}
i += 1
}
}
# every cross-row @Ref met names a row of its table in this map
function pmk_refs() -> void {
let xs = new []int