Through load: Fix getting and checking station veh/tile when leaving station
This commit is contained in:
@@ -2705,7 +2705,10 @@ void Vehicle::LeaveStation()
|
|||||||
delete this->cargo_payment;
|
delete this->cargo_payment;
|
||||||
assert(this->cargo_payment == NULL); // cleared by ~CargoPayment
|
assert(this->cargo_payment == NULL); // cleared by ~CargoPayment
|
||||||
|
|
||||||
|
TileIndex station_tile = INVALID_TILE;
|
||||||
|
|
||||||
if (this->type == VEH_TRAIN) {
|
if (this->type == VEH_TRAIN) {
|
||||||
|
station_tile = Train::From(this)->GetStationLoadingVehicle()->tile;
|
||||||
for (Train *v = Train::From(this); v != nullptr; v = v->Next()) {
|
for (Train *v = Train::From(this); v != nullptr; v = v->Next()) {
|
||||||
ClrBit(v->flags, VRF_BEYOND_PLATFORM_END);
|
ClrBit(v->flags, VRF_BEYOND_PLATFORM_END);
|
||||||
ClrBit(v->flags, VRF_NOT_YET_IN_PLATFORM);
|
ClrBit(v->flags, VRF_NOT_YET_IN_PLATFORM);
|
||||||
@@ -2777,8 +2780,7 @@ void Vehicle::LeaveStation()
|
|||||||
|
|
||||||
if (this->type == VEH_TRAIN && !(this->vehstatus & VS_CRASHED)) {
|
if (this->type == VEH_TRAIN && !(this->vehstatus & VS_CRASHED)) {
|
||||||
/* Trigger station animation (trains only) */
|
/* Trigger station animation (trains only) */
|
||||||
TileIndex station_tile = Train::From(this)->GetStationLoadingVehicle()->tile;
|
if (IsRailStationTile(station_tile)) {
|
||||||
if (IsTileType(station_tile, MP_STATION)) {
|
|
||||||
TriggerStationRandomisation(st, station_tile, SRT_TRAIN_DEPARTS);
|
TriggerStationRandomisation(st, station_tile, SRT_TRAIN_DEPARTS);
|
||||||
TriggerStationAnimation(st, station_tile, SAT_TRAIN_DEPARTS);
|
TriggerStationAnimation(st, station_tile, SAT_TRAIN_DEPARTS);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user