CvMinorCivAI::GetNumUnitsGifted(PlayerTypes)
- Defined in
- CvMinorCivAI.cpp, line 9844
- Class
- CvMinorCivAI
- Hook name
CivHooks::CvMinorCivAI_GetNumUnitsGifted
Hooks
static bool BeforeCvMinorCivAI_GetNumUnitsGifted(CvMinorCivAI* self, PlayerTypes ePlayer, int& result);static void AfterCvMinorCivAI_GetNumUnitsGifted(CvMinorCivAI* self, PlayerTypes ePlayer, int& result);static int ReplaceCvMinorCivAI_GetNumUnitsGifted(int (*original)(CvMinorCivAI*, PlayerTypes), CvMinorCivAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvMinorCivAI_GetNumUnitsGifted>(host, &BeforeCvMinorCivAI_GetNumUnitsGifted);CivRegisterAfter<CivHooks::CvMinorCivAI_GetNumUnitsGifted>(host, &AfterCvMinorCivAI_GetNumUnitsGifted);CivRegisterReplace<CivHooks::CvMinorCivAI_GetNumUnitsGifted>(host, &ReplaceCvMinorCivAI_GetNumUnitsGifted);
Code
9843// How many units has ePlayer gifted this minor? (used to prevent unit spam for influence exploits)9844int CvMinorCivAI::GetNumUnitsGifted(PlayerTypes ePlayer)9845{9846 CvAssertMsg(ePlayer >= 0, "ePlayer is expected to be non-negative (invalid Index)");9847 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "ePlayer is expected to be within maximum bounds (invalid Index)");9848 if(ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return -1; // as defined during Reset()98499850 return m_aiNumUnitsGifted[ePlayer];9851}