Accept data revision 1.4: real ages for all players (M5)
Revision 1.4 of the Modern data set brings birth dates for every player, the camp catalogue with its maps and 100 referees. The expansion now takes the age from a birth date for the original players as well (WorldPlayer::born); before, only the added players kept their data age. The yearly aging stops at 47, the most the age bits hold, so real ages (a goalkeeper of 40) cannot run into the bits above. The season sim counts second referee assignments per day. Two seasons and ten seasons run through; the save round trip is identical; second referee assignments drop to about 7 a season. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7de6f644f2
commit
44a7a77915
8 files changed
+35
-4
No files matched your search
@@ -156,7 +156,7 @@ World read_world(const obw::Documents& documents) {
|
||||
pl.position = position_of(str(positions[0]));
|
||||
const auto& nations = arr(get(p, "nationalities"));
|
||||
if (!nations.empty()) pl.nation = str(nations[0]);
|
||||
if (const J* born = find(p, "born")) pl.age = age_on(str(*born), w.start_date);
|
||||
if (const J* born = find(p, "born")) pl.age = age_on(str(*born), w.start_date), pl.born = pl.age >= 0;
|
||||
else if (const J* at = find(p, "age_at_start")) pl.age = integer(find(*at, "years"), -1);
|
||||
pl.photo = text(find(p, "photo"));
|
||||
const J& a = get(p, "attributes");
|
||||
|
||||
@@ -43,6 +43,7 @@ struct WorldPlayer {
|
||||
int position = 0; // 0 GK, 1 DEF, 2 MID, 3 FWD
|
||||
std::string nation; // first nationality
|
||||
int age = -1; // age on the start date
|
||||
bool born = false; // the age comes from a birth date (not a placeholder age)
|
||||
std::string photo;
|
||||
// Attributes of bmh-classic@1.
|
||||
int technique = 0, condition = 0, form = 0, bonus = 0;
|
||||
|
||||
@@ -295,6 +295,16 @@ ExpandReport expand_to_world(ModernState& g, const World& world) {
|
||||
g.player_name_offsets.resize(size_t(next_player), 0);
|
||||
g.player_cards.resize(size_t(next_player), 0);
|
||||
if (g.player_bonus.size() < size_t(next_player) + 0x36) g.player_bonus.resize(size_t(next_player) + 0x36, 0);
|
||||
// Original players with a birth date in the world take that age (bits 21-25: age - 16); the
|
||||
// career start keeps it instead of drawing one (balance.md). Data set 1.3 had only a
|
||||
// placeholder age for them, 1.4 gives birth dates.
|
||||
g.world_age_known.assign(size_t(next_player), false);
|
||||
for (size_t i = 0; i < original_players; ++i)
|
||||
if (const WorldPlayer* p = player_at[i]; p && p->born) {
|
||||
const int age = std::clamp(p->age, 16, 47);
|
||||
g.players[i].w364 = (g.players[i].w364 & ~(0x1fu << 21)) | uint32_t(age - 16) << 21;
|
||||
g.world_age_known[i] = true;
|
||||
}
|
||||
for (size_t i = original_players; i < size_t(next_player); ++i) {
|
||||
const WorldPlayer& p = *player_at[i];
|
||||
const auto clamp7 = [](int v) { return uint32_t(std::clamp(v, 0, 127)); };
|
||||
|
||||
Reference in new issue
Block a user