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>
54 lines
2.4 KiB
C++
54 lines
2.4 KiB
C++
// SPDX-License-Identifier: GPL-3.0-only
|
|
// modern_world_info <world.obw> - opens a Modern world package and prints its leagues, clubs
|
|
// and players (docs/new_engine, M3). Exit code 0 when the package opens, 1 otherwise.
|
|
#include <cstdio>
|
|
#include <exception>
|
|
#include <map>
|
|
|
|
#include "modern/content/world_package.hpp"
|
|
|
|
int main(int argc, char** argv) {
|
|
if (argc != 2) {
|
|
std::fprintf(stderr, "usage: modern_world_info WORLD.obw\n");
|
|
return 2;
|
|
}
|
|
try {
|
|
const auto package = bmh::modern::open_world_package(argv[1]);
|
|
const auto& w = *package.world;
|
|
std::printf("world %s, revision %s, start %s, content %s\n", w.id.c_str(),
|
|
w.data_revision.empty() ? "-" : w.data_revision.c_str(), w.start_date.c_str(),
|
|
package.classic->content_id.c_str());
|
|
int league_clubs = 0;
|
|
for (const auto& l : w.leagues) {
|
|
int added = 0;
|
|
for (const auto& m : l.members)
|
|
if (const auto* c = w.club(m); c && c->legacy_index < 0) ++added;
|
|
std::printf("league %d %-28s %2zu clubs (%d added), %s, %zu dates\n", l.index, l.name.c_str(),
|
|
l.members.size(), added, l.generator.c_str(), l.dates.size());
|
|
league_clubs += int(l.members.size());
|
|
}
|
|
int legacy = 0, without_team = 0, coded = 0;
|
|
std::map<std::string, int> squads;
|
|
for (const auto& p : w.players) {
|
|
legacy += p.legacy;
|
|
if (p.team.empty()) ++without_team;
|
|
else ++squads[p.team];
|
|
coded += w.nationality.count(p.nation) && w.nationality.at(p.nation) < 32;
|
|
}
|
|
int largest = 0, smallest = 99;
|
|
for (const auto& l : w.leagues)
|
|
for (const auto& m : l.members) {
|
|
const int n = squads.count(m) ? squads.at(m) : 0;
|
|
largest = std::max(largest, n);
|
|
smallest = std::min(smallest, n);
|
|
}
|
|
std::printf("%d league clubs, %zu clubs in all; %zu players (%d original, %d without club, "
|
|
"%d with a Classic nationality code); league squads %d-%d\n",
|
|
league_clubs, w.clubs.size(), w.players.size(), legacy, without_team, coded, smallest, largest);
|
|
return 0;
|
|
} catch (const std::exception& e) {
|
|
std::fprintf(stderr, "cannot open world: %s\n", e.what());
|
|
return 1;
|
|
}
|
|
}
|