mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
(svn r27151) -Add: Allow changing max heightlevel in scenario editor.
This commit is contained in:
parent
64e943d32a
commit
310258f283
@ -125,7 +125,8 @@ static int32 ClickChangeDateCheat(int32 p1, int32 p2)
|
|||||||
* @return New value (or unchanged old value) of the maximum
|
* @return New value (or unchanged old value) of the maximum
|
||||||
* allowed heightlevel value.
|
* allowed heightlevel value.
|
||||||
*/
|
*/
|
||||||
static int32 ClickChangeMaxHlCheat(int32 p1, int32 p2) {
|
static int32 ClickChangeMaxHlCheat(int32 p1, int32 p2)
|
||||||
|
{
|
||||||
p1 = Clamp(p1, MIN_MAX_HEIGHTLEVEL, MAX_MAX_HEIGHTLEVEL);
|
p1 = Clamp(p1, MIN_MAX_HEIGHTLEVEL, MAX_MAX_HEIGHTLEVEL);
|
||||||
|
|
||||||
/* Check if at least one mountain on the map is higher than the new value.
|
/* Check if at least one mountain on the map is higher than the new value.
|
||||||
|
@ -1277,6 +1277,27 @@ static bool ChangeDynamicEngines(int32 p1)
|
|||||||
return true;
|
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)
|
static bool StationCatchmentChanged(int32 p1)
|
||||||
{
|
{
|
||||||
Station::RecomputeIndustriesNearForAll();
|
Station::RecomputeIndustriesNearForAll();
|
||||||
|
@ -28,6 +28,7 @@ static bool TownFoundingChanged(int32 p1);
|
|||||||
static bool DifficultyNoiseChange(int32 i);
|
static bool DifficultyNoiseChange(int32 i);
|
||||||
static bool MaxNoAIsChange(int32 i);
|
static bool MaxNoAIsChange(int32 i);
|
||||||
static bool CheckRoadSide(int p1);
|
static bool CheckRoadSide(int p1);
|
||||||
|
static bool ChangeMaxHeightLevel(int32 p1);
|
||||||
static bool CheckFreeformEdges(int32 p1);
|
static bool CheckFreeformEdges(int32 p1);
|
||||||
static bool ChangeDynamicEngines(int32 p1);
|
static bool ChangeDynamicEngines(int32 p1);
|
||||||
static bool StationCatchmentChanged(int32 p1);
|
static bool StationCatchmentChanged(int32 p1);
|
||||||
@ -382,7 +383,7 @@ base = GameSettings
|
|||||||
var = construction.max_heightlevel
|
var = construction.max_heightlevel
|
||||||
type = SLE_UINT8
|
type = SLE_UINT8
|
||||||
from = 194
|
from = 194
|
||||||
guiflags = SGF_NEWGAME_ONLY | SGF_NO_NETWORK
|
guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO
|
||||||
def = DEF_MAX_HEIGHTLEVEL
|
def = DEF_MAX_HEIGHTLEVEL
|
||||||
min = MIN_MAX_HEIGHTLEVEL
|
min = MIN_MAX_HEIGHTLEVEL
|
||||||
max = MAX_MAX_HEIGHTLEVEL
|
max = MAX_MAX_HEIGHTLEVEL
|
||||||
@ -390,6 +391,7 @@ interval = 1
|
|||||||
str = STR_CONFIG_SETTING_MAX_HEIGHTLEVEL
|
str = STR_CONFIG_SETTING_MAX_HEIGHTLEVEL
|
||||||
strhelp = STR_CONFIG_SETTING_MAX_HEIGHTLEVEL_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_MAX_HEIGHTLEVEL_HELPTEXT
|
||||||
strval = STR_JUST_INT
|
strval = STR_JUST_INT
|
||||||
|
proc = ChangeMaxHeightLevel
|
||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
[SDT_BOOL]
|
[SDT_BOOL]
|
||||||
|
Loading…
Reference in New Issue
Block a user