diff options
author | truelight <truelight@openttd.org> | 2007-03-19 15:59:23 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2007-03-19 15:59:23 +0000 |
commit | a33d240af89c83d09b1c95b1c187bea7b02eea2e (patch) | |
tree | 06ba1ea3c0d46ecf622bff268d90d3362e5a7201 /src | |
parent | c24f6f3b243cebd681c695af9cc58c9978754eb9 (diff) | |
download | openttd-a33d240af89c83d09b1c95b1c187bea7b02eea2e.tar.xz |
(svn r9338) -Fix: close the Shared Order Vehicle List if you remove the shared link with only 2 vehicles
Diffstat (limited to 'src')
-rw-r--r-- | src/order_cmd.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 1ddde9fc4..fb544565b 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -1138,7 +1138,7 @@ void DeleteVehicleOrders(Vehicle *v) /* If we have a shared order-list, don't delete the list, but just remove our pointer */ if (IsOrderListShared(v)) { - const Vehicle *u = v; + Vehicle *u = v; v->orders = NULL; v->num_orders = 0; @@ -1155,6 +1155,10 @@ void DeleteVehicleOrders(Vehicle *v) v->prev_shared = NULL; v->next_shared = NULL; + /* If we are the only one left in the Shared Order Vehicle List, + * remove it, as we are no longer a Shared Order Vehicle */ + if (u->prev_shared == NULL && u->next_shared == NULL) RemoveSharedOrderVehicleList(u); + /* We only need to update this-one, because if there is a third * vehicle which shares the same order-list, nothing will change. If * this is the last vehicle, the last line of the order-window |