CvPlayer::SetFaith(int)
- Defined in
- CvPlayer.cpp, line 11396
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_SetFaith
Hooks
static bool BeforeCvPlayer_SetFaith(CvPlayer* self, int iNewValue);static void AfterCvPlayer_SetFaith(CvPlayer* self, int iNewValue);static void ReplaceCvPlayer_SetFaith(void (*original)(CvPlayer*, int), CvPlayer* self, int iNewValue);CivRegisterBefore<CivHooks::CvPlayer_SetFaith>(host, &BeforeCvPlayer_SetFaith);CivRegisterAfter<CivHooks::CvPlayer_SetFaith>(host, &AfterCvPlayer_SetFaith);CivRegisterReplace<CivHooks::CvPlayer_SetFaith>(host, &ReplaceCvPlayer_SetFaith);
Code
11396void CvPlayer::SetFaith(int iNewValue)11397{11398 if(GC.getGame().isOption(GAMEOPTION_NO_RELIGION))11399 {11400 return;11401 }1140211403 if(GetFaith() != iNewValue)11404 {11405 // Add to the total we've ever had11406 if(iNewValue > m_iFaith)11407 {11408 ChangeFaithEverGenerated(iNewValue - m_iFaith);11409 }1141011411 m_iFaith = iNewValue;1141211413 if(GC.getGame().getActivePlayer() == GetID())11414 {11415 GC.GetEngineUserInterface()->setDirty(GameData_DIRTY_BIT, true);11416 }11417 }11418}