Show the season opening when a running Modern career reaches a new season

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-14 08:39:51 +01:00
1 parent fee03624be
commit 749c5ec512
2 files changed
+30 -3

No files matched your search

+13 -1
View File
@@ -48,7 +48,9 @@ void App::engine_kickoff() {
return EngineReply{link, desk, response, nullptr};
}
response["liveRecording"] = state;
return EngineReply{link, link->snapshot(), response, nullptr};
auto after = link->snapshot();
engine_attach_opening(*link, engine_season_id(desk), after, response);
return EngineReply{link, std::move(after), response, nullptr};
}, true);
}
// A contract runs out on the way to the next desk: the manager extends at the player's
@@ -129,6 +131,16 @@ void App::engine_accept(EngineReply result) {
if (engine_response_.value("code", "") == "decision_pending" && args.is_object() && args.value("decision", "") == "contract_expiry")
engine_expiry_ask(args);
}
if (engine_response_.contains("seasonOpening")) {
// a new season began: its draw is shown once the ticker is closed
const Json opening = engine_response_.at("seasonOpening");
engine_response_.erase("seasonOpening");
try {
auto state = engine_opening_projection(engine_data_, opening);
engine_opening_read_ = opening; engine_opening_state_ = std::move(state);
opening_due_ = 0; opening_io_blocked_ = false;
} catch (const std::exception &) {} // without a showable draw the desk simply continues
}
if (engine_response_.contains("liveState")) {
const Json state = engine_response_.at("liveState");
engine_response_.erase("liveState");