Hooks
static bool BeforeCvMilitaryAI_RequestShowOfForce(CvMilitaryAI* self, PlayerTypes eEnemy, bool& result);static void AfterCvMilitaryAI_RequestShowOfForce(CvMilitaryAI* self, PlayerTypes eEnemy, bool& result);static bool ReplaceCvMilitaryAI_RequestShowOfForce(bool (*original)(CvMilitaryAI*, PlayerTypes), CvMilitaryAI* self, PlayerTypes eEnemy);CivRegisterBefore<CivHooks::CvMilitaryAI_RequestShowOfForce>(host, &BeforeCvMilitaryAI_RequestShowOfForce);CivRegisterAfter<CivHooks::CvMilitaryAI_RequestShowOfForce>(host, &AfterCvMilitaryAI_RequestShowOfForce);CivRegisterReplace<CivHooks::CvMilitaryAI_RequestShowOfForce>(host, &ReplaceCvMilitaryAI_RequestShowOfForce);
Code
557/// Send an army to force concessions558bool CvMilitaryAI::RequestShowOfForce(PlayerTypes eEnemy)559{560 CvMilitaryTarget target;561562 target = FindBestAttackTarget(AI_OPERATION_SNEAK_CITY_ATTACK, eEnemy);563 if(target.m_pTargetCity)564 {565 if (target.m_bAttackBySea)566 {567 CvAIOperation* pOperation = m_pPlayer->addAIOperation(AI_OPERATION_NAVAL_SNEAK_ATTACK, eEnemy, target.m_pTargetCity->getArea(), target.m_pTargetCity, target.m_pMusterCity);568 if(pOperation != NULL && !pOperation->ShouldAbort())569 {570 return true;571 }572 }573 else574 {575 CvAIOperation* pOperation = m_pPlayer->addAIOperation(AI_OPERATION_SMALL_CITY_ATTACK, eEnemy, target.m_pTargetCity->getArea(), target.m_pTargetCity, target.m_pMusterCity);576 if(pOperation != NULL && !pOperation->ShouldAbort())577 {578 return true;579 }580 }581 }582583 return false;584}