Bazaar developer reference

CvTacticalAI::PlotBastionMoves(int)

Defined in
CvTacticalAI.cpp, line 3142
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_PlotBastionMoves

Hooks

static bool BeforeCvTacticalAI_PlotBastionMoves(CvTacticalAI* self, int iNumTurnsAway);static void AfterCvTacticalAI_PlotBastionMoves(CvTacticalAI* self, int iNumTurnsAway);static void ReplaceCvTacticalAI_PlotBastionMoves(void (*original)(CvTacticalAI*, int), CvTacticalAI* self, int iNumTurnsAway);CivRegisterBefore<CivHooks::CvTacticalAI_PlotBastionMoves>(host, &BeforeCvTacticalAI_PlotBastionMoves);CivRegisterAfter<CivHooks::CvTacticalAI_PlotBastionMoves>(host, &AfterCvTacticalAI_PlotBastionMoves);CivRegisterReplace<CivHooks::CvTacticalAI_PlotBastionMoves>(host, &ReplaceCvTacticalAI_PlotBastionMoves);

Code

3141/// Establish a defensive bastion adjacent to a city3142void CvTacticalAI::PlotBastionMoves(int iNumTurnsAway)3143{3144	CvTacticalTarget* pTarget;3145	pTarget = GetFirstZoneTarget(AI_TACTICAL_TARGET_DEFENSIVE_BASTION);3146	while(pTarget != NULL)3147	{3148		// Grab units that make sense for this move type3149		CvPlot* pPlot = GC.getMap().plot(pTarget->GetTargetX(), pTarget->GetTargetY());3150		FindUnitsForThisMove((TacticalAIMoveTypes)m_CachedInfoTypes[eTACTICAL_BASTION_ALREADY_THERE], pPlot, iNumTurnsAway);31513152		if(m_CurrentMoveHighPriorityUnits.size() + m_CurrentMoveUnits.size() > 0)3153		{3154			ExecuteMoveToTarget(pPlot);3155			if(GC.getLogging() && GC.getAILogging())3156			{3157				CvString strLogString;3158				strLogString.Format("Bastion, X: %d, Y: %d, Priority: %d, Turns Away: %d", pTarget->GetTargetX(), pTarget->GetTargetY(), pTarget->GetAuxIntData(), iNumTurnsAway);3159				LogTacticalMessage(strLogString);3160			}3161		}3162		pTarget = GetNextZoneTarget();3163	}3164}

Calls

Called by