(svn r22788) -Codechange: move modal progress related functions and variables to progress.cpp/h

This commit is contained in:
rubidium
2011-08-21 12:48:46 +00:00
parent a67cf6bae1
commit 421053a694
15 changed files with 102 additions and 25 deletions

View File

@@ -32,6 +32,7 @@
#include "newgrf.h"
#include "core/random_func.hpp"
#include "core/backup_type.hpp"
#include "progress.h"
#include "table/sprites.h"
@@ -54,11 +55,6 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin
*/
GenWorldInfo _gw;
/** Rights for the performing work. */
ThreadMutex *_modal_progress_work_mutex = ThreadMutex::New();
/** Rights for the painting. */
ThreadMutex *_modal_progress_paint_mutex = ThreadMutex::New();
/** Whether we are generating the map or not. */
bool _generating_world;
@@ -82,7 +78,7 @@ static void CleanupGeneration()
if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
/* Show all vital windows again, because we have hidden them */
if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows();
_gw.active = false;
SetModalProgress(false);
_gw.proc = NULL;
_gw.abortp = NULL;
_gw.threaded = false;
@@ -280,11 +276,11 @@ void HandleGeneratingWorldAbortion()
*/
void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_settings)
{
if (_gw.active) return;
if (HasModalProgress()) return;
_gw.mode = mode;
_gw.size_x = size_x;
_gw.size_y = size_y;
_gw.active = true;
SetModalProgress(true);
_gw.abort = false;
_gw.abortp = NULL;
_gw.lc = _local_company;