League system: the league tables of the loaded game as one structure

The mutable globals of schedule.hpp (league sizes, calendar groups, promotion
ladder, European places, league suffixes, newcomers, English competitions) are
members of LeagueSystem in world_layout.hpp, read through league_system() and
written only by the installer of a game version. Values and uses are unchanged.
The size check of set_league_sizes asks the world layout for the league teams.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude committed 2026-11-10 22:13:40 +01:00
1 parent 74d6cde914
commit cb6d3b6035
38 files changed
+232 -180

No files matched your search

+2 -2
View File
@@ -100,7 +100,7 @@ TeamStatisticsProjection team_statistics_from_game(const GameState& game, int te
if (out.league < 0 || out.league >= kLeagueCount)
throw FormatError("team statistics: Source league index unavailable");
out.league_row = team - league_first_team(out.league);
if (out.league_row < 0 || out.league_row >= kLeagueSizes[out.league])
if (out.league_row < 0 || out.league_row >= league_system().sizes[out.league])
throw FormatError("team statistics: runtime team is not in a supported league table");
out.source_flags = exe.u8(::bmh::layout::TableFlags + uint32_t(mode_number));
out.points_mode = exe.u8(::bmh::layout::CareerSession_BeginFriendlyOpponentTable_RuntimeField + uint32_t(out.league));
@@ -419,7 +419,7 @@ Image TeamStatisticsScreen::render() const {
const int league = projection_.league;
rect(out, 225, 150, 1, 43, 0x6a); rect(out, 225, 192, 81, 1, 0x6a);
if (projection_.source_has_position_history && projection_.source_has_league_panel) {
const int clubs = kLeagueSizes[league];
const int clubs = league_system().sizes[league];
for (int round = 0; round < projection_.league_rounds && round < 39; ++round) {
const size_t word_index = size_t(round / 3) * 2;
const uint16_t packed = uint16_t(projection_.position_history[word_index] |