Bazaar developer reference

CvEconomicAI::GetUnitTargetGoodyPlot(CvUnit *, CvPlot **)

Defined in
CvEconomicAI.cpp, line 972
Class
CvEconomicAI
Hook name
CivHooks::CvEconomicAI_GetUnitTargetGoodyPlot

Hooks

static bool BeforeCvEconomicAI_GetUnitTargetGoodyPlot(CvEconomicAI* self, CvUnit* pUnit, CvPlot** ppkStepPlot, CvPlot*& result);static void AfterCvEconomicAI_GetUnitTargetGoodyPlot(CvEconomicAI* self, CvUnit* pUnit, CvPlot** ppkStepPlot, CvPlot*& result);static CvPlot* ReplaceCvEconomicAI_GetUnitTargetGoodyPlot(CvPlot* (*original)(CvEconomicAI*, CvUnit*, CvPlot**), CvEconomicAI* self, CvUnit* pUnit, CvPlot** ppkStepPlot);CivRegisterBefore<CivHooks::CvEconomicAI_GetUnitTargetGoodyPlot>(host, &BeforeCvEconomicAI_GetUnitTargetGoodyPlot);CivRegisterAfter<CivHooks::CvEconomicAI_GetUnitTargetGoodyPlot>(host, &AfterCvEconomicAI_GetUnitTargetGoodyPlot);CivRegisterReplace<CivHooks::CvEconomicAI_GetUnitTargetGoodyPlot>(host, &ReplaceCvEconomicAI_GetUnitTargetGoodyPlot);

Code

972CvPlot* CvEconomicAI::GetUnitTargetGoodyPlot(CvUnit* pUnit, CvPlot** ppkStepPlot /*= NULL */)973{974	if(m_bExplorationPlotsDirty)975	{976		UpdatePlots();977	}978979	int iUnitID = pUnit->GetID();980	for(uint ui = 0; ui < m_aiGoodyHutUnitAssignments.size(); ui++)981	{982		if(iUnitID == m_aiGoodyHutUnitAssignments[ui].m_iUnitID)983		{984			if (ppkStepPlot)985			{986				int iStepPlotID = m_aiGoodyHutUnitAssignments[ui].m_iStepPlotID;987				*ppkStepPlot = (iStepPlotID != -1)?GC.getMap().plotByIndex(iStepPlotID):NULL;988			}989			return GC.getMap().plotByIndex(m_aiGoodyHutPlots[ui]);990		}991	}992993	return NULL;994}

Calls

Called by