From 37415b9cf7edaae66ca1fb35665894b9f9241127 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 21 Aug 2011 12:46:46 +0000 Subject: [PATCH] (svn r22785) -Codechange: rename IsGeneratingWorld to HasModalProgress --- src/command.cpp | 4 ++-- src/genworld.h | 2 +- src/genworld_gui.cpp | 2 +- src/gfx.cpp | 2 +- src/main_gui.cpp | 2 +- src/openttd.cpp | 4 ++-- src/road.cpp | 2 +- src/video/sdl_v.cpp | 2 +- src/window.cpp | 14 +++++++------- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/command.cpp b/src/command.cpp index b291ce7977..e5357f1400 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -500,10 +500,10 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac /* Cost estimation is generally only done when the * local user presses shift while doing somthing. * However, in case of incoming network commands, - * map generation of the pause button we do want + * map generation or the pause button we do want * to execute. */ bool estimate_only = _shift_pressed && IsLocalCompany() && - !IsGeneratingWorld() && + !_generating_world && !(cmd & CMD_NETWORK_COMMAND) && (cmd & CMD_ID_MASK) != CMD_PAUSE; diff --git a/src/genworld.h b/src/genworld.h index 535da923b5..549fe4660a 100644 --- a/src/genworld.h +++ b/src/genworld.h @@ -75,7 +75,7 @@ enum GenWorldProgress { * Check if we are currently in the process of generating a world. * @return are we generating world? */ -static inline bool IsGeneratingWorld() +static inline bool HasModalProgress() { extern GenWorldInfo _gw; return _gw.active; diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 8101a9c7b3..5668735289 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -1250,7 +1250,7 @@ static void AbortGeneratingWorldCallback(Window *w, bool confirmed) { if (confirmed) { AbortGeneratingWorld(); - } else if (IsGeneratingWorld() && !IsGeneratingWorldAborted()) { + } else if (HasModalProgress() && !IsGeneratingWorldAborted()) { SetMouseCursor(SPR_CURSOR_ZZZ, PAL_NONE); } } diff --git a/src/gfx.cpp b/src/gfx.cpp index 300a33ecfb..c468e6192e 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -1554,7 +1554,7 @@ void DrawDirtyBlocks() int x; int y; - if (IsGeneratingWorld()) { + if (HasModalProgress()) { /* We are generating the world, so release our rights to the map and * painting while we are waiting a bit. */ _genworld_paint_mutex->EndCritical(); diff --git a/src/main_gui.cpp b/src/main_gui.cpp index e7a593c8fb..793ef77503 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -282,7 +282,7 @@ struct MainWindow : Window * generating the world, otherwise they create threading * problem during the generating, resulting in random * assertions that are hard to trigger and debug */ - if (IsGeneratingWorld()) return ES_NOT_HANDLED; + if (HasModalProgress()) return ES_NOT_HANDLED; switch (num) { case GHK_ABANDON: diff --git a/src/openttd.cpp b/src/openttd.cpp index a5fde97e98..6e105796e6 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1113,7 +1113,7 @@ void StateGameLoop() CallWindowTickEvent(); return; } - if (IsGeneratingWorld()) return; + if (HasModalProgress()) return; ClearStorageChanges(false); @@ -1217,7 +1217,7 @@ void GameLoop() /* Check for UDP stuff */ if (_network_available) NetworkUDPGameLoop(); - if (_networking && !IsGeneratingWorld()) { + if (_networking && !HasModalProgress()) { /* Multiplayer */ NetworkGameLoop(); } else { diff --git a/src/road.cpp b/src/road.cpp index e0c18c0154..2c2af2a4d1 100644 --- a/src/road.cpp +++ b/src/road.cpp @@ -106,7 +106,7 @@ bool HasRoadTypesAvail(const CompanyID company, const RoadTypes rts) { RoadTypes avail_roadtypes; - if (company == OWNER_TOWN || _game_mode == GM_EDITOR || IsGeneratingWorld()) { + if (company == OWNER_TOWN || _game_mode == GM_EDITOR || _generating_world) { avail_roadtypes = ROADTYPES_ROAD; } else { Company *c = Company::GetIfValid(company); diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index d53ebc5b39..a27866b843 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -594,7 +594,7 @@ void VideoDriver_SDL::MainLoop() } /* End of the critical part. */ - if (_draw_threaded && !IsGeneratingWorld()) { + if (_draw_threaded && !HasModalProgress()) { _draw_mutex->SendSignal(); } else { /* Oh, we didn't have threads, then just draw unthreaded */ diff --git a/src/window.cpp b/src/window.cpp index e5f5250d8c..b20a460046 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1997,7 +1997,7 @@ void HandleKeypress(uint32 raw_key) { /* World generation is multithreaded and messes with companies. * But there is no company related window open anyway, so _current_company is not used. */ - assert(IsGeneratingWorld() || IsLocalCompany()); + assert(HasModalProgress() || IsLocalCompany()); /* Setup event */ uint16 key = GB(raw_key, 0, 16); @@ -2063,7 +2063,7 @@ static int _input_events_this_tick = 0; */ static void HandleAutoscroll() { - if (_settings_client.gui.autoscroll && _game_mode != GM_MENU && !IsGeneratingWorld()) { + if (_settings_client.gui.autoscroll && _game_mode != GM_MENU && !HasModalProgress()) { int x = _cursor.pos.x; int y = _cursor.pos.y; Window *w = FindWindowFromPt(x, y); @@ -2158,7 +2158,7 @@ static void MouseLoop(MouseClick click, int mousewheel) { /* World generation is multithreaded and messes with companies. * But there is no company related window open anyway, so _current_company is not used. */ - assert(IsGeneratingWorld() || IsLocalCompany()); + assert(HasModalProgress() || IsLocalCompany()); HandlePlacePresize(); UpdateTileSelection(); @@ -2182,8 +2182,8 @@ static void MouseLoop(MouseClick click, int mousewheel) if (click != MC_HOVER && !MaybeBringWindowToFront(w)) return; ViewPort *vp = IsPtInWindowViewport(w, x, y); - /* Don't allow any action in a viewport if either in menu of in generating world */ - if (vp != NULL && (_game_mode == GM_MENU || IsGeneratingWorld())) return; + /* Don't allow any action in a viewport if either in menu or when having a modal progress window */ + if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return; if (mousewheel != 0) { /* Send mousewheel event to window */ @@ -2248,7 +2248,7 @@ void HandleMouseEvents() { /* World generation is multithreaded and messes with companies. * But there is no company related window open anyway, so _current_company is not used. */ - assert(IsGeneratingWorld() || IsLocalCompany()); + assert(HasModalProgress() || IsLocalCompany()); static int double_click_time = 0; static Point double_click_pos = {0, 0}; @@ -2355,7 +2355,7 @@ void InputLoop() { /* World generation is multithreaded and messes with companies. * But there is no company related window open anyway, so _current_company is not used. */ - assert(IsGeneratingWorld() || IsLocalCompany()); + assert(HasModalProgress() || IsLocalCompany()); CheckSoftLimit(); HandleKeyScrolling();