Codechange: Add DropDownIcon constructor to override dimension.

This avoids the need to construct a DropDownIcon and set the dimension after.
This commit is contained in:
Peter Nelson
2023-11-25 19:41:21 +00:00
committed by Peter Nelson
parent 49532914dd
commit 8db7c79e79
3 changed files with 9 additions and 18 deletions

View File

@@ -1828,9 +1828,7 @@ DropDownList GetRoadTypeDropDownList(RoadTramTypes rtts, bool for_replacement, b
list.push_back(std::make_unique<DropDownListStringItem>(rti->strings.replace_text, rt, !HasBit(avail_roadtypes, rt)));
} else {
StringID str = rti->max_speed > 0 ? STR_TOOLBAR_RAILTYPE_VELOCITY : STR_JUST_STRING;
auto iconitem = std::make_unique<DropDownListIconItem>(rti->gui_sprites.build_x_road, PAL_NONE, str, rt, !HasBit(avail_roadtypes, rt));
iconitem->SetDimension(d);
list.push_back(std::move(iconitem));
list.push_back(std::make_unique<DropDownListIconItem>(d, rti->gui_sprites.build_x_road, PAL_NONE, str, rt, !HasBit(avail_roadtypes, rt)));
}
}
@@ -1869,9 +1867,7 @@ DropDownList GetScenRoadTypeDropDownList(RoadTramTypes rtts)
SetDParam(0, rti->strings.menu_text);
SetDParam(1, rti->max_speed / 2);
StringID str = rti->max_speed > 0 ? STR_TOOLBAR_RAILTYPE_VELOCITY : STR_JUST_STRING;
auto item = std::make_unique<DropDownListIconItem>(rti->gui_sprites.build_x_road, PAL_NONE, str, rt, !HasBit(avail_roadtypes, rt));
item->SetDimension(d);
list.push_back(std::move(item));
list.push_back(std::make_unique<DropDownListIconItem>(d, rti->gui_sprites.build_x_road, PAL_NONE, str, rt, !HasBit(avail_roadtypes, rt)));
}
if (list.empty()) {