(svn r3621) - Codechange: Only define the server and bans list if network is enabled. Preparatory work for saving patches/settings to savegame.
--- a/network.h Mon Feb 20 09:26:07 2006 +0000
+++ b/network.h Mon Feb 20 17:49:26 2006 +0000
@@ -212,13 +212,12 @@
byte NetworkSpectatorCount(void);
+VARDEF char *_network_host_list[10];
+VARDEF char *_network_ban_list[25];
+
#endif /* ENABLE_NETWORK */
// Those variables must always be registered!
-#define MAX_SAVED_SERVERS 10
-VARDEF char *_network_host_list[MAX_SAVED_SERVERS];
-#define MAX_BANS 25
-VARDEF char *_network_ban_list[MAX_BANS];
VARDEF bool _networking;
VARDEF bool _network_available; // is network mode available?
VARDEF bool _network_server; // network-server is active
--- a/settings.c Mon Feb 20 09:26:07 2006 +0000
+++ b/settings.c Mon Feb 20 17:49:26 2006 +0000
@@ -1124,8 +1124,10 @@
IniFile *ini = ini_load(_config_file);
HandleSettingDescs(ini, load_setting_desc);
LoadList(ini, "newgrf", _newgrf_files, lengthof(_newgrf_files));
+#ifdef ENABLE_NETWORK
LoadList(ini, "servers", _network_host_list, lengthof(_network_host_list));
LoadList(ini, "bans", _network_ban_list, lengthof(_network_ban_list));
+#endif /* ENABLE_NETWORK */
ini_free(ini);
}
@@ -1133,8 +1135,10 @@
{
IniFile *ini = ini_load(_config_file);
HandleSettingDescs(ini, save_setting_desc);
+#ifdef ENABLE_NETWORK
SaveList(ini, "servers", _network_host_list, lengthof(_network_host_list));
SaveList(ini, "bans", _network_ban_list, lengthof(_network_ban_list));
+#endif /* ENABLE_NETWORK */
ini_save(_config_file, ini);
ini_free(ini);
}