From 016f0bdfaf1e551b60c1656df00bfc6ccd5bebc5 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 2 Jun 2018 00:34:30 +0100 Subject: [PATCH] Through load: Fix getting and checking station veh/tile when leaving station --- src/vehicle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index ccfa93d4a0..c85ca6e13a 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2705,7 +2705,10 @@ void Vehicle::LeaveStation() delete this->cargo_payment; assert(this->cargo_payment == NULL); // cleared by ~CargoPayment + TileIndex station_tile = INVALID_TILE; + if (this->type == VEH_TRAIN) { + station_tile = Train::From(this)->GetStationLoadingVehicle()->tile; for (Train *v = Train::From(this); v != nullptr; v = v->Next()) { ClrBit(v->flags, VRF_BEYOND_PLATFORM_END); ClrBit(v->flags, VRF_NOT_YET_IN_PLATFORM); @@ -2777,8 +2780,7 @@ void Vehicle::LeaveStation() if (this->type == VEH_TRAIN && !(this->vehstatus & VS_CRASHED)) { /* Trigger station animation (trains only) */ - TileIndex station_tile = Train::From(this)->GetStationLoadingVehicle()->tile; - if (IsTileType(station_tile, MP_STATION)) { + if (IsRailStationTile(station_tile)) { TriggerStationRandomisation(st, station_tile, SRT_TRAIN_DEPARTS); TriggerStationAnimation(st, station_tile, SAT_TRAIN_DEPARTS); }