Bazaar developer reference

CvTacticalAI::PlotCivilianAttackMoves(AITacticalTargetType)

Defined in
CvTacticalAI.cpp, line 2949
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_PlotCivilianAttackMoves

Hooks

static bool BeforeCvTacticalAI_PlotCivilianAttackMoves(CvTacticalAI* self, AITacticalTargetType eTargetType);static void AfterCvTacticalAI_PlotCivilianAttackMoves(CvTacticalAI* self, AITacticalTargetType eTargetType);static void ReplaceCvTacticalAI_PlotCivilianAttackMoves(void (*original)(CvTacticalAI*, AITacticalTargetType), CvTacticalAI* self, AITacticalTargetType eTargetType);CivRegisterBefore<CivHooks::CvTacticalAI_PlotCivilianAttackMoves>(host, &BeforeCvTacticalAI_PlotCivilianAttackMoves);CivRegisterAfter<CivHooks::CvTacticalAI_PlotCivilianAttackMoves>(host, &AfterCvTacticalAI_PlotCivilianAttackMoves);CivRegisterReplace<CivHooks::CvTacticalAI_PlotCivilianAttackMoves>(host, &ReplaceCvTacticalAI_PlotCivilianAttackMoves);

Code

2948/// Assigns units to capture undefended civilians2949void CvTacticalAI::PlotCivilianAttackMoves(AITacticalTargetType eTargetType)2950{2951	CvTacticalTarget* pTarget;2952	pTarget = GetFirstZoneTarget(eTargetType);2953	while(pTarget != NULL)2954	{2955		// See what units we have who can reach target this turn2956		CvPlot* pPlot = GC.getMap().plot(pTarget->GetTargetX(), pTarget->GetTargetY());2957		if(FindUnitsWithinStrikingDistance(pPlot, 1, 0, false /* bNoRangedUnits */, false /*bNavalOnly*/, false /*bMustMoveThrough*/, false /*bIncludeBlockedUnits*/, false /*bWillPillage*/, true /*bTargetUndefended*/))2958		{2959			// Queue best one up to capture it2960			ExecuteCivilianCapture(pPlot);29612962			if(GC.getLogging() && GC.getAILogging())2963			{2964				CvString strLogString;2965				switch(eTargetType)2966				{2967				case AI_TACTICAL_TARGET_VERY_HIGH_PRIORITY_CIVILIAN:2968					strLogString.Format("Attacking very high priority civilian, X: %d, Y: %d", pTarget->GetTargetX(),2969					                    pTarget->GetTargetY());2970					break;2971				case AI_TACTICAL_TARGET_HIGH_PRIORITY_CIVILIAN:2972					strLogString.Format("Attacking high priority civilian, X: %d, Y: %d", pTarget->GetTargetX(),2973					                    pTarget->GetTargetY());2974					break;2975				case AI_TACTICAL_TARGET_MEDIUM_PRIORITY_CIVILIAN:2976					strLogString.Format("Attacking medium priority civilian, X: %d, Y: %d", pTarget->GetTargetX(),2977					                    pTarget->GetTargetY());2978					break;2979				case AI_TACTICAL_TARGET_LOW_PRIORITY_CIVILIAN:2980					strLogString.Format("Attacking low priority civilian, X: %d, Y: %d", pTarget->GetTargetX(),2981					                    pTarget->GetTargetY());2982					break;2983				}2984				LogTacticalMessage(strLogString);2985			}2986		}2987		pTarget = GetNextZoneTarget();2988	}2989}

Calls

Called by