Changeset - r14789:ae5ae13ad9ae
[Not reviewed]
master
0 2 0
rubidium - 15 years ago 2010-03-11 21:55:37
rubidium@openttd.org
(svn r19388) -Fix [FS#3666]: [NoAI] When reloading a savegame, an AI failing to compile could trigger (trying) to read the not yet loaded information of another AI via the AI Debug window and its "open with the most recently used AI" feature
2 files changed with 10 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -995,24 +995,32 @@ static const NWidgetPart _nested_ai_debu
 
		NWidget(NWID_VERTICAL),
 
			NWidget(WWT_SCROLLBAR, COLOUR_GREY, AID_WIDGET_SCROLLBAR),
 
			NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
		EndContainer(),
 
	EndContainer(),
 
};
 

	
 
static const WindowDesc _ai_debug_desc(
 
	WDP_AUTO, 600, 450,
 
	WC_AI_DEBUG, WC_NONE,
 
	0,
 
	_nested_ai_debug_widgets, lengthof(_nested_ai_debug_widgets)
 
);
 

	
 
void ShowAIDebugWindow(CompanyID show_company)
 
{
 
	if (!_networking || _network_server) {
 
		AIDebugWindow *w = (AIDebugWindow *)BringWindowToFrontById(WC_AI_DEBUG, 0);
 
		if (w == NULL) w = new AIDebugWindow(&_ai_debug_desc, 0);
 
		if (show_company != INVALID_COMPANY) w->ChangeToAI(show_company);
 
	} else {
 
		ShowErrorMessage(STR_ERROR_AI_DEBUG_SERVER_ONLY, INVALID_STRING_ID, WL_INFO);
 
	}
 
}
 

	
 
/**
 
 * Reset the AI windows to their initial state.
 
 */
 
void InitializeAIGui()
 
{
 
	AIDebugWindow::ai_debug_company = INVALID_COMPANY;
 
}
src/misc.cpp
Show inline comments
 
@@ -20,48 +20,49 @@
 
#include "date_func.h"
 
#include "texteff.hpp"
 
#include "gfx_func.h"
 
#include "gamelog.h"
 
#include "animated_tile_func.h"
 
#include "tilehighlight_func.h"
 
#include "network/network_func.h"
 
#include "window_func.h"
 

	
 

	
 
extern TileIndex _cur_tileloop_tile;
 
extern void MakeNewgameSettingsLive();
 

	
 
void InitializeSound();
 
void InitializeMusic();
 
void InitializeVehicles();
 
void InitializeDepots();
 
void InitializeEngineRenews();
 
void InitializeOrders();
 
void InitializeClearLand();
 
void InitializeRailGui();
 
void InitializeRoadGui();
 
void InitializeAirportGui();
 
void InitializeDockGui();
 
void InitializeAIGui();
 
void InitializeIndustries();
 
void InitializeTowns();
 
void InitializeSubsidies();
 
void InitializeTrees();
 
void InitializeSigns();
 
void InitializeStations();
 
void InitializeRoadStops();
 
void InitializeCargoPackets();
 
void InitializeCompanies();
 
void InitializeCheats();
 
void InitializeNPF();
 
void InitializeOldNames();
 

	
 
void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings)
 
{
 
	/* Make sure there isn't any window that can influence anything
 
	 * related to the new game we're about to start/load. */
 
	UnInitWindowSystem();
 

	
 
	AllocateMap(size_x, size_y);
 

	
 
	_pause_mode = PM_UNPAUSED;
 
	_fast_forward = 0;
 
	_tick_counter = 0;
 
@@ -71,48 +72,49 @@ void InitializeGame(uint size_x, uint si
 
	_thd.redsq = INVALID_TILE;
 
	if (reset_settings) MakeNewgameSettingsLive();
 

	
 
	InitializeSound();
 
	InitializeMusic();
 

	
 
	if (reset_date) {
 
		SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
 
		InitializeOldNames();
 
	}
 

	
 
	InitializeEngineRenews();
 
	InitializeVehicles();
 
	InitializeDepots();
 
	InitializeOrders();
 
	InitializeGroup();
 

	
 
	InitNewsItemStructs();
 
	InitializeLandscape();
 
	InitializeClearLand();
 
	InitializeRailGui();
 
	InitializeRoadGui();
 
	InitializeAirportGui();
 
	InitializeDockGui();
 
	InitializeAIGui();
 
	InitializeTowns();
 
	InitializeSubsidies();
 
	InitializeTrees();
 
	InitializeSigns();
 
	InitializeStations();
 
	InitializeRoadStops();
 
	InitializeCargoPackets();
 
	InitializeIndustries();
 
	InitializeBuildingCounts();
 

	
 
	InitializeNPF();
 

	
 
	InitializeCompanies();
 
	AI::Initialize();
 
	InitializeCheats();
 

	
 
	InitTextEffects();
 
#ifdef ENABLE_NETWORK
 
	NetworkInitChatMessage();
 
#endif /* ENABLE_NETWORK */
 
	InitializeAnimatedTiles();
 

	
 
	InitializeEconomy();
 

	
0 comments (0 inline, 0 general)