Bazaar developer reference

CvArmyAI::IsAllOceanGoing()

Defined in
CvArmyAI.cpp, line 477
Class
CvArmyAI
Hook name
CivHooks::CvArmyAI_IsAllOceanGoing

Hooks

static bool BeforeCvArmyAI_IsAllOceanGoing(CvArmyAI* self, bool& result);static void AfterCvArmyAI_IsAllOceanGoing(CvArmyAI* self, bool& result);static bool ReplaceCvArmyAI_IsAllOceanGoing(bool (*original)(CvArmyAI*), CvArmyAI* self);CivRegisterBefore<CivHooks::CvArmyAI_IsAllOceanGoing>(host, &BeforeCvArmyAI_IsAllOceanGoing);CivRegisterAfter<CivHooks::CvArmyAI_IsAllOceanGoing>(host, &AfterCvArmyAI_IsAllOceanGoing);CivRegisterReplace<CivHooks::CvArmyAI_IsAllOceanGoing>(host, &ReplaceCvArmyAI_IsAllOceanGoing);

Code

476/// Can all units in this army move on ocean?477bool CvArmyAI::IsAllOceanGoing()478{479	UnitHandle pUnit;480481	pUnit = GetFirstUnit();482	while(pUnit)483	{484		if(pUnit->getDomainType() != DOMAIN_SEA && !pUnit->IsHasEmbarkAbility())485		{486			return false;487		}488489		// If can move over ocean, not a coastal vessel490		if(pUnit->isTerrainImpassable(TERRAIN_OCEAN))491		{492			return false;493		}494495		pUnit = GetNextUnit();496	}497498	return true;499}

Calls

Called by