Bazaar developer reference

CvUnitPromotions::SetPromotion(PromotionTypes, bool)

Defined in
CvPromotionClasses.cpp, line 2242
Class
CvUnitPromotions
Hook name
CivHooks::CvUnitPromotions_SetPromotion

Hooks

static bool BeforeCvUnitPromotions_SetPromotion(CvUnitPromotions* self, PromotionTypes eIndex, bool bValue);static void AfterCvUnitPromotions_SetPromotion(CvUnitPromotions* self, PromotionTypes eIndex, bool bValue);static void ReplaceCvUnitPromotions_SetPromotion(void (*original)(CvUnitPromotions*, PromotionTypes, bool), CvUnitPromotions* self, PromotionTypes eIndex, bool bValue);CivRegisterBefore<CivHooks::CvUnitPromotions_SetPromotion>(host, &BeforeCvUnitPromotions_SetPromotion);CivRegisterAfter<CivHooks::CvUnitPromotions_SetPromotion>(host, &AfterCvUnitPromotions_SetPromotion);CivRegisterReplace<CivHooks::CvUnitPromotions_SetPromotion>(host, &ReplaceCvUnitPromotions_SetPromotion);

Code

2241/// Sets the promotion to a certain value2242void CvUnitPromotions::SetPromotion(PromotionTypes eIndex, bool bValue)2243{2244	CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");2245	CvAssertMsg(eIndex < GC.getNumPromotionInfos(), "eIndex is expected to be within maximum bounds (invalid Index)");22462247	if(eIndex >= 0 && eIndex < GC.getNumPromotionInfos())2248	{2249		m_kHasPromotion.SetBit(eIndex, bValue);2250	}2251}

Calls

Called by