TBTR: Autorefit button in depot window now also does template replacements

This commit is contained in:
Jonathan G Rennison
2023-08-20 23:37:46 +01:00
parent b0331c84b3
commit 83d3fab599

View File

@@ -813,6 +813,17 @@ CommandCost CmdDepotMassAutoReplace(TileIndex tile, DoCommandFlag flags, uint32
/* Ensure that the vehicle completely in the depot */ /* Ensure that the vehicle completely in the depot */
if (!v->IsChainInDepot()) continue; if (!v->IsChainInDepot()) continue;
if (v->type == VEH_TRAIN) {
_new_vehicle_id = INVALID_VEHICLE;
CommandCost ret = DoCommand(v->tile, v->index, 0, flags, CMD_TEMPLATE_REPLACE_VEHICLE);
if (ret.Succeeded()) cost.AddCost(ret);
if (_new_vehicle_id != INVALID_VEHICLE) {
v = Vehicle::Get(_new_vehicle_id);
}
}
CommandCost ret = DoCommand(0, v->index, 0, flags, CMD_AUTOREPLACE_VEHICLE); CommandCost ret = DoCommand(0, v->index, 0, flags, CMD_AUTOREPLACE_VEHICLE);
if (ret.Succeeded()) cost.AddCost(ret); if (ret.Succeeded()) cost.AddCost(ret);