1
0
Fork 0

(svn r22785) -Codechange: rename IsGeneratingWorld to HasModalProgress

release/1.2
rubidium 2011-08-21 12:46:46 +00:00
parent 236075e944
commit 37415b9cf7
9 changed files with 17 additions and 17 deletions

View File

@ -500,10 +500,10 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
/* Cost estimation is generally only done when the /* Cost estimation is generally only done when the
* local user presses shift while doing somthing. * local user presses shift while doing somthing.
* However, in case of incoming network commands, * 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. */ * to execute. */
bool estimate_only = _shift_pressed && IsLocalCompany() && bool estimate_only = _shift_pressed && IsLocalCompany() &&
!IsGeneratingWorld() && !_generating_world &&
!(cmd & CMD_NETWORK_COMMAND) && !(cmd & CMD_NETWORK_COMMAND) &&
(cmd & CMD_ID_MASK) != CMD_PAUSE; (cmd & CMD_ID_MASK) != CMD_PAUSE;

View File

@ -75,7 +75,7 @@ enum GenWorldProgress {
* Check if we are currently in the process of generating a world. * Check if we are currently in the process of generating a world.
* @return are we generating world? * @return are we generating world?
*/ */
static inline bool IsGeneratingWorld() static inline bool HasModalProgress()
{ {
extern GenWorldInfo _gw; extern GenWorldInfo _gw;
return _gw.active; return _gw.active;

View File

@ -1250,7 +1250,7 @@ static void AbortGeneratingWorldCallback(Window *w, bool confirmed)
{ {
if (confirmed) { if (confirmed) {
AbortGeneratingWorld(); AbortGeneratingWorld();
} else if (IsGeneratingWorld() && !IsGeneratingWorldAborted()) { } else if (HasModalProgress() && !IsGeneratingWorldAborted()) {
SetMouseCursor(SPR_CURSOR_ZZZ, PAL_NONE); SetMouseCursor(SPR_CURSOR_ZZZ, PAL_NONE);
} }
} }

View File

@ -1554,7 +1554,7 @@ void DrawDirtyBlocks()
int x; int x;
int y; int y;
if (IsGeneratingWorld()) { if (HasModalProgress()) {
/* We are generating the world, so release our rights to the map and /* We are generating the world, so release our rights to the map and
* painting while we are waiting a bit. */ * painting while we are waiting a bit. */
_genworld_paint_mutex->EndCritical(); _genworld_paint_mutex->EndCritical();

View File

@ -282,7 +282,7 @@ struct MainWindow : Window
* generating the world, otherwise they create threading * generating the world, otherwise they create threading
* problem during the generating, resulting in random * problem during the generating, resulting in random
* assertions that are hard to trigger and debug */ * assertions that are hard to trigger and debug */
if (IsGeneratingWorld()) return ES_NOT_HANDLED; if (HasModalProgress()) return ES_NOT_HANDLED;
switch (num) { switch (num) {
case GHK_ABANDON: case GHK_ABANDON:

View File

@ -1113,7 +1113,7 @@ void StateGameLoop()
CallWindowTickEvent(); CallWindowTickEvent();
return; return;
} }
if (IsGeneratingWorld()) return; if (HasModalProgress()) return;
ClearStorageChanges(false); ClearStorageChanges(false);
@ -1217,7 +1217,7 @@ void GameLoop()
/* Check for UDP stuff */ /* Check for UDP stuff */
if (_network_available) NetworkUDPGameLoop(); if (_network_available) NetworkUDPGameLoop();
if (_networking && !IsGeneratingWorld()) { if (_networking && !HasModalProgress()) {
/* Multiplayer */ /* Multiplayer */
NetworkGameLoop(); NetworkGameLoop();
} else { } else {

View File

@ -106,7 +106,7 @@ bool HasRoadTypesAvail(const CompanyID company, const RoadTypes rts)
{ {
RoadTypes avail_roadtypes; 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; avail_roadtypes = ROADTYPES_ROAD;
} else { } else {
Company *c = Company::GetIfValid(company); Company *c = Company::GetIfValid(company);

View File

@ -594,7 +594,7 @@ void VideoDriver_SDL::MainLoop()
} }
/* End of the critical part. */ /* End of the critical part. */
if (_draw_threaded && !IsGeneratingWorld()) { if (_draw_threaded && !HasModalProgress()) {
_draw_mutex->SendSignal(); _draw_mutex->SendSignal();
} else { } else {
/* Oh, we didn't have threads, then just draw unthreaded */ /* Oh, we didn't have threads, then just draw unthreaded */

View File

@ -1997,7 +1997,7 @@ void HandleKeypress(uint32 raw_key)
{ {
/* World generation is multithreaded and messes with companies. /* World generation is multithreaded and messes with companies.
* But there is no company related window open anyway, so _current_company is not used. */ * But there is no company related window open anyway, so _current_company is not used. */
assert(IsGeneratingWorld() || IsLocalCompany()); assert(HasModalProgress() || IsLocalCompany());
/* Setup event */ /* Setup event */
uint16 key = GB(raw_key, 0, 16); uint16 key = GB(raw_key, 0, 16);
@ -2063,7 +2063,7 @@ static int _input_events_this_tick = 0;
*/ */
static void HandleAutoscroll() 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 x = _cursor.pos.x;
int y = _cursor.pos.y; int y = _cursor.pos.y;
Window *w = FindWindowFromPt(x, 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. /* World generation is multithreaded and messes with companies.
* But there is no company related window open anyway, so _current_company is not used. */ * But there is no company related window open anyway, so _current_company is not used. */
assert(IsGeneratingWorld() || IsLocalCompany()); assert(HasModalProgress() || IsLocalCompany());
HandlePlacePresize(); HandlePlacePresize();
UpdateTileSelection(); UpdateTileSelection();
@ -2182,8 +2182,8 @@ static void MouseLoop(MouseClick click, int mousewheel)
if (click != MC_HOVER && !MaybeBringWindowToFront(w)) return; if (click != MC_HOVER && !MaybeBringWindowToFront(w)) return;
ViewPort *vp = IsPtInWindowViewport(w, x, y); ViewPort *vp = IsPtInWindowViewport(w, x, y);
/* Don't allow any action in a viewport if either in menu of in generating world */ /* 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 || IsGeneratingWorld())) return; if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return;
if (mousewheel != 0) { if (mousewheel != 0) {
/* Send mousewheel event to window */ /* Send mousewheel event to window */
@ -2248,7 +2248,7 @@ void HandleMouseEvents()
{ {
/* World generation is multithreaded and messes with companies. /* World generation is multithreaded and messes with companies.
* But there is no company related window open anyway, so _current_company is not used. */ * 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 int double_click_time = 0;
static Point double_click_pos = {0, 0}; static Point double_click_pos = {0, 0};
@ -2355,7 +2355,7 @@ void InputLoop()
{ {
/* World generation is multithreaded and messes with companies. /* World generation is multithreaded and messes with companies.
* But there is no company related window open anyway, so _current_company is not used. */ * But there is no company related window open anyway, so _current_company is not used. */
assert(IsGeneratingWorld() || IsLocalCompany()); assert(HasModalProgress() || IsLocalCompany());
CheckSoftLimit(); CheckSoftLimit();
HandleKeyScrolling(); HandleKeyScrolling();