Team id comparisons ask the world layout

92 comparisons against the raw numbers 138, 168 and 357 in engine, UI and app
read world_layout().league_teams, first_foreign_cup() and no_team(); a team id
written as 0x165 is kNoTeam. Same values, same arithmetic.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude committed 2026-11-10 23:16:53 +01:00
1 parent cb6d3b6035
commit d552c59a77
29 files changed
+94 -93

No files matched your search

+3 -3
View File
@@ -160,13 +160,13 @@ OtherGamesClubMetadata source_metadata(const GameState& game, int team) {
uint16_t(game.manager_records[kNationalOriginalClub + 1]) << 8));
manager_owned = original_club == team;
}
if (team >= 168 && !manager_owned) {
const size_t at = size_t(team - 168);
if (team >= world_layout().first_foreign_cup() && !manager_owned) {
const size_t at = size_t(team - world_layout().first_foreign_cup());
if (at >= game.foreign_strength.size()) invalid("missing Source foreign-strength byte");
out.foreign_strength = game.foreign_strength[at];
return out;
}
if (team >= 168 && team != kNoTeam)
if (team >= world_layout().first_foreign_cup() && team != kNoTeam)
invalid("manager-controlled foreign-club row needs live TeamRating W-generator context");
constexpr std::array<uint16_t, 5> kFlags{0x0f1, 0x0f2, 0x0f4, 0x0f8, 0x0ff};
for (size_t i = 0; i < kFlags.size(); ++i)