Add company setting for whether to add vehicle to group on copy-clone

This commit is contained in:
Jonathan G Rennison
2020-10-12 18:11:14 +01:00
parent cce6d731a1
commit ca726d79f5
5 changed files with 16 additions and 1 deletions

View File

@@ -1462,7 +1462,8 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
_new_vehicle_id = w_front->index;
}
if (flags & DC_EXEC) {
const Company *owner = Company::GetIfValid(_current_company);
if ((flags & DC_EXEC) && ((p2 & 1) || owner == nullptr || owner->settings.copy_clone_add_to_group)) {
/* Cloned vehicles belong to the same group */
DoCommand(0, v_front->group_id, w_front->index, flags, CMD_ADD_VEHICLE_GROUP);
}