changeset 8129:f4083301273a draft

(svn r11690) -Fix: Since indices into the patch array is sent over the network having conditionally compiled entries in the table can cause desyncs. Moving them to the end will hide this issue, but it should really be solved in a better way.
author egladil <egladil@openttd.org>
date Tue, 25 Dec 2007 01:29:54 +0000
parents c4f75b4136a0
children 0586823afe39
files src/settings.cpp
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1362,10 +1362,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),
@@ -1579,6 +1575,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()
 };