Bazaar developer reference

CvPlayerTechs::GetResearchTurnsLeft(TechTypes, bool) const

Defined in
CvTechClasses.cpp, line 1411
Class
CvPlayerTechs
Hook name
CivHooks::CvPlayerTechs_GetResearchTurnsLeft

Hooks

static bool BeforeCvPlayerTechs_GetResearchTurnsLeft(const CvPlayerTechs* self, TechTypes eTech, bool bOverflow, int& result);static void AfterCvPlayerTechs_GetResearchTurnsLeft(const CvPlayerTechs* self, TechTypes eTech, bool bOverflow, int& result);static int ReplaceCvPlayerTechs_GetResearchTurnsLeft(int (*original)(const CvPlayerTechs*, TechTypes, bool), const CvPlayerTechs* self, TechTypes eTech, bool bOverflow);CivRegisterBefore<CivHooks::CvPlayerTechs_GetResearchTurnsLeft>(host, &BeforeCvPlayerTechs_GetResearchTurnsLeft);CivRegisterAfter<CivHooks::CvPlayerTechs_GetResearchTurnsLeft>(host, &AfterCvPlayerTechs_GetResearchTurnsLeft);CivRegisterReplace<CivHooks::CvPlayerTechs_GetResearchTurnsLeft>(host, &ReplaceCvPlayerTechs_GetResearchTurnsLeft);

Code

1410/// Accessor: How many turns of research left?1411int CvPlayerTechs::GetResearchTurnsLeft(TechTypes eTech, bool bOverflow) const1412{1413	int iTurnsLeft = GetResearchTurnsLeftTimes100(eTech, bOverflow);14141415	if(iTurnsLeft == INT_MAX)1416	{1417		return INT_MAX;1418	}14191420	iTurnsLeft = (iTurnsLeft + 99) / 100; // round up14211422	return std::max(1, iTurnsLeft);1423}

Calls

Called by