Bazaar developer reference

CounselSort(const CvAdvisorCounsel::Counsel, const CvAdvisorCounsel::Counsel)

Defined in
CvAdvisorCounsel.cpp, line 52
Hook name
CivHooks::CounselSort

Hooks

static bool BeforeCounselSort(const CvAdvisorCounsel::Counsel Counsel1, const CvAdvisorCounsel::Counsel Counsel2, bool& result);static void AfterCounselSort(const CvAdvisorCounsel::Counsel Counsel1, const CvAdvisorCounsel::Counsel Counsel2, bool& result);static bool ReplaceCounselSort(bool (*original)(const CvAdvisorCounsel::Counsel, const CvAdvisorCounsel::Counsel), const CvAdvisorCounsel::Counsel Counsel1, const CvAdvisorCounsel::Counsel Counsel2);CivRegisterBefore<CivHooks::CounselSort>(host, &BeforeCounselSort);CivRegisterAfter<CivHooks::CounselSort>(host, &AfterCounselSort);CivRegisterReplace<CivHooks::CounselSort>(host, &ReplaceCounselSort);

Code

52bool CounselSort(const CvAdvisorCounsel::Counsel Counsel1, const CvAdvisorCounsel::Counsel Counsel2)53{54	// if the advisors are different types55	if(Counsel1.m_eAdvisor != Counsel2.m_eAdvisor)56	{57		// adjust the advisor values so that empty values will be moved to the end of the list58		AdvisorTypes eCounselAdvisor1 = Counsel1.m_eAdvisor;59		AdvisorTypes eCounselAdvisor2 = Counsel2.m_eAdvisor;60		if(eCounselAdvisor1 == NO_ADVISOR_TYPE)61		{62			eCounselAdvisor1 = NUM_ADVISOR_TYPES;63		}6465		if(eCounselAdvisor2 == NO_ADVISOR_TYPE)66		{67			eCounselAdvisor2 = NUM_ADVISOR_TYPES;68		}6970		return eCounselAdvisor1 < eCounselAdvisor2;71	}7273	return Counsel1.m_iValue > Counsel2.m_iValue;74}

Called by