diff options
author | truelight <truelight@openttd.org> | 2005-01-16 14:42:53 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-01-16 14:42:53 +0000 |
commit | 07647737d5d52cb548662ffbec4eca3514090b18 (patch) | |
tree | 6a56912dfd4ec0a7d3c46aa7b8cd50edb2d28031 | |
parent | 8493f68c96d9dbc4deaf0dac53c80a04511a2b70 (diff) | |
download | openttd-07647737d5d52cb548662ffbec4eca3514090b18.tar.xz |
(svn r1544) -Fix: SwapOrder did not use AssignOrder, which caused the saveroutine to
crash from time to time
-Codechange: added const before 'Order *' where possible
-rw-r--r-- | ai.c | 2 | ||||
-rw-r--r-- | aircraft_cmd.c | 2 | ||||
-rw-r--r-- | order.h | 2 | ||||
-rw-r--r-- | order_cmd.c | 6 | ||||
-rw-r--r-- | order_gui.c | 2 |
5 files changed, 8 insertions, 6 deletions
@@ -3609,7 +3609,7 @@ static void AiStateRemoveStation(Player *p) { // Remove stations that aren't in use by any vehicle byte in_use[256], *used; - Order *ord; + const Order *ord; Station *st; uint tile; diff --git a/aircraft_cmd.c b/aircraft_cmd.c index d13af1a41..4f61d21a7 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -1023,7 +1023,7 @@ static void HandleAircraftSmoke(Vehicle *v) static void ProcessAircraftOrder(Vehicle *v) { - Order *order; + const Order *order; // OT_GOTO_DEPOT, OT_LOADING if (v->current_order.type == OT_GOTO_DEPOT || @@ -74,7 +74,7 @@ static inline Order *GetOrder(uint index) static inline bool HasOrderPoolFree(uint amount) { - Order *order; + const Order *order; FOR_ALL_ORDERS(order) if (order->type == OT_NOTHING) diff --git a/order_cmd.c b/order_cmd.c index 1e074bcd4..3a40e2241 100644 --- a/order_cmd.c +++ b/order_cmd.c @@ -67,8 +67,10 @@ static void SwapOrders(Order *order1, Order *order2) Order temp_order; temp_order = *order1; - *order1 = *order2; - *order2 = temp_order; + AssignOrder(order1, *order2); + order1->next = order2->next; + AssignOrder(order2, temp_order); + order2->next = temp_order.next; } /** diff --git a/order_gui.c b/order_gui.c index ca2c3be0a..5c99bb557 100644 --- a/order_gui.c +++ b/order_gui.c @@ -387,7 +387,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) sel += w->vscroll.pos; if (_ctrl_pressed && sel < v->num_orders) { - Order *ord = GetVehicleOrder(v, sel); + const Order *ord = GetVehicleOrder(v, sel); int xy = 0; switch (ord->type) { case OT_GOTO_STATION: /* station order */ |