summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-09-21 11:27:34 +0000
committerrubidium <rubidium@openttd.org>2014-09-21 11:27:34 +0000
commitf41b55f0ff6ee71d8e40cd522ae175bcb28c35c5 (patch)
tree3e1f5c7e5c6fc362ee671d9136d3dcdfce77570b
parent9daf7e749ccb00873443e2261379bf31999664d9 (diff)
downloadopenttd-f41b55f0ff6ee71d8e40cd522ae175bcb28c35c5.tar.xz
(svn r26880) -Add: stub settings for limiting bridge and map height
-rw-r--r--src/cheat_type.h1
-rw-r--r--src/saveload/afterload.cpp2
-rw-r--r--src/settings_type.h2
-rw-r--r--src/table/settings.ini26
-rw-r--r--src/tile_type.h4
5 files changed, 35 insertions, 0 deletions
diff --git a/src/cheat_type.h b/src/cheat_type.h
index a345cdd3b..845574772 100644
--- a/src/cheat_type.h
+++ b/src/cheat_type.h
@@ -36,6 +36,7 @@ struct Cheats {
Cheat change_date; ///< changes date ingame
Cheat setup_prod; ///< setup raw-material production in game
Cheat dummy3; ///< empty cheat (enable running el-engines on normal rail)
+ Cheat edit_max_hl; ///< edit the maximum heightlevel
};
extern Cheats _cheats;
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index cb3eae472..d16b34ddc 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -583,6 +583,8 @@ bool AfterLoadGame()
}
if (IsSavegameVersionBefore(194)) {
+ _settings_game.construction.max_heightlevel = 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);
diff --git a/src/settings_type.h b/src/settings_type.h
index c51024c00..0cd9b9b75 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -296,9 +296,11 @@ struct GameCreationSettings {
/** Settings related to construction in-game */
struct ConstructionSettings {
+ uint8 max_heightlevel; ///< 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
bool extra_dynamite; ///< extra dynamite
diff --git a/src/table/settings.ini b/src/table/settings.ini
index 3e5a222de..e74b11e52 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -377,6 +377,19 @@ proc = CheckRoadSide
; Construction
+[SDT_VAR]
+base = GameSettings
+var = construction.max_heightlevel
+type = SLE_UINT8
+from = 194
+guiflags = SGF_NEWGAME_ONLY | SGF_NO_NETWORK
+def = DEF_MAX_HEIGHTLEVEL
+min = MIN_MAX_HEIGHTLEVEL
+max = MAX_MAX_HEIGHTLEVEL
+interval = 1
+strval = STR_JUST_INT
+cat = SC_BASIC
+
[SDT_BOOL]
base = GameSettings
var = construction.build_on_slopes
@@ -496,6 +509,19 @@ strval = STR_CONFIG_SETTING_TILE_LENGTH
[SDT_VAR]
base = GameSettings
+var = construction.max_bridge_height
+type = SLE_UINT8
+from = 194
+guiflags = SGF_NO_NETWORK
+def = 12
+min = 1
+max = MAX_TILE_HEIGHT
+interval = 1
+strval = STR_JUST_COMMA
+cat = SC_EXPERT
+
+[SDT_VAR]
+base = GameSettings
var = construction.max_tunnel_length
type = SLE_UINT16
from = 159
diff --git a/src/tile_type.h b/src/tile_type.h
index 34543eb93..7276307af 100644
--- a/src/tile_type.h
+++ b/src/tile_type.h
@@ -19,6 +19,10 @@ static const uint TILE_HEIGHT = 8; ///< The standard height-diffe
static const uint MAX_TILE_HEIGHT = 15; ///< 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 = 15; ///< 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_SNOWLINE_HEIGHT = 2; ///< Minimum snowline height
static const uint DEF_SNOWLINE_HEIGHT = 7; ///< Default snowline height
static const uint MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2); ///< Maximum allowed snowline height