From 9474db5cb6c4b9db2f7b68d1dda1a523305282f1 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 7 Sep 2008 11:23:10 +0000 Subject: (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. --- src/rail_cmd.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/rail_cmd.cpp') 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); -- cgit v1.2.3-54-g00ecf