Codechange: Use EnumBitSet for RailTypes.
This commit is contained in:
committed by
Peter Nelson
parent
732109e444
commit
47d078c033
@@ -2052,9 +2052,9 @@ DropDownList GetRailTypeDropDownList(bool for_replacement, bool all_option)
|
||||
Dimension d = { 0, 0 };
|
||||
/* Get largest icon size, to ensure text is aligned on each menu item. */
|
||||
if (!for_replacement) {
|
||||
used_railtypes &= ~_railtypes_hidden_mask;
|
||||
used_railtypes.Reset(_railtypes_hidden_mask);
|
||||
for (const auto &rt : _sorted_railtypes) {
|
||||
if (!HasBit(used_railtypes, rt)) continue;
|
||||
if (!used_railtypes.Test(rt)) continue;
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(rt);
|
||||
d = maxdim(d, GetSpriteSize(rti->gui_sprites.build_x_rail));
|
||||
}
|
||||
@@ -2065,17 +2065,17 @@ DropDownList GetRailTypeDropDownList(bool for_replacement, bool all_option)
|
||||
|
||||
for (const auto &rt : _sorted_railtypes) {
|
||||
/* If it's not used ever, don't show it to the user. */
|
||||
if (!HasBit(used_railtypes, rt)) continue;
|
||||
if (!used_railtypes.Test(rt)) continue;
|
||||
|
||||
const RailTypeInfo *rti = GetRailTypeInfo(rt);
|
||||
|
||||
if (for_replacement) {
|
||||
list.push_back(MakeDropDownListBadgeItem(badge_class_list, rti->badges, GSF_RAILTYPES, rti->introduction_date, GetString(rti->strings.replace_text), rt, !HasBit(avail_railtypes, rt)));
|
||||
list.push_back(MakeDropDownListBadgeItem(badge_class_list, rti->badges, GSF_RAILTYPES, rti->introduction_date, GetString(rti->strings.replace_text), rt, !avail_railtypes.Test(rt)));
|
||||
} else {
|
||||
std::string str = rti->max_speed > 0
|
||||
? GetString(STR_TOOLBAR_RAILTYPE_VELOCITY, rti->strings.menu_text, rti->max_speed)
|
||||
: GetString(rti->strings.menu_text);
|
||||
list.push_back(MakeDropDownListBadgeIconItem(badge_class_list, rti->badges, GSF_RAILTYPES, rti->introduction_date, d, rti->gui_sprites.build_x_rail, PAL_NONE, std::move(str), rt, !HasBit(avail_railtypes, rt)));
|
||||
list.push_back(MakeDropDownListBadgeIconItem(badge_class_list, rti->badges, GSF_RAILTYPES, rti->introduction_date, d, rti->gui_sprites.build_x_rail, PAL_NONE, std::move(str), rt, !avail_railtypes.Test(rt)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user