summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index d774a7ee6..0fdac279d 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1773,8 +1773,8 @@ void UpdateLevelCrossing(TileIndex tile, bool sound)
{
assert(IsLevelCrossingTile(tile));
- /* train on crossing || train approaching crossing */
- bool new_state = VehicleFromPos(tile, NULL, &TrainOnTileEnum) != NULL || TrainApproachingCrossing(tile);
+ /* train on crossing || train approaching crossing || reserved */
+ bool new_state = VehicleFromPos(tile, NULL, &TrainOnTileEnum) != NULL || TrainApproachingCrossing(tile) || GetCrossingReservation(tile);
if (new_state != IsCrossingBarred(tile)) {
if (new_state && sound) {
@@ -3734,6 +3734,10 @@ static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image)
if (IsFrontEngine(v)) {
v->load_unload_time_rem = 0;
+ /* If we are approching a crossing that is reserved, play the sound now. */
+ TileIndex crossing = TrainApproachingCrossingTile(v);
+ if (crossing != INVALID_TILE && GetCrossingReservation(crossing)) SndPlayTileFx(SND_0E_LEVEL_CROSSING, crossing);
+
/* Always try to extend the reservation when entering a tile. */
CheckNextTrainTile(v);
}