1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-29 09:29:10 +00:00

Change: Preserve orders and related settings where possible when moving engines around in a train.

This commit is contained in:
Michael Lutz
2023-05-09 22:27:45 +02:00
parent 07449be876
commit 7e906c7c59

View File

@@ -1322,8 +1322,14 @@ CommandCost CmdMoveRailVehicle(DoCommandFlag flags, VehicleID src_veh, VehicleID
DeleteNewGRFInspectWindow(GSF_TRAINS, src->index);
SetWindowDirty(WC_COMPANY, _current_company);
/* Delete orders, group stuff and the unit number as we're not the
* front of any vehicle anymore. */
if (src_head != nullptr && src_head->IsFrontEngine()) {
/* Cases #?b: Transfer order, unit number and other stuff
* to the new front engine. */
src_head->orders = src->orders;
if (src_head->orders != nullptr) src_head->AddToShared(src);
src_head->CopyVehicleConfigAndStatistics(src);
}
/* Remove stuff not valid anymore for non-front engines. */
DeleteVehicleOrders(src);
src->unitnumber = 0;
}