TBTR: Use virtual train head in CmdReplaceTemplateVehicle
Check that train is virtual
This commit is contained in:
@@ -1150,8 +1150,12 @@ CommandCost CmdReplaceTemplateVehicle(TileIndex tile, DoCommandFlag flags, uint3
|
|||||||
CommandCost ret = CheckOwnership(vehicle->owner);
|
CommandCost ret = CheckOwnership(vehicle->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
Train* train = Train::From(vehicle);
|
vehicle = vehicle->First();
|
||||||
|
|
||||||
|
Train* train = Train::From(vehicle);
|
||||||
|
if (!train->IsVirtual()) {
|
||||||
|
return CMD_ERROR;
|
||||||
|
}
|
||||||
if (!TemplateVehicle::CanAllocateItem(CountVehiclesInChain(train))) {
|
if (!TemplateVehicle::CanAllocateItem(CountVehiclesInChain(train))) {
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user