summaryrefslogtreecommitdiff
path: root/order_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'order_cmd.c')
-rw-r--r--order_cmd.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/order_cmd.c b/order_cmd.c
index 3cca2aa0f..f2b1924b9 100644
--- a/order_cmd.c
+++ b/order_cmd.c
@@ -1028,7 +1028,7 @@ bool VehicleHasDepotOrders(const Vehicle *v)
*/
void DeleteVehicleOrders(Vehicle *v)
{
- Order *order, *cur;
+ Order *cur, *next;
DeleteOrderWarnings(v);
@@ -1066,20 +1066,10 @@ void DeleteVehicleOrders(Vehicle *v)
v->orders = NULL;
v->num_orders = 0;
- order = NULL;
- while (cur != NULL) {
- if (order != NULL) {
- order->type = OT_NOTHING;
- order->next = NULL;
- }
-
- order = cur;
- cur = cur->next;
- }
-
- if (order != NULL) {
- order->type = OT_NOTHING;
- order->next = NULL;
+ while (cur != NULL) {
+ next = cur->next;
+ DeleteOrder(cur);
+ cur = next;
}
}