CvHomelandAI::PlotExplorerSeaMoves()
- Defined in
- CvHomelandAI.cpp, line 845
- Class
- CvHomelandAI
- Hook name
CivHooks::CvHomelandAI_PlotExplorerSeaMoves
Hooks
static bool BeforeCvHomelandAI_PlotExplorerSeaMoves(CvHomelandAI* self);static void AfterCvHomelandAI_PlotExplorerSeaMoves(CvHomelandAI* self);static void ReplaceCvHomelandAI_PlotExplorerSeaMoves(void (*original)(CvHomelandAI*), CvHomelandAI* self);CivRegisterBefore<CivHooks::CvHomelandAI_PlotExplorerSeaMoves>(host, &BeforeCvHomelandAI_PlotExplorerSeaMoves);CivRegisterAfter<CivHooks::CvHomelandAI_PlotExplorerSeaMoves>(host, &AfterCvHomelandAI_PlotExplorerSeaMoves);CivRegisterReplace<CivHooks::CvHomelandAI_PlotExplorerSeaMoves>(host, &ReplaceCvHomelandAI_PlotExplorerSeaMoves);
Code
844/// Get units with explore AI and plan their moves845void CvHomelandAI::PlotExplorerSeaMoves()846{847 ClearCurrentMoveUnits();848849 // Loop through all recruited units850 for(list<int>::iterator it = m_CurrentTurnUnits.begin(); it != m_CurrentTurnUnits.end(); ++it)851 {852 UnitHandle pUnit = m_pPlayer->getUnit(*it);853 if(pUnit)854 {855 if(pUnit->AI_getUnitAIType() == UNITAI_EXPLORE_SEA ||856 pUnit->IsAutomated() && pUnit->getDomainType() == DOMAIN_SEA && pUnit->GetAutomateType() == AUTOMATE_EXPLORE)857 {858 CvHomelandUnit unit;859 unit.SetID(pUnit->GetID());860 m_CurrentMoveUnits.push_back(unit);861 }862 }863 }864865 if(m_CurrentMoveUnits.size() > 0)866 {867 // Execute twice so explorers who can reach the end of their sight can move again868 ExecuteExplorerMoves();869 ExecuteExplorerMoves();870 }871}
Calls
BaseVector::size- CvHomelandAI::ClearCurrentMoveUnits()
- CvHomelandAI::ExecuteExplorerMoves()
- CvHomelandUnit::CvHomelandUnit()
- CvHomelandUnit::SetID(int)
- CvPlayer::getUnit(int)
- CvUnit::AI_getUnitAIType() const
- CvUnit::GetAutomateType() const
- CvUnit::getDomainType() const
- CvUnit::GetID() const
- CvUnit::IsAutomated() const
FObjectHandle::FObjectHandleFObjectHandle::operator boolFObjectHandle::operator->FStaticVector::push_backstd::list::_Const_iterator::operator!=std::list::_Iterator::operator*std::list::_Iterator::operator++std::list::beginstd::list::end