Changeset - r19988:14349f4000aa
[Not reviewed]
master
0 1 0
frosch - 11 years ago 2013-01-27 18:11:16
frosch@openttd.org
(svn r24944) -Fix [FS#5452]: Deleting implicit orders wasn't able to deal with the various side-effects of DeleteOrder.
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -1847,15 +1847,15 @@ void Vehicle::DeleteUnreachedImplicitOrd
 

	
 
	const Order *order = this->GetOrder(this->cur_implicit_order_index);
 
	while (order != NULL) {
 
		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;
 
			this->cur_implicit_order_index++;
 
		}
 

	
 
@@ -1929,15 +1929,15 @@ void Vehicle::BeginLoading()
 
						InvalidateVehicleOrder(this, 0);
 
					} else {
 
						/* Delete all implicit orders up to the station we just reached */
 
						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;
 
								this->cur_implicit_order_index++;
 
							}
 

	
0 comments (0 inline, 0 general)