Bazaar developer reference

CvTeam::doTurn()

Defined in
CvTeam.cpp, line 781
Class
CvTeam
Hook name
CivHooks::CvTeam_doTurn

Hooks

static bool BeforeCvTeam_doTurn(CvTeam* self);static void AfterCvTeam_doTurn(CvTeam* self);static void ReplaceCvTeam_doTurn(void (*original)(CvTeam*), CvTeam* self);CivRegisterBefore<CivHooks::CvTeam_doTurn>(host, &BeforeCvTeam_doTurn);CivRegisterAfter<CivHooks::CvTeam_doTurn>(host, &AfterCvTeam_doTurn);CivRegisterReplace<CivHooks::CvTeam_doTurn>(host, &ReplaceCvTeam_doTurn);

Code

781void CvTeam::doTurn()782{783	int iI;784785	CvAssertMsg(isAlive(), "isAlive is expected to be true");786787	// Barbarians get all Techs that 3/4 of alive players get788	if(isBarbarian())789	{790		DoBarbarianTech();791	}792	// NOT barbs793	else794	{795		// War counter796		TeamTypes eTeam;797		int iTeamLoop;798		for(iTeamLoop = 0; iTeamLoop < MAX_CIV_TEAMS; iTeamLoop++)799		{800			eTeam = (TeamTypes) iTeamLoop;801802			if(!GET_TEAM(eTeam).isBarbarian())803			{804				if(isAtWar(eTeam))805					ChangeNumTurnsAtWar(eTeam, 1);806				else807					SetNumTurnsAtWar(eTeam, 0);808			}809810			if(GetNumTurnsLockedIntoWar(eTeam) > 0)811				ChangeNumTurnsLockedIntoWar(eTeam, -1);812		}813	}814815	// City States also get all Techs that 3/4 of alive players get816	if(isMinorCiv())817	{818		DoMinorCivTech();819	}820821	for(iI = 0; iI < GC.getNumTechInfos(); iI++)822	{823		GetTeamTechs()->SetNoTradeTech(((TechTypes)iI), false);824	}825826	DoTestSmallAwards();827828	testCircumnavigated();829830#ifndef FINAL_RELEASE831	for(int iMinorLoop = MAX_MAJOR_CIVS; iMinorLoop < MAX_CIV_PLAYERS; iMinorLoop++)832	{833		if(!isAtWar(GET_PLAYER((PlayerTypes) iMinorLoop).getTeam()))834			continue;835836		CvAssertMsg(GET_PLAYER((PlayerTypes) iMinorLoop).GetMinorCivAI()->GetAlly() != getLeaderID(), "Major civ is now at war with a minor it is allied with! This is dumb and bad. Please send Jon this along with your last 5 autosaves and a changelist #.");837	}838#endif839}

Calls

Called by