diff options
author | rubidium <rubidium@openttd.org> | 2008-09-07 11:23:10 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-09-07 11:23:10 +0000 |
commit | 6e67ea1f9dac718ec58d54b73883b0dd043bff2d (patch) | |
tree | 94706b006a8848169482c99bfbb9ca6f9c734954 /src/rail_cmd.cpp | |
parent | 466e7740d71bb76ed96d3509e8b987e1ed9019bb (diff) | |
download | openttd-6e67ea1f9dac718ec58d54b73883b0dd043bff2d.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.cpp | 10 |
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); |