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

Just start loading again without moving instead
pull/338/head
Jonathan G Rennison 3 years ago
parent 782fba3064
commit 71c39dc8c2

@ -6382,7 +6382,29 @@ static bool TrainLocoHandler(Train *v, bool mode)
}
if (v->current_order.IsType(OT_LEAVESTATION)) {
StationID station_id = v->current_order.GetDestination();
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);
return true;
}

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

Loading…
Cancel
Save