Bazaar developer reference

CvUnitPromotions::HasPromotion(PromotionTypes) const

Defined in
CvPromotionClasses.cpp, line 2228
Class
CvUnitPromotions
Hook name
CivHooks::CvUnitPromotions_HasPromotion

Hooks

static bool BeforeCvUnitPromotions_HasPromotion(const CvUnitPromotions* self, PromotionTypes eIndex, bool& result);static void AfterCvUnitPromotions_HasPromotion(const CvUnitPromotions* self, PromotionTypes eIndex, bool& result);static bool ReplaceCvUnitPromotions_HasPromotion(bool (*original)(const CvUnitPromotions*, PromotionTypes), const CvUnitPromotions* self, PromotionTypes eIndex);CivRegisterBefore<CivHooks::CvUnitPromotions_HasPromotion>(host, &BeforeCvUnitPromotions_HasPromotion);CivRegisterAfter<CivHooks::CvUnitPromotions_HasPromotion>(host, &AfterCvUnitPromotions_HasPromotion);CivRegisterReplace<CivHooks::CvUnitPromotions_HasPromotion>(host, &ReplaceCvUnitPromotions_HasPromotion);

Code

2227/// Accessor: Does the unit have a certain promotion2228bool CvUnitPromotions::HasPromotion(PromotionTypes eIndex) const2229{2230	CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");2231	CvAssertMsg(eIndex < GC.getNumPromotionInfos(), "eIndex is expected to be within maximum bounds (invalid Index)");22322233	if(eIndex >= 0 && eIndex < GC.getNumPromotionInfos())2234	{2235		return m_kHasPromotion.GetBit(eIndex);2236	}22372238	return false;2239}

Calls

Called by