mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-11 16:54:42 +00:00
(svn r27809) -Codechange: Improve check in UpdateLevelCrossing
In UpdateLevelCrossing, checking if a level crossing is reserved is cheaper than finding trains on it or approaching it, so do it first. (cirdan)
This commit is contained in:
parent
f3cbe98156
commit
67ab0450dd
@ -1700,8 +1700,8 @@ void UpdateLevelCrossing(TileIndex tile, bool sound)
|
||||
{
|
||||
assert(IsLevelCrossingTile(tile));
|
||||
|
||||
/* train on crossing || train approaching crossing || reserved */
|
||||
bool new_state = HasVehicleOnPos(tile, NULL, &TrainOnTileEnum) || TrainApproachingCrossing(tile) || HasCrossingReservation(tile);
|
||||
/* reserved || train on crossing || train approaching crossing */
|
||||
bool new_state = HasCrossingReservation(tile) || HasVehicleOnPos(tile, NULL, &TrainOnTileEnum) || TrainApproachingCrossing(tile);
|
||||
|
||||
if (new_state != IsCrossingBarred(tile)) {
|
||||
if (new_state && sound) {
|
||||
|
Loading…
Reference in New Issue
Block a user