Bazaar developer reference

CvUnit::SetFortifiedThisTurn(bool)

Defined in
CvUnit.cpp, line 17607
Class
CvUnit
Hook name
CivHooks::CvUnit_SetFortifiedThisTurn

Hooks

static bool BeforeCvUnit_SetFortifiedThisTurn(CvUnit* self, bool bValue);static void AfterCvUnit_SetFortifiedThisTurn(CvUnit* self, bool bValue);static void ReplaceCvUnit_SetFortifiedThisTurn(void (*original)(CvUnit*, bool), CvUnit* self, bool bValue);CivRegisterBefore<CivHooks::CvUnit_SetFortifiedThisTurn>(host, &BeforeCvUnit_SetFortifiedThisTurn);CivRegisterAfter<CivHooks::CvUnit_SetFortifiedThisTurn>(host, &AfterCvUnit_SetFortifiedThisTurn);CivRegisterReplace<CivHooks::CvUnit_SetFortifiedThisTurn>(host, &ReplaceCvUnit_SetFortifiedThisTurn);

Code

17607void CvUnit::SetFortifiedThisTurn(bool bValue)17608{17609	VALIDATE_OBJECT17610	if(!IsEverFortifyable() && bValue)17611	{17612		return;17613	}1761417615	if(IsFortifiedThisTurn() != bValue)17616	{17617		m_bFortifiedThisTurn = bValue;1761817619		if(bValue)17620		{17621			int iTurnsToFortify = 1;17622			if(!isFortifyable())17623			{17624				iTurnsToFortify = 0;17625			}1762617627			// Manually set us to being fortified for the first turn (so we get the Fort bonus immediately)17628			setFortifyTurns(iTurnsToFortify);1762917630			if(iTurnsToFortify > 0)17631			{17632				auto_ptr<ICvUnit1> pDllUnit(new CvDllUnit(this));17633				gDLL->GameplayUnitFortify(pDllUnit.get(), true);17634			}17635		}17636	}17637}

Calls

Called by