Bazaar developer reference

CvGame::setAIAutoPlay(int, PlayerTypes)

Defined in
CvGame.cpp, line 5014
Class
CvGame
Hook name
CivHooks::CvGame_setAIAutoPlay

Hooks

static bool BeforeCvGame_setAIAutoPlay(CvGame* self, int iNewValue, PlayerTypes eReturnAsPlayer);static void AfterCvGame_setAIAutoPlay(CvGame* self, int iNewValue, PlayerTypes eReturnAsPlayer);static void ReplaceCvGame_setAIAutoPlay(void (*original)(CvGame*, int, PlayerTypes), CvGame* self, int iNewValue, PlayerTypes eReturnAsPlayer);CivRegisterBefore<CivHooks::CvGame_setAIAutoPlay>(host, &BeforeCvGame_setAIAutoPlay);CivRegisterAfter<CivHooks::CvGame_setAIAutoPlay>(host, &AfterCvGame_setAIAutoPlay);CivRegisterReplace<CivHooks::CvGame_setAIAutoPlay>(host, &ReplaceCvGame_setAIAutoPlay);

Code

5014void CvGame::setAIAutoPlay(int iNewValue, PlayerTypes eReturnAsPlayer)5015{5016	int iOldValue;50175018	iOldValue = getAIAutoPlay();50195020	if(iOldValue != iNewValue)5021	{5022		m_iAIAutoPlay = std::max(0, iNewValue);5023		m_eAIAutoPlayReturnPlayer = eReturnAsPlayer;50245025		if((iOldValue == 0) && (getAIAutoPlay() > 0))5026		{5027			if(CanMoveActivePlayerToObserver())5028			{5029				ActivateObserverSlot();5030			}50315032			else5033			{5034				GET_PLAYER(getActivePlayer()).killUnits();5035				GET_PLAYER(getActivePlayer()).killCities();5036				CvPreGame::setSlotStatus(getActivePlayer(), SS_OBSERVER);5037			}5038		}5039	}5040}

Calls

Called by