CvTeam::HasSpyAtTeam(TeamTypes) const
- Defined in
- CvTeam.cpp, line 4181
- Class
- CvTeam
- Hook name
CivHooks::CvTeam_HasSpyAtTeam
Hooks
static bool BeforeCvTeam_HasSpyAtTeam(const CvTeam* self, TeamTypes eIndex, bool& result);static void AfterCvTeam_HasSpyAtTeam(const CvTeam* self, TeamTypes eIndex, bool& result);static bool ReplaceCvTeam_HasSpyAtTeam(bool (*original)(const CvTeam*, TeamTypes), const CvTeam* self, TeamTypes eIndex);CivRegisterBefore<CivHooks::CvTeam_HasSpyAtTeam>(host, &BeforeCvTeam_HasSpyAtTeam);CivRegisterAfter<CivHooks::CvTeam_HasSpyAtTeam>(host, &AfterCvTeam_HasSpyAtTeam);CivRegisterReplace<CivHooks::CvTeam_HasSpyAtTeam>(host, &ReplaceCvTeam_HasSpyAtTeam);
Code
4181bool CvTeam::HasSpyAtTeam(TeamTypes eIndex) const4182{4183 CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");4184 CvAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be within maximum bounds (invalid Index)");41854186 for (uint uiMyPlayer = 0; uiMyPlayer < MAX_MAJOR_CIVS; uiMyPlayer++)4187 {4188 CvPlayer& kMyPlayer = GET_PLAYER((PlayerTypes)uiMyPlayer);4189 if (kMyPlayer.getTeam() == m_eID)4190 {4191 for (uint uiOtherPlayer = 0; uiOtherPlayer < MAX_MAJOR_CIVS; uiOtherPlayer++)4192 {4193 CvPlayer& kOtherPlayer = GET_PLAYER((PlayerTypes)uiOtherPlayer);4194 if (kOtherPlayer.getTeam() == eIndex)4195 {4196 if (kMyPlayer.GetEspionage()->GetSpyIndexInCity(kOtherPlayer.getCapitalCity()) != -1)4197 {4198 return true;4199 }4200 }4201 }4202 }4203 }42044205 return false;4206}