(svn r4675) - Backport from trunk (r4501): 0.4
authorDarkvater
Tue, 02 May 2006 13:36:38 +0000
branch0.4
changeset 9989 56cc28c68fb6
parent 9988 13ab8ba57a49
child 9990 2a5460a73917
(svn r4675) - Backport from trunk (r4501):
Fix: When, in a train that has multiple engines in front, the _first_
of those engines is sold, all the orders are copied to the second
engine (to ensure "seamless" operation). The next_shared/prev_shared
pointers where not updated correctly during this operation.
train_cmd.c
--- a/train_cmd.c	Tue May 02 13:30:13 2006 +0000
+++ b/train_cmd.c	Tue May 02 13:36:38 2006 +0000
@@ -1288,6 +1288,16 @@
 						new_f->current_order = first->current_order;
 						new_f->cur_order_index = first->cur_order_index;
 						new_f->orders = first->orders;
+						if (first->prev_shared != NULL) {
+							first->prev_shared->next_shared = new_f;
+							new_f->prev_shared = first->prev_shared;
+						}
+
+						if (first->next_shared != NULL) {
+							first->next_shared->prev_shared = new_f;
+							new_f->next_shared = first->next_shared;
+						}
+
 						new_f->num_orders = first->num_orders;
 						first->orders = NULL; // XXX - to not to delete the orders */
 						if (IsLocalPlayer()) ShowTrainViewWindow(new_f);