From 112b8492d9e8ca063734c86daa078480b631d121 Mon Sep 17 00:00:00 2001 From: Weyoune Date: Tue, 17 Nov 2026 13:44:37 +0100 Subject: [PATCH] The interested clubs show the squad's age and the last league matches Co-Authored-By: Claude Fable 5.2 --- assets/modern/pages.rcss | 12 ++++++++++++ docs/new_engine/ui-anbindung.md | 2 +- src/modern/app/modern_session.cpp | 29 ++++++++++++++++++++++++++++- src/modern/ui/engine_assembly.inc | 24 ++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 2 deletions(-) diff --git a/assets/modern/pages.rcss b/assets/modern/pages.rcss index 94f6f44..a5f92a2 100644 --- a/assets/modern/pages.rcss +++ b/assets/modern/pages.rcss @@ -1135,3 +1135,15 @@ body .popup-box p.as-verdict {margin:14dp 0 0;text-align:center;font-size:31dp;} .pg-dlg p.cs-note {font-size:29dp;line-height:40dp;color:var(--p-n7);} #assembly-layer {z-index:150;height:100%;} .cs-cash,.cs-fact {min-height:250dp;} +.cs-form {flex:none;width:684dp;} +.cs-games {display:flex;justify-content:space-between;margin-top:20dp;} +.cs-game {display:block;width:96dp;text-align:center;} +.cs-dot {display:block;width:76dp;height:76dp;margin:0 auto;border-radius:38dp;font-family:Display;font-size:36dp;line-height:76dp;text-align:center;color:#fffdf6;background-color:#8e8778;} +.cs-dot.win {background-color:#5f7f4c;} +.cs-dot.loss {background-color:#a8502c;} +.cs-score {display:block;margin-top:8dp;font-size:31dp;line-height:38dp;} +.cs-where {display:block;font-size:23dp;line-height:30dp;color:var(--p-n7);} +.cs-none.small {padding:50dp 0;} +.cs-sum.cs-age {width:230dp;} +.cs-cash .cs-label {overflow:hidden;white-space:nowrap;text-overflow:ellipsis;} +.pg-dlg.cs-sheet {height:1900dp;} diff --git a/docs/new_engine/ui-anbindung.md b/docs/new_engine/ui-anbindung.md index 45b258f..c299788 100644 --- a/docs/new_engine/ui-anbindung.md +++ b/docs/new_engine/ui-anbindung.md @@ -46,7 +46,7 @@ Revision kommt vom Aufrufer (Konsole bzw. AppController), der Read ändert nicht | `sponsor` | das Exklusiv-Sponsor-Angebot aus einem Trainingslager und ein vorgemerkter Vertrag (`monthly` als `Money`; `asset: null`, siehe [Trainingslager](trainingslager.md)) | | `bank` | Konto, Festgeld, Kreditrahmen, Anlagen (alles `Money`), die 12 Aktien (Kurs, Vorkurs, Bestand, bezahlt, Höchstkauf, 30 Kurse Verlauf) und die angebotenen Fonds; `credit` verweist auf den Read `credit`, der Aktientipp zieht Zufall und kommt als `quote.request` | | `credit` | der Kreditdialog (`lenderId` `bank` oder die Manager-ID eines anderen Menschen): `saved` (Darlehen, Gesamtbetrag, Rate, Laufzeit, vergangene Monate, Zahlungen), `fields` (acht Felder mit `field`, `label`, `value`, `editable`, `min`, `max`; Werte in ganzen Euro bzw. Monaten), `fees`, `refund`, `principalPaid` (`Money`). Optional `edits` [{field, value}] als Vorschau, nichts wird gebucht; Fehler `unknown_lender`, `credit_unavailable`, `invalid_credit_edit` | -| `assembly` | die [Jahreshauptversammlung](hauptversammlung.md) und die interessierten Vereine: `available` (false am Schreibtisch des Bundestrainers), `due` (am Schreibtisch „Saisonende“, solange in dieser Saison nicht abgestimmt ist), `dismissals`, `vote {sport, finance, supporters, yes, confirmed}` (Prozent), `club` und `offers[]` je mit `teamId`, `name`, `league`, `leagueIndex`, `leagueSize`, `strength` (Schnitt der Elf), `lines {goal, defence, midfield, attack}`, `positions[]` (Platz nach jedem Spieltag der Saison), `squad` (Spieler), `stadiumCapacity` (Plätze des Stadions, das ein Manager dort erhält), `position`; Angebote zusätzlich `cash` (`Money`), dazu `cash` des Managers heute. Rein lesend, zieht keine Zufallszahl | +| `assembly` | die [Jahreshauptversammlung](hauptversammlung.md) und die interessierten Vereine: `available` (false am Schreibtisch des Bundestrainers), `due` (am Schreibtisch „Saisonende“, solange in dieser Saison nicht abgestimmt ist), `dismissals`, `vote {sport, finance, supporters, yes, confirmed}` (Prozent), `club` und `offers[]` je mit `teamId`, `name`, `league`, `leagueIndex`, `leagueSize`, `strength` (Schnitt der Elf), `lines {goal, defence, midfield, attack}`, `positions[]` (Platz nach jedem Spieltag der Saison), `squad` (Spieler), `averageAge` (Altersschnitt des Kaders in Zehnteljahren), `results[]` (die letzten sechs Ligaspiele: `home`, `goalsFor`, `goalsAgainst`, `opponent`, `outcome` win/draw/loss), `stadiumCapacity` (Plätze des Stadions, das ein Manager dort erhält), `position`; Angebote zusätzlich `cash` (`Money`), dazu `cash` des Managers heute. Rein lesend, zieht keine Zufallszahl | | `postmatch` | das Nachspiel des letzten `session.advance` (auch am Bundestrainer-Schreibtisch): `steps` (`results`, `report`, `team_of_the_day`, `overview`, `table` je mit `available`), `matches` (alle Spiele des Anstoßes im Almanach-Format), `reportMatchIds` (Spiele menschlicher Manager), `teamOfTheDay` (die Sportschau-Elf der Engine je Wettbewerb mit Spieler, Verein, Wertung; nur mit der Sportschau-Option der EXE, sonst leer und `team_of_the_day` nicht verfügbar), `tables` (die aktuellen Tabellen der Ligen des Spieltags). Rückblick und Abspielen ändern nichts; weiter geht es mit `session.advance` | Fehler: `unknown_read`, `manager_not_active`, `no_active_manager`, `unknown_team`. diff --git a/src/modern/app/modern_session.cpp b/src/modern/app/modern_session.cpp index e110a53..87e069c 100644 --- a/src/modern/app/modern_session.cpp +++ b/src/modern/app/modern_session.cpp @@ -8953,6 +8953,33 @@ cli::Json assembly_data(const modern::ModernState& g, const LeImage& exe, int ma } return out; }; + // the mean age of the squad in tenths of a year + const auto age = [&](int t) { + const SquadRange range = squad_range(t); + int sum = 0, count = 0; + for (size_t i = 0; i < range.count && range.first + i < g.squad_slots.size(); ++i) { + const size_t player = g.squad_slots[range.first + i] & 0x0fff; + if (player == 0x0fff || player >= g.players.size()) continue; + sum += g.players[player].age(), ++count; + } + return count ? cli::Json(sum * 10 / count) : cli::Json(nullptr); + }; + // the club's last six league matches of the season, the latest last + const auto results = [&](int t) { + A out; + const std::string id = size_t(t) < g.world_club_id.size() && !g.world_club_id[size_t(t)].empty() ? g.world_club_id[size_t(t)] : "team:" + std::to_string(t); + const auto& season = g.almanac.current; + for (auto m = season.matches.rbegin(); m != season.matches.rend() && out.size() < 6; ++m) { + if (m->type != 0 || m->home >= season.clubs.size() || m->away >= season.clubs.size()) continue; + const bool home = season.clubs[m->home].id == id; + if (!home && season.clubs[m->away].id != id) continue; + const int scored = home ? m->home_goals : m->away_goals, conceded = home ? m->away_goals : m->home_goals; + out.insert(out.begin(), O{{"home", home}, {"goalsFor", scored}, {"goalsAgainst", conceded}, + {"opponent", season.clubs[home ? m->away : m->home].name}, + {"outcome", scored > conceded ? "win" : scored < conceded ? "loss" : "draw"}}); + } + return out; + }; // the ground a manager gets with a club of this league (build_stadium): eight stands of equal size const auto capacity = [&](int league) { const uint32_t at = ::bmh::layout::Career_BuildStadium_RuntimeField4 + uint32_t(league > 2 ? league - 1 : league); @@ -8964,7 +8991,7 @@ cli::Json assembly_data(const modern::ModernState& g, const LeImage& exe, int ma {"name", size_t(t) < g.world_club_name.size() ? g.world_club_name[size_t(t)] : std::string()}, {"league", league >= 0 && size_t(league) < g.world_league_name.size() ? g.world_league_name[size_t(league)] : std::string()}, {"leagueIndex", league}, {"leagueSize", league_table_teams(league)}, {"strength", team_average(g, t, eleven).value}, - {"lines", lines(t)}, {"positions", places(t)}, {"squad", modern::squad_count(g, t, 2)}, {"stadiumCapacity", capacity(league)}, + {"lines", lines(t)}, {"positions", places(t)}, {"squad", modern::squad_count(g, t, 2)}, {"averageAge", age(t)}, {"results", results(t)}, {"stadiumCapacity", capacity(league)}, {"position", modern::table_position(g, t) < 0 ? cli::Json(nullptr) : cli::Json(modern::table_position(g, t) + 1)}}; }; A offers; diff --git a/src/modern/ui/engine_assembly.inc b/src/modern/ui/engine_assembly.inc index fbac931..8cb95c7 100644 --- a/src/modern/ui/engine_assembly.inc +++ b/src/modern/ui/engine_assembly.inc @@ -185,10 +185,34 @@ std::string App::engine_assembly_sheet() { return "
" + std::string(label) + "
" + assembly_count(value) + " €
"; }; + // the mean age of both squads + const auto age_bar = [&](const std::string &label, const Json &row, const char *css) { + const bool known = row.contains("averageAge") && row.at("averageAge").is_number_integer(); + const int tenths = known ? row.at("averageAge").get() : 0; + return "
" + esc(label) + "
" + + (known ? std::to_string(tenths / 10) + "," + std::to_string(tenths % 10) + " Jahre" : std::string("—")) + "
"; + }; + const std::string ages = "
ALTERSSCHNITT DES KADERS" + age_bar(mine, own, "own") + age_bar(name, c, "new") + "
"; + // the last league matches: won, drawn or lost, with the score + std::string form = "
LETZTE LIGASPIELE"; + const Json results = c.value("results", Json::array()); + if (results.empty()) form += "
Noch kein Ligaspiel in dieser Saison.
"; + else { + form += "
"; + for (const auto &game : results) { + const std::string outcome = game.value("outcome", std::string("draw")); + form += "
" + (outcome == "win" ? "S" : outcome == "loss" ? "N" : "U") + "
" + std::to_string(game.value("goalsFor", 0)) + ":" + + std::to_string(game.value("goalsAgainst", 0)) + "
" + (game.value("home", false) ? "Heim" : "Auswärts") + "
"; + } + form += "
"; + } + form += "
"; out += "
VEREINSKASSE" + money_bar("Dein Konto heute", now, "own") + money_bar("Startkapital dort", then, "new") + "
STADION" + (c.contains("stadiumCapacity") && c.at("stadiumCapacity").is_number_integer() ? assembly_count(c.at("stadiumCapacity").get()) : std::string("—")) + "Plätze zum Start
KADER" + std::to_string(c.value("squad", 0)) + "Spieler
" + + "
" + ages + form + "
" + "

Beim Wechsel bleiben dein Konto, deine Aktien, Fonds und Kredite zurück. Stadion, Verträge und Werbung beginnen beim neuen Verein neu.

"; } out += "