summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-09-14 22:27:40 +0000
committerrubidium <rubidium@openttd.org>2007-09-14 22:27:40 +0000
commit3055d42fc4c0e58deb6b37ff712d754384b9c174 (patch)
tree66f89fc328e49813581c22632a0a9cb21d7c2eb8 /src/town_cmd.cpp
parent9e14778057689f1f7e6efb2b0708cbe70c7c3101 (diff)
downloadopenttd-3055d42fc4c0e58deb6b37ff712d754384b9c174.tar.xz
(svn r11107) -Feature: some tool so one can still build tunnels under rails (and other structures) when the owner of the structure built it on foundations and if you have enough "empty" space ofcourse. One could use the tool for some other construction needs too. Patch by frosch.
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index f399f09a2..d192e1a28 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -41,6 +41,7 @@
#include "newgrf_commons.h"
#include "newgrf_townname.h"
#include "misc/autoptr.hpp"
+#include "autoslope.h"
/* Initialize the town-pool */
DEFINE_OLD_POOL_GENERIC(Town, Town)
@@ -2309,6 +2310,15 @@ void InitializeTowns()
static CommandCost TerraformTile_Town(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
{
+ if (AutoslopeEnabled()) {
+ HouseID house = GetHouseType(tile);
+ HouseSpec *hs = GetHouseSpecs(house);
+
+ /* Here we differ from TTDP by checking TILE_NOT_SLOPED */
+ if (((hs->building_flags & TILE_NOT_SLOPED) == 0) && !IsSteepSlope(tileh_new) &&
+ (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new))) return _price.terraform;
+ }
+
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
}