CvAIOperation::FinishedBuilding(OperationSlot)
- Defined in
- CvAIOperation.cpp, line 419
- Class
- CvAIOperation
- Hook name
CivHooks::CvAIOperation_FinishedBuilding
Hooks
static bool BeforeCvAIOperation_FinishedBuilding(CvAIOperation* self, OperationSlot thisOperationSlot, bool& result);static void AfterCvAIOperation_FinishedBuilding(CvAIOperation* self, OperationSlot thisOperationSlot, bool& result);static bool ReplaceCvAIOperation_FinishedBuilding(bool (*original)(CvAIOperation*, OperationSlot), CvAIOperation* self, OperationSlot thisOperationSlot);CivRegisterBefore<CivHooks::CvAIOperation_FinishedBuilding>(host, &BeforeCvAIOperation_FinishedBuilding);CivRegisterAfter<CivHooks::CvAIOperation_FinishedBuilding>(host, &AfterCvAIOperation_FinishedBuilding);CivRegisterReplace<CivHooks::CvAIOperation_FinishedBuilding>(host, &ReplaceCvAIOperation_FinishedBuilding);
Code
418/// Called by a city after a unit is done training419bool CvAIOperation::FinishedBuilding(OperationSlot thisOperationSlot)420{421 // find the operation in the list of committed units422 std::vector<OperationSlot>::iterator iter = find(m_viListOfUnitsCitiesHaveCommittedToBuild.begin(),m_viListOfUnitsCitiesHaveCommittedToBuild.end(),thisOperationSlot);423 // if we found it424 if(iter != m_viListOfUnitsCitiesHaveCommittedToBuild.end())425 {426 // remove it from the list of committed units427 m_viListOfUnitsCitiesHaveCommittedToBuild.erase(iter);428429 // See if our army is now complete430 if(m_viListOfUnitsWeStillNeedToBuild.empty() && m_eCurrentState == AI_OPERATION_STATE_RECRUITING_UNITS)431 {432 m_eCurrentState = AI_OPERATION_STATE_GATHERING_FORCES;433434 for(unsigned int uiI = 0; uiI < m_viArmyIDs.size(); uiI++)435 {436 CvArmyAI* pThisArmy = GET_PLAYER(m_eOwner).getArmyAI(m_viArmyIDs[uiI]);437 if(pThisArmy)438 {439 pThisArmy->SetArmyAIState(ARMYAISTATE_WAITING_FOR_UNITS_TO_CATCH_UP);440 }441 }442 }443 return true;444 }445 return false;446}
Calls
- CvArmyAI::SetArmyAIState(ArmyAIState)
- CvPlayer::getArmyAI(int)
- CvPlayerAI::getPlayer(PlayerTypes)
std::_Vector_const_iterator::_Vector_const_iteratorstd::_Vector_const_iterator::operator!=std::findstd::vector::beginstd::vector::emptystd::vector::endstd::vector::erasestd::vector::operator[]std::vector::size