Modern UI contract: the end of the game
Resigning as the only or last human ends the game as the end of the set duration does: the highscore hook updates and shows the table. The end's reason and date are saved; the session read follows the contract's Session schema (archived managers, termination reason, ownership, mode), managers become archived (resigned or retired) and their employments end with the career. The resign answer carries the ownership change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6570384642
commit
d6d31f939d
10 files changed
+99
-20
No files matched your search
@@ -155,7 +155,9 @@ void save_world_career(const std::filesystem::path& path, const World& world, co
|
||||
{"manager_serial", int64_t(state.manager_serial)},
|
||||
{"traffic_scale", int64_t(state.traffic_scale)},
|
||||
{"press", press_json(state.press)},
|
||||
{"press_serial", int64_t(state.press_serial)}});
|
||||
{"press_serial", int64_t(state.press_serial)},
|
||||
{"career_end_reason", state.career_end_reason},
|
||||
{"career_end_date", int64_t(state.career_end_date)}});
|
||||
// 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);
|
||||
@@ -215,6 +217,10 @@ SavedWorldCareer load_world_career(const std::filesystem::path& path, const Worl
|
||||
out.state.press = press_json(get(modern, "press"));
|
||||
out.state.press_serial = uint32_t(num(get(modern, "press_serial")));
|
||||
}
|
||||
if (o->count("career_end_reason")) {
|
||||
out.state.career_end_reason = str(get(modern, "career_end_reason"));
|
||||
out.state.career_end_date = uint32_t(num(get(modern, "career_end_date")));
|
||||
}
|
||||
}
|
||||
for (const auto& [name, bytes] : docs) {
|
||||
if (!name.starts_with("history/season-")) continue;
|
||||
|
||||
Reference in new issue
Block a user