CvHomelandAI::PlotPatrolMoves()
- Defined in
- CvHomelandAI.cpp, line 1448
- Class
- CvHomelandAI
- Hook name
CivHooks::CvHomelandAI_PlotPatrolMoves
Hooks
static bool BeforeCvHomelandAI_PlotPatrolMoves(CvHomelandAI* self);static void AfterCvHomelandAI_PlotPatrolMoves(CvHomelandAI* self);static void ReplaceCvHomelandAI_PlotPatrolMoves(void (*original)(CvHomelandAI*), CvHomelandAI* self);CivRegisterBefore<CivHooks::CvHomelandAI_PlotPatrolMoves>(host, &BeforeCvHomelandAI_PlotPatrolMoves);CivRegisterAfter<CivHooks::CvHomelandAI_PlotPatrolMoves>(host, &AfterCvHomelandAI_PlotPatrolMoves);CivRegisterReplace<CivHooks::CvHomelandAI_PlotPatrolMoves>(host, &ReplaceCvHomelandAI_PlotPatrolMoves);
Code
1447/// When nothing better to do, have units patrol to an adjacent tiles1448void CvHomelandAI::PlotPatrolMoves()1449{1450#if defined(MOD_AI_SECONDARY_SETTLERS)1451 if (MOD_AI_SECONDARY_SETTLERS && !m_pPlayer->isMinorCiv() && m_pPlayer->getCapitalCity()) {1452 // Find any units with a secondary role of settler and check for opportunistic city founding1453 PlotOpportunisticSettlementMoves();1454 }1455#endif1456 1457 ClearCurrentMoveUnits();14581459 // Loop through all remaining units1460 for(list<int>::iterator it = m_CurrentTurnUnits.begin(); it != m_CurrentTurnUnits.end(); ++it)1461 {1462 UnitHandle pUnit = m_pPlayer->getUnit(*it);1463 if(pUnit && !pUnit->isHuman() && pUnit->getDomainType() != DOMAIN_AIR && !pUnit->isTrade())1464 {1465 CvPlot* pTarget = FindPatrolTarget(pUnit.pointer());1466 if(pTarget)1467 {1468 CvHomelandUnit unit;1469 unit.SetID(pUnit->GetID());1470 unit.SetTarget(pTarget);1471 m_CurrentMoveUnits.push_back(unit);1472 if(GC.getLogging() && GC.getAILogging())1473 {1474 CvString strLogString;1475 CvString strTemp;14761477 strTemp = pUnit->getUnitInfo().GetDescription();1478 strLogString.Format("%s (%d) patrolling to, X: %d, Y: %d, Current X: %d, Current Y: %d", strTemp.GetCString(), pUnit->GetID(), pTarget->getX(), pTarget->getY(), pUnit->getX(), pUnit->getY());1479 LogHomelandMessage(strLogString);1480 }1481 }1482 }1483 }14841485 if(m_CurrentMoveUnits.size() > 0)1486 {1487 ExecutePatrolMoves();1488 }1489}
Calls
BaseVector::size- CustomMods::isAI_SECONDARY_SETTLERS()
- CvBaseInfo::GetDescription() const
- CvGlobals::getAILogging()
- CvGlobals::getLogging()
- CvHomelandAI::ClearCurrentMoveUnits()
- CvHomelandAI::ExecutePatrolMoves()
- CvHomelandAI::FindPatrolTarget(CvUnit *)
- CvHomelandAI::LogHomelandMessage(CvString &)
- CvHomelandAI::PlotOpportunisticSettlementMoves()
- CvHomelandUnit::CvHomelandUnit()
- CvHomelandUnit::SetID(int)
- CvHomelandUnit::SetTarget(CvPlot *)
- CvPlayer::getCapitalCity()
- CvPlayer::getUnit(int)
- CvPlayer::isMinorCiv() const
- CvPlot::getX() const
- CvPlot::getY() const
CvString::CvStringCvString::FormatCvString::GetCStringCvString::operator=- CvUnit::getDomainType() const
- CvUnit::GetID() const
- CvUnit::getUnitInfo() const
- CvUnit::getX() const
- CvUnit::getY() const
- CvUnit::isHuman() const
- CvUnit::isTrade() const
FObjectHandle::FObjectHandleFObjectHandle::operator boolFObjectHandle::operator->FObjectHandle::pointerFStaticVector::push_backstd::list::_Const_iterator::operator!=std::list::_Iterator::operator*std::list::_Iterator::operator++std::list::beginstd::list::end