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:
1 parent
badd08f05e
commit
f2fcb28f65
81 files changed
+29351
-91
No files matched your search
+7
-9
@@ -1,5 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/world_layout.hpp"
|
||||
#include "game/state.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
@@ -10,11 +11,6 @@ namespace bmh {
|
||||
|
||||
namespace {
|
||||
|
||||
// Squad table layout constants of V2.24 (TeamsWithSquads, LargeSquadClubCount, NoTeamSquadStart).
|
||||
constexpr int kBigSquadTeams = 90;
|
||||
constexpr size_t kNoTeamSquadStart = 3072;
|
||||
constexpr int kTeamsWithSquads = 168;
|
||||
|
||||
// C-style signed division by 8 as compiled by Watcom (rounds toward zero).
|
||||
int div8(int x) { return x / 8; }
|
||||
|
||||
@@ -156,14 +152,16 @@ void GameState::formation_position(int team, int slot, int& x, int& y) const {
|
||||
}
|
||||
|
||||
SquadRange squad_range(int team) {
|
||||
if (team == kNoTeam) return {kNoTeamSquadStart, 24};
|
||||
if (team < kBigSquadTeams) return {size_t(team) * 24, 24};
|
||||
if (team < 138) return {size_t(team) * 16 + kBigSquadTeams * 8, 16};
|
||||
// WorldLayout: Classic gives the original table (24 slots for the 90 German clubs, 16 for
|
||||
// the 48 international ones from slot 2160, 24 for kNoTeam at 3072).
|
||||
const WorldLayout& w = world_layout();
|
||||
if (team == w.no_team()) return {w.pool_end, w.no_team_slots};
|
||||
if (team >= 0 && team < w.league_teams) return {w.squad_start[size_t(team)], w.squad_size[size_t(team)]};
|
||||
return {0, 0};
|
||||
}
|
||||
|
||||
TeamAverage team_average(const GameState& g, int team, uint16_t flags, WatcomRandom* rand) {
|
||||
if (team >= kTeamsWithSquads && team != kNoTeam) {
|
||||
if (team >= world_layout().first_foreign_cup() && team != no_team()) {
|
||||
// TeamRating(team, profile 2 at layout field): a random value around the club's level
|
||||
if (!rand) throw std::invalid_argument("team_average: a team without squad needs the Watcom generator");
|
||||
RatingContext ctx;
|
||||
|
||||
Reference in new issue
Block a user