Introduce setting for a max height level for towns

Prior to this change, the game tended to place towns on mountain tops. Realistic heightmaps had limitations because of this.

This change allows the player to specify that the towns should be generated in the valleys.
This commit is contained in:
Andreas Schmitt
2021-06-19 03:48:05 +02:00
committed by Jonathan G Rennison
parent d718ba62ef
commit a17efcd7d5
5 changed files with 26 additions and 3 deletions

View File

@@ -2118,6 +2118,11 @@ static CommandCost TownCanBePlacedHere(TileIndex tile)
return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_TOWN);
}
/* Check max height level. */
if (GetTileZ(tile) > _settings_game.economy.max_town_heightlevel) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
/* Can only build on clear flat areas, possibly with trees. */
if ((!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES)) || !IsTileFlat(tile)) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);