diff options
author | Erich Eckner <git@eckner.net> | 2018-11-05 22:43:31 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2022-01-16 21:58:15 +0100 |
commit | 795c8b2f9c2d5b6a7ccf0504f62d8426a8bc79ec (patch) | |
tree | 41abe6fdc04cd8f12f6309891a373fefe310e1e2 /src/rail_cmd.cpp | |
parent | ac2a6b19fc3d83e16d200fdddff2c965bb7d52b3 (diff) | |
download | openttd-795c8b2f9c2d5b6a7ccf0504f62d8426a8bc79ec.tar.xz |
UNDERGROUND_COST_MULTIPLIER new
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r-- | src/rail_cmd.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 88f4adb0f..0197dd6a4 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -538,12 +538,12 @@ CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType rai uint num_new_road_pieces = (road != ROAD_NONE) ? 2 - CountBits(road) : 0; if (num_new_road_pieces > 0) { - cost.AddCost(num_new_road_pieces * RoadBuildCost(roadtype_road)); + cost.AddCost(num_new_road_pieces * RoadBuildCost(roadtype_road) * UNDERGROUND_COST_MULTIPLIER(tile)); } uint num_new_tram_pieces = (tram != ROAD_NONE) ? 2 - CountBits(tram) : 0; if (num_new_tram_pieces > 0) { - cost.AddCost(num_new_tram_pieces * RoadBuildCost(roadtype_tram)); + cost.AddCost(num_new_tram_pieces * RoadBuildCost(roadtype_tram) * UNDERGROUND_COST_MULTIPLIER(tile)); } if (flags & DC_EXEC) { @@ -606,7 +606,7 @@ CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType rai YapfNotifyTrackLayoutChange(tile, track); } - cost.AddCost(RailBuildCost(railtype)); + cost.AddCost(RailBuildCost(railtype) * UNDERGROUND_COST_MULTIPLIER(tile)); return cost; } @@ -647,7 +647,7 @@ CommandCost CmdRemoveSingleRail(DoCommandFlag flags, TileIndex tile, Track track if (ret.Failed()) return ret; } - cost.AddCost(RailClearCost(GetRailType(tile))); + cost.AddCost(RailClearCost(GetRailType(tile)) * UNDERGROUND_COST_MULTIPLIER(tile)); if (flags & DC_EXEC) { if (HasReservedTracks(tile, trackbit)) { @@ -681,7 +681,7 @@ CommandCost CmdRemoveSingleRail(DoCommandFlag flags, TileIndex tile, Track track if ((present & trackbit) == 0) return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); if (present == (TRACK_BIT_X | TRACK_BIT_Y)) crossing = true; - cost.AddCost(RailClearCost(GetRailType(tile))); + cost.AddCost(RailClearCost(GetRailType(tile)) * UNDERGROUND_COST_MULTIPLIER(tile)); /* Charge extra to remove signals on the track, if they are there */ if (HasSignalOnTrack(tile, track)) { @@ -983,7 +983,7 @@ CommandCost CmdBuildTrainDepot(DoCommandFlag flags, TileIndex tile, RailType rai if (!_settings_game.construction.build_on_slopes || !CanBuildDepotByTileh(dir, tileh)) { return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED); } - cost.AddCost(_price[PR_BUILD_FOUNDATION]); + cost.AddCost(_price[PR_BUILD_FOUNDATION] * UNDERGROUND_COST_MULTIPLIER(tile)); } cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile)); @@ -1008,8 +1008,8 @@ CommandCost CmdBuildTrainDepot(DoCommandFlag flags, TileIndex tile, RailType rai YapfNotifyTrackLayoutChange(tile, DiagDirToDiagTrack(dir)); } - cost.AddCost(_price[PR_BUILD_DEPOT_TRAIN]); - cost.AddCost(RailBuildCost(railtype)); + cost.AddCost(_price[PR_BUILD_DEPOT_TRAIN] * UNDERGROUND_COST_MULTIPLIER(tile)); + cost.AddCost(RailBuildCost(railtype) * UNDERGROUND_COST_MULTIPLIER(tile)); return cost; } @@ -1641,7 +1641,7 @@ CommandCost CmdConvertRail(DoCommandFlag flags, TileIndex tile, TileIndex area_s InvalidateWindowData(WC_BUILD_VEHICLE, tile); } found_convertible_track = true; - cost.AddCost(RailConvertCost(type, totype)); + cost.AddCost(RailConvertCost(type, totype) * UNDERGROUND_COST_MULTIPLIER(tile)); break; default: // RAIL_TILE_NORMAL, RAIL_TILE_SIGNALS @@ -1653,7 +1653,7 @@ CommandCost CmdConvertRail(DoCommandFlag flags, TileIndex tile, TileIndex area_s } } found_convertible_track = true; - cost.AddCost(RailConvertCost(type, totype) * CountBits(GetTrackBits(tile))); + cost.AddCost(RailConvertCost(type, totype) * CountBits(GetTrackBits(tile)) * UNDERGROUND_COST_MULTIPLIER(tile)); break; } break; @@ -1716,7 +1716,7 @@ CommandCost CmdConvertRail(DoCommandFlag flags, TileIndex tile, TileIndex area_s } found_convertible_track = true; - cost.AddCost((GetTunnelBridgeLength(tile, endtile) + 2) * RailConvertCost(type, totype)); + cost.AddCost((GetTunnelBridgeLength(tile, endtile) + 2) * RailConvertCost(type, totype) * UNDERGROUND_COST_MULTIPLIER(tile)); break; } @@ -1727,7 +1727,7 @@ CommandCost CmdConvertRail(DoCommandFlag flags, TileIndex tile, TileIndex area_s } found_convertible_track = true; - cost.AddCost(RailConvertCost(type, totype)); + cost.AddCost(RailConvertCost(type, totype) * UNDERGROUND_COST_MULTIPLIER(tile)); break; } |