mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-27 16:39:09 +00:00
Feature: Place cargo icon on cargo filter dropdowns.
Reveal the pixel art.
This commit is contained in:
@@ -1579,8 +1579,9 @@ struct BuildVehicleWindow : Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add cargos */
|
/* Add cargos */
|
||||||
|
Dimension d = GetLargestCargoIconSize();
|
||||||
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
list.push_back(std::make_unique<DropDownListStringItem>(cs->name, cs->Index(), false));
|
list.push_back(std::make_unique<DropDownListIconItem>(d, cs->GetCargoIcon(), PAL_NONE, cs->name, cs->Index(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@@ -1753,8 +1753,9 @@ public:
|
|||||||
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_NONE), CF_NONE, false));
|
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_NONE), CF_NONE, false));
|
||||||
|
|
||||||
/* Add cargos */
|
/* Add cargos */
|
||||||
|
Dimension d = GetLargestCargoIconSize();
|
||||||
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
list.push_back(std::make_unique<DropDownListStringItem>(cs->name, cs->Index(), false));
|
list.push_back(std::make_unique<DropDownListIconItem>(d, cs->GetCargoIcon(), PAL_NONE, cs->name, cs->Index(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
@@ -3091,8 +3092,9 @@ struct IndustryCargoesWindow : public Window {
|
|||||||
|
|
||||||
case WID_IC_CARGO_DROPDOWN: {
|
case WID_IC_CARGO_DROPDOWN: {
|
||||||
DropDownList lst;
|
DropDownList lst;
|
||||||
|
Dimension d = GetLargestCargoIconSize();
|
||||||
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
lst.push_back(std::make_unique<DropDownListStringItem>(cs->name, cs->Index(), false));
|
lst.push_back(std::make_unique<DropDownListIconItem>(d, cs->GetCargoIcon(), PAL_NONE, cs->name, cs->Index(), false));
|
||||||
}
|
}
|
||||||
if (!lst.empty()) {
|
if (!lst.empty()) {
|
||||||
int selected = (this->ind_cargo >= NUM_INDUSTRYTYPES) ? (int)(this->ind_cargo - NUM_INDUSTRYTYPES) : -1;
|
int selected = (this->ind_cargo >= NUM_INDUSTRYTYPES) ? (int)(this->ind_cargo - NUM_INDUSTRYTYPES) : -1;
|
||||||
|
@@ -383,8 +383,9 @@ DropDownList BaseVehicleListWindow::BuildCargoDropDownList() const
|
|||||||
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_NONE), CF_NONE, false));
|
list.push_back(std::make_unique<DropDownListStringItem>(this->GetCargoFilterLabel(CF_NONE), CF_NONE, false));
|
||||||
|
|
||||||
/* Add cargos */
|
/* Add cargos */
|
||||||
|
Dimension d = GetLargestCargoIconSize();
|
||||||
for (const CargoSpec *cs : _sorted_cargo_specs) {
|
for (const CargoSpec *cs : _sorted_cargo_specs) {
|
||||||
list.push_back(std::make_unique<DropDownListStringItem>(cs->name, cs->Index(), false));
|
list.push_back(std::make_unique<DropDownListIconItem>(d, cs->GetCargoIcon(), PAL_NONE, cs->name, cs->Index(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
Reference in New Issue
Block a user