Changeset - r25079:09d645764ffe
[Not reviewed]
master
0 16 0
Patric Stout - 3 years ago 2021-03-24 08:42:54
truebrain@openttd.org
Change: rename setting "max_heightlevel" to "map_height_limit"

This better reflects what it is, and hopefully removes a bit of
the confusion people are having what this setting actually does.

Additionally, update the text on the setting to better inform
users what it is doing exactly, so they can make an educated
decision on how to change it.

Next commit will introduce an "auto" value, which should be the
new default. The rename has as added benefit that everyone will
start out on the "auto" value.
16 files changed with 47 insertions and 46 deletions:
0 comments (0 inline, 0 general)
src/cheat_gui.cpp
Show inline comments
 
@@ -122,32 +122,32 @@ static int32 ClickChangeDateCheat(int32 
 
 * @param p2 unused
 
 * @return New value (or unchanged old value) of the maximum
 
 *         allowed heightlevel value.
 
 */
 
static int32 ClickChangeMaxHlCheat(int32 p1, int32 p2)
 
{
 
	p1 = Clamp(p1, MIN_MAX_HEIGHTLEVEL, MAX_MAX_HEIGHTLEVEL);
 
	p1 = Clamp(p1, MIN_MAP_HEIGHT_LIMIT, MAX_MAP_HEIGHT_LIMIT);
 

	
 
	/* Check if at least one mountain on the map is higher than the new value.
 
	 * If yes, disallow the change. */
 
	for (TileIndex t = 0; t < MapSize(); t++) {
 
		if ((int32)TileHeight(t) > p1) {
 
			ShowErrorMessage(STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN, INVALID_STRING_ID, WL_ERROR);
 
			/* Return old, unchanged value */
 
			return _settings_game.construction.max_heightlevel;
 
			return _settings_game.construction.map_height_limit;
 
		}
 
	}
 

	
 
	/* Execute the change and reload GRF Data */
 
	_settings_game.construction.max_heightlevel = p1;
 
	_settings_game.construction.map_height_limit = p1;
 
	ReloadNewGRFData();
 

	
 
	/* The smallmap uses an index from heightlevels to colours. Trigger rebuilding it. */
 
	InvalidateWindowClassesData(WC_SMALLMAP, 2);
 

	
 
	return _settings_game.construction.max_heightlevel;
 
	return _settings_game.construction.map_height_limit;
 
}
 

	
 
/** Available cheats. */
 
enum CheatNumbers {
 
	CHT_MONEY,           ///< Change amount of money.
 
	CHT_CHANGE_COMPANY,  ///< Switch company.
 
@@ -179,20 +179,20 @@ struct CheatEntry {
 

	
 
/**
 
 * The available cheats.
 
 * Order matches with the values of #CheatNumbers
 
 */
 
static const CheatEntry _cheats_ui[] = {
 
	{SLE_INT32, STR_CHEAT_MONEY,           &_money_cheat_amount,                    &_cheats.money.been_used,            &ClickMoneyCheat         },
 
	{SLE_UINT8, STR_CHEAT_CHANGE_COMPANY,  &_local_company,                         &_cheats.switch_company.been_used,   &ClickChangeCompanyCheat },
 
	{SLE_BOOL,  STR_CHEAT_EXTRA_DYNAMITE,  &_cheats.magic_bulldozer.value,          &_cheats.magic_bulldozer.been_used,  nullptr                     },
 
	{SLE_BOOL,  STR_CHEAT_CROSSINGTUNNELS, &_cheats.crossing_tunnels.value,         &_cheats.crossing_tunnels.been_used, nullptr                     },
 
	{SLE_BOOL,  STR_CHEAT_NO_JETCRASH,     &_cheats.no_jetcrash.value,              &_cheats.no_jetcrash.been_used,      nullptr                     },
 
	{SLE_BOOL,  STR_CHEAT_SETUP_PROD,      &_cheats.setup_prod.value,               &_cheats.setup_prod.been_used,       &ClickSetProdCheat       },
 
	{SLE_UINT8, STR_CHEAT_EDIT_MAX_HL,     &_settings_game.construction.max_heightlevel, &_cheats.edit_max_hl.been_used, &ClickChangeMaxHlCheat   },
 
	{SLE_INT32, STR_CHEAT_CHANGE_DATE,     &_cur_year,                              &_cheats.change_date.been_used,      &ClickChangeDateCheat    },
 
	{SLE_INT32, STR_CHEAT_MONEY,           &_money_cheat_amount,                          &_cheats.money.been_used,            &ClickMoneyCheat         },
 
	{SLE_UINT8, STR_CHEAT_CHANGE_COMPANY,  &_local_company,                               &_cheats.switch_company.been_used,   &ClickChangeCompanyCheat },
 
	{SLE_BOOL,  STR_CHEAT_EXTRA_DYNAMITE,  &_cheats.magic_bulldozer.value,                &_cheats.magic_bulldozer.been_used,  nullptr                  },
 
	{SLE_BOOL,  STR_CHEAT_CROSSINGTUNNELS, &_cheats.crossing_tunnels.value,               &_cheats.crossing_tunnels.been_used, nullptr                  },
 
	{SLE_BOOL,  STR_CHEAT_NO_JETCRASH,     &_cheats.no_jetcrash.value,                    &_cheats.no_jetcrash.been_used,      nullptr                  },
 
	{SLE_BOOL,  STR_CHEAT_SETUP_PROD,      &_cheats.setup_prod.value,                     &_cheats.setup_prod.been_used,       &ClickSetProdCheat       },
 
	{SLE_UINT8, STR_CHEAT_EDIT_MAX_HL,     &_settings_game.construction.map_height_limit, &_cheats.edit_max_hl.been_used,      &ClickChangeMaxHlCheat   },
 
	{SLE_INT32, STR_CHEAT_CHANGE_DATE,     &_cur_year,                                    &_cheats.change_date.been_used,      &ClickChangeDateCheat    },
 
};
 

	
 
static_assert(CHT_NUM_CHEATS == lengthof(_cheats_ui));
 

	
 
/** Widget definitions of the cheat GUI. */
 
static const NWidgetPart _nested_cheat_widgets[] = {
src/genworld_gui.cpp
Show inline comments
 
@@ -1059,13 +1059,13 @@ struct CreateScenarioWindow : public Win
 
			case WID_CS_FLAT_LAND_HEIGHT_UP: // Height level buttons
 
				/* Don't allow too fast scrolling */
 
				if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) {
 
					this->HandleButtonClick(widget);
 
					this->SetDirty();
 

	
 
					_settings_newgame.game_creation.se_flat_world_height = Clamp(_settings_newgame.game_creation.se_flat_world_height + widget - WID_CS_FLAT_LAND_HEIGHT_TEXT, 0, _settings_game.construction.max_heightlevel);
 
					_settings_newgame.game_creation.se_flat_world_height = Clamp(_settings_newgame.game_creation.se_flat_world_height + widget - WID_CS_FLAT_LAND_HEIGHT_TEXT, 0, _settings_game.construction.map_height_limit);
 
				}
 
				_left_button_clicked = false;
 
				break;
 

	
 
			case WID_CS_FLAT_LAND_HEIGHT_TEXT: // Height level text
 
				this->widget_id = WID_CS_FLAT_LAND_HEIGHT_TEXT;
 
@@ -1105,13 +1105,13 @@ struct CreateScenarioWindow : public Win
 
					this->SetWidgetDirty(WID_CS_START_DATE_TEXT);
 
					_settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
 
					break;
 

	
 
				case WID_CS_FLAT_LAND_HEIGHT_TEXT:
 
					this->SetWidgetDirty(WID_CS_FLAT_LAND_HEIGHT_TEXT);
 
					_settings_newgame.game_creation.se_flat_world_height = Clamp(value, 0, _settings_game.construction.max_heightlevel);
 
					_settings_newgame.game_creation.se_flat_world_height = Clamp(value, 0, _settings_game.construction.map_height_limit);
 
					break;
 
			}
 

	
 
			this->SetDirty();
 
		}
 
	}
src/heightmap.cpp
Show inline comments
 
@@ -365,13 +365,13 @@ static void GrayscaleToMapHeights(uint i
 
				uint heightmap_height = map[img_row * img_width + img_col];
 

	
 
				if (heightmap_height > 0) {
 
					/* 0 is sea level.
 
					 * Other grey scales are scaled evenly to the available height levels > 0.
 
					 * (The coastline is independent from the number of height levels) */
 
					heightmap_height = 1 + (heightmap_height - 1) * _settings_game.construction.max_heightlevel / 255;
 
					heightmap_height = 1 + (heightmap_height - 1) * _settings_game.construction.map_height_limit / 255;
 
				}
 

	
 
				SetTileHeight(tile, heightmap_height);
 
			}
 
			/* Only clear the tiles within the map area. */
 
			if (IsInnerTile(tile)) {
src/landscape.cpp
Show inline comments
 
@@ -114,13 +114,13 @@ Point InverseRemapCoords2(int x, int y, 
 
	const uint max_y = MapMaxY() * TILE_SIZE - 1;
 

	
 
	if (clamp_to_map) {
 
		/* Bring the coordinates near to a valid range. At the top we allow a number
 
		 * of extra tiles. This is mostly due to the tiles on the north side of
 
		 * the map possibly being drawn higher due to the extra height levels. */
 
		int extra_tiles = CeilDiv(_settings_game.construction.max_heightlevel * TILE_HEIGHT, TILE_PIXELS);
 
		int extra_tiles = CeilDiv(_settings_game.construction.map_height_limit * TILE_HEIGHT, TILE_PIXELS);
 
		Point old_pt = pt;
 
		pt.x = Clamp(pt.x, -extra_tiles * TILE_SIZE, max_x);
 
		pt.y = Clamp(pt.y, -extra_tiles * TILE_SIZE, max_y);
 
		if (clamped != nullptr) *clamped = (pt.x != old_pt.x) || (pt.y != old_pt.y);
 
	}
 

	
src/lang/english.txt
Show inline comments
 
@@ -1202,15 +1202,15 @@ STR_CONFIG_SETTING_TRAIN_REVERSING      
 
STR_CONFIG_SETTING_TRAIN_REVERSING_HELPTEXT                     :If enabled, trains will not reverse in non-terminus stations, even if there is a shorter path to their next destination when reversing
 
STR_CONFIG_SETTING_DISASTERS                                    :Disasters: {STRING2}
 
STR_CONFIG_SETTING_DISASTERS_HELPTEXT                           :Toggle disasters which may occasionally block or destroy vehicles or infrastructure
 
STR_CONFIG_SETTING_CITY_APPROVAL                                :Town council's attitude towards area restructuring: {STRING2}
 
STR_CONFIG_SETTING_CITY_APPROVAL_HELPTEXT                       :Choose how much noise and environmental damage by companies affect their town rating and further construction actions in their area
 

	
 
STR_CONFIG_SETTING_MAX_HEIGHTLEVEL                              :Maximum map height: {STRING2}
 
STR_CONFIG_SETTING_MAX_HEIGHTLEVEL_HELPTEXT                     :Set the maximum allowed height for mountains on the map
 
STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN                            :{WHITE}You can't set the maximum map height to this value. At least one mountain on the map is higher
 
STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT                             :Map height limit: {STRING2}
 
STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_HELPTEXT                    :Set the maximum allowed height of the map; neither the terrain generator nor you can build higher than this limit
 
STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN                            :{WHITE}You can't set the map height limit to this value. At least one mountain on the map is higher
 
STR_CONFIG_SETTING_AUTOSLOPE                                    :Allow landscaping under buildings, tracks, etc.: {STRING2}
 
STR_CONFIG_SETTING_AUTOSLOPE_HELPTEXT                           :Allow landscaping under buildings and tracks without removing them
 
STR_CONFIG_SETTING_CATCHMENT                                    :Allow more realistically sized catchment areas: {STRING2}
 
STR_CONFIG_SETTING_CATCHMENT_HELPTEXT                           :Have differently sized catchment areas for different types of stations and airports
 
STR_CONFIG_SETTING_SERVE_NEUTRAL_INDUSTRIES                     :Company stations can serve industries with attached neutral stations: {STRING2}
 
STR_CONFIG_SETTING_SERVE_NEUTRAL_INDUSTRIES_HELPTEXT            :When enabled, industries with attached stations (such as Oil Rigs) may also be served by company owned stations built nearby. When disabled, these industries may only be served by their attached stations. Any nearby company stations won't be able to serve them, nor will the attached station serve anything else other than the industry
src/newgrf.cpp
Show inline comments
 
@@ -2736,19 +2736,19 @@ static ChangeInfoResult GlobalVarChangeI
 
					byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS];
 

	
 
					for (uint i = 0; i < SNOW_LINE_MONTHS; i++) {
 
						for (uint j = 0; j < SNOW_LINE_DAYS; j++) {
 
							table[i][j] = buf->ReadByte();
 
							if (_cur.grffile->grf_version >= 8) {
 
								if (table[i][j] != 0xFF) table[i][j] = table[i][j] * (1 + _settings_game.construction.max_heightlevel) / 256;
 
								if (table[i][j] != 0xFF) table[i][j] = table[i][j] * (1 + _settings_game.construction.map_height_limit) / 256;
 
							} else {
 
								if (table[i][j] >= 128) {
 
									/* no snow */
 
									table[i][j] = 0xFF;
 
								} else {
 
									table[i][j] = table[i][j] * (1 + _settings_game.construction.max_heightlevel) / 128;
 
									table[i][j] = table[i][j] * (1 + _settings_game.construction.map_height_limit) / 128;
 
								}
 
							}
 
						}
 
					}
 
					SetSnowLine(table);
 
				}
 
@@ -6333,13 +6333,13 @@ bool GetGlobalVariable(byte param, uint3
 
			return true;
 

	
 
		/* case 0x1F: // locale dependent settings not implemented to avoid desync */
 

	
 
		case 0x20: { // snow line height
 
			byte snowline = GetSnowLine();
 
			if (_settings_game.game_creation.landscape == LT_ARCTIC && snowline <= _settings_game.construction.max_heightlevel) {
 
			if (_settings_game.game_creation.landscape == LT_ARCTIC && snowline <= _settings_game.construction.map_height_limit) {
 
				*value = Clamp(snowline * (grffile->grf_version >= 8 ? 1 : TILE_HEIGHT), 0, 0xFE);
 
			} else {
 
				/* No snow */
 
				*value = 0xFF;
 
			}
 
			return true;
 
@@ -7008,13 +7008,13 @@ static uint32 GetPatchVariable(uint8 par
 
			return (map_bits << 24) | (std::min(log_X, log_Y) << 20) | (max_edge << 16) |
 
				(log_X << 12) | (log_Y << 8) | (log_X + log_Y);
 
		}
 

	
 
		/* The maximum height of the map. */
 
		case 0x14:
 
			return _settings_game.construction.max_heightlevel;
 
			return _settings_game.construction.map_height_limit;
 

	
 
		/* Extra foundations base sprite */
 
		case 0x15:
 
			return SPR_SLOPES_BASE;
 

	
 
		/* Shore base sprite */
src/saveload/afterload.cpp
Show inline comments
 
@@ -602,13 +602,13 @@ bool AfterLoadGame()
 
			st->train_station.w = std::max<uint>(st->train_station.w, dx + 1);
 
			st->train_station.h = std::max<uint>(st->train_station.h, dy + 1);
 
		}
 
	}
 

	
 
	if (IsSavegameVersionBefore(SLV_194)) {
 
		_settings_game.construction.max_heightlevel = 15;
 
		_settings_game.construction.map_height_limit = 15;
 

	
 
		/* In old savegame versions, the heightlevel was coded in bits 0..3 of the type field */
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			_m[t].height = GB(_m[t].type, 0, 4);
 
			SB(_m[t].type, 0, 2, GB(_me[t].m6, 0, 2));
 
			SB(_me[t].m6, 0, 2, 0);
src/screenshot.cpp
Show inline comments
 
@@ -817,13 +817,13 @@ static bool MakeLargeWorldScreenshot(Scr
 
static void HeightmapCallback(void *userdata, void *buffer, uint y, uint pitch, uint n)
 
{
 
	byte *buf = (byte *)buffer;
 
	while (n > 0) {
 
		TileIndex ti = TileXY(MapMaxX(), y);
 
		for (uint x = MapMaxX(); true; x--) {
 
			*buf = 256 * TileHeight(ti) / (1 + _settings_game.construction.max_heightlevel);
 
			*buf = 256 * TileHeight(ti) / (1 + _settings_game.construction.map_height_limit);
 
			buf++;
 
			if (x == 0) break;
 
			ti = TILE_ADDXY(ti, -1, 0);
 
		}
 
		y++;
 
		n--;
src/settings_gui.cpp
Show inline comments
 
@@ -1653,13 +1653,13 @@ static SettingsContainer &GetSettingsTre
 

	
 
		SettingsPage *limitations = main->Add(new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS));
 
		{
 
			limitations->Add(new SettingEntry("construction.command_pause_level"));
 
			limitations->Add(new SettingEntry("construction.autoslope"));
 
			limitations->Add(new SettingEntry("construction.extra_dynamite"));
 
			limitations->Add(new SettingEntry("construction.max_heightlevel"));
 
			limitations->Add(new SettingEntry("construction.map_height_limit"));
 
			limitations->Add(new SettingEntry("construction.max_bridge_length"));
 
			limitations->Add(new SettingEntry("construction.max_bridge_height"));
 
			limitations->Add(new SettingEntry("construction.max_tunnel_length"));
 
			limitations->Add(new SettingEntry("station.never_expire_airports"));
 
			limitations->Add(new SettingEntry("vehicle.never_expire_vehicles"));
 
			limitations->Add(new SettingEntry("vehicle.max_trains"));
src/settings_type.h
Show inline comments
 
@@ -313,13 +313,13 @@ struct GameCreationSettings {
 
	byte   river_route_random;               ///< the amount of randomicity for the route finding
 
	byte   amount_of_rivers;                 ///< the amount of rivers
 
};
 

	
 
/** Settings related to construction in-game */
 
struct ConstructionSettings {
 
	uint8  max_heightlevel;                  ///< maximum allowed heightlevel
 
	uint8  map_height_limit;                 ///< the maximum allowed heightlevel
 
	bool   build_on_slopes;                  ///< allow building on slopes
 
	bool   autoslope;                        ///< allow terraforming under things
 
	uint16 max_bridge_length;                ///< maximum length of bridges
 
	byte   max_bridge_height;                ///< maximum height of bridges
 
	uint16 max_tunnel_length;                ///< maximum length of tunnels
 
	byte   train_signal_side;                ///< show signals on left / driving / right side
src/smallmap_gui.cpp
Show inline comments
 
@@ -295,18 +295,18 @@ void BuildLandLegend()
 
	 * It tries to evenly space the legend items over the two columns that are there for the legend.
 
	 */
 

	
 
	/* Table for delta; if max_height is less than the first column, use the second column as value. */
 
	uint deltas[][2] = { { 24, 2 }, { 48, 4 }, { 72, 6 }, { 120, 10 }, { 180, 15 }, { 240, 20 }, { MAX_TILE_HEIGHT + 1, 25 }};
 
	uint i = 0;
 
	for (; _settings_game.construction.max_heightlevel >= deltas[i][0]; i++) {
 
	for (; _settings_game.construction.map_height_limit >= deltas[i][0]; i++) {
 
		/* Nothing to do here. */
 
	}
 
	uint delta = deltas[i][1];
 

	
 
	int total_entries = (_settings_game.construction.max_heightlevel / delta) + 1;
 
	int total_entries = (_settings_game.construction.map_height_limit / delta) + 1;
 
	int rows = CeilDiv(total_entries, 2);
 
	int j = 0;
 

	
 
	for (i = 0; i < lengthof(_legend_land_contours) - 1 && j < total_entries; i++) {
 
		if (_legend_land_contours[i].legend != STR_TINY_BLACK_HEIGHT) continue;
 

	
 
@@ -1100,28 +1100,28 @@ SmallMapWindow::~SmallMapWindow()
 
/**
 
 * Rebuilds the colour indices used for fast access to the smallmap contour colours based on the heightlevel.
 
 */
 
void SmallMapWindow::RebuildColourIndexIfNecessary()
 
{
 
	/* Rebuild colour indices if necessary. */
 
	if (SmallMapWindow::max_heightlevel == _settings_game.construction.max_heightlevel) return;
 
	if (SmallMapWindow::map_height_limit == _settings_game.construction.map_height_limit) return;
 

	
 
	for (uint n = 0; n < lengthof(_heightmap_schemes); n++) {
 
		/* The heights go from 0 up to and including maximum. */
 
		int heights = _settings_game.construction.max_heightlevel + 1;
 
		int heights = _settings_game.construction.map_height_limit + 1;
 
		_heightmap_schemes[n].height_colours = ReallocT<uint32>(_heightmap_schemes[n].height_colours, heights);
 

	
 
		for (int z = 0; z < heights; z++) {
 
			size_t access_index = (_heightmap_schemes[n].colour_count * z) / heights;
 

	
 
			/* Choose colour by mapping the range (0..max heightlevel) on the complete colour table. */
 
			_heightmap_schemes[n].height_colours[z] = _heightmap_schemes[n].height_colours_base[access_index];
 
		}
 
	}
 

	
 
	SmallMapWindow::max_heightlevel = _settings_game.construction.max_heightlevel;
 
	SmallMapWindow::map_height_limit = _settings_game.construction.map_height_limit;
 
	BuildLandLegend();
 
}
 

	
 
/* virtual */ void SmallMapWindow::SetStringParameters(int widget) const
 
{
 
	switch (widget) {
 
@@ -1679,13 +1679,13 @@ Point SmallMapWindow::GetStationMiddle(c
 
	ret.x -= 3 + this->subscroll;
 
	return ret;
 
}
 

	
 
SmallMapWindow::SmallMapType SmallMapWindow::map_type = SMT_CONTOUR;
 
bool SmallMapWindow::show_towns = true;
 
int SmallMapWindow::max_heightlevel = -1;
 
int SmallMapWindow::map_height_limit = -1;
 

	
 
/**
 
 * Custom container class for displaying smallmap with a vertically resizing legend panel.
 
 * The legend panel has a smallest height that depends on its width. Standard containers cannot handle this case.
 
 *
 
 * @note The container assumes it has two children, the first is the display, the second is the bar with legends and selection image buttons.
src/smallmap_gui.h
Show inline comments
 
@@ -59,13 +59,13 @@ protected:
 
		ZLC_ZOOM_OUT,   ///< Zoom out.
 
		ZLC_ZOOM_IN,    ///< Zoom in.
 
	};
 

	
 
	static SmallMapType map_type; ///< Currently displayed legends.
 
	static bool show_towns;       ///< Display town names in the smallmap.
 
	static int max_heightlevel;   ///< Currently used/cached maximum heightlevel.
 
	static int map_height_limit;  ///< Currently used/cached map height limit.
 

	
 
	static const uint LEGEND_BLOB_WIDTH = 8;              ///< Width of the coloured blob in front of a line text in the #WID_SM_LEGEND widget.
 
	static const uint INDUSTRY_MIN_NUMBER_OF_COLUMNS = 2; ///< Minimal number of columns in the #WID_SM_LEGEND widget for the #SMT_INDUSTRY legend.
 
	static const uint FORCE_REFRESH_PERIOD = 930; ///< map is redrawn after that many milliseconds.
 
	static const uint BLINK_PERIOD         = 450; ///< highlight blinking interval in milliseconds.
 

	
src/table/settings.ini
Show inline comments
 
@@ -388,22 +388,22 @@ proc     = CheckRoadSide
 
cat      = SC_BASIC
 

	
 
; Construction
 

	
 
[SDT_VAR]
 
base     = GameSettings
 
var      = construction.max_heightlevel
 
var      = construction.map_height_limit
 
type     = SLE_UINT8
 
from     = SLV_194
 
guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO
 
def      = DEF_MAX_HEIGHTLEVEL
 
min      = MIN_MAX_HEIGHTLEVEL
 
max      = MAX_MAX_HEIGHTLEVEL
 
def      = DEF_MAP_HEIGHT_LIMIT
 
min      = MIN_MAP_HEIGHT_LIMIT
 
max      = MAX_MAP_HEIGHT_LIMIT
 
interval = 1
 
str      = STR_CONFIG_SETTING_MAX_HEIGHTLEVEL
 
strhelp  = STR_CONFIG_SETTING_MAX_HEIGHTLEVEL_HELPTEXT
 
str      = STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT
 
strhelp  = STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_HELPTEXT
 
strval   = STR_JUST_INT
 
proc     = ChangeMaxHeightLevel
 
cat      = SC_BASIC
 

	
 
[SDT_BOOL]
 
base     = GameSettings
src/terraform_cmd.cpp
Show inline comments
 
@@ -101,13 +101,13 @@ static void TerraformAddDirtyTileAround(
 
static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height)
 
{
 
	assert(tile < MapSize());
 

	
 
	/* Check range of destination height */
 
	if (height < 0) return_cmd_error(STR_ERROR_ALREADY_AT_SEA_LEVEL);
 
	if (height > _settings_game.construction.max_heightlevel) return_cmd_error(STR_ERROR_TOO_HIGH);
 
	if (height > _settings_game.construction.map_height_limit) return_cmd_error(STR_ERROR_TOO_HIGH);
 

	
 
	/*
 
	 * Check if the terraforming has any effect.
 
	 * This can only be true, if multiple corners of the start-tile are terraformed (i.e. the terraforming is done by towns/industries etc.).
 
	 * In this case the terraforming should fail. (Don't know why.)
 
	 */
 
@@ -358,13 +358,13 @@ CommandCost CmdLevelLand(TileIndex tile,
 
		case LM_RAISE: h++; break;
 
		case LM_LOWER: h--; break;
 
		default: return CMD_ERROR;
 
	}
 

	
 
	/* Check range of destination height */
 
	if (h > _settings_game.construction.max_heightlevel) return_cmd_error((oldh == 0) ? STR_ERROR_ALREADY_AT_SEA_LEVEL : STR_ERROR_TOO_HIGH);
 
	if (h > _settings_game.construction.map_height_limit) return_cmd_error((oldh == 0) ? STR_ERROR_ALREADY_AT_SEA_LEVEL : STR_ERROR_TOO_HIGH);
 

	
 
	Money money = GetAvailableMoneyForCommand();
 
	CommandCost cost(EXPENSES_CONSTRUCTION);
 
	CommandCost last_error(lm == LM_LEVEL ? STR_ERROR_ALREADY_LEVELLED : INVALID_STRING_ID);
 
	bool had_success = false;
 

	
src/tgp.cpp
Show inline comments
 
@@ -233,13 +233,14 @@ static height_t TGPGetMaxHeight()
 
		{  10,  11,  17,  19,  49,  63,  73 }, ///< Mountainous
 
		{  12,  19,  25,  31,  67,  75,  87 }, ///< Alpinist
 
	};
 

	
 
	int map_size_bucket = std::min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS;
 
	int max_height_from_table = max_height[_settings_game.difficulty.terrain_type][map_size_bucket];
 
	return I2H(std::min<uint>(max_height_from_table, _settings_game.construction.max_heightlevel));
 

	
 
	return I2H(std::min<uint>(max_height_from_table, _settings_game.construction.map_height_limit));
 
}
 

	
 
/**
 
 * Get the amplitude associated with the currently selected
 
 * smoothness and maximum height level.
 
 * @param frequency The frequency to get the amplitudes for
src/tile_type.h
Show inline comments
 
@@ -18,15 +18,15 @@ static const uint TILE_HEIGHT         = 
 
static const uint MAX_BUILDING_PIXELS = 200;                   ///< Maximum height of a building in pixels in #ZOOM_LVL_BASE. (Also applies to "bridge buildings" on the bridge floor.)
 
static const int MAX_VEHICLE_PIXEL_X  = 192;                   ///< Maximum width of a vehicle in pixels in #ZOOM_LVL_BASE.
 
static const int MAX_VEHICLE_PIXEL_Y  = 96;                    ///< Maximum height of a vehicle in pixels in #ZOOM_LVL_BASE.
 

	
 
static const uint MAX_TILE_HEIGHT     = 255;                   ///< Maximum allowed tile height
 

	
 
static const uint MIN_MAX_HEIGHTLEVEL = 15;                    ///< Lower bound of maximum allowed heightlevel (in the construction settings)
 
static const uint DEF_MAX_HEIGHTLEVEL = 30;                    ///< Default maximum allowed heightlevel (in the construction settings)
 
static const uint MAX_MAX_HEIGHTLEVEL = MAX_TILE_HEIGHT;       ///< Upper bound of maximum allowed heightlevel (in the construction settings)
 
static const uint MIN_MAP_HEIGHT_LIMIT = 15;                   ///< Lower bound of maximum allowed heightlevel (in the construction settings)
 
static const uint DEF_MAP_HEIGHT_LIMIT = 30;                   ///< Default maximum allowed heightlevel (in the construction settings)
 
static const uint MAX_MAP_HEIGHT_LIMIT = MAX_TILE_HEIGHT;      ///< Upper bound of maximum allowed heightlevel (in the construction settings)
 

	
 
static const uint MIN_SNOWLINE_HEIGHT = 2;                     ///< Minimum snowline height
 
static const uint DEF_SNOWLINE_HEIGHT = 10;                    ///< Default snowline height
 
static const uint MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2); ///< Maximum allowed snowline height
 

	
 
static const uint DEF_SNOW_COVERAGE = 40;                      ///< Default snow coverage.
0 comments (0 inline, 0 general)