diff options
author | frosch <frosch@openttd.org> | 2008-08-23 23:31:27 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-08-23 23:31:27 +0000 |
commit | 6aeeeb9012cd4f8d69d0337c930a38c9eb351786 (patch) | |
tree | 20397b399e3908e20ff4b820f235167641a58546 /src | |
parent | 13d938ae3d3dcc5fce40ac2cae38a97bd1f20ec8 (diff) | |
download | openttd-6aeeeb9012cd4f8d69d0337c930a38c9eb351786.tar.xz |
(svn r14149) -Fix: When selling the front engine of a train consist with another engine at the second position, not all 'important' data was copied to the new head.
Diffstat (limited to 'src')
-rw-r--r-- | src/train_cmd.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 77d1be499..42e1d02ff 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1421,20 +1421,20 @@ CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) * promote it as a new train, retaining the unitnumber, orders */ if (new_f != NULL && IsTrainEngine(new_f)) { 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; - new_f->num_orders = first->num_orders; /* Make sure the group counts stay correct. */ new_f->group_id = first->group_id; first->group_id = DEFAULT_GROUP; + /* Copy orders (by sharing) */ + new_f->orders = first->orders; + new_f->num_orders = first->num_orders; new_f->AddToShared(first); DeleteVehicleOrders(first); + /* Copy other important data from the front engine */ + new_f->CopyVehicleConfigAndStatistics(first); + /* If we deleted a window then open a new one for the 'new' train */ if (IsLocalPlayer() && w != NULL) ShowVehicleViewWindow(new_f); } |