Save and load Modern careers (M6)

Modern saves (save_profile modern-career-v1) name their world by id and
data revision and hold the career only; loading reinstalls the world
dimensions. Club names now follow promotion and relegation. The season
sim gains MODERN_SAVE_CHECK for a save/load round trip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-23 23:22:13 +02:00
1 parent 6f55622307
commit 28b59d9890
11 files changed
+265 -14

No files matched your search

+17 -4
View File
@@ -168,6 +168,22 @@ std::string legacy_encoding(const std::string& utf8) {
return out;
}
void install_world_dimensions(const World& world) {
int league_clubs = 0, german_clubs = 0;
uint8_t sizes[kLeagueCount] = {};
for (const WorldLeague& l : world.leagues) {
sizes[l.index] = uint8_t(l.members.size());
league_clubs += int(l.members.size());
if (l.index < 5) german_clubs += int(l.members.size());
}
WorldLayout layout = modern_layout(league_clubs, german_clubs);
// The league sizes are checked against the layout and need the per-league fixture tables.
kLeagueTablesPerLeague = true;
set_world_layout(layout);
set_league_sizes(sizes);
kNewcomerFirst = world_layout().first_amateur();
}
ExpandReport expand_to_world(ModernState& g, const World& world) {
const WorldLayout old = world_layout();
if (old.league_teams != 138 || old.total_teams() != 419) fail("the world expands a Classic start state only");
@@ -355,10 +371,7 @@ ExpandReport expand_to_world(ModernState& g, const World& world) {
g.squad_slots = std::move(slots);
stage("squads");
set_world_layout(layout);
kLeagueTablesPerLeague = true;
set_league_sizes(sizes);
kNewcomerFirst = layout.first_amateur();
install_world_dimensions(world);
stage("layout and league sizes");
// --- league dates of the international group (calendar bit 4) -------------------------