Calendar and results-page Stärken work during a running career

Found with the debug log and savegames of a real session:

- Calendar: it read the memory copies of the season origin and day,
  which hold only the day the game was loaded or saved, and refused
  from the first kickoff on ("saved native season cursor disagrees").
  It now uses the live values, as the reschedule code does. This also
  fixes "Spiel verlegen".
- Stärken: the guard of dispatch_strengths required a desk stage, but
  the turn driver marks the running turn as Failed (replay guard) for
  its whole duration, so Stärken could never open from the live
  overview or the end-of-phase results page; the failed handover then
  left the other pages with stale owners and the match stuck. The
  guard now accepts the running turn while a live overview is open.
- Tests: calendar after a kickoff; live overview handovers on the
  phase results page.

Refs #71, #73.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-11-05 08:28:45 +01:00
1 parent f12857414e
commit 7cfc8267b6
4 files changed
+61 -8

No files matched your search

+42
View File
@@ -1269,6 +1269,18 @@ void check_calendar_readonly_controller(const std::filesystem::path& data) {
check(flow.click(0, 0, true).request == FlowRequest::none, "menu 7 close release is consumed");
check(!flow.calendar() && flow.screen_name() == "desktop",
"right event8 closes menu 7 and returns to the refreshed desk");
// After a kickoff the memory copy of the season day is only the day the game was loaded: the
// calendar follows the live day (it was refused from the first kickoff on).
ui::DeskRequest kickoff;
kickoff.kind = ui::DeskRequestKind::advance_turn;
kickoff.manager_slot = int(game.memory.u8(::bmh::layout::ActiveManager));
kickoff.revision = revision;
std::string kickoff_error;
const auto advanced = session->dispatch_kickoff(kickoff, revision, kickoff_error);
check(advanced.kind != TurnDeskKind::Failed, "the fixture's first kickoff is played");
const auto after_kickoff = ui::calendar_from_game(game, load_le(asset_path(data, "BMH.exe")));
check(after_kickoff.current_day == game.season_day() + after_kickoff.leading_days,
"the calendar after a kickoff shows the live day of the season");
}
void check_readonly_views(const std::filesystem::path& data) {
@@ -4306,6 +4318,36 @@ void check_loaded_lineup(const std::filesystem::path& data, const std::filesyste
(state.squad_slots.at(squad.first + 11) & 0x0fff) == (first & 0x0fff);
}
});
// The end-of-phase results page (key slot 1 at the Source phase boundary) is the viewer the
// players meet after every match: Spiele -> Stärken -> Spiele -> Tabelle -> close must not strand it.
int phase_pages = 0;
session.set_phase_results([&](const PhaseResultRequest&, const std::vector<MatchGroup>&, const GameState&) {
if (phase_pages >= 2) return;
std::string phase_error;
auto opened = session.open_phase_results(revision, Image{}, phase_error);
if (!opened) return; // a phase of another group or competition: nothing to view here
++phase_pages;
const auto hop = [&](ui::StrengthsIdentity from, int from_child, int target_child, const char* what) {
ui::LeagueFamilyRequest nav;
nav.identity = from; nav.kind = ui::LeagueFamilyRequestKind::navigate;
nav.from_child = from_child; nav.target_child = target_child;
auto page = session.dispatch_phase_results(app::CareerSession::LiveOverviewAction{nav}, revision, phase_error);
if (!page) throw std::runtime_error(std::string("phase results ") + what + " failed: " + phase_error);
return *page;
};
ui::StrengthsIdentity at = opened->family_identity;
int child = opened->kind == app::CareerSession::LiveOverviewKind::league_table ? 1 : 2;
const int path[] = {3, 2, 1, 3, 1, 2};
for (const int next : path) {
auto page = hop(at, child, next, "handover");
at = page.family_identity; child = next;
}
ui::LeagueFamilyRequest close;
close.identity = at; close.kind = ui::LeagueFamilyRequestKind::close;
close.from_child = child; close.target_child = 0;
auto closed = session.dispatch_phase_results(app::CareerSession::LiveOverviewAction{close}, revision, phase_error);
if (!closed || !closed->closed) throw std::runtime_error("phase results page did not close: " + phase_error);
});
int turns = 0;
for (; turns < 8 && (!saw_fixture || turns < 2); ++turns) {
ui::DeskRequest request;