summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-10-13 14:22:48 +0000
committerrubidium <rubidium@openttd.org>2014-10-13 14:22:48 +0000
commit8d90e86c2c6b0ae633714d015c0b9dcbba421185 (patch)
tree02ce0d0f48e24a044afbc472bf820bc6f7d0ce36
parentfcdbdd60439578a8bae7b3e211e7e088ebcb6785 (diff)
downloadopenttd-8d90e86c2c6b0ae633714d015c0b9dcbba421185.tar.xz
(svn r27009) -Add: extra level of general map heightness (ChillCore)
-rw-r--r--src/genworld_gui.cpp14
-rw-r--r--src/landscape.cpp3
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/table/settings.ini2
-rw-r--r--src/tgp.cpp3
5 files changed, 17 insertions, 6 deletions
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index d968663f8..475cef8e7 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -296,7 +296,7 @@ static DropDownList *BuildMapsizeDropDown()
return list;
}
-static const StringID _elevations[] = {STR_TERRAIN_TYPE_VERY_FLAT, STR_TERRAIN_TYPE_FLAT, STR_TERRAIN_TYPE_HILLY, STR_TERRAIN_TYPE_MOUNTAINOUS, INVALID_STRING_ID};
+static const StringID _elevations[] = {STR_TERRAIN_TYPE_VERY_FLAT, STR_TERRAIN_TYPE_FLAT, STR_TERRAIN_TYPE_HILLY, STR_TERRAIN_TYPE_MOUNTAINOUS, STR_TERRAIN_TYPE_ALPINIST, INVALID_STRING_ID};
static const StringID _sea_lakes[] = {STR_SEA_LEVEL_VERY_LOW, STR_SEA_LEVEL_LOW, STR_SEA_LEVEL_MEDIUM, STR_SEA_LEVEL_HIGH, STR_SEA_LEVEL_CUSTOM, INVALID_STRING_ID};
static const StringID _rivers[] = {STR_RIVERS_NONE, STR_RIVERS_FEW, STR_RIVERS_MODERATE, STR_RIVERS_LOT, INVALID_STRING_ID};
static const StringID _smoothness[] = {STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_SMOOTH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_ROUGH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_ROUGH, INVALID_STRING_ID};
@@ -650,7 +650,8 @@ struct GenerateLandscapeWindow : public Window {
break;
case WID_GL_TERRAIN_PULLDOWN: // Terrain type
- ShowDropDownMenu(this, _elevations, _settings_newgame.difficulty.terrain_type, WID_GL_TERRAIN_PULLDOWN, 0, 0);
+ /* For the original map generation only the first four are valid. */
+ ShowDropDownMenu(this, _elevations, _settings_newgame.difficulty.terrain_type, WID_GL_TERRAIN_PULLDOWN, 0, _settings_newgame.game_creation.land_generator == LG_ORIGINAL ? ~0xF : 0);
break;
case WID_GL_WATER_PULLDOWN: { // Water quantity
@@ -723,7 +724,14 @@ struct GenerateLandscapeWindow : public Window {
case WID_GL_RIVER_PULLDOWN: _settings_newgame.game_creation.amount_of_rivers = index; break;
case WID_GL_SMOOTHNESS_PULLDOWN: _settings_newgame.game_creation.tgen_smoothness = index; break;
case WID_GL_VARIETY_PULLDOWN: _settings_newgame.game_creation.variety = index; break;
- case WID_GL_LANDSCAPE_PULLDOWN: _settings_newgame.game_creation.land_generator = index; break;
+
+ case WID_GL_LANDSCAPE_PULLDOWN: _settings_newgame.game_creation.land_generator = index;
+ /* If original landgenerator is selected and alpinist terrain_type was selected, revert to mountainous. */
+ if (_settings_newgame.game_creation.land_generator == LG_ORIGINAL) {
+ _settings_newgame.difficulty.terrain_type = Clamp(_settings_newgame.difficulty.terrain_type, 0, 3);
+ }
+ break;
+
case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: _settings_newgame.game_creation.heightmap_rotation = index; break;
case WID_GL_TOWN_PULLDOWN:
diff --git a/src/landscape.cpp b/src/landscape.cpp
index 0f21b2920..d1c73fd42 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -1273,7 +1273,8 @@ void GenerateLandscape(byte mode)
assert(_settings_game.difficulty.quantity_sea_lakes != CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY);
uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _settings_game.difficulty.quantity_sea_lakes) * 256 + 100);
for (; i != 0; --i) {
- GenerateTerrain(_settings_game.difficulty.terrain_type, 0);
+ /* Make sure we do not overflow. */
+ GenerateTerrain(Clamp(_settings_game.difficulty.terrain_type, 0, 3), 0);
}
break;
}
diff --git a/src/lang/english.txt b/src/lang/english.txt
index c718d5af7..156012108 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1084,6 +1084,7 @@ STR_TERRAIN_TYPE_VERY_FLAT :Very Flat
STR_TERRAIN_TYPE_FLAT :Flat
STR_TERRAIN_TYPE_HILLY :Hilly
STR_TERRAIN_TYPE_MOUNTAINOUS :Mountainous
+STR_TERRAIN_TYPE_ALPINIST :Alpinist
STR_CITY_APPROVAL_PERMISSIVE :Permissive
STR_CITY_APPROVAL_TOLERANT :Tolerant
diff --git a/src/table/settings.ini b/src/table/settings.ini
index 7a4c6dc34..3cd29e067 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -255,7 +255,7 @@ from = 97
guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY
def = 1
min = 0
-max = 3
+max = 4
interval = 1
str = STR_CONFIG_SETTING_TERRAIN_TYPE
strhelp = STR_CONFIG_SETTING_TERRAIN_TYPE_HELPTEXT
diff --git a/src/tgp.cpp b/src/tgp.cpp
index 6f6fd1f01..4e26ffe42 100644
--- a/src/tgp.cpp
+++ b/src/tgp.cpp
@@ -227,12 +227,13 @@ static height_t TGPGetMaxHeight()
* raised land 24 times in the center of the map) will leave only a ring of about 10 tiles
* around the mountain to build on. On a 4096x4096 map, it won't cover any major part of the map.
*/
- static const int max_height[4][MAX_MAP_SIZE_BITS - MIN_MAP_SIZE_BITS + 1] = {
+ static const int max_height[5][MAX_MAP_SIZE_BITS - MIN_MAP_SIZE_BITS + 1] = {
/* 64 128 256 512 1024 2048 4096 */
{ 3, 3, 5, 5, 5, 5, 5 }, ///< Very flat
{ 4, 4, 6, 10, 10, 10, 10 }, ///< Flat
{ 6, 9, 15, 25, 31, 31, 31 }, ///< Hilly
{ 7, 12, 23, 42, 78, 85, 85 }, ///< Mountainous
+ { 12, 21, 36, 73, 146, 170, 170 } ///< Alpinist
};
int max_height_from_table = max_height[_settings_game.difficulty.terrain_type][min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS];