Mercurial > hg > openttd
diff src/autoreplace_cmd.cpp @ 12690:1e91f0c18469 draft
(svn r17147) -Fix [FS#3048]: Keep vehicle news and viewports following vehicles, when autoreplacing/renewing them.
author | frosch <frosch@openttd.org> |
---|---|
date | Mon, 10 Aug 2009 20:06:39 +0000 |
parents | 2f530108f787 |
children | bc7926153e19 |
line wrap: on
line diff
--- 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 @@ /* 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;