Changeset - r28191:5fe4d4ffc726
[Not reviewed]
master
0 2 0
Peter Nelson - 12 months ago 2023-11-28 13:48:09
peter1138@openttd.org
Fix #10926: New free wagons no longer split by type. (#11507)

NormalizeTrainVehInDepot() should only be called if an engine was built, not for wagons.
2 files changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/train_cmd.cpp
Show inline comments
 
@@ -689,6 +689,7 @@ static CommandCost CmdBuildRailWagon(DoC
 
/** Move all free vehicles in the depot to the train */
 
void NormalizeTrainVehInDepot(const Train *u)
 
{
 
	assert(u->IsEngine());
 
	for (const Train *v : Train::Iterate()) {
 
		if (v->IsFreeWagon() && v->tile == u->tile &&
 
				v->track == TRACK_BIT_DEPOT) {
src/vehicle_cmd.cpp
Show inline comments
 
@@ -172,7 +172,7 @@ std::tuple<CommandCost, VehicleID, uint,
 
		}
 

	
 
		if (flags & DC_EXEC) {
 
			if (type == VEH_TRAIN && use_free_vehicles && !(flags & DC_AUTOREPLACE)) {
 
			if (type == VEH_TRAIN && use_free_vehicles && !(flags & DC_AUTOREPLACE) && Train::From(v)->IsEngine()) {
 
				/* Move any free wagons to the new vehicle. */
 
				NormalizeTrainVehInDepot(Train::From(v));
 
			}
0 comments (0 inline, 0 general)