diff options
author | frosch <frosch@openttd.org> | 2009-08-10 20:06:39 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-08-10 20:06:39 +0000 |
commit | 52f9b8ffbd5fe9222da34e968d69876982b9a810 (patch) | |
tree | ac1f89eacfa91e22cdd80d1c7d39ba898bd0944f /src/autoreplace_cmd.cpp | |
parent | 238b0e43bbaa997acb7e53f1de118a963bb330fa (diff) | |
download | openttd-52f9b8ffbd5fe9222da34e968d69876982b9a810.tar.xz |
(svn r17147) -Fix [FS#3048]: Keep vehicle news and viewports following vehicles, when autoreplacing/renewing them.
Diffstat (limited to 'src/autoreplace_cmd.cpp')
-rw-r--r-- | src/autoreplace_cmd.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp index 45e084bff..333b3710b 100644 --- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -4,7 +4,6 @@ #include "stdafx.h" #include "company_func.h" -#include "vehicle_gui.h" #include "train.h" #include "rail.h" #include "command_func.h" @@ -18,6 +17,10 @@ #include "table/strings.h" +extern void ChangeVehicleViewports(VehicleID from_index, VehicleID to_index); +extern void ChangeVehicleNews(VehicleID from_index, VehicleID to_index); +extern void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index); + /** Figure out if two engines got at least one type of cargo in common (refitting if needed) * @param engine_a one of the EngineIDs * @param engine_b the other EngineID @@ -332,8 +335,10 @@ static CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head, /* Copy other things which cannot be copied by a command and which shall not stay resetted from the build vehicle command */ new_head->CopyVehicleConfigAndStatistics(old_head); - /* Switch vehicle windows to the new vehicle, so they are not closed when the old vehicle is sold */ + /* Switch vehicle windows/news to the new vehicle, so they are not closed/deleted when the old vehicle is sold */ + ChangeVehicleViewports(old_head->index, new_head->index); ChangeVehicleViewWindow(old_head->index, new_head->index); + ChangeVehicleNews(old_head->index, new_head->index); } return cost; |