Take a rehearsed kickoff back completely

A rehearsal (and a kickoff refused for a pending question) now also returns
the turn driver and the managers' desks; before, the desk and the matches
played ran one step apart after a rehearsal. The contract tests rehearse
three kickoffs and check that the desk reads as before and that the
announced fixture is the one played; modern_live_dump can rehearse, play
live and report the announced and the played fixture per kickoff.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-14 08:03:41 +01:00
1 parent 29680d659e
commit 6970dfa20a
3 files changed
+83 -8

No files matched your search

+10 -2
View File
@@ -9929,6 +9929,14 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
}
std::string pending_player;
std::array<uint32_t, 4> pending_demands{};
// a run that is taken back returns the turn driver and the managers' desks as well
const TurnDriver saved_driver = turn_driver_;
const auto saved_managers = managers_;
const auto saved_desk_callargs = source_desk_callargs_;
const auto restore_run = [&] {
restore();
turn_driver_ = saved_driver, managers_ = saved_managers, source_desk_callargs_ = saved_desk_callargs;
};
auto previous_hook = g_.contract_screen;
const bool previous_installed = contract_expiry_presenter_installed_;
set_contract_expiry_presenter([&](modern::ModernState& state, WatcomRandom& random, int m, int row) -> int {
@@ -9978,7 +9986,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
g_.contract_screen = previous_hook; // the session's own presenter again
contract_expiry_presenter_installed_ = previous_installed;
if (r.kind == TurnDeskKind::Failed || r.kind == TurnDeskKind::WaitingAtDesk) {
restore();
restore_run();
g_.contract_screen = previous_hook;
if (!pending_player.empty()) {
cli::Json pending = refuse("decision_pending", "Ein Vertrag läuft aus: Verlängern oder freigeben?");
@@ -9994,7 +10002,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
}
if (const cli::Json* dry = ui_field(*payload, "dryRun"); dry && std::holds_alternative<bool>(dry->value) && std::get<bool>(dry->value)) {
// a rehearsal: everything goes back, the interface only learns that no question is open
restore();
restore_run();
g_.contract_screen = previous_hook;
cli::Json rehearsal = modern::ui_command_result(request_id, previous, previous, {}, "Probelauf ohne offene Rückfrage.");
std::get<cli::Json::Object>(rehearsal.value)["outcome"] = "rehearsed";