Bazaar developer reference

CvPlayerEspionage::BuildStealableTechList(PlayerTypes)

Defined in
CvEspionageClasses.cpp, line 2635
Class
CvPlayerEspionage
Hook name
CivHooks::CvPlayerEspionage_BuildStealableTechList

Hooks

static bool BeforeCvPlayerEspionage_BuildStealableTechList(CvPlayerEspionage* self, PlayerTypes ePlayer);static void AfterCvPlayerEspionage_BuildStealableTechList(CvPlayerEspionage* self, PlayerTypes ePlayer);static void ReplaceCvPlayerEspionage_BuildStealableTechList(void (*original)(CvPlayerEspionage*, PlayerTypes), CvPlayerEspionage* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvPlayerEspionage_BuildStealableTechList>(host, &BeforeCvPlayerEspionage_BuildStealableTechList);CivRegisterAfter<CivHooks::CvPlayerEspionage_BuildStealableTechList>(host, &AfterCvPlayerEspionage_BuildStealableTechList);CivRegisterReplace<CivHooks::CvPlayerEspionage_BuildStealableTechList>(host, &ReplaceCvPlayerEspionage_BuildStealableTechList);

Code

2634/// BuildStealableTechList - Go through opponents list and see what techs you can steal from them.2635void CvPlayerEspionage::BuildStealableTechList(PlayerTypes ePlayer)2636{2637	CvAssertMsg((uint)ePlayer < m_aaPlayerStealableTechList.size(), "ePlayer out of bounds");2638	if((uint)ePlayer >= m_aaPlayerStealableTechList.size())2639	{2640		return;2641	}26422643	m_aaPlayerStealableTechList[ePlayer].clear();26442645	if(!GET_PLAYER(ePlayer).isAlive())2646	{2647		return;2648	}26492650	int iMaxTechCost = -1;26512652	CvPlayerTechs* pMyPlayerTechs = m_pPlayer->GetPlayerTechs();2653	CvPlayerTechs* pOtherPlayerTechs = GET_PLAYER(ePlayer).GetPlayerTechs();2654	for(int iTechLoop = 0; iTechLoop < pOtherPlayerTechs->GetTechs()->GetNumTechs(); iTechLoop++)2655	{2656		TechTypes eTech = (TechTypes)iTechLoop;26572658		// Does the other player already have this tech?2659		if(!GET_TEAM(GET_PLAYER(ePlayer).getTeam()).GetTeamTechs()->HasTech(eTech))2660		{2661			continue;2662		}26632664		// can we not research this tech?2665		if(!pMyPlayerTechs->CanResearch(eTech))2666		{2667			continue;2668		}26692670		// add to list!2671		m_aaPlayerStealableTechList[ePlayer].push_back(eTech);26722673		// try to find the most expensive tech that can be researched2674		int iTechCost = m_pPlayer->GetPlayerTechs()->GetResearchCost(eTech) * 100;2675		if(iTechCost > iMaxTechCost)2676		{2677			iMaxTechCost = iTechCost;2678		}2679	}26802681	m_aiMaxTechCost[ePlayer] = iMaxTechCost;2682}

Calls

Called by