feat(editor): add WCFG JSON round-trip (--export/--import-wcfg-json)

Dual encoding for both WCFG enums via the readEnumField
template: configKind (int 0..7 OR 255 OR token "xprate"/
"droprate"/"honorrate"/"restedxp"/"realmtype"/
"worldflag"/"performance"/"security"/"misc") and
valueKind (int 0..3 OR token "float"/"int"/"bool"/
"string"). restartRequired accepts bool or int.

The polymorphic value field is preserved on disk by
emitting ALL THREE value carriers (floatValue,
intValue, strValue) regardless of valueKind — only the
matching one is meaningful at runtime, but the others
must round-trip byte-identically. JSON also includes
the activeValue derived field rendering only the
meaningful one per kind, so operators editing the
sidecar see the right value front-and-center.

intValue uses int64_t for the trade-gold-cap and other
high-magnitude configs that exceed uint32 range.

All 3 presets (rates/perf/security with mixed value
kinds: Float, Int, Bool, String) byte-identical
roundtrip OK. CLI flag count 1267 -> 1269.
This commit is contained in:
Kelsi 2026-05-10 02:59:53 -07:00
parent 441ca0d139
commit 695c22b274
3 changed files with 192 additions and 0 deletions

View file

@ -370,6 +370,7 @@ const char* const kArgRequired[] = {
"--export-wskp-json", "--import-wskp-json",
"--gen-cfg", "--gen-cfg-perf", "--gen-cfg-sec",
"--info-wcfg", "--validate-wcfg",
"--export-wcfg-json", "--import-wcfg-json",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",