diff options
author | peter1138 <peter1138@openttd.org> | 2017-03-20 08:04:47 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2017-03-20 08:04:47 +0000 |
commit | 67ab0450dd9ab652ee4ec515e06f4ea8f04b7f6b (patch) | |
tree | 494ed06d519bd5c715d33f45664ac6832c7d945c /src | |
parent | f3cbe981561bab44bb5ee83a49ac1fed884e5961 (diff) | |
download | openttd-67ab0450dd9ab652ee4ec515e06f4ea8f04b7f6b.tar.xz |
(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)
Diffstat (limited to 'src')
-rw-r--r-- | src/train_cmd.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 550253223..4a279bb7e 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -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) { |