Merge branch 'master' into jgrpp
# Conflicts: # src/genworld_gui.cpp # src/group_gui.cpp # src/saveload/saveload.cpp # src/settings_gui.cpp # src/toolbar_gui.cpp # src/vehicle_gui.cpp # src/vehicle_gui_base.h # src/widgets/dropdown.cpp # src/widgets/dropdown_type.h
This commit is contained in:
@@ -337,34 +337,34 @@ bool BaseVehicleListWindow::ShouldShowActionDropdownList() const
|
||||
* @param show_group If true include group-related stuff.
|
||||
* @return Itemlist for dropdown
|
||||
*/
|
||||
DropDownList *BaseVehicleListWindow::BuildActionDropdownList(bool show_autoreplace, bool show_group, bool show_template_replace,
|
||||
DropDownList BaseVehicleListWindow::BuildActionDropdownList(bool show_autoreplace, bool show_group, bool show_template_replace,
|
||||
StringID change_order_str, bool show_create_group, bool consider_top_level)
|
||||
{
|
||||
DropDownList *list = new DropDownList();
|
||||
DropDownList list;
|
||||
bool disable = this->vehicles.size() == 0;
|
||||
bool mass_action_disable = disable || (_settings_client.gui.disable_top_veh_list_mass_actions && consider_top_level);
|
||||
|
||||
if (show_autoreplace) list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_REPLACE_VEHICLES, ADI_REPLACE, disable));
|
||||
if (show_autoreplace) list.emplace_back(new DropDownListStringItem(STR_VEHICLE_LIST_REPLACE_VEHICLES, ADI_REPLACE, disable));
|
||||
if (show_autoreplace && show_template_replace) {
|
||||
list->push_back(new DropDownListStringItem(STR_TMPL_TEMPLATE_REPLACEMENT, ADI_TEMPLATE_REPLACE, disable));
|
||||
list.emplace_back(new DropDownListStringItem(STR_TMPL_TEMPLATE_REPLACEMENT, ADI_TEMPLATE_REPLACE, disable));
|
||||
}
|
||||
list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_SEND_FOR_SERVICING, ADI_SERVICE, mass_action_disable));
|
||||
list->push_back(new DropDownListStringItem(this->vehicle_depot_name[this->vli.vtype], ADI_DEPOT, mass_action_disable));
|
||||
if (_settings_client.gui.show_depot_sell_gui) list->push_back(new DropDownListStringItem(this->vehicle_depot_sell_name[this->vli.vtype], ADI_DEPOT_SELL, mass_action_disable));
|
||||
list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_CANCEL_DEPOT_SERVICE, ADI_CANCEL_DEPOT, mass_action_disable));
|
||||
list.emplace_back(new DropDownListStringItem(STR_VEHICLE_LIST_SEND_FOR_SERVICING, ADI_SERVICE, mass_action_disable));
|
||||
list.emplace_back(new DropDownListStringItem(this->vehicle_depot_name[this->vli.vtype], ADI_DEPOT, mass_action_disable));
|
||||
if (_settings_client.gui.show_depot_sell_gui) list.emplace_back(new DropDownListStringItem(this->vehicle_depot_sell_name[this->vli.vtype], ADI_DEPOT_SELL, mass_action_disable));
|
||||
list.emplace_back(new DropDownListStringItem(STR_VEHICLE_LIST_CANCEL_DEPOT_SERVICE, ADI_CANCEL_DEPOT, mass_action_disable));
|
||||
|
||||
if (show_group) {
|
||||
list->push_back(new DropDownListStringItem(STR_GROUP_ADD_SHARED_VEHICLE, ADI_ADD_SHARED, disable));
|
||||
list->push_back(new DropDownListStringItem(STR_GROUP_REMOVE_ALL_VEHICLES, ADI_REMOVE_ALL, disable));
|
||||
list.emplace_back(new DropDownListStringItem(STR_GROUP_ADD_SHARED_VEHICLE, ADI_ADD_SHARED, disable));
|
||||
list.emplace_back(new DropDownListStringItem(STR_GROUP_REMOVE_ALL_VEHICLES, ADI_REMOVE_ALL, disable));
|
||||
}
|
||||
if (this->vli.vtype == VEH_TRAIN && _settings_client.gui.show_adv_tracerestrict_features) {
|
||||
list->push_back(new DropDownListStringItem(STR_TRACE_RESTRICT_SLOT_MANAGE, ADI_TRACERESTRICT_SLOT_MGMT, false));
|
||||
list.emplace_back(new DropDownListStringItem(STR_TRACE_RESTRICT_SLOT_MANAGE, ADI_TRACERESTRICT_SLOT_MGMT, false));
|
||||
}
|
||||
if (change_order_str != 0) {
|
||||
list->push_back(new DropDownListStringItem(change_order_str, ADI_CHANGE_ORDER, false));
|
||||
list.emplace_back(new DropDownListStringItem(change_order_str, ADI_CHANGE_ORDER, false));
|
||||
}
|
||||
if (show_create_group) {
|
||||
list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_CREATE_GROUP, ADI_CREATE_GROUP, false));
|
||||
list.emplace_back(new DropDownListStringItem(STR_VEHICLE_LIST_CREATE_GROUP, ADI_CREATE_GROUP, false));
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -2040,9 +2040,9 @@ public:
|
||||
|
||||
case WID_VL_MANAGE_VEHICLES_DROPDOWN: {
|
||||
VehicleListIdentifier vli = VehicleListIdentifier::UnPack(this->window_number);
|
||||
DropDownList *list = this->BuildActionDropdownList(vli.type == VL_STANDARD, false,
|
||||
DropDownList list = this->BuildActionDropdownList(vli.type == VL_STANDARD, false,
|
||||
this->vli.vtype == VEH_TRAIN, this->GetChangeOrderStringID(), true, vli.type == VL_STANDARD);
|
||||
ShowDropDownList(this, list, -1, WID_VL_MANAGE_VEHICLES_DROPDOWN);
|
||||
ShowDropDownList(this, std::move(list), -1, WID_VL_MANAGE_VEHICLES_DROPDOWN);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3436,12 +3436,12 @@ public:
|
||||
} else if (_settings_client.gui.show_depot_sell_gui && v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||
if (_ctrl_pressed) {
|
||||
OrderDepotActionFlags flags = v->current_order.GetDepotActionType() & (ODATFB_HALT | ODATFB_SELL);
|
||||
DropDownList *list = new DropDownList();
|
||||
list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_SEND_FOR_SERVICING, DEPOT_SERVICE | DEPOT_DONT_CANCEL, !flags));
|
||||
list->push_back(new DropDownListStringItem(BaseVehicleListWindow::vehicle_depot_name[v->type], DEPOT_DONT_CANCEL, flags == ODATFB_HALT));
|
||||
list->push_back(new DropDownListStringItem(BaseVehicleListWindow::vehicle_depot_sell_name[v->type], DEPOT_SELL | DEPOT_DONT_CANCEL, flags == (ODATFB_HALT | ODATFB_SELL)));
|
||||
list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_CANCEL_DEPOT_SERVICE, DEPOT_CANCEL, false));
|
||||
ShowDropDownList(this, list, -1, widget, 0, true);
|
||||
DropDownList list;
|
||||
list.emplace_back(new DropDownListStringItem(STR_VEHICLE_LIST_SEND_FOR_SERVICING, DEPOT_SERVICE | DEPOT_DONT_CANCEL, !flags));
|
||||
list.emplace_back(new DropDownListStringItem(BaseVehicleListWindow::vehicle_depot_name[v->type], DEPOT_DONT_CANCEL, flags == ODATFB_HALT));
|
||||
list.emplace_back(new DropDownListStringItem(BaseVehicleListWindow::vehicle_depot_sell_name[v->type], DEPOT_SELL | DEPOT_DONT_CANCEL, flags == (ODATFB_HALT | ODATFB_SELL)));
|
||||
list.emplace_back(new DropDownListStringItem(STR_VEHICLE_LIST_CANCEL_DEPOT_SERVICE, DEPOT_CANCEL, false));
|
||||
ShowDropDownList(this, std::move(list), -1, widget, 0, true);
|
||||
} else {
|
||||
DoCommandP(v->tile, v->index | DEPOT_CANCEL, 0, GetCmdSendToDepot(v));
|
||||
}
|
||||
|
Reference in New Issue
Block a user