Bazaar developer reference

CvUnit::setMoves(int)

Defined in
CvUnit.cpp, line 16904
Class
CvUnit
Hook name
CivHooks::CvUnit_setMoves

Hooks

static bool BeforeCvUnit_setMoves(CvUnit* self, int iNewValue);static void AfterCvUnit_setMoves(CvUnit* self, int iNewValue);static void ReplaceCvUnit_setMoves(void (*original)(CvUnit*, int), CvUnit* self, int iNewValue);CivRegisterBefore<CivHooks::CvUnit_setMoves>(host, &BeforeCvUnit_setMoves);CivRegisterAfter<CivHooks::CvUnit_setMoves>(host, &AfterCvUnit_setMoves);CivRegisterReplace<CivHooks::CvUnit_setMoves>(host, &ReplaceCvUnit_setMoves);

Code

16904void CvUnit::setMoves(int iNewValue)16905{16906	VALIDATE_OBJECT16907	if(getMoves() != iNewValue)16908	{16909		CvPlot* pPlot = plot();1691016911		m_iMoves = iNewValue;1691216913		auto_ptr<ICvUnit1> pDllUnit(new CvDllUnit(this));16914		gDLL->GameplayUnitShouldDimFlag(pDllUnit.get(), /*bDim*/ getMoves() <= 0);1691516916		if(IsSelected())16917		{16918			GC.getPathFinder().ForceReset();16919			DLLUI->setDirty(UnitInfo_DIRTY_BIT, true);16920		}1692116922		auto_ptr<ICvPlot1> pDllSelectionPlot(DLLUI->getSelectionPlot());16923		int iSelectionPlotIndex = (pDllSelectionPlot.get() != NULL)? pDllSelectionPlot->GetPlotIndex() : -1;1692416925		if(pPlot->GetPlotIndex() == iSelectionPlotIndex)16926		{16927			DLLUI->setDirty(PlotListButtons_DIRTY_BIT, true);16928		}16929	}16930}

Calls

Called by