summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-02-20 17:49:26 +0000
committerDarkvater <darkvater@openttd.org>2006-02-20 17:49:26 +0000
commit4b5970da8428603e2e91c18281c5afa138cfa63b (patch)
tree93fc7b6931550959f7c4dd56209966a7b72e6782
parent4f9ea7640a4c0df9c53791c51eed9d320be16327 (diff)
downloadopenttd-4b5970da8428603e2e91c18281c5afa138cfa63b.tar.xz
(svn r3621) - Codechange: Only define the server and bans list if network is enabled. Preparatory work for saving patches/settings to savegame.
-rw-r--r--network.h7
-rw-r--r--settings.c4
2 files changed, 7 insertions, 4 deletions
diff --git a/network.h b/network.h
index 30b75e636..f3602ea48 100644
--- a/network.h
+++ b/network.h
@@ -212,13 +212,12 @@ NetworkGameList *NetworkQueryServer(const char* host, unsigned short port, bool
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
diff --git a/settings.c b/settings.c
index 678f5e4e6..a287b7f7f 100644
--- a/settings.c
+++ b/settings.c
@@ -1124,8 +1124,10 @@ void LoadFromConfig(void)
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 @@ void SaveToConfig(void)
{
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);
}