Bazaar developer reference

CvGame::getCurrentEra() const

Defined in
CvGame.cpp, line 4222
Class
CvGame
Hook name
CivHooks::CvGame_getCurrentEra

Hooks

static bool BeforeCvGame_getCurrentEra(const CvGame* self, EraTypes& result);static void AfterCvGame_getCurrentEra(const CvGame* self, EraTypes& result);static EraTypes ReplaceCvGame_getCurrentEra(EraTypes (*original)(const CvGame*), const CvGame* self);CivRegisterBefore<CivHooks::CvGame_getCurrentEra>(host, &BeforeCvGame_getCurrentEra);CivRegisterAfter<CivHooks::CvGame_getCurrentEra>(host, &AfterCvGame_getCurrentEra);CivRegisterReplace<CivHooks::CvGame_getCurrentEra>(host, &ReplaceCvGame_getCurrentEra);

Code

4222EraTypes CvGame::getCurrentEra() const4223{4224	int iEra;4225	int iCount;4226	int iI;42274228	iEra = 0;4229	iCount = 0;42304231	for(iI = 0; iI < MAX_TEAMS; iI++)4232	{4233		if(GET_TEAM((TeamTypes)iI).isAlive())4234		{4235			iEra += GET_TEAM((TeamTypes)iI).GetCurrentEra();4236			iCount++;4237		}4238	}42394240	if(iCount > 0)4241	{4242		return ((EraTypes)(iEra / iCount));4243	}42444245	return NO_ERA;4246}

Calls

Called by