CvTacticalAI::FindParatroopersWithinStrikingDistance(CvPlot *)
- Defined in
- CvTacticalAI.cpp, line 9279
- Class
- CvTacticalAI
- Hook name
CivHooks::CvTacticalAI_FindParatroopersWithinStrikingDistance
Hooks
static bool BeforeCvTacticalAI_FindParatroopersWithinStrikingDistance(CvTacticalAI* self, CvPlot* pTarget, bool& result);static void AfterCvTacticalAI_FindParatroopersWithinStrikingDistance(CvTacticalAI* self, CvPlot* pTarget, bool& result);static bool ReplaceCvTacticalAI_FindParatroopersWithinStrikingDistance(bool (*original)(CvTacticalAI*, CvPlot*), CvTacticalAI* self, CvPlot* pTarget);CivRegisterBefore<CivHooks::CvTacticalAI_FindParatroopersWithinStrikingDistance>(host, &BeforeCvTacticalAI_FindParatroopersWithinStrikingDistance);CivRegisterAfter<CivHooks::CvTacticalAI_FindParatroopersWithinStrikingDistance>(host, &AfterCvTacticalAI_FindParatroopersWithinStrikingDistance);CivRegisterReplace<CivHooks::CvTacticalAI_FindParatroopersWithinStrikingDistance>(host, &ReplaceCvTacticalAI_FindParatroopersWithinStrikingDistance);
Code
9278/// Fills m_CurrentMoveUnits with all paratrooper units (available to jump) to the target (returns TRUE if 1 or more found)9279bool CvTacticalAI::FindParatroopersWithinStrikingDistance(CvPlot* pTarget)9280{9281 list<int>::iterator it;9282 UnitHandle pLoopUnit;92839284 bool rtnValue = false;9285 m_CurrentMoveUnits.clear();92869287 // Loop through all units available to tactical AI this turn9288 for(it = m_CurrentTurnUnits.begin(); it != m_CurrentTurnUnits.end(); it++)9289 {9290 pLoopUnit = m_pPlayer->getUnit(*it);9291 if(pLoopUnit && pLoopUnit->canParadropAt(pLoopUnit->plot(), pTarget->getX(), pTarget->getY()))9292 {9293 CvTacticalUnit unit;9294 unit.SetID(pLoopUnit->GetID());9295 unit.SetAttackStrength(pLoopUnit->GetMaxAttackStrength(NULL, NULL, NULL));9296 unit.SetHealthPercent(pLoopUnit->GetCurrHitPoints(), pLoopUnit->GetMaxHitPoints());9297 m_CurrentMoveUnits.push_back(unit);9298 rtnValue = true;9299 }9300 }93019302 // Now sort them in the order we'd like them to attack9303 std::stable_sort(m_CurrentMoveUnits.begin(), m_CurrentMoveUnits.end());93049305 return rtnValue;9306}
Calls
- CvPlayer::getUnit(int)
- CvPlot::getX() const
- CvPlot::getY() const
- CvTacticalUnit::CvTacticalUnit()
- CvTacticalUnit::SetAttackStrength(int)
- CvTacticalUnit::SetHealthPercent(int, int)
- CvTacticalUnit::SetID(int)
- CvUnit::canParadropAt(const CvPlot *, int, int) const
- CvUnit::GetCurrHitPoints() const
- CvUnit::GetID() const
- CvUnit::GetMaxAttackStrength(const CvPlot *, const CvPlot *, const CvUnit *) const
- CvUnit::GetMaxHitPoints() const
- CvUnit::plot() const
FObjectHandle::FObjectHandleFObjectHandle::operator boolFObjectHandle::operator->FObjectHandle::operator=std::list::_Const_iterator::operator!=std::list::_Iterator::_Iteratorstd::list::_Iterator::operator*std::list::_Iterator::operator++std::list::_Iterator::operator=std::list::beginstd::list::endstd::stable_sortstd::vector::beginstd::vector::clearstd::vector::endstd::vector::push_back