CvTacticalAI::ComputeTotalExpectedBombardDamage(UnitHandle)
- Defined in
- CvTacticalAI.cpp, line 9677
- Class
- CvTacticalAI
- Hook name
CivHooks::CvTacticalAI_ComputeTotalExpectedBombardDamage
Hooks
static bool BeforeCvTacticalAI_ComputeTotalExpectedBombardDamage(CvTacticalAI* self, UnitHandle pTarget, int& result);static void AfterCvTacticalAI_ComputeTotalExpectedBombardDamage(CvTacticalAI* self, UnitHandle pTarget, int& result);static int ReplaceCvTacticalAI_ComputeTotalExpectedBombardDamage(int (*original)(CvTacticalAI*, UnitHandle), CvTacticalAI* self, UnitHandle pTarget);CivRegisterBefore<CivHooks::CvTacticalAI_ComputeTotalExpectedBombardDamage>(host, &BeforeCvTacticalAI_ComputeTotalExpectedBombardDamage);CivRegisterAfter<CivHooks::CvTacticalAI_ComputeTotalExpectedBombardDamage>(host, &AfterCvTacticalAI_ComputeTotalExpectedBombardDamage);CivRegisterReplace<CivHooks::CvTacticalAI_ComputeTotalExpectedBombardDamage>(host, &ReplaceCvTacticalAI_ComputeTotalExpectedBombardDamage);
Code
9676/// Estimates the bombard damage we can apply to a target9677int CvTacticalAI::ComputeTotalExpectedBombardDamage(UnitHandle pTarget)9678{9679 int rtnValue = 0;9680 int iExpectedDamage;96819682 // Now loop through all the cities that can bombard it9683 for(unsigned int iI = 0; iI < m_CurrentMoveCities.size(); iI++)9684 {9685 CvCity* pAttackingCity = m_pPlayer->getCity(m_CurrentMoveCities[iI].GetID());9686 iExpectedDamage = pAttackingCity->rangeCombatDamage(pTarget.pointer(), NULL, false);9687 m_CurrentMoveCities[iI].SetExpectedTargetDamage(iExpectedDamage);9688 rtnValue += iExpectedDamage;9689 }96909691 return rtnValue;9692}
Calls
- CvCity::rangeCombatDamage(const CvUnit *, CvCity *, bool) const
- CvPlayer::getCity(int)
- CvTacticalCity::GetID() const
- CvTacticalCity::SetExpectedTargetDamage(int)
FObjectHandle::pointerstd::vector::operator[]std::vector::size