(by Codex) Preserve long-career player counts and title history

This commit is contained in:
Codex committed 2026-11-01 18:15:55 +01:00
1 parent 8e2f491d5e
commit 30843fc9f3
23 files changed
+491 -47

No files matched your search

+8 -5
View File
@@ -28,7 +28,7 @@ void rect(Image& out, int x, int y, int w, int h, uint8_t color) {
for (int yy = std::max(0, y); yy < std::min(out.height, y + h); ++yy)
for (int xx = std::max(0, x); xx < std::min(out.width, x + w); ++xx) out.at(xx, yy) = color;
}
std::string padded(int value, int width = 2) {
std::string padded(uint64_t value, int width = 2) {
std::string s = std::to_string(value);
if (int(s.size()) < width) s.insert(0, size_t(width - int(s.size())), '%');
return s;
@@ -110,7 +110,10 @@ ClubInfoProjection club_info_from_game(const GameState& g, int team,
player.cards = g.player_cards[id];
player.bonus = g.player_bonus[id];
}
if (board) player.manager_board = std::move(board);
if (board) {
player.manager_board = std::move(board);
if (player.player_id >= 0) player.statistics = player_club_statistics(g, team, player.player_id, *player.manager_board);
}
if (!player.borrowed && player.player_id >= 0) {
for (int loan = 0; loan < 200; ++loan) {
const uint32_t address = ::bmh::layout::Career_RemoveJoinLoans_RuntimeField + uint32_t(loan) * 4;
@@ -296,9 +299,9 @@ Image ClubInfoScreen::render() const {
std::string attrs = padded(p.bonus & 127, 3) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5);
if (p.manager_board) {
const auto& b = *p.manager_board;
attrs += padded(b[7], 3) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5) + padded(b[9], 3) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5);
Bytes raw(b.begin(), b.end()); attrs += padded(le16(raw, 0x48), 3) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2) +
padded(le16(raw, 0x4a), 3) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2) + padded(le16(raw, 0x4c), 3) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField);
attrs += padded(p.statistics ? p.statistics->appearances[0] : b[7], 3) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5) + padded(p.statistics ? p.statistics->appearances[2] : b[9], 3) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5);
Bytes raw(b.begin(), b.end()); attrs += padded((p.statistics ? p.statistics->total : le16(raw, 0x48)), 3) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2) +
padded((p.statistics ? p.statistics->goals : le16(raw, 0x4a)), 3) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2) + padded((p.statistics ? p.statistics->assists : le16(raw, 0x4c)), 3) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField);
}
text(out, 165, baseline, attrs, 0x6c);
}
+1
View File
@@ -36,6 +36,7 @@ struct ClubInfoPlayer {
bool offer_name_color = false;
// Present only when this runtime club belongs to a human manager.
std::optional<std::array<uint8_t, 0x58>> manager_board;
std::optional<PlayerClubStatistics> statistics;
};
// Owned inputs for one render of ClubInfoFromGame / LineupScreen. Build this from the actual
+5 -3
View File
@@ -148,6 +148,7 @@ ContractsState contracts_from_game(const GameState& game, int manager_slot, uint
view.source.name = game.player_name(player); view.source.attributes = source;
view.source.cards = game.player_cards.at(size_t(player)); view.source.bonus = game.player_bonus.at(size_t(player));
std::copy_n(game.tactics.begin() + std::ptrdiff_t(at), 0x58, view.source.board.begin());
view.source.statistics = player_club_statistics(game, team, player, view.source.board);
state.players.push_back(std::move(view));
}
if (!state.players.empty()) {
@@ -314,6 +315,7 @@ Image ContractsScreen::render_roster() const {
text(out, x, y, original_to_utf8(raw), color, -1);
};
const auto fixed = [](uint32_t value, int width, bool grouped = false) { return original_number(value, width, grouped); };
const auto count = [](uint64_t value) { auto s = std::to_string(value); if(s.size()<3)s.insert(0,3-s.size(),'%'); return s; };
const auto title = original_to_utf8(texts_[(::bmh::layout::Contracts_RenderRoster_TextPointer2 - ::bmh::layout::TextPointerTable) / 4]);
sprite_font_.draw(out, SpriteFont::centered_title_x(sprite_font_.text_width(title)), 13, title, 5);
sprite_font_.draw(out, 5, 235, state_.club_name, 5);
@@ -374,9 +376,9 @@ Image ContractsScreen::render_roster() const {
original_text(65, baseline, fixed(a.age(), 2) + texts_[(::bmh::layout::ClubInfo_Render_TextPointer5 - ::bmh::layout::TextPointerTable) / 4], 0x6c);
for (int skill = 0; skill < 7; ++skill) copy_region(out, atlas_, 256 + a.skill(Player::Skill(skill)) * 16, 32, 87 + skill * 10, baseline - 5, 16, 5, true);
auto word = [&](int at) { return uint16_t(s.board[at] | uint16_t(s.board[at + 1]) << 8); };
original_text(165, baseline, fixed(s.bonus & 127, 3) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5) + fixed(s.board[7], 3) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5) +
fixed(s.board[9], 3) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5) + fixed(word(0x48), 3) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2) +
fixed(word(0x4a), 3) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2) + fixed(word(0x4c), 3) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField), 0x6c);
original_text(165, baseline, fixed(s.bonus & 127, 3) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5) + count(s.statistics ? s.statistics->appearances[0] : s.board[7]) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5) +
count(s.statistics ? s.statistics->appearances[2] : s.board[9]) + exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5) + count(s.statistics ? s.statistics->total : word(0x48)) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2) +
count(s.statistics ? s.statistics->goals : word(0x4a)) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2) + count(s.statistics ? s.statistics->assists : word(0x4c)) + exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField), 0x6c);
}
baseline += 7;
}
+11 -4
View File
@@ -83,7 +83,7 @@ void copy(Image& out, const Image& src, int sx, int sy, int x, int y, int w, int
if (c != transparent && x+xx>=0 && x+xx<out.width && y+yy>=0 && y+yy<out.height) out.at(x+xx,y+yy)=c;
}
}
std::string number(int value, int width = 2) {
std::string number(uint64_t value, int width = 2) {
auto s=std::to_string(value);
if (int(s.size())<width) s.insert(0,size_t(width-int(s.size())),'%');
return s;
@@ -110,11 +110,16 @@ LineupState lineup_from_save(const SaveState& s,const LeImage& exe,uint64_t revi
for(size_t at=0;at<w1.size();at+=4) players.push_back({{},le32(w1,at),le32(w2,at),le32(w3,at)});
auto out=project(memory,exe,teams,words(block(s,::bmh::layout::SquadSlots)),players,block(s,::bmh::layout::TacticsBoards),block(s,::bmh::layout::ManagerAutomation),
words(block(s,::bmh::layout::PlayerCards)),block(s,::bmh::layout::PlayerBonuses),words(block(s,::bmh::layout::PlayerNameOffsets)),s.pool(1),words(block(s,::bmh::layout::ClubIdentities)),s.pool(0),revision);
const auto g = GameState::from_save(s);
for (auto& p : out.players) if (p.player_id >= 0)
p.statistics = player_club_statistics(g, out.runtime_club, p.player_id, p.board);
out.source="original_save_read_only"; return out;
}
LineupState lineup_from_game(const GameState& g,const LeImage& exe,uint64_t revision) {
auto out=project(g.memory,exe,g.manager_teams,g.squad_slots,g.players,g.tactics,g.manager_options,
g.player_cards,g.player_bonus,g.player_name_offsets,g.player_names,g.club_ids,g.club_names,revision);
for (auto& p : out.players) if (p.player_id >= 0)
p.statistics = player_club_statistics(g, out.runtime_club, p.player_id, p.board);
out.source="engine_projection"; return out;
}
@@ -224,9 +229,9 @@ Image LineupScreen::render() const {
} else {
text(out,65,baseline,number(a.age())+texts_[(::bmh::layout::ClubInfo_Render_TextPointer5-::bmh::layout::TextPointerTable)/4],0x6c);
for(int skill=0;skill<7;++skill)copy(out,atlas_,256+a.skill(Player::Skill(skill))*16,32,87+skill*10,baseline-5,16,5,0);
text(out,165,baseline,number(p.bonus&127,3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5)+number(p.board[7],3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5)+
number(p.board[9],3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5)+number(le16(Bytes(p.board.begin(),p.board.end()),0x48),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2)+
number(le16(Bytes(p.board.begin(),p.board.end()),0x4a),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2)+number(le16(Bytes(p.board.begin(),p.board.end()),0x4c),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField),0x6c);
text(out,165,baseline,number(p.bonus&127,3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5)+number(p.statistics ? p.statistics->appearances[0] : p.board[7],3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5)+
number(p.statistics ? p.statistics->appearances[2] : p.board[9],3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5)+number((p.statistics ? p.statistics->total : le16(Bytes(p.board.begin(),p.board.end()),0x48)),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2)+
number((p.statistics ? p.statistics->goals : le16(Bytes(p.board.begin(),p.board.end()),0x4a)),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2)+number((p.statistics ? p.statistics->assists : le16(Bytes(p.board.begin(),p.board.end()),0x4c)),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField),0x6c);
}
}
button(out,1,215,texts_[(::bmh::layout::Lineup_Render_TextPointer-::bmh::layout::TextPointerTable)/4+(state_.view==LineupView::data_a?1:0)]);
@@ -310,6 +315,8 @@ std::string LineupScreen::state_json() const {
if(p.player_id>=0)s<<",\"starting\":"<<((p.slot&0x8000)?"true":"false")<<",\"bench\":"<<((p.slot&0x4000)?"true":"false")
<<",\"position_type\":"<<p.attributes.position()<<",\"condition\":"<<p.attributes.condition()<<",\"technique\":"<<p.attributes.technique()
<<",\"form\":"<<p.attributes.form()<<",\"strength\":"<<p.attributes.strength()<<",\"age\":"<<p.attributes.age()<<",\"exhaustion\":"<<int(p.board[0xf]);
if (p.statistics) s << ",\"club_appearances\":[" << p.statistics->appearances[0] << ',' << p.statistics->appearances[1] << ',' << p.statistics->appearances[2]
<< "],\"total_appearances\":" << p.statistics->total << ",\"club_goals\":" << p.statistics->goals << ",\"club_assists\":" << p.statistics->assists;
s<<'}';}
s<<"]}";return s.str();
}
+2
View File
@@ -6,6 +6,7 @@
#include <vector>
#include "formats/font.hpp"
#include "game/long_career.hpp"
#include "formats/m3d.hpp"
#include "formats/textd.hpp"
#include "ui/setup.hpp"
@@ -22,6 +23,7 @@ struct LineupPlayer {
uint16_t cards = 0;
uint8_t bonus = 0;
std::array<uint8_t, 0x58> board{};
std::optional<PlayerClubStatistics> statistics;
};
struct LineupState {
int manager_slot = -1, runtime_club = -1;
+39 -21
View File
@@ -59,7 +59,7 @@ StatisticsRankingState statistics_rankings_from_game(const GameState& game, cons
int manager_slot, int category, int first_season,
const Image& underlay) {
if (category < 0 || category >= int(kTitleCount)) throw FormatError("statistics rankings: category outside 0..8");
if (first_season < 0 || first_season >= int(kSeasonCount) || (first_season % 4) != 0)
if (first_season < 0 || (first_season % 4) != 0)
throw FormatError("statistics rankings: Source page must start at a four-season boundary");
if (!game.memory.has(kTitles + kTitleCount * kSeasonCount * 2 - 1))
throw FormatError("statistics rankings: save lacks the Original Titles title-holder block");
@@ -76,7 +76,14 @@ StatisticsRankingState statistics_rankings_from_game(const GameState& game, cons
const uint32_t manager_year_at = uint32_t(manager_slot) * 0xb0c + 0x2aa;
out.season_number_base = int(exe.u16(::bmh::layout::Achievements_FormatError_RuntimeField2)) +
int(game.manager_records[manager_year_at] | (uint16_t(game.manager_records[manager_year_at + 1]) << 8));
out.current_season = std::clamp(game.season, 0, int(kSeasonCount) - 1);
const auto history = title_history_rows(game);
if (history.empty()) throw FormatError("statistics rankings: missing title history");
out.history_first_season = int(history.begin()->first);
out.current_season = game.season - out.history_first_season;
if (out.current_season < 0 || first_season > out.current_season)
throw FormatError("statistics rankings: history page outside known career");
out.season_number_base += out.history_first_season - std::max(0, game.season - 49);
out.season_known.assign(size_t(out.current_season) + 1, false);
out.underlay = underlay;
for (uint32_t index = 0; index < kTitleCount; ++index) {
const uint8_t title_id = exe.u8(::bmh::layout::StatisticsRankings_FormatError_RuntimeField + index);
@@ -84,18 +91,23 @@ StatisticsRankingState statistics_rankings_from_game(const GameState& game, cons
if (title_id >= kTitleCount) throw FormatError("statistics rankings: Source title id outside nine stored lists");
out.categories[index] = StatisticsRankingCategory{title_id, alternate};
}
for (uint32_t category_index = 0; category_index < kTitleCount; ++category_index) {
for (uint32_t season = 0; season < kSeasonCount; ++season) {
// StatisticsRankingsFromGame reads Titles by selected control index (local_14).
// title_id only chooses the Original label pointer above.
const uint32_t at = kTitles + category_index * 100 + season * 2;
out.title_holders[category_index][season] = game.memory.u16(at);
const uint16_t team = out.title_holders[category_index][season];
if (team != 0xffff) {
if (team >= game.club_ids.size())
throw FormatError("statistics rankings: Source title holder has no club identity/name");
out.club_names[category_index][season] = game.club_name(team);
out.club_name_colors[category_index][season] = original_name_color(game, team);
for (size_t category = 0; category < 9; ++category) {
const auto count = size_t(out.current_season) + 1;
out.title_holders[category].assign(count, 0xffff);
out.club_names[category].resize(count);
out.club_name_colors[category].assign(count, 0x5f);
out.title_present[category].assign(count, false);
for (const auto& [season, names] : history) {
if (int(season) > game.season) throw FormatError("statistics rankings: future archived season");
const auto index = size_t(int(season) - out.history_first_season);
out.season_known[index] = true;
out.club_names[category][index] = names[category];
out.title_present[category][index] = !names[category].empty();
const int native_index = int(season) - std::max(0, game.season - 49);
if (native_index >= 0 && native_index < 50) {
const auto team = game.memory.u16(kTitles + uint32_t(category) * 100 + uint32_t(native_index) * 2);
out.title_holders[category][index] = team;
if (team != 0xffff) out.club_name_colors[category][index] = original_name_color(game, team);
}
}
}
@@ -109,11 +121,16 @@ StatisticsRankingsScreen::StatisticsRankingsScreen(const std::filesystem::path&
button_art_(load_vga(asset_path(data / "KB", "0.VGA"))),
texts_(load_textd(asset_path(data, "TEXTD.BLK"))) {
if (state_.category < 0 || state_.category >= int(kTitleCount) || state_.current_season < 0 ||
state_.current_season >= int(kSeasonCount) || state_.first_season < 0 ||
state_.first_season >= int(kSeasonCount) || state_.first_season % 4 != 0 ||
state_.first_season < 0 || state_.first_season > state_.current_season || state_.first_season % 4 != 0 ||
state_.underlay.width != 320 || state_.underlay.height != 240 ||
button_art_.width < 76 || button_art_.height < 84)
throw FormatError("statistics rankings: incomplete Source projection");
for (size_t i = 0; i < 9; ++i)
if (state_.club_names[i].size() != size_t(state_.current_season) + 1 ||
state_.club_name_colors[i].size() != state_.club_names[i].size() ||
state_.title_present[i].size() != state_.club_names[i].size() ||
state_.season_known.size() != state_.club_names[i].size())
throw FormatError("statistics rankings: incomplete archived rows");
for (size_t i = 0; i < state_.categories.size(); ++i) {
const auto& category = state_.categories[i];
if (category.title_id >= kTitleCount)
@@ -169,21 +186,22 @@ Image StatisticsRankingsScreen::render() const {
for (int season = state_.first_season; season <= end; ++season) {
const int visible = season - state_.first_season;
const int y = 0x31 + visible * 6;
const uint16_t team = state_.title_holders[size_t(state_.category)][size_t(season)];
if (season < state_.current_season || team != 0xffff) {
const bool has_title = state_.title_present[size_t(state_.category)][size_t(season)];
if (season < state_.current_season || has_title) {
const int source_season_number = state_.season_number_base + season + 1;
std::string n = std::to_string(source_season_number);
while (n.size() < 4) n.insert(n.begin(), '%');
n += "%%"; // FormatNumber(...,0xc4,&StatisticsRankingsRuntimeField): width-four Source number and suffix.
const uint8_t year_color = team == 0xffff &&
const uint8_t year_color = !has_title &&
(state_.category == 5 || state_.category == 6) ? 0x67 : 0x6b;
font_.draw(out, 100, y - font_.baseline, n, year_color);
if (team != 0xffff) {
if (has_title) {
font_.draw(out, 130, y - font_.baseline,
state_.club_names[size_t(state_.category)][size_t(season)],
state_.club_name_colors[size_t(state_.category)][size_t(season)]);
} else {
font_.draw(out, 130, y - font_.baseline, empty_label_, 0x67);
font_.draw(out, 130, y - font_.baseline,
state_.season_known[size_t(season)] ? empty_label_ : "Unbekannt", 0x67);
}
}
}
+6 -3
View File
@@ -27,9 +27,12 @@ struct StatisticsRankingCategory {
struct StatisticsRankingState {
std::array<StatisticsRankingCategory, 9> categories{};
std::array<std::array<uint16_t, 50>, 9> title_holders{};
std::array<std::array<std::string, 50>, 9> club_names{};
std::array<std::array<uint8_t, 50>, 9> club_name_colors{};
std::array<std::vector<uint16_t>, 9> title_holders{};
std::array<std::vector<std::string>, 9> club_names{};
std::array<std::vector<uint8_t>, 9> club_name_colors{};
std::array<std::vector<bool>, 9> title_present{};
std::vector<bool> season_known;
int history_first_season = 0;
int current_season = 0; // SeasonIndex: latest history index; current empty slot is retained.
int manager_slot = -1;
int season_number_base = 0; // AchievementsRuntimeField[manager] + Achievements_FormatError_RuntimeField2; StatisticsRankingsFromGame adds one.
+22
View File
@@ -97,6 +97,28 @@ int main(int argc, char** argv) {
screen.pending()->kind == StatisticsRankingsRequestKind::close,
"right-click is the Source parent-return request");
auto career = sample(); career.season = 300;
career.manager_records[0x2aa] = uint8_t(258); career.manager_records[0x2ab] = uint8_t(258 >> 8);
for (uint32_t season = 0; season <= 300; ++season) {
std::array<std::string,9> titles; titles[0] = "Bayer"; career.title_history.emplace(season, titles);
}
auto wide = statistics_rankings_from_game(career, exe, 0, 0, 0, underlay);
check(wide.current_season == 300 && wide.history_first_season == 0 && wide.club_names[0].size() == 301 &&
wide.club_names[0][0] == "Bayer" && wide.club_names[0][300] == "Bayer",
"archived title lists retain all 301 known seasons and original winner snapshots");
check(wide.season_number_base == int(exe.u16(::bmh::layout::Achievements_FormatError_RuntimeField2)) + 7,
"absolute archive year labels compensate for the native 50-row window shift");
StatisticsRankingsScreen long_screen(data, wide);
for (int n = 0; n < 100; ++n) long_screen.scroll(1);
check(long_screen.state().first_season == 288 && long_screen.render().width == 320,
"history paging reaches season 300 instead of stopping at the fiftieth row");
for (int n = 0; n < 100; ++n) long_screen.scroll(-1);
check(long_screen.state().first_season == 0, "oldest archived title rows remain reachable");
auto legacy = sample(); legacy.season = 300;
const auto imported = statistics_rankings_from_game(legacy, exe, 0, 0, 0, underlay);
check(imported.history_first_season == 251 && imported.current_season == 49,
"a legacy late-career save exposes only its surviving 50 seasons, without invented earlier winners");
GameState missing;
bool rejected = false;
try { (void)statistics_rankings_from_game(missing, exe, 0, 0, 0, underlay); }
+5 -3
View File
@@ -32,7 +32,7 @@ void copy(Image& out,const Image& source,int sx,int sy,int x,int y,int w,int h,i
if(pixel!=key&&x+xx>=0&&x+xx<out.width&&y+yy>=0&&y+yy<out.height)out.at(x+xx,y+yy)=pixel;
}
}
std::string padded(int n,int width=2) {
std::string padded(uint64_t n,int width=2) {
auto text=std::to_string(n);if(int(text.size())<width)text.insert(0,size_t(width-int(text.size())),'%');return text;
}
std::string money(int64_t value) {
@@ -191,6 +191,7 @@ TransferMarketState transfer_market_from_game(const GameState& g, uint64_t revis
if(int(word&31)==manager&&int(word>>10&0xfff)==id)p.offer_name_color=true;
}
}
if (p.manager_board && p.player_id >= 0) p.statistics = player_club_statistics(g, state.runtime_club, p.player_id, *p.manager_board);
state.roster.players.push_back(std::move(p));
}
for(size_t index=0;index<borrowed.size();++index) {
@@ -204,6 +205,7 @@ TransferMarketState transfer_market_from_game(const GameState& g, uint64_t revis
const uint32_t board=::bmh::layout::ClubInfo_FormatError_RuntimeField+uint32_t(loan)*0x58;
if(!g.memory.has(board+0x57))throw FormatError("transfer market: borrowed board outside Native storage");
p.manager_board.emplace();for(uint32_t n=0;n<0x58;++n)(*p.manager_board)[n]=g.memory.u8(board+n);
p.statistics = player_club_statistics(g, state.runtime_club, p.player_id, *p.manager_board);
state.roster.players.push_back(std::move(p));
}
for (size_t row = 0; row < ordinary_count; ++row) {
@@ -448,8 +450,8 @@ void TransferMarketScreen::draw_roster(Image& out,bool full) const {
for(int skill=0;skill<7;++skill)copy(out,atlas_,256+a.skill(Player::Skill(skill))*16,32,87+skill*10,baseline-5,16,5,0);
std::string stats=padded(p.bonus&127,3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5);
if(p.manager_board) {
const auto& b=*p.manager_board;stats+=padded(b[7],3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5)+padded(b[9],3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5);
if(full){Bytes raw(b.begin(),b.end());stats+=padded(le16(raw,0x48),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2)+padded(le16(raw,0x4a),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2)+padded(le16(raw,0x4c),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField);}
const auto& b=*p.manager_board;stats+=padded(p.statistics ? p.statistics->appearances[0] : b[7],3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5)+padded(p.statistics ? p.statistics->appearances[2] : b[9],3)+exe_.cstring(::bmh::layout::ClubInfo_Render_ExecutableField5);
if(full){Bytes raw(b.begin(),b.end());stats+=padded((p.statistics ? p.statistics->total : le16(raw,0x48)),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2)+padded((p.statistics ? p.statistics->goals : le16(raw,0x4a)),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField2)+padded((p.statistics ? p.statistics->assists : le16(raw,0x4c)),3)+exe_.cstring(::bmh::layout::ClubInfo_Raw_ExecutableField);}
}
original_text(out,165,baseline,stats,0x6c);
}
+12
View File
@@ -100,6 +100,18 @@ int main(int argc,char** argv){
check(!transfer_market_from_game(expired,5).squad[0].already_listed,
"cleared rejected/expired pool entry immediately makes the player listable again");
auto wide_game=fixture();
wide_game.player_statistics.emplace(uint32_t(1)<<12, PlayerClubStatistics{{256,0,256},65536,0,0});
const auto wide_state=transfer_market_from_game(wide_game,4);
check(wide_state.roster.players[0].statistics&&wide_state.roster.players[0].statistics->appearances[0]==256&&
wide_state.roster.players[0].statistics->total==65536,
"roster projection owns widened counts instead of showing wrapped Native bytes");
TransferMarketScreen wide_screen(argv[1],wide_state),native_screen(argv[1],s);
wide_screen.click(65,219);native_screen.click(65,219);
wide_screen.click(10,219);native_screen.click(10,219);
check(wide_screen.render().pixels!=native_screen.render().pixels,
"actual transfer roster renderer visibly retains the 256th appearance");
auto all=s;all.items.clear();for(int n=0;n<40;++n){auto item=s.items[0];item.list_entry=n;item.source_slot=2928+n;item.player=100+n;item.name="P"+std::to_string(n);item.position=n%4;item.strength=60+n%7;all.items.push_back(item);}
TransferMarketScreen pages(argv[1],all);const auto first=visible(pages);std::set<int> reached;
for(int page=0;page<7;++page){const auto rows=visible(pages);check(rows.size()==size_t(page==6?4:6),"six original rows per page with final four");reached.insert(rows.begin(),rows.end());pages.click(210,45,true);}