summaryrefslogtreecommitdiff
path: root/src/rail_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-01-23 22:34:04 +0000
committersmatz <smatz@openttd.org>2008-01-23 22:34:04 +0000
commit5a7c9037709772e4678ee57d9b42f5332bd66f97 (patch)
treeae76a3390a465cf3bfc011e2b32d53d5ae55c298 /src/rail_cmd.cpp
parentb5641ae0f2ca3723af7fe7f68c4ac45e113e8421 (diff)
downloadopenttd-5a7c9037709772e4678ee57d9b42f5332bd66f97.tar.xz
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r--src/rail_cmd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 3c39cf266..c646b3a5c 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -40,6 +40,7 @@
#include "vehicle_func.h"
#include "sound_func.h"
#include "signal_func.h"
+#include "tunnelbridge.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -939,7 +940,7 @@ static bool CheckSignalAutoFill(TileIndex &tile, Trackdir &trackdir, int &signal
* note that tile is a parameter by reference, so it must be updated */
tile = GetOtherTunnelBridgeEnd(tile);
- signal_ctr += 2 + DistanceMax(orig_tile, tile) * 2;
+ signal_ctr += (GetTunnelBridgeLength(orig_tile, tile) + 2) * 2;
return true;
}
@@ -1294,7 +1295,7 @@ CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
}
- cost.AddCost((DistanceManhattan(tile, endtile) + 1) * RailConvertCost(type, totype));
+ cost.AddCost((GetTunnelBridgeLength(tile, endtile) + 2) * RailConvertCost(type, totype));
} break;
default: // MP_STATION, MP_ROAD