Play the Modern kickoff live: minute steps, substitutions and tactics from the ticker
A rehearsal (session.advance with dryRun) settles questions of the run before the kickoff; an extension answered there is agreed at the player's demand of that moment. With an own match the kickoff runs live: one live.step per beat of the speed control, substitutions and the tactics board through live.substitute and live.tactics, and leaving the ticker plays the match to its end. After the final whistle the engine's recording replaces the frames composed on the way. The paused live read names clubs in the world's spelling, and the review table shows wins, draws and losses. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
2d66609ca8
commit
a5810b15ae
14 files changed
+456
-31
No files matched your search
@@ -8678,6 +8678,11 @@ cli::Json ModernSession::read_live(const cli::Json& request) const {
|
||||
// a live kickoff standing still: the minute and the live matches' scores so far (the
|
||||
// full recording with every event follows after the final whistle, kind "fixture")
|
||||
if (!live_->paused || !live_->groups) return fail("live_running");
|
||||
// the world's own spelling of a club name where the data set has one
|
||||
const auto club_label = [this](int team) {
|
||||
if (team >= 0 && size_t(team) < g_.world_club_name.size() && !g_.world_club_name[size_t(team)].empty()) return g_.world_club_name[size_t(team)];
|
||||
return ui::original_to_utf8(g_.club_name(team));
|
||||
};
|
||||
cli::Json::Array matches;
|
||||
for (const MatchGroup& grp : *live_->groups)
|
||||
for (int m = 0; m < grp.matches(); ++m) {
|
||||
@@ -8711,8 +8716,8 @@ cli::Json ModernSession::read_live(const cli::Json& request) const {
|
||||
{"player", person(player)}, {"other", person(assistant)}});
|
||||
}
|
||||
matches.push_back(O{{"events", std::move(events)},
|
||||
{"home", O{{"id", modern::ui_team_id(g_, home)}, {"name", ui::original_to_utf8(g_.club_name(home))}}},
|
||||
{"away", O{{"id", modern::ui_team_id(g_, away)}, {"name", ui::original_to_utf8(g_.club_name(away))}}},
|
||||
{"home", O{{"id", modern::ui_team_id(g_, home)}, {"name", club_label(home)}}},
|
||||
{"away", O{{"id", modern::ui_team_id(g_, away)}, {"name", club_label(away)}}},
|
||||
{"homeManagerId", hm >= 0 ? cli::Json(modern::ui_manager_id(g_, hm)) : cli::Json(nullptr)},
|
||||
{"awayManagerId", am >= 0 ? cli::Json(modern::ui_manager_id(g_, am)) : cli::Json(nullptr)},
|
||||
// the crowd and the weather the kickoff set (descriptor +0x30 temperature,
|
||||
@@ -9835,7 +9840,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
const auto demands = modern::contract_demands(state, m, row, false, random);
|
||||
const uint32_t demand = demands[size_t(it->second.term)];
|
||||
if (demand == 0 || demand == UINT32_MAX) return 0;
|
||||
return modern::contract_offer(state, m, row, it->second.term, it->second.salary, demand, false, true, random, nullptr) ? 1 : 0;
|
||||
return modern::contract_offer(state, m, row, it->second.term, std::max(it->second.salary, demand), demand, false, true, random, nullptr) ? 1 : 0;
|
||||
} catch (const std::exception&) { return -2; }
|
||||
});
|
||||
turn_driver_.sportschau.awards = [r, inner = run->previous_sportschau.awards](const GameState& state, const SportschauAwardsView& v) {
|
||||
@@ -9942,7 +9947,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
const auto demands = modern::contract_demands(state, m, row, false, random);
|
||||
const uint32_t demand = demands[size_t(it->second.term)];
|
||||
if (demand == 0 || demand == UINT32_MAX) return 0;
|
||||
return modern::contract_offer(state, m, row, it->second.term, it->second.salary, demand, false, true, random, nullptr) ? 1 : 0;
|
||||
return modern::contract_offer(state, m, row, it->second.term, std::max(it->second.salary, demand), demand, false, true, random, nullptr) ? 1 : 0;
|
||||
} catch (const std::exception&) {
|
||||
return -2;
|
||||
}
|
||||
@@ -9987,6 +9992,14 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
return refuse(r.kind == TurnDeskKind::WaitingAtDesk ? "decision_pending" : "advance_failed",
|
||||
"Weiter nicht möglich: " + reason);
|
||||
}
|
||||
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();
|
||||
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";
|
||||
return rehearsal;
|
||||
}
|
||||
modern::journal_advance(g_, saved_state);
|
||||
modern::ensure_ui_identities(g_);
|
||||
revision = previous + 1;
|
||||
|
||||
Reference in new issue
Block a user