Hooks
static bool BeforeCvMinorCivAI_IsDisplayedQuestForPlayer(CvMinorCivAI* self, PlayerTypes ePlayer, MinorCivQuestTypes eType, bool& result);static void AfterCvMinorCivAI_IsDisplayedQuestForPlayer(CvMinorCivAI* self, PlayerTypes ePlayer, MinorCivQuestTypes eType, bool& result);static bool ReplaceCvMinorCivAI_IsDisplayedQuestForPlayer(bool (*original)(CvMinorCivAI*, PlayerTypes, MinorCivQuestTypes), CvMinorCivAI* self, PlayerTypes ePlayer, MinorCivQuestTypes eType);CivRegisterBefore<CivHooks::CvMinorCivAI_IsDisplayedQuestForPlayer>(host, &BeforeCvMinorCivAI_IsDisplayedQuestForPlayer);CivRegisterAfter<CivHooks::CvMinorCivAI_IsDisplayedQuestForPlayer>(host, &AfterCvMinorCivAI_IsDisplayedQuestForPlayer);CivRegisterReplace<CivHooks::CvMinorCivAI_IsDisplayedQuestForPlayer>(host, &ReplaceCvMinorCivAI_IsDisplayedQuestForPlayer);
Code
5133bool CvMinorCivAI::IsDisplayedQuestForPlayer(PlayerTypes ePlayer, MinorCivQuestTypes eType)5134{5135 CvAssertMsg(ePlayer >= 0, "ePlayer is expected to be non-negative (invalid Index)");5136 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "ePlayer is expected to be within maximum bounds (invalid Index)");5137 if(ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return false;51385139#if defined(MOD_EVENTS_QUESTS)5140 CvAssertMsg(eType >= NO_MINOR_CIV_QUEST_TYPE, "eType is expected to be non-negative (invalid Index)");5141 CvAssertMsg(eType < NUM_MINOR_CIV_QUEST_TYPES, "eType is expected to be within maximum bounds (invalid Index)");5142 if(eType < NO_MINOR_CIV_QUEST_TYPE || eType >= GC.getNumQuestInfos()) return false;5143#else5144 CvAssertMsg(eType >= NO_MINOR_CIV_QUEST_TYPE, "eType is expected to be non-negative (invalid Index)");5145 CvAssertMsg(eType < NUM_MINOR_CIV_QUEST_TYPES, "eType is expected to be within maximum bounds (invalid Index)");5146 if(eType < NO_MINOR_CIV_QUEST_TYPE || eType >= NUM_MINOR_CIV_QUEST_TYPES) return false;5147#endif51485149 for(uint iQuestLoop = 0; iQuestLoop < m_QuestsGiven[ePlayer].size(); iQuestLoop++)5150 {5151 if(m_QuestsGiven[ePlayer][iQuestLoop].GetType() == eType)5152 {5153 if(!m_QuestsGiven[ePlayer][iQuestLoop].IsHandled())5154 {5155 return true;5156 }5157 }5158 }51595160 return false;5161}