(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
authorrubidium
Sun, 03 Sep 2006 22:07:28 +0000
changeset 4536 f13408cba18f
parent 4535 17934c877430
child 4537 fefcd6142977
(svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect.
main_gui.c
openttd.c
video/cocoa_v.m
video/sdl_v.c
video/win32_v.c
--- a/main_gui.c	Sun Sep 03 21:53:32 2006 +0000
+++ b/main_gui.c	Sun Sep 03 22:07:28 2006 +0000
@@ -1024,7 +1024,7 @@
 
 	vp = w->viewport;
 
-	if (_game_mode != GM_MENU && !IsGeneratingWorld()) {
+	if (_game_mode != GM_MENU) {
 		if ((in && vp->zoom == 0) || (!in && vp->zoom == 2))
 			return;
 
@@ -1777,8 +1777,6 @@
 	case WE_KEYPRESS: {
 		PlayerID local = (_local_player != OWNER_SPECTATOR) ? _local_player : 0;
 
-		if (IsGeneratingWorld()) break;
-
 		switch (e->keypress.keycode) {
 		case WKC_F1: case WKC_PAUSE:
 			ToolbarPauseClick(w);
@@ -2106,7 +2104,7 @@
 			70, 1, (_pause || _patches.status_long_date) ? STR_00AF : STR_00AE, 0
 		);
 
-		if (p != NULL && !IsGeneratingWorld()) {
+		if (p != NULL) {
 			// Draw player money
 			SetDParam64(0, p->money64);
 			DrawStringCentered(570, 1, p->player_money >= 0 ? STR_0004 : STR_0005, 0);
@@ -2124,7 +2122,7 @@
 			if (!DrawScrollingStatusText(&_statusbar_news_item, WP(w,def_d).data_1))
 				WP(w,def_d).data_1 = -1280;
 		} else {
-			if (p != NULL && !IsGeneratingWorld()) {
+			if (p != NULL) {
 				// This is the default text
 				SetDParam(0, p->name_1);
 				SetDParam(1, p->name_2);
@@ -2225,12 +2223,6 @@
 		break;
 
 	case WE_KEYPRESS:
-		if (e->keypress.keycode == WKC_BACKQUOTE) {
-			if (!IsGeneratingWorld()) IConsoleSwitch();
-			e->keypress.cont = false;
-			break;
-		}
-
 		switch (e->keypress.keycode) {
 			case 'Q' | WKC_CTRL:
 			case 'Q' | WKC_META:
@@ -2238,7 +2230,19 @@
 				break;
 		}
 
-		if (_game_mode == GM_MENU || IsGeneratingWorld()) break;
+		/* Disable all key shortcuts, except quit shortcuts when
+		 * generating the world, otherwise they create threading
+		 * problem during the generating, resulting in random
+		 * assertions that are hard to trigger and debug */
+		if (IsGeneratingWorld()) break;
+
+		if (e->keypress.keycode == WKC_BACKQUOTE) {
+			IConsoleSwitch();
+			e->keypress.cont = false;
+			break;
+		}
+
+		if (_game_mode == GM_MENU) break;
 
 		switch (e->keypress.keycode) {
 			case 'C':
@@ -2363,14 +2367,10 @@
 
 	if (_game_mode != GM_EDITOR) {
 		w = AllocateWindowDesc(&_toolb_normal_desc);
-		/* Disable zoom-in for normal things, and zoom-out if we come
-		 *  from world-generating. */
-		w->disabled_state = IsGeneratingWorld() ? (1 << 18) : (1 << 17);
+		w->disabled_state = 1 << 18;
 	} else {
 		w = AllocateWindowDesc(&_toolb_scen_desc);
-		/* Disable zoom-in for normal things, and zoom-out if we come
-		 *  from world-generating. */
-		w->disabled_state = IsGeneratingWorld() ? (1 << 10) : (1 << 9);
+		w->disabled_state = 1 << 10;
 	}
 	CLRBITS(w->flags4, WF_WHITE_BORDER_MASK);
 
--- a/openttd.c	Sun Sep 03 21:53:32 2006 +0000
+++ b/openttd.c	Sun Sep 03 22:07:28 2006 +0000
@@ -899,7 +899,7 @@
 
 static void ScrollMainViewport(int x, int y)
 {
-	if (_game_mode != GM_MENU && !IsGeneratingWorld()) {
+	if (_game_mode != GM_MENU) {
 		Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
 		assert(w);
 
--- a/video/cocoa_v.m	Sun Sep 03 21:53:32 2006 +0000
+++ b/video/cocoa_v.m	Sun Sep 03 22:07:28 2006 +0000
@@ -56,7 +56,6 @@
 #include "../window.h"
 #include "../network.h"
 #include "../variables.h"
-#include "../genworld.h"
 #include "../os/macosx/splash.h"
 
 #include "cocoa_v.h"
@@ -711,7 +710,7 @@
 #endif
 		{
 			if (!_networking && _game_mode != GM_MENU) _fast_forward |= 2;
-		} else if (_fast_forward & 2 && !IsGeneratingWorld()) {
+		} else if (_fast_forward & 2) {
 			_fast_forward = 0;
 		}
 
--- a/video/sdl_v.c	Sun Sep 03 21:53:32 2006 +0000
+++ b/video/sdl_v.c	Sun Sep 03 22:07:28 2006 +0000
@@ -13,7 +13,6 @@
 #include "../window.h"
 #include "../network.h"
 #include "../variables.h"
-#include "../genworld.h"
 #include "sdl_v.h"
 #include <SDL.h>
 
@@ -461,7 +460,7 @@
 		if (keys[SDLK_TAB])
 #endif
 		{
-			if (!_networking && _game_mode != GM_MENU && !IsGeneratingWorld()) _fast_forward |= 2;
+			if (!_networking && _game_mode != GM_MENU) _fast_forward |= 2;
 		} else if (_fast_forward & 2) {
 			_fast_forward = 0;
 		}
--- a/video/win32_v.c	Sun Sep 03 21:53:32 2006 +0000
+++ b/video/win32_v.c	Sun Sep 03 22:07:28 2006 +0000
@@ -9,7 +9,6 @@
 #include "../variables.h"
 #include "../win32.h"
 #include "../window.h"
-#include "../genworld.h"
 #include "win32_v.h"
 #include <windows.h>
 
@@ -801,7 +800,7 @@
 			 * real key is in the upper 16 bits (see WM_SYSKEYDOWN in WndProcGdi()) */
 			if ((_pressed_key >> 16) & WKC_TAB &&
 #endif
-			    !_networking && _game_mode != GM_MENU && !IsGeneratingWorld())
+			    !_networking && _game_mode != GM_MENU)
 				_fast_forward |= 2;
 		} else if (_fast_forward & 2) {
 			_fast_forward = 0;