Bazaar developer reference

CvTechAI::RecommendNextTech(CvPlayer *, TechTypes)

Defined in
CvTechAI.cpp, line 208
Class
CvTechAI
Hook name
CivHooks::CvTechAI_RecommendNextTech

Hooks

static bool BeforeCvTechAI_RecommendNextTech(CvTechAI* self, CvPlayer * pPlayer, TechTypes eIgnoreTech, TechTypes& result);static void AfterCvTechAI_RecommendNextTech(CvTechAI* self, CvPlayer * pPlayer, TechTypes eIgnoreTech, TechTypes& result);static TechTypes ReplaceCvTechAI_RecommendNextTech(TechTypes (*original)(CvTechAI*, CvPlayer *, TechTypes), CvTechAI* self, CvPlayer * pPlayer, TechTypes eIgnoreTech);CivRegisterBefore<CivHooks::CvTechAI_RecommendNextTech>(host, &BeforeCvTechAI_RecommendNextTech);CivRegisterAfter<CivHooks::CvTechAI_RecommendNextTech>(host, &AfterCvTechAI_RecommendNextTech);CivRegisterReplace<CivHooks::CvTechAI_RecommendNextTech>(host, &ReplaceCvTechAI_RecommendNextTech);

Code

207/// Choose a player's next tech research project208TechTypes CvTechAI::RecommendNextTech(CvPlayer *pPlayer, TechTypes eIgnoreTech /* = NO_TECH */)209{210	TechTypes rtnValue = NO_TECH;211	int iTechLoop;212213	// Create a new vector holding only techs we can currently research214	m_ResearchableTechs.clear();215216	// Loop through adding the researchable techs217	for(iTechLoop = 0; iTechLoop < m_pCurrentTechs->GetTechs()->GetNumTechs(); iTechLoop++)218	{219		//if (m_pCurrentTechs->CanResearch((TechTypes) iTechLoop) &&220		//	iTechLoop != eIgnoreTech &&221		//	m_pCurrentTechs->GetTechs()->GetEntry(iTechLoop)->GetAdvisorType() != eIgnoreAdvisor)222		if(m_pCurrentTechs->CanResearch((TechTypes) iTechLoop) && iTechLoop != eIgnoreTech)223		{224			m_ResearchableTechs.push_back(iTechLoop, m_TechAIWeights.GetWeight(iTechLoop));225		}226	}227228	ReweightByCost(pPlayer);229	m_ResearchableTechs.SortItems();230	LogPossibleResearch();231232	// If total weight is above 0, choose top choice as recommendation233	if(m_ResearchableTechs.GetTotalWeight() > 0)234	{235236		rtnValue = (TechTypes) m_ResearchableTechs.GetElement(0);237		LogResearchChoice(rtnValue);238	}239240	return rtnValue;241}

Calls