Changeset - r3608:60e41251f988
[Not reviewed]
master
0 1 0
celestar - 19 years ago 2006-04-21 17:15:05
celestar@openttd.org
(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.
1 file changed with 10 insertions and 0 deletions:
0 comments (0 inline, 0 general)
train_cmd.c
Show inline comments
 
@@ -1314,12 +1314,22 @@ int32 CmdSellRailWagon(TileIndex tile, u
 
						switch_engine = true;
 
						/* Copy important data from the front engine */
 
						new_f->unitnumber = first->unitnumber;
 
						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);
 
					}
 
				}
 
			}
0 comments (0 inline, 0 general)