summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-02-14 21:55:30 +0000
committerfrosch <frosch@openttd.org>2015-02-14 21:55:30 +0000
commit310258f2834693e2794c1e6fbe88ba9cca2af77a (patch)
tree0021d307f253de199af72928dc6ab93796f87f4b /src/settings.cpp
parent64e943d32af130641380a2099b494e8b2a9b0f43 (diff)
downloadopenttd-310258f2834693e2794c1e6fbe88ba9cca2af77a.tar.xz
(svn r27151) -Add: Allow changing max heightlevel in scenario editor.
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index e2baed5ba..9dc08ecc1 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1277,6 +1277,27 @@ static bool ChangeDynamicEngines(int32 p1)
return true;
}
+static bool ChangeMaxHeightLevel(int32 p1)
+{
+ if (_game_mode == GM_NORMAL) return false;
+ if (_game_mode != GM_EDITOR) return true;
+
+ /* 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 false;
+ }
+ }
+
+ /* The smallmap uses an index from heightlevels to colours. Trigger rebuilding it. */
+ InvalidateWindowClassesData(WC_SMALLMAP, 2);
+
+ return true;
+}
+
static bool StationCatchmentChanged(int32 p1)
{
Station::RecomputeIndustriesNearForAll();