Bind player rankings and fair play to recorded season events (by Codex)

This commit is contained in:
Codex committed 2026-10-28 23:46:35 +01:00
1 parent 6b4aa9772d
commit 738ecc7a09
27 files changed
+436 -36

No files matched your search

+10 -5
View File
@@ -81,6 +81,7 @@ void App::engine_frame() {
if (auto *roster = element("contracts-roster-scroll")) roster->SetScrollTop(*engine_contract_scroll_);
engine_contract_scroll_.reset();
}
if(rendered&&(menu_=="scorers"||menu_=="fairplay")){rankings_restore_scroll();context_->Update();}
if (center_selects(*doc_)) context_->Update();
if (menu_ == "lineup" && lineup_roster_scroll_) {
if (auto *roster = element("lineup-roster-scroll")) roster->SetScrollTop(*lineup_roster_scroll_);
@@ -138,8 +139,9 @@ void App::engine_event(Rml::Event &event) {
if (!engine_busy_ && advertising_event(event)) return;
if (!engine_busy_ && popup_.empty() && contracts_event(event)) return;
if (engine_reports_event(event)) return;
if(!engine_busy_&&popup_.empty()&&rankings_event(event))return;
if (!engine_busy_ && popup_.empty() && engine_friendly_event(event)) return;
if (!engine_busy_ && planning_dialog_.empty() && popup_.empty() && (menu_ == "friendlies" || menu_ == "almanac" || menu_=="tables" || menu_=="strengths" || menu_=="league" || menu_=="other") && report_picker_event(event)) return;
if (!engine_busy_ && planning_dialog_.empty() && popup_.empty() && (menu_ == "friendlies" || menu_ == "almanac" || menu_=="tables" || menu_=="strengths" || menu_=="league" || menu_=="other" || menu_=="scorers") && report_picker_event(event)) return;
if (engine_sports_event(event)) return;
Rml::ElementFormControl *range = nullptr;
for (auto *node = target; node && node != doc_; node = node->GetParentNode())
@@ -168,7 +170,7 @@ void App::engine_event(Rml::Event &event) {
if (!popup_.empty()) { popup_.clear(); confirm_ = {}; dirty_ = true; }
else if (!engine_busy_ && !engine_player_.empty()) { focus_after_render_ = "lineup-detail-" + engine_player_ + "-0"; engine_player_.clear(); refresh(); }
else if (!engine_busy_ && menu_ == "almanac") engine_almanac_action("alm-back",nullptr);
else if (!engine_busy_ && !menu_.empty()) { if (menu_ == "training" || menu_ == "tactics") engine_sports_reset(); menu_.clear(); refresh(); }
else if (!engine_busy_ && !menu_.empty()) { if (menu_ == "training" || menu_ == "tactics") engine_sports_reset(); if(menu_=="scorers"||menu_=="fairplay")rankings_remember_scroll(); menu_.clear(); refresh(); }
else engine_quit();
event.StopImmediatePropagation(); return;
}
@@ -219,10 +221,11 @@ void App::engine_event(Rml::Event &event) {
if (action == "popup-confirm") { auto callback = std::move(confirm_); popup_.clear(); dirty_ = true; if (callback) callback(); }
return;
}
if(action.starts_with("rankings-")&&menu_=="scorers"){rankings_action(action,node);return;}
if (engine_reports_action(action,node)) return;
if (almanac_action(action,node)) return;
if (engine_friendly_action(action, node)) return;
if ((menu_ == "friendlies" || menu_ == "almanac" || menu_=="tables" || menu_=="strengths" || menu_=="league" || menu_=="other") && report_picker_action(action,node)) return;
if ((menu_ == "friendlies" || menu_ == "almanac" || menu_=="tables" || menu_=="strengths" || menu_=="league" || menu_=="other" || menu_=="scorers") && report_picker_action(action,node)) return;
if (engine_calendar_action(action, node)) return;
if (contracts_action(action, node)) return;
if (environment_action(action, node)) return;
@@ -230,12 +233,14 @@ void App::engine_event(Rml::Event &event) {
if (bank_action(action, node)) return;
if (engine_sports_action(action, id, node)) return;
if (engine_lineup_action(action, id, node)) return;
if (action == "close") { menu_.clear(); refresh(); }
if (action == "close") { if(menu_=="scorers"||menu_=="fairplay")rankings_remember_scroll(); menu_.clear(); refresh(); }
else if (action == "engine-ticket" && engine_fresh_) {
const auto price = engine_ticket_projection(engine_data_);
ticket_->open(node, device_ratio_, price.at("min"), price.at("max")); dirty_ = true;
}
else if (action == "engine-open" && (id == "environment" || id == "advertising")) { menu_ = id; advertising_selected_ = -1; advertising_offer_ = 0; refresh(); }
else if(action=="engine-open"&&id=="scorers"){menu_=id;engine_reports_sync();engine_rankings_load(engine_rankings_state_.at("league"),engine_rankings_state_.at("scope"));}
else if(action=="engine-open"&&id=="fairplay"){menu_=id;engine_reports_sync();engine_fairplay_load();}
else if(action=="engine-open"&&id=="other"){menu_=id;engine_reports_sync();engine_other_load(engine_other_value_.is_object()?engine_other_value_.at("viewId").get<std::string>():"",engine_other_value_.is_object()?engine_other_value_.at("round").get<int>():0);}
else if(action=="engine-open"&&id=="league"){menu_=id;engine_reports_sync();const auto league=engine_reports_state_.at("league").get<std::string>();engine_fixtures_load(league,engine_fixtures_value_.is_object()&&engine_fixtures_value_.at("leagueId")==league?engine_fixtures_value_.at("round").get<int>():0);}
else if(action=="engine-open"&&(id=="tables"||id=="strengths")){menu_=id;engine_reports_sync();engine_reports_load(engine_reports_state_.at("league"),engine_reports_state_.at("filter"));}
@@ -264,5 +269,5 @@ void App::engine_event(Rml::Event &event) {
}
Json App::engine_snapshot() const {
return {{"mode", engine_mode_}, {"busy", engine_busy_}, {"dirty", engine_dirty_}, {"fresh", engine_fresh_}, {"bundle", engine_data_},
{"response", engine_response_}, {"other_index",engine_other_index_},{"other_read",engine_other_read_},{"fixtures_read",engine_fixtures_read_},{"reports_state",engine_reports_state_},{"reports_index",engine_reports_index_},{"reports_read",engine_reports_read_},{"reports_roster",engine_reports_roster_},{"almanac_cache",engine_almanac_cache_}, {"almanac_context",engine_almanac_context_}, {"friendly_quote", engine_friendly_read_}, {"friendly_league", engine_friendly_league_}, {"friendly_opponent", engine_friendly_opponent_}, {"friendly_date", engine_friendly_date_}, {"friendly_home", engine_friendly_home_}, {"friendly_stage", engine_friendly_stage_}, {"friendly_month", engine_friendly_month_}, {"calendar_day", engine_calendar_day_}, {"move_id", engine_move_id_}, {"credit_preview", engine_credit_}, {"credit_edits", engine_credit_edits_}, {"training_draft", engine_training_draft_}, {"tactics_draft", engine_tactics_draft_}, {"player_profile", engine_player_}, {"lineup_selected", lineup_selected_}, {"focus", engine_focus_}, {"selected_camp", engine_camp_}, {"notice", engine_notice_}};
{"response", engine_response_}, {"rankings_read",engine_rankings_read_},{"rankings_state",engine_rankings_state_},{"fairplay_read",engine_fairplay_read_},{"other_index",engine_other_index_},{"other_read",engine_other_read_},{"fixtures_read",engine_fixtures_read_},{"reports_state",engine_reports_state_},{"reports_index",engine_reports_index_},{"reports_read",engine_reports_read_},{"reports_roster",engine_reports_roster_},{"almanac_cache",engine_almanac_cache_}, {"almanac_context",engine_almanac_context_}, {"friendly_quote", engine_friendly_read_}, {"friendly_league", engine_friendly_league_}, {"friendly_opponent", engine_friendly_opponent_}, {"friendly_date", engine_friendly_date_}, {"friendly_home", engine_friendly_home_}, {"friendly_stage", engine_friendly_stage_}, {"friendly_month", engine_friendly_month_}, {"calendar_day", engine_calendar_day_}, {"move_id", engine_move_id_}, {"credit_preview", engine_credit_}, {"credit_edits", engine_credit_edits_}, {"training_draft", engine_training_draft_}, {"tactics_draft", engine_tactics_draft_}, {"player_profile", engine_player_}, {"lineup_selected", lineup_selected_}, {"focus", engine_focus_}, {"selected_camp", engine_camp_}, {"notice", engine_notice_}};
}