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
@@ -0,0 +1,41 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
// The game state of the Modern season core.
|
||||
//
|
||||
// Modern started as a fork of the Classic season core (docs/new_engine). Its season
|
||||
// functions take ModernState instead of GameState: the shared parts (formats, match
|
||||
// core, line-ups, ratings) keep working on the GameState base, and overload resolution
|
||||
// always prefers the Modern season function over a Classic one of the same name.
|
||||
// Modern-only data (world layout, UTF-8 names, ...) is added here, never to GameState.
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
#include "game/state.hpp"
|
||||
#include "game/world_layout.hpp"
|
||||
|
||||
namespace bmh::modern {
|
||||
|
||||
// Dimensions of the running world (WorldLayout). Modern code uses these accessors where
|
||||
// the Classic sources have the fixed numbers (138 league clubs, 90 German clubs, 168, the
|
||||
// pool slots 0xb70/0xb9c/0xbec/0xc00, 3150 slots); no_team() replaces kNoTeam (0x165).
|
||||
inline int league_clubs() { return world_layout().league_teams; }
|
||||
inline int german_clubs() { return world_layout().german_teams; }
|
||||
inline int first_foreign_cup() { return world_layout().first_foreign_cup(); }
|
||||
inline size_t transfer_list_slot() { return world_layout().transfer_list; }
|
||||
inline size_t free_agent_slot() { return world_layout().free_agents; }
|
||||
inline size_t foreign_offer_slot() { return world_layout().foreign_offers; }
|
||||
inline size_t pool_end_slot() { return world_layout().pool_end; }
|
||||
inline size_t total_squad_slots() { return world_layout().total_slots; }
|
||||
|
||||
// The callbacks the shared match core uses for season functions (SeasonHooks).
|
||||
const SeasonHooks& season_hooks();
|
||||
|
||||
struct ModernState : GameState {
|
||||
ModernState() { season_hooks = &modern::season_hooks(); }
|
||||
// Takes over a state built by shared code (save loading, career setup).
|
||||
ModernState(GameState&& g) : GameState(std::move(g)) { season_hooks = &modern::season_hooks(); }
|
||||
ModernState(const GameState& g) : GameState(g) { season_hooks = &modern::season_hooks(); }
|
||||
};
|
||||
|
||||
} // namespace bmh::modern
|
||||
Reference in new issue
Block a user