Bazaar developer reference

CvUnit::clearCombat()

Defined in
CvUnit.cpp, line 19906
Class
CvUnit
Hook name
CivHooks::CvUnit_clearCombat

Hooks

static bool BeforeCvUnit_clearCombat(CvUnit* self);static void AfterCvUnit_clearCombat(CvUnit* self);static void ReplaceCvUnit_clearCombat(void (*original)(CvUnit*), CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_clearCombat>(host, &BeforeCvUnit_clearCombat);CivRegisterAfter<CivHooks::CvUnit_clearCombat>(host, &AfterCvUnit_clearCombat);CivRegisterReplace<CivHooks::CvUnit_clearCombat>(host, &ReplaceCvUnit_clearCombat);

Code

19906void CvUnit::clearCombat()19907{19908	VALIDATE_OBJECT19909	if(isCombatFocus())19910	{19911		DLLUI->setCombatFocus(false);19912	}1991319914	m_bCombatFocus = false;19915	if(getCombatUnit() != NULL || getCombatCity() != NULL)19916	{19917		CvAssertMsg(plot()->isUnitFighting(), "plot()->isUnitFighting is expected to be true");19918		m_combatCity.reset();19919		m_combatUnit.reset();19920		setCombatFirstStrikes(0);1992119922		if(IsSelected())19923		{19924			DLLUI->setDirty(UnitInfo_DIRTY_BIT, true);19925		}1992619927		auto_ptr<ICvPlot1> pDllSelectionPlot(DLLUI->getSelectionPlot());19928		int iSelectionPlotIndex = (pDllSelectionPlot.get() != NULL)? pDllSelectionPlot->GetPlotIndex() : -1;19929		if(plot()->GetPlotIndex() == iSelectionPlotIndex)19930		{19931			DLLUI->setDirty(PlotListButtons_DIRTY_BIT, true);19932		}19933	}19934}

Calls

Called by