mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
When reversing train, ensure that loading is aborted if necessary
This commit is contained in:
parent
2135aa2ae8
commit
9003ef7d11
@ -2740,6 +2740,16 @@ void ReverseTrainDirection(Train *v)
|
|||||||
if (order != nullptr && order->IsType(OT_GOTO_STATION) && order->GetDestination() == v->last_station_visited) {
|
if (order != nullptr && order->IsType(OT_GOTO_STATION) && order->GetDestination() == v->last_station_visited) {
|
||||||
v->IncrementImplicitOrderIndex();
|
v->IncrementImplicitOrderIndex();
|
||||||
}
|
}
|
||||||
|
} else if (v->current_order.IsAnyLoadingType()) {
|
||||||
|
const Vehicle *last = v;
|
||||||
|
while (last->Next() != nullptr) last = last->Next();
|
||||||
|
|
||||||
|
/* not a station || different station --> leave the station */
|
||||||
|
if (!IsTileType(last->tile, MP_STATION) || !IsTileType(v->tile, MP_STATION) ||
|
||||||
|
GetStationIndex(last->tile) != GetStationIndex(v->tile) ||
|
||||||
|
HasBit(v->flags, VRF_BEYOND_PLATFORM_END)) {
|
||||||
|
v->LeaveStation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Train *u = v; u != nullptr; u = u->Next()) {
|
for (Train *u = v; u != nullptr; u = u->Next()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user