Bazaar developer reference

CvMilitaryAI::RequestPillageAttack(PlayerTypes)

Defined in
CvMilitaryAI.cpp, line 604
Class
CvMilitaryAI
Hook name
CivHooks::CvMilitaryAI_RequestPillageAttack

Hooks

static bool BeforeCvMilitaryAI_RequestPillageAttack(CvMilitaryAI* self, PlayerTypes eEnemy, bool& result);static void AfterCvMilitaryAI_RequestPillageAttack(CvMilitaryAI* self, PlayerTypes eEnemy, bool& result);static bool ReplaceCvMilitaryAI_RequestPillageAttack(bool (*original)(CvMilitaryAI*, PlayerTypes), CvMilitaryAI* self, PlayerTypes eEnemy);CivRegisterBefore<CivHooks::CvMilitaryAI_RequestPillageAttack>(host, &BeforeCvMilitaryAI_RequestPillageAttack);CivRegisterAfter<CivHooks::CvMilitaryAI_RequestPillageAttack>(host, &AfterCvMilitaryAI_RequestPillageAttack);CivRegisterReplace<CivHooks::CvMilitaryAI_RequestPillageAttack>(host, &ReplaceCvMilitaryAI_RequestPillageAttack);

Code

603/// Send an army to force concessions604bool CvMilitaryAI::RequestPillageAttack(PlayerTypes eEnemy)605{606	int iNumRequiredSlots = 0;607	int iLandReservesUsed = 0;608	int iFilledSlots = 0;609	iFilledSlots = MilitaryAIHelpers::NumberOfFillableSlots(m_pPlayer, MUFORMATION_FAST_PILLAGERS, false, &iNumRequiredSlots, &iLandReservesUsed);610	if(iFilledSlots >= iNumRequiredSlots && iLandReservesUsed <= GetLandReservesAvailable())611	{612		CvAIOperation* pOperation = m_pPlayer->addAIOperation(AI_OPERATION_PILLAGE_ENEMY, eEnemy);613		if(pOperation != NULL && !pOperation->ShouldAbort())614		{615			return true;616		}617	}618619	return false;620}

Calls