CvAIOperation::BuildListOfUnitsWeStillNeedToBuild()
- Defined in
- CvAIOperation.cpp, line 330
- Class
- CvAIOperation
- Hook name
CivHooks::CvAIOperation_BuildListOfUnitsWeStillNeedToBuild
Hooks
static bool BeforeCvAIOperation_BuildListOfUnitsWeStillNeedToBuild(CvAIOperation* self);static void AfterCvAIOperation_BuildListOfUnitsWeStillNeedToBuild(CvAIOperation* self);static void ReplaceCvAIOperation_BuildListOfUnitsWeStillNeedToBuild(void (*original)(CvAIOperation*), CvAIOperation* self);CivRegisterBefore<CivHooks::CvAIOperation_BuildListOfUnitsWeStillNeedToBuild>(host, &BeforeCvAIOperation_BuildListOfUnitsWeStillNeedToBuild);CivRegisterAfter<CivHooks::CvAIOperation_BuildListOfUnitsWeStillNeedToBuild>(host, &AfterCvAIOperation_BuildListOfUnitsWeStillNeedToBuild);CivRegisterReplace<CivHooks::CvAIOperation_BuildListOfUnitsWeStillNeedToBuild>(host, &ReplaceCvAIOperation_BuildListOfUnitsWeStillNeedToBuild);
Code
329/// Compile a list of all the units we need330void CvAIOperation::BuildListOfUnitsWeStillNeedToBuild()331{332 m_viListOfUnitsCitiesHaveCommittedToBuild.clear();333 m_viListOfUnitsWeStillNeedToBuild.clear();334 CvPlayer& thisPlayer = GET_PLAYER(m_eOwner);335 for(unsigned int uiI = 0; uiI < m_viArmyIDs.size(); uiI++)336 {337 CvArmyAI* pThisArmy = thisPlayer.getArmyAI(m_viArmyIDs[uiI]);338 // if it is still waiting on initial units339 if(pThisArmy)340 {341 if(pThisArmy->GetArmyAIState() == ARMYAISTATE_WAITING_FOR_UNITS_TO_REINFORCE)342 {343 int iThisFormationIndex = pThisArmy->GetFormationIndex();344 if(iThisFormationIndex != NO_MUFORMATION)345 {346 CvMultiUnitFormationInfo* thisFormation = GC.getMultiUnitFormationInfo(iThisFormationIndex);347 if(thisFormation)348 {349 for(int iThisSlotIndex = 0; iThisSlotIndex < thisFormation->getNumFormationSlotEntries(); iThisSlotIndex++)350 {351 OperationSlot thisOperationSlot;352 thisOperationSlot.m_iOperationID = m_iID;353 thisOperationSlot.m_iArmyID = m_viArmyIDs[uiI];354 thisOperationSlot.m_iSlotID = iThisSlotIndex;355 m_viListOfUnitsWeStillNeedToBuild.push_back(thisOperationSlot);356 }357 }358 }359 else360 {361 // punt -- sub-class should be taking care of this362 CvAssertMsg(false,"A sub-class should have dealt with this");363 }364 }365 }366 }367}
Calls
- CvArmyAI::GetArmyAIState() const
- CvArmyAI::GetFormationIndex() const
- CvGlobals::getMultiUnitFormationInfo(int)
- CvMultiUnitFormationInfo::getNumFormationSlotEntries() const
- CvPlayer::getArmyAI(int)
- CvPlayerAI::getPlayer(PlayerTypes)
- OperationSlot::OperationSlot()
std::vector::clearstd::vector::operator[]std::vector::push_backstd::vector::size
Called by
- CvAIEnemyTerritoryOperation::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)
- CvAINavalEscortedOperation::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)
- CvAIOperation::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)
- CvAIOperationBasicCityAttack::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)
- CvAIOperationCityCloseDefense::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)
- CvAIOperationNavalAttack::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)
- CvAIOperationNavalBombardment::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)
- CvAIOperationNavalSuperiority::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)
- CvAIOperationNukeAttack::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)
- CvAIOperationPureNavalCityAttack::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)
- CvAIOperationRapidResponse::Init(int, PlayerTypes, PlayerTypes, int, CvCity *, CvCity *)