(svn r22785) -Codechange: rename IsGeneratingWorld to HasModalProgress

This commit is contained in:
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
* 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;

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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:

View File

@ -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 {

View File

@ -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);

View File

@ -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 */

View File

@ -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();