diff --git a/src/ui/pitch.cpp b/src/ui/pitch.cpp index c9ee6f9..e4fc8c0 100644 --- a/src/ui/pitch.cpp +++ b/src/ui/pitch.cpp @@ -59,9 +59,16 @@ PitchExtras extras(const StaticMemory& memory,const Bytes& managers,const Bytes& const int count=memory.u8(::bmh::layout::ManagerCount); if(count<1||count>4||e.manager_slot>=count||teams.size()!=size_t(count))throw FormatError("pitch: invalid active manager"); e.runtime_club=teams.at(e.manager_slot); - if(e.runtime_club<0||e.runtime_club>=exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField))throw FormatError("pitch: unsupported club"); + // The national-team desk has no club of its own (runtime club kNoTeam) and runs on the + // national pool; the lineup page accepts it under the same condition (see lineup.cpp). + const bool national=e.runtime_club==kNoTeam&&e.manager_slot==0&&count==1&& + ((memory.u32(::bmh::layout::CompetitionSelection)&2)!=0|| + (memory.has(::bmh::layout::CoachActive)&&memory.u8(::bmh::layout::CoachActive)!=0)); + if(e.runtime_club<0||(e.runtime_club>=exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField)&&!national)) + throw FormatError("pitch: unsupported club"); const size_t m=size_t(e.manager_slot)*0xb0c,f=size_t(e.manager_slot)*0x160; - if(managers.size()=game.tactics.size())throw FormatError("pitch: truncated own marking rows"); const uint16_t marked=uint16_t(game.tactics[assignment]|uint16_t(game.tactics[assignment+1])<<8); - if(marked==id){const int own_id=game.squad_slots.at(squad_range(e.runtime_club).first+size_t(own))&0x0fff; + if(marked==id){const size_t own_first=e.runtime_club==kNoTeam?size_t(3072):squad_range(e.runtime_club).first; + const int own_id=game.squad_slots.at(own_first+size_t(own))&0x0fff; if(own_id!=0x0fff)opponent.current_marker_player_id=own_id;break;} } e.opponent_players.push_back(std::move(opponent));