Fix VRF_BEYOND_PLATFORM_END not being cleared when switching order

pull/352/head
Jonathan G Rennison 2 years ago
parent e993afcd99
commit 30817c3915

@ -37,6 +37,7 @@
#include "order_cmd.h"
#include "vehiclelist.h"
#include "tracerestrict.h"
#include "train.h"
#include "table/strings.h"
@ -1462,6 +1463,12 @@ CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (v->current_order.IsAnyLoadingType()) v->LeaveStation();
if (v->current_order.IsType(OT_WAITING)) v->HandleWaiting(true);
if (v->type == VEH_TRAIN) {
for (Train *u = Train::From(v); u != nullptr; u = u->Next()) {
ClrBit(u->flags, VRF_BEYOND_PLATFORM_END);
}
}
v->cur_implicit_order_index = v->cur_real_order_index = sel_ord;
v->UpdateRealOrderIndex();
v->cur_timetable_order_index = INVALID_VEH_ORDER_ID;

@ -4072,6 +4072,10 @@ static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *u, TileIndex tile, int
if (order != nullptr && order->IsType(OT_GOTO_STATION) && order->GetDestination() == v->last_station_visited) {
v->IncrementImplicitOrderIndex();
}
} else {
for (Train *u = v; u != nullptr; u = u->Next()) {
ClrBit(u->flags, VRF_BEYOND_PLATFORM_END);
}
}
};

@ -6590,6 +6590,10 @@ static void CheckIfTrainNeedsService(Train *v)
v->current_order.MakeGoToDepot(depot, ODTFB_SERVICE);
v->dest_tile = tfdd.tile;
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
for (Train *u = v; u != nullptr; u = u->Next()) {
ClrBit(u->flags, VRF_BEYOND_PLATFORM_END);
}
}
/** Update day counters of the train vehicle. */

@ -3669,6 +3669,12 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command, Tile
if (flags & DC_EXEC) {
if (this->current_order.IsAnyLoadingType()) this->LeaveStation();
if (this->type == VEH_TRAIN) {
for (Train *v = Train::From(this); v != nullptr; v = v->Next()) {
ClrBit(v->flags, VRF_BEYOND_PLATFORM_END);
}
}
if (this->IsGroundVehicle() && this->GetNumManualOrders() > 0) {
uint16 &gv_flags = this->GetGroundVehicleFlags();
SetBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);

Loading…
Cancel
Save