Changeset - r17968:93e4c2154cdf
[Not reviewed]
master
0 3 0
rubidium - 13 years ago 2011-08-21 12:47:45
rubidium@openttd.org
(svn r22787) -Codechange: rename genworld redraw constant
3 files changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/genworld.h
Show inline comments
 
@@ -13,26 +13,26 @@
 
#define GENWORLD_H
 

	
 
#include "company_type.h"
 

	
 
/** Constants related to world generation */
 
enum LandscapeGenerator {
 
	/* Order of these enums has to be the same as in lang/english.txt
 
	 * Otherwise you will get inconsistent behaviour. */
 
	LG_ORIGINAL     = 0,  ///< The original landscape generator
 
	LG_TERRAGENESIS = 1,  ///< TerraGenesis Perlin landscape generator
 
};
 

	
 
static const uint GENERATE_NEW_SEED       = UINT_MAX; ///< Create a new random seed
 
static const uint GENWORLD_REDRAW_TIMEOUT = 200;      ///< Timeout between redraws
 
static const uint GENERATE_NEW_SEED = UINT_MAX; ///< Create a new random seed
 
static const uint MODAL_PROGRESS_REDRAW_TIMEOUT = 200; ///< Timeout between redraws
 

	
 
/** Modes for GenerateWorld */
 
enum GenWorldMode {
 
	GWM_NEWGAME   = 0, ///< Generate a map for a new game
 
	GWM_EMPTY     = 1, ///< Generate an empty map (sea-level)
 
	GWM_RANDOM    = 2, ///< Generate a random map for SE
 
	GWM_HEIGHTMAP = 3, ///< Generate a newgame from a heightmap
 
};
 

	
 
static const uint CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY = 4; ///< Value for custom sea level in difficulty settings.
 
static const uint CUSTOM_SEA_LEVEL_MIN_PERCENTAGE = 1;    ///< Minimum percentage a user can specify for custom sea level.
 
static const uint CUSTOM_SEA_LEVEL_MAX_PERCENTAGE = 90;   ///< Maximum percentage a user can specify for custom sea level.
src/genworld_gui.cpp
Show inline comments
 
@@ -1356,25 +1356,25 @@ static void _SetGeneratingWorldProgress(
 
	if (total == 0) {
 
		assert(_gws.cls == _generation_class_table[cls]);
 
		_gws.current += progress;
 
		assert(_gws.current <= _gws.total);
 
	} else {
 
		_gws.cls     = _generation_class_table[cls];
 
		_gws.current = progress;
 
		_gws.total   = total;
 
		_gws.percent = percent_table[cls];
 
	}
 

	
 
	/* Don't update the screen too often. So update it once in every once in a while... */
 
	if (!_network_dedicated && _gws.timer != 0 && _realtime_tick - _gws.timer < GENWORLD_REDRAW_TIMEOUT) return;
 
	if (!_network_dedicated && _gws.timer != 0 && _realtime_tick - _gws.timer < MODAL_PROGRESS_REDRAW_TIMEOUT) return;
 

	
 
	/* Percentage is about the number of completed tasks, so 'current - 1' */
 
	_gws.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_gws.current == 0 ? 0 : _gws.current - 1) / _gws.total;
 

	
 
	if (_network_dedicated) {
 
		static uint last_percent = 0;
 

	
 
		/* Never display 0% */
 
		if (_gws.percent == 0) return;
 
		/* Reset if percent is lower than the last recorded */
 
		if (_gws.percent < last_percent) last_percent = 0;
 
		/* Display every 5%, but 6% is also very valid.. just not smaller steps than 5% */
src/gfx.cpp
Show inline comments
 
@@ -1552,26 +1552,26 @@ void DrawDirtyBlocks()
 
	const int w = Align(_screen.width,  DIRTY_BLOCK_WIDTH);
 
	const int h = Align(_screen.height, DIRTY_BLOCK_HEIGHT);
 
	int x;
 
	int y;
 

	
 
	if (HasModalProgress()) {
 
		/* We are generating the world, so release our rights to the map and
 
		 * painting while we are waiting a bit. */
 
		_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;
 
		CSleep(MODAL_PROGRESS_REDRAW_TIMEOUT);
 
		_realtime_tick += MODAL_PROGRESS_REDRAW_TIMEOUT;
 
		_modal_progress_paint_mutex->BeginCritical();
 
		_modal_progress_work_mutex->BeginCritical();
 
	}
 

	
 
	y = 0;
 
	do {
 
		x = 0;
 
		do {
 
			if (*b != 0) {
 
				int left;
 
				int top;
 
				int right = x + DIRTY_BLOCK_WIDTH;
0 comments (0 inline, 0 general)