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:
Jonathan G Rennison
2019-04-11 18:12:22 +01:00
53 changed files with 587 additions and 627 deletions

View File

@@ -64,7 +64,7 @@ static const StringID _cargo_type_unload_order_drowdown[] = {
};
static const uint32 _cargo_type_unload_order_drowdown_hidden_mask = 0x8; // 01000
DropDownList* GetSlotDropDownList(Owner owner, TraceRestrictSlotID slot_id, int &selected);
DropDownList GetSlotDropDownList(Owner owner, TraceRestrictSlotID slot_id, int &selected);
struct CargoTypeOrdersWindow : public Window {
private:
@@ -2064,8 +2064,8 @@ public:
case WID_O_COND_SLOT: {
int selected;
TraceRestrictSlotID value = this->vehicle->GetOrder(this->OrderGetSel())->GetXData();
DropDownList *list = GetSlotDropDownList(this->vehicle->owner, value, selected);
if (list != nullptr) ShowDropDownList(this, list, selected, WID_O_COND_SLOT, 0, true);
DropDownList list = GetSlotDropDownList(this->vehicle->owner, value, selected);
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_COND_SLOT, 0, true);
break;
}
@@ -2082,16 +2082,12 @@ public:
case WID_O_COND_CARGO: {
uint value = this->vehicle->GetOrder(this->OrderGetSel())->GetConditionValue();
DropDownList *list = new DropDownList();
DropDownList list;
for (size_t i = 0; i < _sorted_standard_cargo_specs_size; ++i) {
const CargoSpec *cs = _sorted_cargo_specs[i];
list->push_back(new DropDownListStringItem(cs->name, cs->Index(), false));
list.emplace_back(new DropDownListStringItem(cs->name, cs->Index(), false));
}
if (list->size() == 0) {
delete list;
return;
}
ShowDropDownList(this, list, value, WID_O_COND_CARGO, 0);
if (!list.empty()) ShowDropDownList(this, std::move(list), value, WID_O_COND_CARGO, 0);
break;
}
@@ -2100,11 +2096,11 @@ public:
break;
case WID_O_COND_VARIABLE: {
DropDownList *list = new DropDownList();
DropDownList list;
for (uint i = 0; i < lengthof(_order_conditional_variable); i++) {
list->push_back(new DropDownListStringItem(STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + _order_conditional_variable[i], _order_conditional_variable[i], false));
list.emplace_back(new DropDownListStringItem(STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + _order_conditional_variable[i], _order_conditional_variable[i], false));
}
ShowDropDownList(this, list, this->vehicle->GetOrder(this->OrderGetSel())->GetConditionVariable(), WID_O_COND_VARIABLE);
ShowDropDownList(this, std::move(list), this->vehicle->GetOrder(this->OrderGetSel())->GetConditionVariable(), WID_O_COND_VARIABLE);
break;
}