Bazaar developer reference

CvAIOperation::ShouldAbort()

Defined in
CvAIOperation.cpp, line 797
Class
CvAIOperation
Hook name
CivHooks::CvAIOperation_ShouldAbort
Overridden by
CvAIOperationBasicCityAttack::ShouldAbort(), CvAIOperationDestroyBarbarianCamp::ShouldAbort(), CvAIOperationFoundCity::ShouldAbort(), CvAIOperationPureNavalCityAttack::ShouldAbort()

Hooks

static bool BeforeCvAIOperation_ShouldAbort(CvAIOperation* self, bool& result);static void AfterCvAIOperation_ShouldAbort(CvAIOperation* self, bool& result);static bool ReplaceCvAIOperation_ShouldAbort(bool (*original)(CvAIOperation*), CvAIOperation* self);CivRegisterBefore<CivHooks::CvAIOperation_ShouldAbort>(host, &BeforeCvAIOperation_ShouldAbort);CivRegisterAfter<CivHooks::CvAIOperation_ShouldAbort>(host, &AfterCvAIOperation_ShouldAbort);CivRegisterReplace<CivHooks::CvAIOperation_ShouldAbort>(host, &ReplaceCvAIOperation_ShouldAbort);

Code

796/// Returns true when we should abort the operation totally (besides when we have lost all units in it)797bool CvAIOperation::ShouldAbort()798{799	UnitHandle pUnit;800801	// Mark units in successful operation802	if(m_eCurrentState == AI_OPERATION_STATE_SUCCESSFUL_FINISH)803	{804		for(unsigned int uiI = 0; uiI < m_viArmyIDs.size(); uiI++)805		{806			CvArmyAI* pArmy = GET_PLAYER(m_eOwner).getArmyAI(m_viArmyIDs[uiI]);807808			pUnit = pArmy->GetFirstUnit();809			while(pUnit)810			{811				pUnit->SetDeployFromOperationTurn(GC.getGame().getGameTurn());812				pUnit = pArmy->GetNextUnit();813			}814		}815	}816817	return (m_eCurrentState == AI_OPERATION_STATE_ABORTED || m_eCurrentState == AI_OPERATION_STATE_SUCCESSFUL_FINISH);818}

Calls

Called by