summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-08-21 12:47:24 +0000
committerrubidium <rubidium@openttd.org>2011-08-21 12:47:24 +0000
commit7b7869fba73a6f9923bb40ccbd7344255f890771 (patch)
tree6400d1090b67592b8e580b6e16be8ef4d13a0e68
parent37415b9cf7edaae66ca1fb35665894b9f9241127 (diff)
downloadopenttd-7b7869fba73a6f9923bb40ccbd7344255f890771.tar.xz
(svn r22786) -Codechange: rename genworld mutices to model_progress mutices
-rw-r--r--src/genworld.cpp26
-rw-r--r--src/genworld.h4
-rw-r--r--src/genworld_gui.cpp8
-rw-r--r--src/gfx.cpp8
-rw-r--r--src/openttd.cpp4
5 files changed, 25 insertions, 25 deletions
diff --git a/src/genworld.cpp b/src/genworld.cpp
index 7be576cbd..3c6709295 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -54,10 +54,10 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin
*/
GenWorldInfo _gw;
-/** Rights for the map generation */
-ThreadMutex *_genworld_mapgen_mutex = ThreadMutex::New();
-/** Rights for the painting */
-ThreadMutex *_genworld_paint_mutex = ThreadMutex::New();
+/** 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;
@@ -101,7 +101,7 @@ static void _GenerateWorld(void *)
try {
_generating_world = true;
- _genworld_mapgen_mutex->BeginCritical();
+ _modal_progress_work_mutex->BeginCritical();
if (_network_dedicated) DEBUG(net, 0, "Generating map, please wait...");
/* Set the Random() seed to generation_seed so we produce the same map with the same seed */
if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
@@ -177,7 +177,7 @@ static void _GenerateWorld(void *)
IncreaseGeneratingWorldProgress(GWP_GAME_START);
CleanupGeneration();
- _genworld_mapgen_mutex->EndCritical();
+ _modal_progress_work_mutex->EndCritical();
ShowNewGRFError();
@@ -192,7 +192,7 @@ static void _GenerateWorld(void *)
} catch (...) {
if (_cur_company.IsValid()) _cur_company.Restore();
_generating_world = false;
- _genworld_mapgen_mutex->EndCritical();
+ _modal_progress_work_mutex->EndCritical();
throw;
}
}
@@ -225,15 +225,15 @@ void WaitTillGeneratedWorld()
{
if (_gw.thread == NULL) return;
- _genworld_mapgen_mutex->EndCritical();
- _genworld_paint_mutex->EndCritical();
+ _modal_progress_work_mutex->EndCritical();
+ _modal_progress_paint_mutex->EndCritical();
_gw.quit_thread = true;
_gw.thread->Join();
delete _gw.thread;
_gw.thread = NULL;
_gw.threaded = false;
- _genworld_mapgen_mutex->BeginCritical();
- _genworld_paint_mutex->BeginCritical();
+ _modal_progress_work_mutex->BeginCritical();
+ _modal_progress_paint_mutex->BeginCritical();
}
/**
@@ -318,9 +318,9 @@ void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_setti
!ThreadObject::New(&_GenerateWorld, NULL, &_gw.thread)) {
DEBUG(misc, 1, "Cannot create genworld thread, reverting to single-threaded mode");
_gw.threaded = false;
- _genworld_mapgen_mutex->EndCritical();
+ _modal_progress_work_mutex->EndCritical();
_GenerateWorld(NULL);
- _genworld_mapgen_mutex->BeginCritical();
+ _modal_progress_work_mutex->BeginCritical();
return;
}
diff --git a/src/genworld.h b/src/genworld.h
index 549fe4660..95de2f81b 100644
--- a/src/genworld.h
+++ b/src/genworld.h
@@ -101,8 +101,8 @@ void StartNewGameWithoutGUI(uint seed);
void ShowCreateScenario();
void StartScenarioEditor();
-extern class ThreadMutex *_genworld_mapgen_mutex;
-extern class ThreadMutex *_genworld_paint_mutex;
+extern class ThreadMutex *_modal_progress_work_mutex;
+extern class ThreadMutex *_modal_progress_paint_mutex;
extern bool _generating_world;
#endif /* GENWORLD_H */
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 566873528..8f464ca11 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -1396,10 +1396,10 @@ static void _SetGeneratingWorldProgress(GenWorldProgress cls, uint progress, uin
* paint thread. The 'other' thread already has the paint thread rights so
* this ensures us that we are waiting until the paint thread is done
* before we reacquire the mapgen rights */
- _genworld_mapgen_mutex->EndCritical();
- _genworld_paint_mutex->BeginCritical();
- _genworld_mapgen_mutex->BeginCritical();
- _genworld_paint_mutex->EndCritical();
+ _modal_progress_work_mutex->EndCritical();
+ _modal_progress_paint_mutex->BeginCritical();
+ _modal_progress_work_mutex->BeginCritical();
+ _modal_progress_paint_mutex->EndCritical();
_gws.timer = _realtime_tick;
}
diff --git a/src/gfx.cpp b/src/gfx.cpp
index c468e6192..eb75ff91e 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -1557,14 +1557,14 @@ void DrawDirtyBlocks()
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();
- _genworld_mapgen_mutex->EndCritical();
+ _modal_progress_paint_mutex->EndCritical();
+ _modal_progress_work_mutex->EndCritical();
/* Wait a while and update _realtime_tick so we are given the rights */
CSleep(GENWORLD_REDRAW_TIMEOUT);
_realtime_tick += GENWORLD_REDRAW_TIMEOUT;
- _genworld_paint_mutex->BeginCritical();
- _genworld_mapgen_mutex->BeginCritical();
+ _modal_progress_paint_mutex->BeginCritical();
+ _modal_progress_work_mutex->BeginCritical();
}
y = 0;
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 6e105796e..9ea00405f 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -653,8 +653,8 @@ int ttd_main(int argc, char *argv[])
IConsoleCmdExec("exec scripts/autoexec.scr 0");
/* Take our initial lock on whatever we might want to do! */
- _genworld_paint_mutex->BeginCritical();
- _genworld_mapgen_mutex->BeginCritical();
+ _modal_progress_paint_mutex->BeginCritical();
+ _modal_progress_work_mutex->BeginCritical();
GenerateWorld(GWM_EMPTY, 64, 64); // Make the viewport initialization happy
WaitTillGeneratedWorld();