diff options
author | Erich Eckner <git@eckner.net> | 2018-11-19 16:10:09 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2021-07-21 19:01:20 +0200 |
commit | 95f4c22ef5897c597592b03bcd0617f8d2d2aa8d (patch) | |
tree | cec7ec814fb84d51e2bf16fa679c91416466e402 | |
parent | 9d59706168faa9072a510a4b02a7f761e47fb67d (diff) | |
download | openttd-95f4c22ef5897c597592b03bcd0617f8d2d2aa8d.tar.xz |
removed some slope checks
-rw-r--r-- | src/station_cmd.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 1707bdf15..60396da7a 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -776,7 +776,7 @@ CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags); * Checks if the given tile is buildable, flat and has a certain height. * @param tile TileIndex to check. * @param invalid_dirs Prohibited directions for slopes (set of #DiagDirection). - * @param allowed_z Height allowed for the tile. If allowed_z is negative, it will be set to the height of this tile. + * @param allowed_z Height allowed for the tile. If allowed_z is -1, it will be set to the height of this tile. * @param allow_steep Whether steep slopes are allowed. * @param check_bridge Check for the existence of a bridge. * @return The cost in case of success, or an error code if it failed. @@ -814,11 +814,11 @@ CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z cost.AddCost(_price[PR_BUILD_FOUNDATION]); } - /* The level of this tile must be equal to allowed_z. */ - if (allowed_z < 0) { + /* The level of this tile must be equal to allowed_z. */ + if (allowed_z == -1) { /* First tile. */ allowed_z = flat_z; - } else if (allowed_z != flat_z) { + } else if (allowed_z != flat_z && allowed_z >= 0) { return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED); } @@ -866,14 +866,14 @@ static CommandCost CheckFlatLandAirport(AirportTileTableIterator tile_iter, DoCo static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, std::vector<Train *> &affected_vehicles, StationClassID spec_class, byte spec_index, byte plat_len, byte numtracks) { CommandCost cost(EXPENSES_CONSTRUCTION); - int allowed_z = -1; + int allowed_z = -2; uint invalid_dirs = 5 << axis; const StationSpec *statspec = StationClass::Get(spec_class)->GetSpec(spec_index); bool slope_cb = statspec != nullptr && HasBit(statspec->callback_mask, CBM_STATION_SLOPE_CHECK); for (TileIndex tile_cur : tile_area) { - CommandCost ret = CheckBuildableTile(tile_cur, invalid_dirs, allowed_z, false); + CommandCost ret = CheckBuildableTile(tile_cur, 0, allowed_z, true); if (ret.Failed()) return ret; cost.AddCost(ret); @@ -949,14 +949,13 @@ static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag fl * @param rt Road type to build. * @return The cost in case of success, or an error code if it failed. */ -static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags, uint invalid_dirs, bool is_drive_through, bool is_truck_stop, Axis axis, StationID *station, RoadType rt) +static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags, bool is_drive_through, bool is_truck_stop, Axis axis, StationID *station, RoadType rt) { CommandCost cost(EXPENSES_CONSTRUCTION); - int allowed_z = -1; -// TODO: possibly needs some checks for slope, too? + int allowed_z = -2; for (TileIndex cur_tile : tile_area) { - CommandCost ret = CheckBuildableTile(cur_tile, invalid_dirs, allowed_z, !is_drive_through); + CommandCost ret = CheckBuildableTile(cur_tile, 0, allowed_z, true); if (ret.Failed()) return ret; cost.AddCost(ret); @@ -1879,7 +1878,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin /* Total road stop cost. */ CommandCost cost(EXPENSES_CONSTRUCTION, roadstop_area.w * roadstop_area.h * _price[type ? PR_BUILD_STATION_TRUCK : PR_BUILD_STATION_BUS]); StationID est = INVALID_STATION; - ret = CheckFlatLandRoadStop(roadstop_area, flags, is_drive_through ? 5 << axis : 1 << ddir, is_drive_through, type, axis, &est, rt); + ret = CheckFlatLandRoadStop(roadstop_area, flags, is_drive_through, type, axis, &est, rt); if (ret.Failed()) return ret; cost.AddCost(ret); |