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

pull/199/head
Jonathan G Rennison 4 years ago
parent cce6d731a1
commit ca726d79f5

@ -2021,6 +2021,9 @@ STR_CONFIG_OCCUPANCY_SMOOTHNESS_HELPTEXT :0% sets the mea
STR_CONFIG_SETTING_ADVANCE_ORDER_ON_CLONE :Advance order after cloning/copying/sharing: {STRING2}
STR_CONFIG_SETTING_ADVANCE_ORDER_ON_CLONE_HELPTEXT :After cloning a vehicle or copying/sharing orders from an existing vehicle.{}For trains, road vehicles and ships: if the vehicle is in a depot which is in the order list, skip to the order which follows one of the orders for that depot.{}For aircraft: if the aircraft is in a hangar and the associated airport is in the order list, skip to one of the orders for that airport.
STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP :Add vehicle to group on copy-clone: {STRING2}
STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP_HELPTEXT :Set whether cloned vehicles which do not share orders are added to the copied vehicle's group.
STR_CONFIG_SETTING_SCENARIO_MULTIPLE_BUILDINGS :Allow multiple churches/stadiums: {STRING2}
STR_CONFIG_SETTING_SCENARIO_MULTIPLE_BUILDINGS_HELPTEXT :Allow manually adding churches and stadiums when there is already one present in the town.
STR_CONFIG_SETTING_SCENARIO_HOUSE_IGNORE_DATES :Ignore house year restrictions: {STRING2}

@ -1790,6 +1790,7 @@ static SettingsContainer &GetSettingsTree()
company->Add(new SettingEntry("company.infra_others_buy_in_depot[2]"));
company->Add(new SettingEntry("company.infra_others_buy_in_depot[3]"));
company->Add(new SettingEntry("company.advance_order_on_clone"));
company->Add(new SettingEntry("company.copy_clone_add_to_group"));
}
SettingsPage *accounting = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCOUNTING));

@ -660,6 +660,7 @@ struct CompanySettings {
bool infra_others_buy_in_depot[4]; ///< other companies can buy/autorenew in this companies depots (where infra sharing enabled)
uint16 timetable_autofill_rounding; ///< round up timetable times to be a multiple of this number of ticks
bool advance_order_on_clone; ///< when cloning a vehicle or copying/sharing an order list, advance the current order to a suitable point
bool copy_clone_add_to_group; ///< whether to add cloned vehicles to the source vehicle's group, when cloning a vehicle without sharing orders
};
/** Debug settings. */

@ -246,6 +246,15 @@ str = STR_CONFIG_SETTING_ADVANCE_ORDER_ON_CLONE
strhelp = STR_CONFIG_SETTING_ADVANCE_ORDER_ON_CLONE_HELPTEXT
patxname = ""advance_order_on_clone""
[SDT_BOOL]
base = CompanySettings
var = copy_clone_add_to_group
guiflags = SGF_PER_COMPANY
def = true
str = STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP
strhelp = STR_CONFIG_SETTING_COPY_CLONE_ADD_TO_GROUP_HELPTEXT
patxname = ""copy_clone_add_to_group""
[SDT_END]

@ -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);
}

Loading…
Cancel
Save