Bazaar developer reference

CvPlayer::setHasPolicy(PolicyTypes, bool, bool)

Defined in
CvPlayer.cpp, line 13347
Class
CvPlayer
Hook name
CivHooks::CvPlayer_setHasPolicy

Hooks

static bool BeforeCvPlayer_setHasPolicy(CvPlayer* self, PolicyTypes eIndex, bool bNewValue, bool bFree);static void AfterCvPlayer_setHasPolicy(CvPlayer* self, PolicyTypes eIndex, bool bNewValue, bool bFree);static void ReplaceCvPlayer_setHasPolicy(void (*original)(CvPlayer*, PolicyTypes, bool, bool), CvPlayer* self, PolicyTypes eIndex, bool bNewValue, bool bFree);CivRegisterBefore<CivHooks::CvPlayer_setHasPolicy>(host, &BeforeCvPlayer_setHasPolicy);CivRegisterAfter<CivHooks::CvPlayer_setHasPolicy>(host, &AfterCvPlayer_setHasPolicy);CivRegisterReplace<CivHooks::CvPlayer_setHasPolicy>(host, &ReplaceCvPlayer_setHasPolicy);

Code

13346#if defined(MOD_API_EXTENSIONS)13347void CvPlayer::setHasPolicy(PolicyTypes eIndex, bool bNewValue, bool bFree)13348#else13349void CvPlayer::setHasPolicy(PolicyTypes eIndex, bool bNewValue)13350#endif13351{13352	CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");13353	CvAssertMsg(eIndex < GC.getNumPolicyInfos(), "eIndex is expected to be within maximum bounds (invalid Index)");13354	13355	if(m_pPlayerPolicies->HasPolicy(eIndex) != bNewValue)13356	{13357#if defined(MOD_API_EXTENSIONS)13358		m_pPlayerPolicies->SetPolicy(eIndex, bNewValue, bFree);13359#else13360		m_pPlayerPolicies->SetPolicy(eIndex, bNewValue);13361#endif13362		processPolicies(eIndex, bNewValue ? 1 : -1);13363	}13364}

Calls

Called by