summaryrefslogtreecommitdiff
path: root/src/station_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
commitfef64185b87e4517b7760e017171d646eaa1eb69 (patch)
tree66f89fc328e49813581c22632a0a9cb21d7c2eb8 /src/station_cmd.cpp
parent5647bd5157b623348feb202623057fd84eb9c3c5 (diff)
downloadopenttd-fef64185b87e4517b7760e017171d646eaa1eb69.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/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 6e9993f8a..6113276b3 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -42,6 +42,7 @@
#include "road.h"
#include "cargotype.h"
#include "strings.h"
+#include "autoslope.h"
DEFINE_OLD_POOL_GENERIC(Station, Station)
DEFINE_OLD_POOL_GENERIC(RoadStop, RoadStop)
@@ -2880,6 +2881,36 @@ void AfterLoadStations()
static CommandCost TerraformTile_Station(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
{
+ if (_patches.build_on_slopes && AutoslopeEnabled()) {
+ /* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.
+ * TTDP does not call it.
+ */
+ if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new))) {
+ switch (GetStationType(tile)) {
+ case STATION_RAIL: {
+ DiagDirection direction = AxisToDiagDir(GetRailStationAxis(tile));
+ if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, direction)) break;
+ if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, ReverseDiagDir(direction))) break;
+ return _price.terraform;
+ }
+
+ case STATION_AIRPORT:
+ return _price.terraform;
+
+ case STATION_TRUCK:
+ case STATION_BUS: {
+ DiagDirection direction = GetRoadStopDir(tile);
+ if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, direction)) break;
+ if (IsDriveThroughStopTile(tile)) {
+ if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, ReverseDiagDir(direction))) break;
+ }
+ return _price.terraform;
+ }
+
+ default: break;
+ }
+ }
+ }
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
}