Changeset - r27312:a042c56389f6
[Not reviewed]
master
0 1 0
Michael Lutz - 16 months ago 2023-05-09 20:27:45
michi@icosahedron.de
Change: Preserve orders and related settings where possible when moving engines around in a train.
1 file changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/train_cmd.cpp
Show inline comments
 
@@ -1322,8 +1322,14 @@ CommandCost CmdMoveRailVehicle(DoCommand
 
			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;
 
		}
0 comments (0 inline, 0 general)