Bazaar developer reference

CvUnit::GetEmbarkedUnitDefense() const

Defined in
CvUnit.cpp, line 12706
Class
CvUnit
Hook name
CivHooks::CvUnit_GetEmbarkedUnitDefense

Hooks

static bool BeforeCvUnit_GetEmbarkedUnitDefense(const CvUnit* self, int& result);static void AfterCvUnit_GetEmbarkedUnitDefense(const CvUnit* self, int& result);static int ReplaceCvUnit_GetEmbarkedUnitDefense(int (*original)(const CvUnit*), const CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_GetEmbarkedUnitDefense>(host, &BeforeCvUnit_GetEmbarkedUnitDefense);CivRegisterAfter<CivHooks::CvUnit_GetEmbarkedUnitDefense>(host, &AfterCvUnit_GetEmbarkedUnitDefense);CivRegisterReplace<CivHooks::CvUnit_GetEmbarkedUnitDefense>(host, &ReplaceCvUnit_GetEmbarkedUnitDefense);

Code

12706int CvUnit::GetEmbarkedUnitDefense() const12707{12708	int iRtnValue;12709	int iModifier;12710#if defined(MOD_BUGFIX_USE_GETTERS)12711	CvPlayer& kPlayer = GET_MY_PLAYER();12712#else12713	CvPlayer& kPlayer = GET_PLAYER(m_eOwner);12714#endif12715	EraTypes eEra = kPlayer.GetCurrentEra();1271612717	iRtnValue = GC.getEraInfo(eEra)->getEmbarkedUnitDefense() * 100;1271812719	iModifier = GetEmbarkDefensiveModifier();12720	if(iModifier > 0)12721	{12722		iRtnValue = iRtnValue * (100 + iModifier);12723		iRtnValue /= 100;12724	}1272512726	return iRtnValue;12727}

Calls

Called by