summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-08-21 12:46:46 +0000
committerrubidium <rubidium@openttd.org>2011-08-21 12:46:46 +0000
commit37415b9cf7edaae66ca1fb35665894b9f9241127 (patch)
tree6803ebb1c7b7f42d6ede002c794347e86f11f382 /src
parent236075e944b0d80d9e29b411f1936ba09c788c29 (diff)
downloadopenttd-37415b9cf7edaae66ca1fb35665894b9f9241127.tar.xz
(svn r22785) -Codechange: rename IsGeneratingWorld to HasModalProgress
Diffstat (limited to 'src')
-rw-r--r--src/command.cpp4
-rw-r--r--src/genworld.h2
-rw-r--r--src/genworld_gui.cpp2
-rw-r--r--src/gfx.cpp2
-rw-r--r--src/main_gui.cpp2
-rw-r--r--src/openttd.cpp4
-rw-r--r--src/road.cpp2
-rw-r--r--src/video/sdl_v.cpp2
-rw-r--r--src/window.cpp14
9 files changed, 17 insertions, 17 deletions
diff --git a/src/command.cpp b/src/command.cpp
index b291ce797..e5357f140 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 535da923b..549fe4660 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 8101a9c7b..566873528 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 300a33ecf..c468e6192 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 e7a593c8f..793ef7750 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 a5fde97e9..6e105796e 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 e0c18c015..2c2af2a4d 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 d53ebc5b3..a27866b84 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 e5f5250d8..b20a46004 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();