Bazaar developer reference

CvTacticalAI::FindPosture(CvTacticalDominanceZone *)

Defined in
CvTacticalAI.cpp, line 1151
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_FindPosture

Hooks

static bool BeforeCvTacticalAI_FindPosture(CvTacticalAI* self, CvTacticalDominanceZone* pZone, AITacticalPosture& result);static void AfterCvTacticalAI_FindPosture(CvTacticalAI* self, CvTacticalDominanceZone* pZone, AITacticalPosture& result);static AITacticalPosture ReplaceCvTacticalAI_FindPosture(AITacticalPosture (*original)(CvTacticalAI*, CvTacticalDominanceZone*), CvTacticalAI* self, CvTacticalDominanceZone* pZone);CivRegisterBefore<CivHooks::CvTacticalAI_FindPosture>(host, &BeforeCvTacticalAI_FindPosture);CivRegisterAfter<CivHooks::CvTacticalAI_FindPosture>(host, &AfterCvTacticalAI_FindPosture);CivRegisterReplace<CivHooks::CvTacticalAI_FindPosture>(host, &ReplaceCvTacticalAI_FindPosture);

Code

1150/// Find last posture for a specific zone1151AITacticalPosture CvTacticalAI::FindPosture(CvTacticalDominanceZone* pZone)1152{1153	if(pZone != NULL)1154	{1155		for(unsigned int iI = 0; iI < m_Postures.size(); iI++)1156		{1157			if(m_Postures[iI].GetPlayer() == pZone->GetOwner() &&1158			        m_Postures[iI].IsWater() == pZone->IsWater())1159			{1160				int iCityID = -1;1161				if(pZone->GetClosestCity() != NULL)1162				{1163					iCityID = pZone->GetClosestCity()->GetID();1164				}1165				if(m_Postures[iI].GetCityID() == iCityID)1166				{1167					return m_Postures[iI].GetPosture();1168				}1169			}1170		}1171	}11721173	return AI_TACTICAL_POSTURE_NONE;1174}

Calls

Called by