--- a/src/settings.cpp Mon Dec 03 23:39:38 2007 +0000
+++ b/src/settings.cpp Tue Jan 22 21:00:30 2008 +0000
@@ -22,16 +22,12 @@
#include "stdafx.h"
#include "openttd.h"
#include "currency.h"
-#include "functions.h"
-#include "macros.h"
#include "screenshot.h"
-#include "sound.h"
-#include "string.h"
#include "variables.h"
#include "network/network.h"
-#include "strings.h"
-#include "settings.h"
-#include "command.h"
+#include "network/network_internal.h"
+#include "settings_internal.h"
+#include "command_func.h"
#include "console.h"
#include "saveload.h"
#include "npf.h"
@@ -39,19 +35,34 @@
#include "newgrf.h"
#include "newgrf_config.h"
#include "genworld.h"
-#include "date.h"
#include "rail.h"
#include "train.h"
-#include "helpers.hpp"
#include "news.h"
+#include "window_func.h"
+#include "strings_func.h"
+#include "vehicle_func.h"
+#include "sound_func.h"
+#include "core/alloc_func.hpp"
+#include "player_func.h"
#ifdef WITH_FREETYPE
-#include "gfx.h"
#include "fontcache.h"
#endif
#include "spritecache.h"
#include "transparency.h"
+#include "string_func.h"
+#include "gui.h"
+#include "town.h"
+#include "video/video_driver.hpp"
+#include "sound/sound_driver.hpp"
+#include "music/music_driver.hpp"
+#include "blitter/factory.hpp"
-/** The patch values that are used for new games and/or modified in config file */
+#include "table/strings.h"
+
+GameOptions _opt;
+GameOptions _opt_newgame;
+GameOptions *_opt_ptr;
+Patches _patches;
Patches _patches_newgame;
struct IniFile;
@@ -80,7 +91,7 @@
SettingsMemoryPool *p;
if (minsize < 4096 - 12) minsize = 4096 - 12;
- p = (SettingsMemoryPool*)malloc(sizeof(SettingsMemoryPool) - 1 + minsize);
+ p = (SettingsMemoryPool*)MallocT<byte>(sizeof(SettingsMemoryPool) - 1 + minsize);
p->pos = 0;
p->size = minsize;
p->next = NULL;
@@ -1082,13 +1093,7 @@
#define CR SGF_CURRENCY
#define NN SGF_NO_NETWORK
-#include "table/strings.h"
-
/* Begin - Callback Functions for the various settings */
-#include "window.h"
-#include "gui.h"
-#include "town.h"
-#include "gfx.h"
/* virtual PositionMainToolbar function, calls the right one.*/
static int32 v_PositionMainToolbar(int32 p1)
{
@@ -1307,6 +1312,7 @@
SDTG_VAR("restart_game_year", SLE_INT32, S,D0, _network_restart_game_year, 0, MIN_YEAR, MAX_YEAR, 1, STR_NULL, NULL),
SDTG_VAR("min_players", SLE_UINT8, S, 0, _network_min_players, 0, 0, 10, 0, STR_NULL, NULL),
SDTG_OMANY("server_lang", SLE_UINT8, S, 0, _network_game_info.server_lang, 0, 28, "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN", STR_NULL, NULL),
+ SDTG_BOOL("reload_cfg", S, 0, _network_reload_cfg, false, STR_NULL, NULL),
SDTG_END()
};
#endif /* ENABLE_NETWORK */
@@ -1365,10 +1371,6 @@
SDT_BOOL(Patches, prefer_teamchat, S, 0, false, STR_CONFIG_PATCHES_PREFER_TEAMCHAT, NULL),
SDT_VAR(Patches, scrollwheel_scrolling,SLE_UINT8,S,MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING, NULL),
SDT_VAR(Patches,scrollwheel_multiplier,SLE_UINT8,S, 0, 5, 1, 15, 1, STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER,NULL),
-#ifdef __APPLE__
- /* We might need to emulate a right mouse button on mac */
- SDT_VAR(Patches,right_mouse_btn_emulation,SLE_UINT8,S,MS,0, 0, 2, 0, STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU, NULL),
-#endif
SDT_BOOL(Patches, pause_on_newgame, S, 0, false, STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME, NULL),
SDT_VAR(Patches,advanced_vehicle_list,SLE_UINT8,S,MS, 1, 0, 2, 0, STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS,NULL),
SDT_BOOL(Patches, timetable_in_ticks, S, 0, false, STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS, NULL),
@@ -1582,6 +1584,18 @@
SDT_VAR (Patches, heightmap_rotation, SLE_UINT8, S, MS, 0, 0, 1, 0, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION, NULL),
SDT_VAR (Patches, se_flat_world_height, SLE_UINT8, S, 0, 0, 0, 15, 0, STR_CONFIG_PATCHES_SE_FLAT_WORLD_HEIGHT, NULL),
+ /*
+ * Since the network code (CmdChangePatchSetting and friends) use the index in this array to decide
+ * which patch the server is talking about all conditional compilation of this array must be at the
+ * end. This isn't really the best solution, the patches the server can tell the client about should
+ * either use a seperate array or some other form of identifier.
+ */
+
+#ifdef __APPLE__
+ /* We might need to emulate a right mouse button on mac */
+ SDT_VAR(Patches,right_mouse_btn_emulation,SLE_UINT8,S,MS,0, 0, 2, 0, STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU, NULL),
+#endif
+
SDT_END()
};
@@ -1806,6 +1820,7 @@
if (sd == NULL) return CMD_ERROR;
if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) return CMD_ERROR;
+ if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking) return CMD_ERROR;
if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return CMD_ERROR;
if (flags & DC_EXEC) {