Skip to main content

Module v5

Module v5 

Source
Expand description

Save schema V5 — moves cuque-side counters and multiplier aggregates to crate::bignum::Mag (log-magnitude) so end-game stacks no longer overflow f64 to Infinity.

The persisted wire shape is intentionally backward-compatible: Mag ships an untagged serde shim that accepts both legacy raw JSON numbers (everything written before this bump used "cuques": 1234.5) and the explicit {"log10": x} form (new huge values past f64::MAX). So a V5 reader still parses every V4-written file; a V5 writer only emits the struct form when a value’s log10 exceeds the f64 range, keeping “small” saves indistinguishable from V4 on disk.

V4 → V5 is mechanical: every f64 counter / aggregate / cost becomes Mag::from_f64(old), which collapses any Inf / NaN left behind by the runaway-overflow bug class V5 exists to kill into Mag::ZERO rather than reproducing it.

Once V5 is on main this file is FROZEN. Subsequent schema changes go in v6.rs with a From<GameStateV5> conversion.

Note: V5’s persisted shape is the live GameState shape — moving to a Mag-typed counter set is a live-state change as much as a save change, so V5 has no new fields relative to V4. The whole point of V5 is the field type swap from f64Mag.

Structs§

GameStateV5