From 03f963af586f384de2346e9292f69021caec5a7b Mon Sep 17 00:00:00 2001 From: rubidium <rubidium@openttd.org> Date: Sun, 3 Sep 2006 22:07:28 +0000 Subject: (svn r6365) -Cleanup: remove IsGeneratingWorld calls that are either not called or have no effect. --- main_gui.c | 36 ++++++++++++++++++------------------ openttd.c | 2 +- video/cocoa_v.m | 3 +-- video/sdl_v.c | 3 +-- video/win32_v.c | 3 +-- 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/main_gui.c b/main_gui.c index b0b8a93e2..503c3c68a 100644 --- a/main_gui.c +++ b/main_gui.c @@ -1024,7 +1024,7 @@ void ZoomInOrOutToCursorWindow(bool in, Window *w) 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 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e) 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 @@ static void StatusBarWndProc(Window *w, WindowEvent *e) 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 @@ static void StatusBarWndProc(Window *w, WindowEvent *e) 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 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) 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 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) 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 @@ void ShowVitalWindows(void) 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); diff --git a/openttd.c b/openttd.c index 30101e956..157df5aae 100644 --- a/openttd.c +++ b/openttd.c @@ -899,7 +899,7 @@ static void DoAutosave(void) 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); diff --git a/video/cocoa_v.m b/video/cocoa_v.m index 534ea68ee..d2b88b5f2 100644 --- a/video/cocoa_v.m +++ b/video/cocoa_v.m @@ -56,7 +56,6 @@ extern void HideMenuBar(void); #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 @@ static void QZ_GameLoop(void) #endif { if (!_networking && _game_mode != GM_MENU) _fast_forward |= 2; - } else if (_fast_forward & 2 && !IsGeneratingWorld()) { + } else if (_fast_forward & 2) { _fast_forward = 0; } diff --git a/video/sdl_v.c b/video/sdl_v.c index bd1eb5b8f..57c81c556 100644 --- a/video/sdl_v.c +++ b/video/sdl_v.c @@ -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 @@ static void SdlVideoMainLoop(void) 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; } diff --git a/video/win32_v.c b/video/win32_v.c index db4fcb584..207683db4 100644 --- a/video/win32_v.c +++ b/video/win32_v.c @@ -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 @@ static void Win32GdiMainLoop(void) * 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; -- cgit v1.2.3-70-g09d2