src/openttd.cpp
branchnoai
changeset 10829 8a0ec0f0f928
parent 10776 07203fc29812
child 10867 5de2923d6e59
--- a/src/openttd.cpp	Mon Jun 02 01:46:03 2008 +0000
+++ b/src/openttd.cpp	Wed Jun 04 22:34:45 2008 +0000
@@ -6,7 +6,6 @@
 
 #define VARDEF
 #include "variables.h"
-#include "network/network_internal.h"
 #undef VARDEF
 
 #include "openttd.h"
@@ -41,6 +40,7 @@
 #include "console_func.h"
 #include "screenshot.h"
 #include "network/network.h"
+#include "network/network_func.h"
 #include "signs_base.h"
 #include "signs_func.h"
 #include "waypoint.h"
@@ -54,6 +54,7 @@
 #include "strings_func.h"
 #include "date_func.h"
 #include "vehicle_func.h"
+#include "gamelog.h"
 #include "cheat_func.h"
 #include "animated_tile_func.h"
 #include "functions.h"
@@ -311,6 +312,7 @@
 	UnInitializeAirports();
 
 	/* Uninitialize variables that are allocated dynamically */
+	GamelogReset();
 	_Town_pool.CleanPool();
 	_Industry_pool.CleanPool();
 	_Station_pool.CleanPool();
@@ -495,8 +497,8 @@
 	if (_cur_resolution[1] == 0) _cur_resolution[1] = 1;
 
 #if defined(ENABLE_NETWORK)
-	if (dedicated_host) snprintf(_network_server_bind_ip_host, NETWORK_HOSTNAME_LENGTH, "%s", dedicated_host);
-	if (dedicated_port) _network_server_port = dedicated_port;
+	if (dedicated_host) snprintf(_settings_client.network.server_bind_ip, sizeof(_settings_client.network.server_bind_ip), "%s", dedicated_host);
+	if (dedicated_port) _settings_client.network.server_port = dedicated_port;
 	if (_dedicated_forks && !dedicated) _dedicated_forks = false;
 #endif /* ENABLE_NETWORK */
 
@@ -690,8 +692,8 @@
 #ifdef ENABLE_NETWORK
 	/* We are the server, we start a new player (not dedicated),
 	 * so set the default password *if* needed. */
-	if (_network_server && !StrEmpty(_network_default_company_pass)) {
-		char *password = _network_default_company_pass;
+	if (_network_server && !StrEmpty(_settings_client.network.default_company_pass)) {
+		char *password = _settings_client.network.default_company_pass;
 		NetworkChangeCompanyPassword(1, &password);
 	}
 #endif /* ENABLE_NETWORK */
@@ -820,10 +822,8 @@
 		if (_networking) {
 			if (_network_server && (new_mode == SM_LOAD || new_mode == SM_NEWGAME)) {
 				NetworkReboot();
-				NetworkUDPCloseAll();
 			} else {
 				NetworkDisconnect();
-				NetworkUDPCloseAll();
 			}
 		}
 
@@ -832,7 +832,7 @@
 			/* But not if we are going to the menu */
 			if (new_mode != SM_MENU) {
 				/* check if we should reload the config */
-				if (_network_reload_cfg) {
+				if (_settings_client.network.reload_cfg) {
 					LoadFromConfig();
 					_settings_game = _settings_newgame;
 					ResetGRFConfig(false);
@@ -1113,7 +1113,7 @@
 		if (_network_reconnect > 0 && --_network_reconnect == 0) {
 			/* This means that we want to reconnect to the last host
 			 * We do this here, because it means that the network is really closed */
-			NetworkClientConnectGame(_network_last_host, _network_last_port);
+			NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port);
 		}
 		/* Singleplayer */
 		StateGameLoop();
@@ -1270,6 +1270,13 @@
 	TileIndex map_size = MapSize();
 	Player *p;
 
+	if (CheckSavegameVersion(98)) GamelogOldver();
+
+	GamelogTestRevision();
+	GamelogTestMode();
+
+	if (CheckSavegameVersion(98)) GamelogGRFAddList(_grfconfig);
+
 	/* in version 2.1 of the savegame, town owner was unified. */
 	if (CheckSavegameVersionOldStyle(2, 1)) ConvertTownOwner();
 
@@ -2433,6 +2440,8 @@
 		}
 	}
 
+	if (_debug_gamelog_level > 0) GamelogPrintDebug();
+
 	return InitializeWindowsAndCaches();
 }