Bind the kickoff of the Modern desk to the engine and show its recording in the ticker
The kickoff button sends session.advance; the engine's recording of the played matchday is shaped for the live ticker (phases, per-match tables, the desk manager's squad). A contract running out on the way asks the manager to extend at the player's demand or to release him. The UI script driver accepts optional clicks, and modern_live_dump writes the engine's recording for inspection. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
9e92d07b03
commit
7c0e66affe
15 files changed
+447
-30
No files matched your search
@@ -9923,6 +9923,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
answers[id] = x;
|
||||
}
|
||||
std::string pending_player;
|
||||
std::array<uint32_t, 4> pending_demands{};
|
||||
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 {
|
||||
@@ -9931,7 +9932,11 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
const int p = size_t(row) < range.count ? state.squad_slots[range.first + size_t(row)] & 0x0fff : 0x0fff;
|
||||
const std::string id = p == 0x0fff ? std::string{} : modern::ui_player_id(state, p);
|
||||
const auto it = answers.find(id);
|
||||
if (it == answers.end()) { pending_player = id; return -2; } // ask the interface
|
||||
if (it == answers.end()) { // ask the interface; the run is rolled back, so this draw is repeated later
|
||||
pending_player = id;
|
||||
try { pending_demands = modern::contract_demands(state, m, row, false, random); } catch (const std::exception&) { pending_demands = {}; }
|
||||
return -2;
|
||||
}
|
||||
if (!it->second.renew) return 0; // released
|
||||
try {
|
||||
const auto demands = modern::contract_demands(state, m, row, false, random);
|
||||
@@ -9973,7 +9978,9 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
if (!pending_player.empty()) {
|
||||
cli::Json pending = refuse("decision_pending", "Ein Vertrag läuft aus: Verlängern oder freigeben?");
|
||||
auto& message = std::get<cli::Json::Object>(std::get<cli::Json::Object>(pending.value)["message"].value);
|
||||
message["args"] = cli::Json::Object{{"decision", "contract_expiry"}, {"playerId", pending_player}};
|
||||
cli::Json::Array demands;
|
||||
for (const uint32_t d : pending_demands) demands.push_back(d == 0 || d == UINT32_MAX ? cli::Json(nullptr) : modern::ui_money(int64_t(d)));
|
||||
message["args"] = cli::Json::Object{{"decision", "contract_expiry"}, {"playerId", pending_player}, {"demands", std::move(demands)}};
|
||||
return pending;
|
||||
}
|
||||
const std::string reason = r.reason.empty() ? error : r.reason;
|
||||
|
||||
Reference in new issue
Block a user