If train next order is for same station when leaving, do not leave

Just start loading again without moving instead
This commit is contained in:
Jonathan G Rennison
2021-11-19 00:53:01 +00:00
parent 782fba3064
commit 71c39dc8c2
2 changed files with 23 additions and 1 deletions

View File

@@ -6382,7 +6382,29 @@ static bool TrainLocoHandler(Train *v, bool mode)
} }
if (v->current_order.IsType(OT_LEAVESTATION)) { if (v->current_order.IsType(OT_LEAVESTATION)) {
StationID station_id = v->current_order.GetDestination();
v->current_order.Free(); v->current_order.Free();
bool may_reverse = ProcessOrders(v);
if (IsRailStationTile(v->tile) && GetStationIndex(v->tile) == station_id) {
if (v->current_order.ShouldStopAtStation(INVALID_STATION, station_id, false)) {
v->last_station_visited = station_id;
v->BeginLoading();
return true;
}
}
v->PlayLeaveStationSound();
if (may_reverse && CheckReverseTrain(v)) {
v->wait_counter = 0;
v->cur_speed = 0;
v->subspeed = 0;
ClrBit(v->flags, VRF_LEAVING_STATION);
ReverseTrainDirection(v);
}
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP); SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
return true; return true;
} }

View File

@@ -3464,7 +3464,7 @@ void Vehicle::HandleLoading(bool mode)
return; return;
} }
this->PlayLeaveStationSound(); if (this->type != VEH_TRAIN) this->PlayLeaveStationSound();
this->LeaveStation(); this->LeaveStation();