Hooks
static bool BeforeCvMinorCivAI_IsActiveQuestForPlayer(CvMinorCivAI* self, PlayerTypes ePlayer, MinorCivQuestTypes eType, bool& result);static void AfterCvMinorCivAI_IsActiveQuestForPlayer(CvMinorCivAI* self, PlayerTypes ePlayer, MinorCivQuestTypes eType, bool& result);static bool ReplaceCvMinorCivAI_IsActiveQuestForPlayer(bool (*original)(CvMinorCivAI*, PlayerTypes, MinorCivQuestTypes), CvMinorCivAI* self, PlayerTypes ePlayer, MinorCivQuestTypes eType);CivRegisterBefore<CivHooks::CvMinorCivAI_IsActiveQuestForPlayer>(host, &BeforeCvMinorCivAI_IsActiveQuestForPlayer);CivRegisterAfter<CivHooks::CvMinorCivAI_IsActiveQuestForPlayer>(host, &AfterCvMinorCivAI_IsActiveQuestForPlayer);CivRegisterReplace<CivHooks::CvMinorCivAI_IsActiveQuestForPlayer>(host, &ReplaceCvMinorCivAI_IsActiveQuestForPlayer);
Code
5075bool CvMinorCivAI::IsActiveQuestForPlayer(PlayerTypes ePlayer, MinorCivQuestTypes eType)5076{5077 CvAssertMsg(ePlayer >= 0, "ePlayer is expected to be non-negative (invalid Index)");5078 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "ePlayer is expected to be within maximum bounds (invalid Index)");5079 if(ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return false;50805081#if defined(MOD_EVENTS_QUESTS)5082 CvAssertMsg(eType >= NO_MINOR_CIV_QUEST_TYPE, "eType is expected to be non-negative (invalid Index)");5083 CvAssertMsg(eType < NUM_MINOR_CIV_QUEST_TYPES, "eType is expected to be within maximum bounds (invalid Index)");5084 if(eType < NO_MINOR_CIV_QUEST_TYPE || eType >= GC.getNumQuestInfos()) return false;5085#else5086 CvAssertMsg(eType >= NO_MINOR_CIV_QUEST_TYPE, "eType is expected to be non-negative (invalid Index)");5087 CvAssertMsg(eType < NUM_MINOR_CIV_QUEST_TYPES, "eType is expected to be within maximum bounds (invalid Index)");5088 if(eType < NO_MINOR_CIV_QUEST_TYPE || eType >= NUM_MINOR_CIV_QUEST_TYPES) return false;5089#endif50905091 for(uint iQuestLoop = 0; iQuestLoop < m_QuestsGiven[ePlayer].size(); iQuestLoop++)5092 {5093 if(m_QuestsGiven[ePlayer][iQuestLoop].GetType() == eType)5094 {5095 return true;5096 }5097 }50985099 return false;5100}