Bazaar developer reference

CvMinorCivAI::AddQuestCopyForPlayer(PlayerTypes, CvMinorCivQuest *)

Defined in
CvMinorCivAI.cpp, line 3780
Class
CvMinorCivAI
Hook name
CivHooks::CvMinorCivAI_AddQuestCopyForPlayer

Hooks

static bool BeforeCvMinorCivAI_AddQuestCopyForPlayer(CvMinorCivAI* self, PlayerTypes ePlayer, CvMinorCivQuest* pQuest);static void AfterCvMinorCivAI_AddQuestCopyForPlayer(CvMinorCivAI* self, PlayerTypes ePlayer, CvMinorCivQuest* pQuest);static void ReplaceCvMinorCivAI_AddQuestCopyForPlayer(void (*original)(CvMinorCivAI*, PlayerTypes, CvMinorCivQuest*), CvMinorCivAI* self, PlayerTypes ePlayer, CvMinorCivQuest* pQuest);CivRegisterBefore<CivHooks::CvMinorCivAI_AddQuestCopyForPlayer>(host, &BeforeCvMinorCivAI_AddQuestCopyForPlayer);CivRegisterAfter<CivHooks::CvMinorCivAI_AddQuestCopyForPlayer>(host, &AfterCvMinorCivAI_AddQuestCopyForPlayer);CivRegisterReplace<CivHooks::CvMinorCivAI_AddQuestCopyForPlayer>(host, &ReplaceCvMinorCivAI_AddQuestCopyForPlayer);

Code

3779/// Begin a quest that is already underway, copying over quest data3780void CvMinorCivAI::AddQuestCopyForPlayer(PlayerTypes ePlayer, CvMinorCivQuest* pQuest)3781{3782	CvAssertMsg(ePlayer >= 0, "ePlayer is expected to be non-negative (invalid Index)");3783	CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "ePlayer is expected to be within maximum bounds (invalid Index)");3784	if(ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return;37853786	CvAssertMsg(pQuest != NULL, "pQuest should not be NULL. Please send Anton your save file and version.");3787	if(pQuest == NULL) return;37883789	// ePlayer can only have at most one quest of each type3790	CvAssertMsg(!IsActiveQuestForPlayer(ePlayer, pQuest->GetType()), "ePlayer already has a quest of this type!");3791	if(IsActiveQuestForPlayer(ePlayer, pQuest->GetType())) return;37923793	CvMinorCivQuest newQuest(GetPlayer()->GetID(), ePlayer, pQuest->GetType());3794	newQuest.DoStartQuestUsingExistingData(pQuest);3795	m_QuestsGiven[ePlayer].push_back(newQuest);37963797	// Log quest received3798	GET_PLAYER(ePlayer).GetDiplomacyAI()->LogMinorCivQuestReceived(GetPlayer()->GetID(), GetEffectiveFriendshipWithMajorTimes100(ePlayer), GetEffectiveFriendshipWithMajorTimes100(ePlayer), pQuest->GetType());3799}

Calls

Called by