diff options
author | frosch <frosch@openttd.org> | 2013-01-27 18:11:16 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-01-27 18:11:16 +0000 |
commit | e9c44aaeb37a21d76e296611d19d4df31d83d9bc (patch) | |
tree | 6c56d90f10e3b75844ffaa7a923675c9572e8786 | |
parent | c1dcc4b0dad0abcfb50fdcde2f7b98f79aaddbeb (diff) | |
download | openttd-e9c44aaeb37a21d76e296611d19d4df31d83d9bc.tar.xz |
(svn r24944) -Fix [FS#5452]: Deleting implicit orders wasn't able to deal with the various side-effects of DeleteOrder.
-rw-r--r-- | src/vehicle.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 562054753..c09650410 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1850,9 +1850,9 @@ void Vehicle::DeleteUnreachedImplicitOrders() if (this->cur_implicit_order_index == this->cur_real_order_index) break; if (order->IsType(OT_IMPLICIT)) { - /* Delete order effectively deletes order, so get the next before deleting it. */ - order = order->next; DeleteOrder(this, this->cur_implicit_order_index); + /* DeleteOrder does various magic with order_indices, so resync 'order' with 'cur_implicit_order_index' */ + order = this->GetOrder(this->cur_implicit_order_index); } else { /* Skip non-implicit orders, e.g. service-orders */ order = order->next; @@ -1932,9 +1932,9 @@ void Vehicle::BeginLoading() const Order *order = this->GetOrder(this->cur_implicit_order_index); while (!order->IsType(OT_IMPLICIT) || order->GetDestination() != this->last_station_visited) { if (order->IsType(OT_IMPLICIT)) { - /* Delete order effectively deletes order, so get the next before deleting it. */ - order = order->next; DeleteOrder(this, this->cur_implicit_order_index); + /* DeleteOrder does various magic with order_indices, so resync 'order' with 'cur_implicit_order_index' */ + order = this->GetOrder(this->cur_implicit_order_index); } else { /* Skip non-implicit orders, e.g. service-orders */ order = order->next; |