mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-08 15:30:00 +00:00
(svn r21738) -Fix (r21642)[FS#4384]: Start loading when cur_order_index points to the destination station, i.e. after deleting not-reached automatic orders.
This commit is contained in:
parent
29a0dd65a9
commit
be106c77a9
@ -1744,9 +1744,7 @@ void Vehicle::BeginLoading()
|
|||||||
|
|
||||||
if (this->current_order.IsType(OT_GOTO_STATION) &&
|
if (this->current_order.IsType(OT_GOTO_STATION) &&
|
||||||
this->current_order.GetDestination() == this->last_station_visited) {
|
this->current_order.GetDestination() == this->last_station_visited) {
|
||||||
current_order.MakeLoading(true);
|
/* Delete all automatic orders which were not reached */
|
||||||
UpdateVehicleTimetable(this, true);
|
|
||||||
|
|
||||||
const Order *order = this->GetOrder(this->cur_order_index);
|
const Order *order = this->GetOrder(this->cur_order_index);
|
||||||
while (order != NULL && order->IsType(OT_AUTOMATIC)) {
|
while (order != NULL && order->IsType(OT_AUTOMATIC)) {
|
||||||
/* Delete order effectively deletes order, so get the next before deleting it. */
|
/* Delete order effectively deletes order, so get the next before deleting it. */
|
||||||
@ -1754,6 +1752,10 @@ void Vehicle::BeginLoading()
|
|||||||
DeleteOrder(this, this->cur_order_index);
|
DeleteOrder(this, this->cur_order_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Now cur_order_index points to the destination station, and we can start loading */
|
||||||
|
this->current_order.MakeLoading(true);
|
||||||
|
UpdateVehicleTimetable(this, true);
|
||||||
|
|
||||||
/* Furthermore add the Non Stop flag to mark that this station
|
/* Furthermore add the Non Stop flag to mark that this station
|
||||||
* is the actual destination of the vehicle, which is (for example)
|
* is the actual destination of the vehicle, which is (for example)
|
||||||
* necessary to be known for HandleTrainLoading to determine
|
* necessary to be known for HandleTrainLoading to determine
|
||||||
@ -1774,7 +1776,7 @@ void Vehicle::BeginLoading()
|
|||||||
InsertOrder(this, auto_order, this->cur_order_index);
|
InsertOrder(this, auto_order, this->cur_order_index);
|
||||||
if (this->cur_order_index > 0) --this->cur_order_index;
|
if (this->cur_order_index > 0) --this->cur_order_index;
|
||||||
}
|
}
|
||||||
current_order.MakeLoading(false);
|
this->current_order.MakeLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Station::Get(this->last_station_visited)->loading_vehicles.push_back(this);
|
Station::Get(this->last_station_visited)->loading_vehicles.push_back(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user