Fork the Classic season core into src/modern and add the world layout (M1)

- src/modern/game: the season modules as bmh::modern, working on ModernState
  (a GameState). Data types stay shared with Classic; Modern code calls its
  season functions qualified (modern::...), so a missing Modern function is a
  compile error instead of a silent call into Classic.
- src/modern/app/modern_session: the session on the Modern core. It still uses
  the Classic UI projections until the Modern projections exist.
- SeasonHooks: the shared match core reaches player statistics and the table
  prediction of the season core that owns the game (Classic: unchanged).
- WorldLayout: team ranges, squad slots and pools of the running world. Shared
  code and the Modern fork read them; Classic keeps the original numbers.
- Transfer list views moved to game/transfer_offer_view.hpp (shared).
- tools/modern/check_fork_calls.sh, modern_season_sim and world_layout_tests.

Verified: Classic tests and replay regression unchanged; season_sim and
modern_season_sim produce identical output with Classic data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-23 18:08:54 +02:00
1 parent badd08f05e
commit f2fcb28f65
81 files changed
+29351 -91

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "game/world_layout.hpp"
#include <stdexcept>
#include <utility>
namespace bmh {
namespace {
WorldLayout& current() {
static WorldLayout layout = classic_world_layout();
return layout;
}
} // namespace
WorldLayout classic_world_layout() {
// Squad table of V2.24 (TeamsWithSquads, LargeSquadClubCount, NoTeamSquadStart): the
// 90 German clubs have 24 slots, the 48 international clubs 16 from slot 90 * 24.
WorldLayout w;
w.squad_start.resize(size_t(w.league_teams));
w.squad_size.resize(size_t(w.league_teams));
for (int team = 0; team < w.league_teams; ++team) {
const bool german = team < w.german_teams;
w.squad_start[size_t(team)] = german ? uint32_t(team) * 24 : uint32_t(team) * 16 + uint32_t(w.german_teams) * 8;
w.squad_size[size_t(team)] = german ? 24 : 16;
}
return w;
}
const WorldLayout& world_layout() { return current(); }
void set_world_layout(WorldLayout layout) {
const size_t teams = size_t(layout.league_teams);
if (layout.league_teams <= 0 || layout.german_teams < 0 || layout.german_teams > layout.league_teams ||
layout.amateur_teams < 0 || layout.foreign_cup_teams < 0 || layout.national_teams < 0 ||
layout.squad_start.size() != teams || layout.squad_size.size() != teams)
throw std::invalid_argument("world layout: inconsistent team ranges");
// Squads lie back to back in id order before the pools; the pools and the no-club
// squad follow in their fixed order.
uint32_t next = 0;
for (size_t team = 0; team < teams; ++team) {
if (layout.squad_start[team] != next || layout.squad_size[team] == 0)
throw std::invalid_argument("world layout: squads must be consecutive");
next += layout.squad_size[team];
}
if (layout.transfer_list != next || layout.free_agents != layout.transfer_list + 44 ||
layout.foreign_offers != layout.free_agents + 80 || layout.pool_end != layout.foreign_offers + 20 ||
layout.total_slots < layout.pool_end + layout.no_team_slots)
throw std::invalid_argument("world layout: pools must follow the squads");
// Squad slot values hold 12-bit player ids; loans store 10-bit club ids.
if (layout.total_teams() > 1023) throw std::invalid_argument("world layout: too many teams");
current() = std::move(layout);
}
} // namespace bmh