summaryrefslogtreecommitdiff
path: root/src/rail_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-09-07 11:23:10 +0000
committerrubidium <rubidium@openttd.org>2008-09-07 11:23:10 +0000
commit9474db5cb6c4b9db2f7b68d1dda1a523305282f1 (patch)
tree94706b006a8848169482c99bfbb9ca6f9c734954 /src/rail_cmd.cpp
parentf4ee4fd5aed4861fe65757d2c61ce9510c4a6216 (diff)
downloadopenttd-9474db5cb6c4b9db2f7b68d1dda1a523305282f1.tar.xz
(svn r14258) -Codechange: rework the way to query the vehicle hash to make sure it always results in the same irregardless of the order of the hash-linked-list.
-Fix: desync in PBS reservation following, vehicle flooding and road vehicle overtake/follow code.
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r--src/rail_cmd.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index eea934a6c..b101934e4 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -130,7 +130,7 @@ static bool EnsureNoTrainOnTrack(TileIndex tile, Track track)
{
TrackBits rail_bits = TrackToTrackBits(track);
- return VehicleFromPos(tile, &rail_bits, &EnsureNoTrainOnTrackProc) == NULL;
+ return !HasVehicleOnPos(tile, &rail_bits, &EnsureNoTrainOnTrackProc);
}
static bool CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags)
@@ -1334,7 +1334,7 @@ CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
SetRailType(tile, totype);
MarkTileDirtyByTile(tile);
/* update power of train engines on this tile */
- VehicleFromPos(tile, NULL, &UpdateTrainPowerProc);
+ FindVehicleOnPos(tile, NULL, &UpdateTrainPowerProc);
}
}
@@ -1384,7 +1384,7 @@ CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* When not coverting rail <-> el. rail, any vehicle cannot be in tunnel/bridge */
if (!IsCompatibleRail(GetRailType(tile), totype) &&
- GetVehicleTunnelBridge(tile, endtile) != NULL) continue;
+ !HasVehicleOnTunnelBridge(tile, endtile)) continue;
if (flags & DC_EXEC) {
Track track = DiagDirToDiagTrack(GetTunnelBridgeDirection(tile));
@@ -1398,8 +1398,8 @@ CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
SetRailType(tile, totype);
SetRailType(endtile, totype);
- VehicleFromPos(tile, NULL, &UpdateTrainPowerProc);
- VehicleFromPos(endtile, NULL, &UpdateTrainPowerProc);
+ FindVehicleOnPos(tile, NULL, &UpdateTrainPowerProc);
+ FindVehicleOnPos(endtile, NULL, &UpdateTrainPowerProc);
YapfNotifyTrackLayoutChange(tile, track);
YapfNotifyTrackLayoutChange(endtile, track);