Modern UI contract: envelope, career and manager ids, session and desktop reads
First engine delivery for the Modern interface handoff (docs/new_ui/integration, issue #15): ModernSession::ui_read answers in the draft envelope with careerId, worldId, stateRevision, date, season, scope and Money in minor units. Careers and human managers get persistent ids (saved in state/modern.json, older saves get them on load). Reads: session and desktop. Engine decisions on the P0 points in docs/new_engine/ui-anbindung.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9061123c7e
commit
3336d01004
9 files changed
+342
-2
No files matched your search
@@ -135,7 +135,10 @@ void save_world_career(const std::filesystem::path& path, const World& world, co
|
||||
{"league_names", strings(state.world_league_name)},
|
||||
{"generated_players", int64_t(state.almanac.generated_players)},
|
||||
{"pools", pools_json(state.pools)},
|
||||
{"exclusive_sponsors", sponsors_json(state.exclusive_sponsors)}});
|
||||
{"exclusive_sponsors", sponsors_json(state.exclusive_sponsors)},
|
||||
{"career_id", state.career_id},
|
||||
{"manager_ids", strings(state.manager_ids)},
|
||||
{"manager_serial", int64_t(state.manager_serial)}});
|
||||
// The almanac: finished seasons unchanged, the running one encoded now.
|
||||
for (const auto& [name, bytes] : state.almanac.finished) docs[name] = bytes;
|
||||
if (state.almanac.current.season >= 0) docs["history/current.bin"] = encode_almanac_season(state.almanac.current);
|
||||
@@ -185,6 +188,12 @@ SavedWorldCareer load_world_career(const std::filesystem::path& path, const Worl
|
||||
out.state.almanac.generated_players = uint32_t(num(get(modern, "generated_players")));
|
||||
out.state.pools = pools_json(get(modern, "pools"));
|
||||
out.state.exclusive_sponsors = sponsors_json(get(modern, "exclusive_sponsors"));
|
||||
// interface identities (since 27 October 2026); older saves get them on load (ensure_ui_identities)
|
||||
if (const auto* o = modern.object(); o && o->count("career_id")) {
|
||||
out.state.career_id = str(get(modern, "career_id"));
|
||||
out.state.manager_ids = strings(get(modern, "manager_ids"));
|
||||
out.state.manager_serial = uint32_t(num(get(modern, "manager_serial")));
|
||||
}
|
||||
for (const auto& [name, bytes] : docs) {
|
||||
if (!name.starts_with("history/season-")) continue;
|
||||
decode_almanac_season(bytes); // a damaged season fails here, not in the almanac screen
|
||||
|
||||
Reference in new issue
Block a user