Bazaar developer reference

CvTacticalAI::UseThisDominanceZone(CvTacticalDominanceZone *)

Defined in
CvTacticalAI.cpp, line 11558
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_UseThisDominanceZone

Hooks

static bool BeforeCvTacticalAI_UseThisDominanceZone(CvTacticalAI* self, CvTacticalDominanceZone* pZone, bool& result);static void AfterCvTacticalAI_UseThisDominanceZone(CvTacticalAI* self, CvTacticalDominanceZone* pZone, bool& result);static bool ReplaceCvTacticalAI_UseThisDominanceZone(bool (*original)(CvTacticalAI*, CvTacticalDominanceZone*), CvTacticalAI* self, CvTacticalDominanceZone* pZone);CivRegisterBefore<CivHooks::CvTacticalAI_UseThisDominanceZone>(host, &BeforeCvTacticalAI_UseThisDominanceZone);CivRegisterAfter<CivHooks::CvTacticalAI_UseThisDominanceZone>(host, &AfterCvTacticalAI_UseThisDominanceZone);CivRegisterReplace<CivHooks::CvTacticalAI_UseThisDominanceZone>(host, &ReplaceCvTacticalAI_UseThisDominanceZone);

Code

11557/// Do we want to process moves for this dominance zone?11558bool CvTacticalAI::UseThisDominanceZone(CvTacticalDominanceZone* pZone)11559{11560	bool bIsOurCapital = false;11561	bool bTempZone = false;11562	int iCityID = -1;11563	if(pZone->GetClosestCity() != NULL)11564	{11565		iCityID = pZone->GetClosestCity()->GetID();11566		bIsOurCapital = (pZone->GetClosestCity() == m_pPlayer->getCapitalCity());11567		bTempZone = IsTemporaryZoneCity(pZone->GetClosestCity());11568	}11569	bool bWeHaveUnitsNearEnemy = pZone->GetFriendlyUnitCount() > 0 && pZone->GetTerritoryType() == TACTICAL_TERRITORY_ENEMY;11570	bool bTheyHaveUnitsNearUs = pZone->GetDominanceFlag() != TACTICAL_DOMINANCE_NO_UNITS_VISIBLE && pZone->GetTerritoryType() == TACTICAL_TERRITORY_FRIENDLY;11571	bool bBothHaveUnits = pZone->GetFriendlyUnitCount() > 0 && pZone->GetEnemyUnitCount() > 0;1157211573	return (bTempZone || bIsOurCapital || bWeHaveUnitsNearEnemy || bTheyHaveUnitsNearUs || bBothHaveUnits);11574}

Calls

Called by