summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-02-18 16:35:38 +0000
committersmatz <smatz@openttd.org>2008-02-18 16:35:38 +0000
commit97013cd8c4d1ea12aaed5ba96706b61ac14873ab (patch)
tree57a856421f24707953ee89d92b0c9e7b2d98f4ad /src/train_cmd.cpp
parent9f619f91b382985891a234138d2efa79cfe9ec29 (diff)
downloadopenttd-97013cd8c4d1ea12aaed5ba96706b61ac14873ab.tar.xz
(svn r12178) -Codechange: use the 'side' parameter in TrainController and TrainCheckIfLineEnds to simplify the code
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index b890a7a8d..d305391a9 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -3040,7 +3040,7 @@ static void TrainController(Vehicle *v, bool update_image)
/* Get the status of the tracks in the new tile and mask
* away the bits that aren't reachable. */
- uint32 ts = GetTileTrackStatus(gp.new_tile, TRANSPORT_RAIL, 0) & _reachable_tracks[enterdir];
+ uint32 ts = GetTileTrackStatus(gp.new_tile, TRANSPORT_RAIL, 0, ReverseDiagDir(enterdir)) & _reachable_tracks[enterdir];
/* Combine the from & to directions.
* Now, the lower byte contains the track status, and the byte at bit 16 contains
@@ -3475,7 +3475,7 @@ static bool TrainCheckIfLineEnds(Vehicle *v)
TileIndex tile = v->tile + TileOffsByDiagDir(dir);
/* Determine the track status on the next tile */
- uint32 ts = GetTileTrackStatus(tile, TRANSPORT_RAIL, 0) & _reachable_tracks[dir];
+ uint32 ts = GetTileTrackStatus(tile, TRANSPORT_RAIL, 0, ReverseDiagDir(dir)) & _reachable_tracks[dir];
/* We are sure the train is not entering a depot, it is detected above */
@@ -3485,11 +3485,8 @@ static bool TrainCheckIfLineEnds(Vehicle *v)
bits &= ~TrackCrossesTracks(FindFirstTrack(v->u.rail.track));
}
- /* no suitable trackbits at all || wrong railtype || not our track ||
- * tunnel/bridge from opposite side || depot from opposite side */
- if (bits == TRACK_BIT_NONE || !CheckCompatibleRail(v, tile) || GetTileOwner(tile) != v->owner ||
- (IsTileType(tile, MP_TUNNELBRIDGE) && GetTunnelBridgeDirection(tile) != dir) ||
- (IsTileDepotType(tile, TRANSPORT_RAIL) && GetRailDepotDirection(tile) == dir) ) {
+ /* no suitable trackbits at all || wrong railtype || not our track */
+ if (bits == TRACK_BIT_NONE || !CheckCompatibleRail(v, tile) || GetTileOwner(tile) != v->owner) {
return TrainApproachingLineEnd(v, false);
}