The balance sheet with shares and a what-if calculation; season counts in the line-up

The balance shows its sums as numerals and every position with its share. A
calculation with sliders for ticket price, crowd and home matches ahead draws where
the cash goes; it is arithmetic on the booked figures, not a forecast. The squad read
carries goals, assists and matches of the running season from the almanac, and the
line-up shows them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-15 00:00:42 +01:00
1 parent c560268373
commit d75617052f
11 files changed
+246 -11

No files matched your search

+22
View File
@@ -278,6 +278,25 @@ J squad_data(const ModernState& g, const UiContext& c, int team, const std::stri
const bool own = team == team_of(g, c.manager) && team < league_clubs();
const size_t board = size_t(c.manager) * 0x840;
const SquadRange r = squad_range(team);
// what the almanac recorded of the running season, by world player id: goals, assists and
// matches in the starting eleven or coming on (no shoot-out kicks)
struct Tally { int goals = 0, assists = 0, games = 0; };
std::map<std::string, Tally> season;
{
const auto& s = g.almanac.current;
const auto id_of = [&](uint16_t p) { return p < s.players.size() ? s.players[p].id : std::string(); };
for (const auto& m : s.matches) {
for (const auto& side : m.lineup)
for (size_t i = 0; i < side.size() && i < 11; ++i)
if (side[i] != kAlmanacNone) ++season[id_of(side[i])].games;
for (const auto& e : m.events) {
if (e.kind == AlmanacEventKind::Goal) {
if (e.player != kAlmanacNone) ++season[id_of(e.player)].goals;
if (e.other != kAlmanacNone) ++season[id_of(e.other)].assists;
} else if (e.kind == AlmanacEventKind::Substitution && e.player != kAlmanacNone) ++season[id_of(e.player)].games;
}
}
}
A players;
for (size_t s = r.first; s < r.first + r.count && s < g.squad_slots.size(); ++s) {
const uint16_t e = g.squad_slots[s];
@@ -323,6 +342,9 @@ J squad_data(const ModernState& g, const UiContext& c, int team, const std::stri
row["contractRemaining"] = nullptr;
}
row["contractUntil"] = nullptr;
const auto tally = season.find(pid);
row["season"] = O{{"goals", tally == season.end() ? 0 : tally->second.goals}, {"assists", tally == season.end() ? 0 : tally->second.assists},
{"games", tally == season.end() ? 0 : tally->second.games}};
players.push_back(std::move(row));
}
return O{{"kind", "squad"}, {"team", team_ref(g, team, today)}, {"players", std::move(players)}};