File diff r23952:2d92a4a7c152 → r23953:ba75d2f3b530
src/ai/ai_gui.cpp
Show inline comments
 
@@ -1049,14 +1049,13 @@ struct AIDebugWindow : public Window {
 
	{
 
		/* Check if the currently selected company is still active. */
 
		if (this->IsValidDebugCompany(ai_debug_company)) return;
 

	
 
		ai_debug_company = INVALID_COMPANY;
 

	
 
		const Company *c;
 
		FOR_ALL_COMPANIES(c) {
 
		for (const Company *c : Company::Iterate()) {
 
			if (c->is_ai) {
 
				ChangeToAI(c->index);
 
				return;
 
			}
 
		}
 

	
 
@@ -1309,14 +1308,13 @@ struct AIDebugWindow : public Window {
 
				}
 

	
 
				/* If the last AI/Game Script is unpaused, unpause the game too. */
 
				if ((_pause_mode & PM_PAUSED_NORMAL) == PM_PAUSED_NORMAL) {
 
					bool all_unpaused = !Game::IsPaused();
 
					if (all_unpaused) {
 
						Company *c;
 
						FOR_ALL_COMPANIES(c) {
 
						for (const Company *c : Company::Iterate()) {
 
							if (c->is_ai && AI::IsPaused(c->index)) {
 
								all_unpaused = false;
 
								break;
 
							}
 
						}
 
						if (all_unpaused) {
 
@@ -1549,14 +1547,13 @@ void InitializeAIGui()
 
/** Open the AI debug window if one of the AI scripts has crashed. */
 
void ShowAIDebugWindowIfAIError()
 
{
 
	/* Network clients can't debug AIs. */
 
	if (_networking && !_network_server) return;
 

	
 
	Company *c;
 
	FOR_ALL_COMPANIES(c) {
 
	for (const Company *c : Company::Iterate()) {
 
		if (c->is_ai && c->ai_instance->IsDead()) {
 
			ShowAIDebugWindow(c->index);
 
			break;
 
		}
 
	}