CvPlayer::UpdateResearchAgreements(int)
- Defined in
- CvPlayer.cpp, line 19321
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_UpdateResearchAgreements
Hooks
static bool BeforeCvPlayer_UpdateResearchAgreements(CvPlayer* self, int iValue);static void AfterCvPlayer_UpdateResearchAgreements(CvPlayer* self, int iValue);static void ReplaceCvPlayer_UpdateResearchAgreements(void (*original)(CvPlayer*, int), CvPlayer* self, int iValue);CivRegisterBefore<CivHooks::CvPlayer_UpdateResearchAgreements>(host, &BeforeCvPlayer_UpdateResearchAgreements);CivRegisterAfter<CivHooks::CvPlayer_UpdateResearchAgreements>(host, &AfterCvPlayer_UpdateResearchAgreements);CivRegisterReplace<CivHooks::CvPlayer_UpdateResearchAgreements>(host, &ReplaceCvPlayer_UpdateResearchAgreements);
Code
19320/// Update the beakers accumulated during the term of RAs19321void CvPlayer::UpdateResearchAgreements(int iValue)19322{19323 PlayerTypes ePlayerLoop;19324 TeamTypes eTeamLoop;19325 for(int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)19326 {19327 ePlayerLoop = (PlayerTypes) iPlayerLoop;19328 eTeamLoop = GET_PLAYER(ePlayerLoop).getTeam();19329 if(ePlayerLoop == GetID())19330 continue;19331 if(eTeamLoop == getTeam())19332 continue;1933319334 if(GET_TEAM(getTeam()).IsHasResearchAgreement(eTeamLoop))19335 {19336 // Note that this increases the counter for all players on the other team,19337 // even though the RA was only made with one of them. This is because19338 // RAs, though made with players, are restricted and tracked by 1 per team.19339 // This must change if future implementations allow for multiple RAs to be19340 // made with a particular team.19341 ChangeResearchAgreementCounter(ePlayerLoop, iValue);19342 }19343 else if(GetResearchAgreementCounter(ePlayerLoop) != 0)19344 {19345 SetResearchAgreementCounter(ePlayerLoop, 0);19346 }19347 }19348}
Calls
- CvPlayer::ChangeResearchAgreementCounter(PlayerTypes, int)
- CvPlayer::GetID() const
- CvPlayer::GetResearchAgreementCounter(PlayerTypes) const
- CvPlayer::getTeam() const
- CvPlayer::SetResearchAgreementCounter(PlayerTypes, int)
- CvPlayerAI::getPlayer(PlayerTypes)
- CvTeam::getTeam(TeamTypes)
- CvTeam::IsHasResearchAgreement(TeamTypes) const