CvGame::getNumHumansInHumanWars(PlayerTypes)
- Defined in
- CvGame.cpp, line 4409
- Class
- CvGame
- Hook name
CivHooks::CvGame_getNumHumansInHumanWars
Hooks
static bool BeforeCvGame_getNumHumansInHumanWars(CvGame* self, PlayerTypes ignorePlayer, int& result);static void AfterCvGame_getNumHumansInHumanWars(CvGame* self, PlayerTypes ignorePlayer, int& result);static int ReplaceCvGame_getNumHumansInHumanWars(int (*original)(CvGame*, PlayerTypes), CvGame* self, PlayerTypes ignorePlayer);CivRegisterBefore<CivHooks::CvGame_getNumHumansInHumanWars>(host, &BeforeCvGame_getNumHumansInHumanWars);CivRegisterAfter<CivHooks::CvGame_getNumHumansInHumanWars>(host, &AfterCvGame_getNumHumansInHumanWars);CivRegisterReplace<CivHooks::CvGame_getNumHumansInHumanWars>(host, &ReplaceCvGame_getNumHumansInHumanWars);
Code
4409int CvGame::getNumHumansInHumanWars(PlayerTypes ignorePlayer)4410{//returns the number of human players who are currently at war with other human players.4411 int humansWarringHumans = 0;4412 for(int i = 0; i < MAX_CIV_PLAYERS; ++i)4413 {4414 const CvPlayer& curPlayer = GET_PLAYER((PlayerTypes)i);4415 if(curPlayer.isAlive() 4416 && curPlayer.isHuman() 4417 && (ignorePlayer == NO_PLAYER || curPlayer.GetID() != ignorePlayer) //ignore the ignore player4418 && GET_TEAM(curPlayer.getTeam()).isAtWarWithHumans())4419 {4420 ++humansWarringHumans;4421 }4422 }4423 return humansWarringHumans;4424}