Bazaar developer reference

CvTacticalAI::GetBestPlot(CvPlot *&, vector<CvPlot *>)

Defined in
CvTacticalAI.cpp, line 8877
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_GetBestPlot

Hooks

static bool BeforeCvTacticalAI_GetBestPlot(CvTacticalAI* self, CvPlot*& outputPlot, vector<CvPlot*> plotsToCheck);static void AfterCvTacticalAI_GetBestPlot(CvTacticalAI* self, CvPlot*& outputPlot, vector<CvPlot*> plotsToCheck);static void ReplaceCvTacticalAI_GetBestPlot(void (*original)(CvTacticalAI*, CvPlot*&, vector<CvPlot*>), CvTacticalAI* self, CvPlot*& outputPlot, vector<CvPlot*> plotsToCheck);CivRegisterBefore<CivHooks::CvTacticalAI_GetBestPlot>(host, &BeforeCvTacticalAI_GetBestPlot);CivRegisterAfter<CivHooks::CvTacticalAI_GetBestPlot>(host, &AfterCvTacticalAI_GetBestPlot);CivRegisterReplace<CivHooks::CvTacticalAI_GetBestPlot>(host, &ReplaceCvTacticalAI_GetBestPlot);

Code

8876//AMS: Iterate through available plots and get the best one to later move at.8877void CvTacticalAI::GetBestPlot(CvPlot*& outputPlot, vector<CvPlot*> plotsToCheck)8878{8879	int minDanger = 0;8880	std::vector<CvPlot*>::iterator it;88818882	for (it = plotsToCheck.begin(); it != plotsToCheck.end(); it++)8883	{8884		CvPlot* pPlot = (*it);8885		int currentDanger = m_pPlayer->GetPlotDanger(*pPlot);88868887		if (minDanger == 0 || (currentDanger < minDanger))8888		{8889			outputPlot = pPlot;8890			minDanger = currentDanger;8891		}8892	}8893}

Calls

Called by