summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-04-21 17:15:05 +0000
committercelestar <celestar@openttd.org>2006-04-21 17:15:05 +0000
commita7b2ec60b3a1822ebf2ea4ee1ea136137cc68012 (patch)
tree95fafef55c7e79e277b0ec03c4fb324587537465 /train_cmd.c
parent31c3240227b3d0159c49ca0a88bf20b30414e525 (diff)
downloadopenttd-a7b2ec60b3a1822ebf2ea4ee1ea136137cc68012.tar.xz
(svn r4501) -Fix: (FS#129) When, in a train that head multiple engines in front, the _first_ of those engines is sold, all the orders are copied to the second engine (to ensure "seamless" operation). However, during this operation, it was forgotten to update the prev_shared and next_shared pointers of the new head engine AND the next_shared and prev_shared of the share partners.
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/train_cmd.c b/train_cmd.c
index d3c1140af..710738872 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1317,6 +1317,16 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
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);