Bazaar developer reference

CvGame::canDoControl(ControlTypes)

Defined in
CvGame.cpp, line 3193
Class
CvGame
Hook name
CivHooks::CvGame_canDoControl

Hooks

static bool BeforeCvGame_canDoControl(CvGame* self, ControlTypes eControl, bool& result);static void AfterCvGame_canDoControl(CvGame* self, ControlTypes eControl, bool& result);static bool ReplaceCvGame_canDoControl(bool (*original)(CvGame*, ControlTypes), CvGame* self, ControlTypes eControl);CivRegisterBefore<CivHooks::CvGame_canDoControl>(host, &BeforeCvGame_canDoControl);CivRegisterAfter<CivHooks::CvGame_canDoControl>(host, &AfterCvGame_canDoControl);CivRegisterReplace<CivHooks::CvGame_canDoControl>(host, &ReplaceCvGame_canDoControl);

Code

3193bool CvGame::canDoControl(ControlTypes eControl)3194{3195	switch(eControl)3196	{3197	case CONTROL_SELECTYUNITTYPE:3198	case CONTROL_SELECTYUNITALL:3199	case CONTROL_SELECT_HEALTHY:3200	case CONTROL_SELECTCITY:3201	case CONTROL_SELECTCAPITAL:3202	case CONTROL_NEXTUNIT:3203	case CONTROL_PREVUNIT:3204	case CONTROL_CYCLEUNIT:3205	case CONTROL_CYCLEUNIT_ALT:3206	case CONTROL_CYCLEWORKER:3207	case CONTROL_LASTUNIT:3208	case CONTROL_FORCEENDTURN:3209	case CONTROL_AUTOMOVES:3210	case CONTROL_SAVE_GROUP:3211	case CONTROL_QUICK_SAVE:3212	case CONTROL_QUICK_LOAD:3213	case CONTROL_TURN_LOG:3214		if(!GC.GetEngineUserInterface()->isFocused())3215		{3216			return true;3217		}3218		break;32193220	case CONTROL_PING:3221	case CONTROL_YIELDS:3222	case CONTROL_RESOURCE_ALL:3223	case CONTROL_UNIT_ICONS:3224	case CONTROL_SCORES:3225	case CONTROL_OPTIONS_SCREEN:3226	case CONTROL_DOMESTIC_SCREEN:3227	case CONTROL_CIVILOPEDIA:3228	case CONTROL_POLICIES_SCREEN:3229	case CONTROL_FOREIGN_SCREEN:3230	case CONTROL_MILITARY_SCREEN:3231	case CONTROL_TECH_CHOOSER:3232	case CONTROL_INFO:3233	case CONTROL_SAVE_NORMAL:3234	case CONTROL_ADVISOR_COUNSEL:3235	case CONTROL_NEXTCITY:3236	case CONTROL_PREVCITY:3237	case CONTROL_RELIGION_OVERVIEW:3238	case CONTROL_ESPIONAGE_OVERVIEW:3239		return true;3240		break;32413242	case CONTROL_VICTORY_SCREEN:3243		if(getGameState() == GAMESTATE_ON)3244		{3245			return true;3246		}3247		break;324832493250	case CONTROL_CENTERONSELECTION:3251	{3252		auto_ptr<ICvPlot1> pSelectionPlot(GC.GetEngineUserInterface()->getSelectionPlot());3253		if(pSelectionPlot.get() != NULL)3254		{3255			return true;3256		}3257	}3258	break;32593260	case CONTROL_LOAD_GAME:3261		if(!(isNetworkMultiPlayer()))3262		{3263			return true;3264		}3265		break;32663267	case CONTROL_RETIRE:3268		if((getGameState() == GAMESTATE_ON) || isGameMultiPlayer())3269		{3270			if(GET_PLAYER(getActivePlayer()).isAlive())3271			{3272				if(isPbem() || isHotSeat())3273				{3274					if(!GET_PLAYER(getActivePlayer()).isEndTurn())3275					{3276						return true;3277					}3278				}3279				else3280				{3281					return true;3282				}3283			}3284		}3285		break;32863287	case CONTROL_ENDTURN:3288	case CONTROL_ENDTURN_ALT:3289		if(GC.GetEngineUserInterface()->canEndTurn() && !GC.GetEngineUserInterface()->isFocused())3290		{3291			return true;3292		}3293		break;32943295	case CONTROL_TOGGLE_STRATEGIC_VIEW:3296		GC.GetEngineUserInterface()->ToggleStrategicView();3297		break;32983299	case CONTROL_RESTART_GAME:3300		{3301			if(!isGameMultiPlayer() && getGameTurn() == getStartTurn())3302			{3303				return true;3304			}3305		}3306		break;33073308	default:3309		CvAssertMsg(false, "eControl did not match any valid options");3310		break;3311	}33123313	return false;3314}

Calls

Called by