comparison src/station_cmd.cpp @ 7582:e77bd387f449 draft

(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.
author rubidium <rubidium@openttd.org>
date Fri, 14 Sep 2007 22:27:40 +0000
parents a84d70ad7876
children 610b2a5d634a
comparison
equal deleted inserted replaced
7581:2572ccd87c4e 7582:e77bd387f449
40 #include "helpers.hpp" 40 #include "helpers.hpp"
41 #include "misc/autoptr.hpp" 41 #include "misc/autoptr.hpp"
42 #include "road.h" 42 #include "road.h"
43 #include "cargotype.h" 43 #include "cargotype.h"
44 #include "strings.h" 44 #include "strings.h"
45 #include "autoslope.h"
45 46
46 DEFINE_OLD_POOL_GENERIC(Station, Station) 47 DEFINE_OLD_POOL_GENERIC(Station, Station)
47 DEFINE_OLD_POOL_GENERIC(RoadStop, RoadStop) 48 DEFINE_OLD_POOL_GENERIC(RoadStop, RoadStop)
48 49
49 50
2878 } 2879 }
2879 } 2880 }
2880 2881
2881 static CommandCost TerraformTile_Station(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new) 2882 static CommandCost TerraformTile_Station(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
2882 { 2883 {
2884 if (_patches.build_on_slopes && AutoslopeEnabled()) {
2885 /* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.
2886 * TTDP does not call it.
2887 */
2888 if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new))) {
2889 switch (GetStationType(tile)) {
2890 case STATION_RAIL: {
2891 DiagDirection direction = AxisToDiagDir(GetRailStationAxis(tile));
2892 if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, direction)) break;
2893 if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, ReverseDiagDir(direction))) break;
2894 return _price.terraform;
2895 }
2896
2897 case STATION_AIRPORT:
2898 return _price.terraform;
2899
2900 case STATION_TRUCK:
2901 case STATION_BUS: {
2902 DiagDirection direction = GetRoadStopDir(tile);
2903 if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, direction)) break;
2904 if (IsDriveThroughStopTile(tile)) {
2905 if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, ReverseDiagDir(direction))) break;
2906 }
2907 return _price.terraform;
2908 }
2909
2910 default: break;
2911 }
2912 }
2913 }
2883 return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); 2914 return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
2884 } 2915 }
2885 2916
2886 2917
2887 extern const TileTypeProcs _tile_type_station_procs = { 2918 extern const TileTypeProcs _tile_type_station_procs = {