diff options
author | smatz <smatz@openttd.org> | 2008-01-23 22:34:04 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-01-23 22:34:04 +0000 |
commit | 74af65e556f6cedf4de72737fb27831f603953c4 (patch) | |
tree | ae76a3390a465cf3bfc011e2b32d53d5ae55c298 /src/road_cmd.cpp | |
parent | dbd4d7d6a8a4449cf1939752331a95c15ad276f9 (diff) | |
download | openttd-74af65e556f6cedf4de72737fb27831f603953c4.tar.xz |
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r-- | src/road_cmd.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 7aaf7f8a3..060b61a24 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -33,6 +33,7 @@ #include "vehicle_base.h" #include "sound_func.h" #include "road_func.h" +#include "tunnelbridge.h" #include "table/sprites.h" #include "table/strings.h" @@ -159,7 +160,7 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (IsTileType(tile, MP_TUNNELBRIDGE)) { TileIndex other_end = GetOtherTunnelBridgeEnd(tile); /* Pay for *every* tile of the bridge or tunnel */ - cost.AddCost((DistanceManhattan(other_end, tile) + 1) * _price.remove_road); + cost.AddCost((GetTunnelBridgeLength(other_end, tile) + 2) * _price.remove_road); if (flags & DC_EXEC) { SetRoadTypes(other_end, GetRoadTypes(other_end) & ~RoadTypeToRoadTypes(rt)); SetRoadTypes(tile, GetRoadTypes(tile) & ~RoadTypeToRoadTypes(rt)); @@ -551,7 +552,7 @@ do_clear:; cost.AddCost(CountBits(pieces) * _price.build_road); if (IsTileType(tile, MP_TUNNELBRIDGE)) { /* Pay for *every* tile of the bridge or tunnel */ - cost.MultiplyCost(DistanceManhattan(GetOtherTunnelBridgeEnd(tile), tile) + 1); + cost.MultiplyCost(GetTunnelBridgeLength(GetOtherTunnelBridgeEnd(tile), tile) + 2); } if (flags & DC_EXEC) { |