Load Modern worlds and add Modern training camps (M3, M4)

M3 - Modern world loader:
- modern/content/world: typed view of the world tables (leagues, clubs,
  players, nations, league dates, training camp catalogue).
- modern/content/world_package: opens a Modern world (runtime:modern-v1, or
  editor:world-v1 until data revision 1.4), reads only the engine entries and
  decodes the Classic payload (import: load_classic_payload).
- modern/content/world_expand: turns the Classic start into the world: club
  ids in the order of the world's leagues, per-club tables remapped (added
  clubs copy an original club of their league), added players from their
  attributes, 24 squad slots per league club, pools kept, layout, league
  sizes and league dates installed; UTF-8 names and OBW ids in ModernState.
- Fixes found by playing the Modern data set: referee pool exhausted on days
  with German and larger international leagues (Modern deviation), card
  table per league club grown, slot-to-team lookup via WorldLayout, form
  history stride from the layout, remaining slot literals.
- Classic UI projections used by the session read the layout instead of
  executable constants (Classic values unchanged).
- modern_season_sim opens .obw worlds; MODERN_DEBUG / MODERN_WATCH tracing.

M4 - training camps:
- Catalogue in ModernState (built-in 18 fictional camps on three maps, or the
  world's extended catalogue); price, booking and effect use it.
- Six-star grades: step index capped, limit +1 from pitch 5 and +1 with pitch
  and fitness 6, catering 6 one more point of condition, lodging 6 one week
  less injury. Classic data behaves as before. modern_camp_tests.

Verified: 190 tests pass; Classic replay regression identical to the M0
baseline; season_sim and modern_season_sim identical with Classic data; the
Modern data set plays full seasons (leagues 34/38/34 rounds).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-23 22:43:25 +02:00
1 parent 13bdc56f04
commit 6f55622307
53 files changed
+1392 -87

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
// Turns the Classic start of a Modern world into the Modern world (docs/new_engine, M3).
//
// The Classic start (startup_state from the world's Classic payload) has the original
// dimensions: 138 league clubs, 2574 players. expand_to_world gives it the dimensions of the
// world: league clubs in the order of the world's league members (international leagues of
// 20/20/18/20 move the ids of every club behind them), the added clubs and players, squads of
// 24 slots for every league club built from the world's squads, the world layout, the league
// sizes and the league dates. Clubs the data set added take the per-club starting values of
// an original club of the same league.
#include <string>
#include <vector>
#include "modern/content/world.hpp"
#include "modern/game/modern_state.hpp"
namespace bmh::modern {
struct ExpandReport {
int league_clubs = 0, added_clubs = 0, added_players = 0, free_agents = 0;
int fallback_nationalities = 0; // players whose nation has no Classic code
std::vector<std::string> notes; // moved league dates and similar remarks
};
// Requires the Classic layout (a fresh startup state) and installs the world's layout,
// league sizes and calendar. Throws FormatError when the world does not fit.
ExpandReport expand_to_world(ModernState& g, const World& world);
// Installs the world's training camp catalogue, or the built-in one when the world has none
// (docs/new_engine/trainingslager.md). Classic data keeps the eight original resorts.
void install_training_camps(ModernState& g, const World& world);
// The UTF-8 text of a name in the single-byte encoding of the engine texts (ISO 646-DE;
// letters outside it lose their accents, other characters become '?').
std::string legacy_encoding(const std::string& utf8);
} // namespace bmh::modern