changeset 17977:678cb42fdc25 draft

(svn r22786) -Codechange: rename genworld mutices to model_progress mutices
author rubidium <rubidium@openttd.org>
date Sun, 21 Aug 2011 12:47:24 +0000
parents 776acb0fd15e
children 6bba1c18478c
files src/genworld.cpp src/genworld.h src/genworld_gui.cpp src/gfx.cpp src/openttd.cpp
diffstat 5 files changed, 25 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -54,10 +54,10 @@
  */
 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 @@
 
 	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 @@
 		IncreaseGeneratingWorldProgress(GWP_GAME_START);
 
 		CleanupGeneration();
-		_genworld_mapgen_mutex->EndCritical();
+		_modal_progress_work_mutex->EndCritical();
 
 		ShowNewGRFError();
 
@@ -192,7 +192,7 @@
 	} 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 @@
 {
 	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 @@
 			!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;
 	}
 
--- a/src/genworld.h
+++ b/src/genworld.h
@@ -101,8 +101,8 @@
 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 */
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -1396,10 +1396,10 @@
 	 * 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;
 }
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -1557,14 +1557,14 @@
 	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;
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -653,8 +653,8 @@
 	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();