Bazaar developer reference

CvArmyAI::CanTacticalAIInterruptUnit(int) const

Defined in
CvArmyAI.cpp, line 712
Class
CvArmyAI
Hook name
CivHooks::CvArmyAI_CanTacticalAIInterruptUnit

Hooks

static bool BeforeCvArmyAI_CanTacticalAIInterruptUnit(const CvArmyAI* self, int arg0, bool& result);static void AfterCvArmyAI_CanTacticalAIInterruptUnit(const CvArmyAI* self, int arg0, bool& result);static bool ReplaceCvArmyAI_CanTacticalAIInterruptUnit(bool (*original)(const CvArmyAI*, int), const CvArmyAI* self, int arg0);CivRegisterBefore<CivHooks::CvArmyAI_CanTacticalAIInterruptUnit>(host, &BeforeCvArmyAI_CanTacticalAIInterruptUnit);CivRegisterAfter<CivHooks::CvArmyAI_CanTacticalAIInterruptUnit>(host, &AfterCvArmyAI_CanTacticalAIInterruptUnit);CivRegisterReplace<CivHooks::CvArmyAI_CanTacticalAIInterruptUnit>(host, &ReplaceCvArmyAI_CanTacticalAIInterruptUnit);

Code

711/// Is this part of an operation that allows units to be poached by tactical AI?712bool CvArmyAI::CanTacticalAIInterruptUnit(int /* iUnitId */) const713{714	// If the operation is still assembling, by all means interrupt it715	if(m_eAIState == ARMYAISTATE_WAITING_FOR_UNITS_TO_REINFORCE ||716	        m_eAIState == ARMYAISTATE_WAITING_FOR_UNITS_TO_CATCH_UP)717	{718		return true;719	}720721	if(m_eOwner >=0 && m_eOwner < MAX_PLAYERS)722	{723		CvAIOperation* op = GET_PLAYER(m_eOwner).getAIOperation(m_iOperationID);724		if(op)725		{726			return op->CanTacticalAIInterruptOperation();727		}728	}729	return false;730}

Calls

Called by