CvMinorCivAI::IsUnitSpawningAllowed(PlayerTypes)
- Defined in
- CvMinorCivAI.cpp, line 8402
- Class
- CvMinorCivAI
- Hook name
CivHooks::CvMinorCivAI_IsUnitSpawningAllowed
Hooks
static bool BeforeCvMinorCivAI_IsUnitSpawningAllowed(CvMinorCivAI* self, PlayerTypes ePlayer, bool& result);static void AfterCvMinorCivAI_IsUnitSpawningAllowed(CvMinorCivAI* self, PlayerTypes ePlayer, bool& result);static bool ReplaceCvMinorCivAI_IsUnitSpawningAllowed(bool (*original)(CvMinorCivAI*, PlayerTypes), CvMinorCivAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvMinorCivAI_IsUnitSpawningAllowed>(host, &BeforeCvMinorCivAI_IsUnitSpawningAllowed);CivRegisterAfter<CivHooks::CvMinorCivAI_IsUnitSpawningAllowed>(host, &AfterCvMinorCivAI_IsUnitSpawningAllowed);CivRegisterReplace<CivHooks::CvMinorCivAI_IsUnitSpawningAllowed>(host, &ReplaceCvMinorCivAI_IsUnitSpawningAllowed);
Code
8401/// Allowed to spawn Units for ePlayer?8402bool CvMinorCivAI::IsUnitSpawningAllowed(PlayerTypes ePlayer)8403{8404 // Must have met ePlayer8405 if(!IsHasMetPlayer(ePlayer))8406 return false;84078408 // Must be Militaristic8409 if(GetTrait() != MINOR_CIV_TRAIT_MILITARISTIC)8410 return false;84118412 // Can't be at war!8413 if(IsAtWarWithPlayersTeam(ePlayer))8414 return false;84158416 // Must be Friends8417 if(!IsFriends(ePlayer))8418 return false;84198420 // We must be alive8421 if(!GetPlayer()->isAlive())8422 return false;84238424 // They must be alive8425 if(!GET_PLAYER(ePlayer).isAlive())8426 return false;84278428 return true;8429}