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
@@ -43,6 +43,19 @@ public:
|
||||
if (!has(address)) blocks_[address].assign(size, 0);
|
||||
}
|
||||
|
||||
// Enlarges the block starting at `address` to `size` bytes (new bytes zero) when the space
|
||||
// up to the next block is free; a Modern world uses it for tables per club that have
|
||||
// room behind them. Throws std::out_of_range when the block is missing or too close.
|
||||
void grow_block(uint32_t address, size_t size) {
|
||||
auto it = blocks_.find(address);
|
||||
if (it == blocks_.end()) throw std::out_of_range("static memory: no block at " + hex(address));
|
||||
if (size <= it->second.size()) return;
|
||||
auto next = std::next(it);
|
||||
if (next != blocks_.end() && address + size > next->first)
|
||||
throw std::out_of_range("static memory: block " + hex(address) + " cannot grow into " + hex(next->first));
|
||||
it->second.resize(size, 0);
|
||||
}
|
||||
|
||||
bool has(uint32_t address) const {
|
||||
auto it = blocks_.upper_bound(address);
|
||||
if (it == blocks_.begin()) return false;
|
||||
|
||||
@@ -9,5 +9,7 @@
|
||||
namespace bmh {
|
||||
|
||||
inline std::atomic<const char*> turn_step{"start"};
|
||||
// The club the current step works on (diagnostics only; -1 = none).
|
||||
inline std::atomic<int> turn_team{-1};
|
||||
|
||||
} // namespace bmh
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "game/world_layout.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
@@ -29,6 +30,16 @@ WorldLayout classic_world_layout() {
|
||||
return w;
|
||||
}
|
||||
|
||||
int WorldLayout::team_of_slot(int slot) const {
|
||||
if (slot < 0) return -1;
|
||||
if (uint32_t(slot) < transfer_list) {
|
||||
const auto it = std::upper_bound(squad_start.begin(), squad_start.end(), uint32_t(slot));
|
||||
return int(it - squad_start.begin()) - 1;
|
||||
}
|
||||
if (uint32_t(slot) >= pool_end && uint32_t(slot) < pool_end + no_team_slots) return no_team();
|
||||
return -1;
|
||||
}
|
||||
|
||||
const WorldLayout& world_layout() { return current(); }
|
||||
|
||||
void set_world_layout(WorldLayout layout) {
|
||||
|
||||
@@ -44,6 +44,9 @@ struct WorldLayout {
|
||||
int no_team() const { return first_foreign_cup() + foreign_cup_teams; }
|
||||
int total_teams() const { return no_team() + national_teams; }
|
||||
bool has_squad(int team) const { return (team >= 0 && team < league_teams) || team == no_team(); }
|
||||
// The team whose squad holds `slot`: a league club, no_team() for the no-club squad, -1 for
|
||||
// the pools and the reserve.
|
||||
int team_of_slot(int slot) const;
|
||||
};
|
||||
|
||||
// The original dimensions (V2.24 and the supported German and English editions).
|
||||
|
||||
Reference in new issue
Block a user