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:
1 parent
13bdc56f04
commit
6f55622307
53 files changed
+1392
-87
No files matched your search
@@ -0,0 +1,75 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
// The world of a Modern data set (docs/new_engine, M3): the parts of the OBW tables the
|
||||
// Modern season core needs, read once when a world is opened. Identities are the stable
|
||||
// OBW ids; runtime team and player indices are assigned by the world loader.
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "import/obw.hpp"
|
||||
#include "modern/game/training_camps.hpp"
|
||||
|
||||
namespace bmh::modern {
|
||||
|
||||
struct WorldLeague {
|
||||
std::string id; // comp:...
|
||||
std::string name;
|
||||
int index = -1; // league 0-8 (x-legacy.league_index)
|
||||
std::vector<std::string> members; // club ids in table order
|
||||
std::string generator; // legacy:<n> or round-robin
|
||||
std::vector<std::string> dates; // explicit league dates, empty = Classic calendar
|
||||
};
|
||||
|
||||
struct WorldClub {
|
||||
std::string id;
|
||||
std::string name;
|
||||
std::string short_name;
|
||||
std::string nation;
|
||||
std::string crest;
|
||||
std::string competition; // league id for league clubs
|
||||
int legacy_index = -1; // Classic team id, -1 for clubs added by the data set
|
||||
int kit_selector = -1;
|
||||
};
|
||||
|
||||
struct WorldPlayer {
|
||||
std::string id;
|
||||
std::string first, last;
|
||||
std::string team; // club id, empty = no club
|
||||
int squad_order = -1;
|
||||
int position = 0; // 0 GK, 1 DEF, 2 MID, 3 FWD
|
||||
std::string nation; // first nationality
|
||||
int age = -1; // age on the start date
|
||||
std::string photo;
|
||||
// Attributes of bmh-classic@1.
|
||||
int technique = 0, condition = 0, form = 0, bonus = 0;
|
||||
int teamplay = 0, speed = 0, shooting = 0, passing = 0, tackling = 0, free_kick = 0, corner = 0;
|
||||
// The original database words of an imported player (x-legacy).
|
||||
bool legacy = false;
|
||||
int legacy_index = -1;
|
||||
uint32_t w35c = 0, w368 = 0, w364 = 0;
|
||||
};
|
||||
|
||||
struct World {
|
||||
std::string id, title, data_revision;
|
||||
std::vector<std::string> requires_;
|
||||
int start_year = 2026;
|
||||
std::string start_date;
|
||||
std::vector<WorldLeague> leagues; // by league index 0-8
|
||||
std::vector<WorldClub> clubs;
|
||||
std::vector<WorldPlayer> players;
|
||||
std::map<std::string, int> nationality; // nation id -> Classic nationality code (0 = Germany)
|
||||
std::map<std::string, size_t> club_by_id; // club id -> index in clubs
|
||||
// rule:training-camps with maps and camp details (data format F4); empty = built-in catalogue.
|
||||
std::optional<CampCatalogue> camps;
|
||||
|
||||
const WorldClub* club(const std::string& id) const;
|
||||
};
|
||||
|
||||
// Reads the world tables. Throws FormatError for missing or malformed required fields.
|
||||
World read_world(const obw::Documents& documents);
|
||||
|
||||
} // namespace bmh::modern
|
||||
Reference in new issue
Block a user