Bazaar developer reference

CvTacticalAI::GetBestRepositionPlot(UnitHandle, CvPlot *)

Defined in
CvTacticalAI.cpp, line 8896
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_GetBestRepositionPlot

Hooks

static bool BeforeCvTacticalAI_GetBestRepositionPlot(CvTacticalAI* self, UnitHandle unitH, CvPlot* plotTarget, CvPlot*& result);static void AfterCvTacticalAI_GetBestRepositionPlot(CvTacticalAI* self, UnitHandle unitH, CvPlot* plotTarget, CvPlot*& result);static CvPlot* ReplaceCvTacticalAI_GetBestRepositionPlot(CvPlot* (*original)(CvTacticalAI*, UnitHandle, CvPlot*), CvTacticalAI* self, UnitHandle unitH, CvPlot* plotTarget);CivRegisterBefore<CivHooks::CvTacticalAI_GetBestRepositionPlot>(host, &BeforeCvTacticalAI_GetBestRepositionPlot);CivRegisterAfter<CivHooks::CvTacticalAI_GetBestRepositionPlot>(host, &AfterCvTacticalAI_GetBestRepositionPlot);CivRegisterReplace<CivHooks::CvTacticalAI_GetBestRepositionPlot>(host, &ReplaceCvTacticalAI_GetBestRepositionPlot);

Code

8895//AMS: Get best plot of the array of possible plots, based on plot danger.8896CvPlot* CvTacticalAI::GetBestRepositionPlot(UnitHandle unitH, CvPlot* plotTarget)8897{8898	CvPlot* pBestRepositionPlot = NULL;8899	std::vector<CvPlot*> movePlotList;8900	unitH -> GetMovablePlotListOpt(movePlotList, plotTarget, false);89018902	if(movePlotList.size() >= 1)8903	{8904		if(GC.getLogging() && GC.getAILogging())8905		{8906			CvString strMsg;8907			strMsg.Format("Ranged unit out of range to target has found %d, alternate tiles to move and fire", movePlotList.size());8908			LogTacticalMessage(strMsg);8909		}89108911		GetBestPlot(pBestRepositionPlot, movePlotList);8912	}89138914	return pBestRepositionPlot;8915}

Calls

Called by