mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r12188) -Codechange [FS#1782]: do not check twice for correct rail owner (patch by Vikthor)
This commit is contained in:
parent
20035ca48d
commit
32d8ac2073
@ -3437,9 +3437,9 @@ static TileIndex TrainApproachingCrossingTile(const Vehicle *v)
|
|||||||
DiagDirection dir = TrainExitDir(v->direction, v->u.rail.track);
|
DiagDirection dir = TrainExitDir(v->direction, v->u.rail.track);
|
||||||
TileIndex tile = v->tile + TileOffsByDiagDir(dir);
|
TileIndex tile = v->tile + TileOffsByDiagDir(dir);
|
||||||
|
|
||||||
/* not a crossing || wrong axis || wrong railtype || wrong owner */
|
/* not a crossing || wrong axis || unusable rail (wrong type or owner) */
|
||||||
if (!IsLevelCrossingTile(tile) || DiagDirToAxis(dir) == GetCrossingRoadAxis(tile) ||
|
if (!IsLevelCrossingTile(tile) || DiagDirToAxis(dir) == GetCrossingRoadAxis(tile) ||
|
||||||
!CheckCompatibleRail(v, tile) || GetTileOwner(tile) != v->owner) {
|
!CheckCompatibleRail(v, tile)) {
|
||||||
return INVALID_TILE;
|
return INVALID_TILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3485,8 +3485,8 @@ static bool TrainCheckIfLineEnds(Vehicle *v)
|
|||||||
bits &= ~TrackCrossesTracks(FindFirstTrack(v->u.rail.track));
|
bits &= ~TrackCrossesTracks(FindFirstTrack(v->u.rail.track));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no suitable trackbits at all || wrong railtype || not our track */
|
/* no suitable trackbits at all || unusable rail (wrong type or owner) */
|
||||||
if (bits == TRACK_BIT_NONE || !CheckCompatibleRail(v, tile) || GetTileOwner(tile) != v->owner) {
|
if (bits == TRACK_BIT_NONE || !CheckCompatibleRail(v, tile)) {
|
||||||
return TrainApproachingLineEnd(v, false);
|
return TrainApproachingLineEnd(v, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user