Cleanup: Replace FOR_ALL_SORTED_RAILTYPES macro with range iterator.

This commit is contained in:
Peter Nelson
2021-04-28 21:49:58 +01:00
committed by PeterN
parent ae7f07de74
commit 3b3d80c8ef
3 changed files with 5 additions and 15 deletions

View File

@@ -2191,17 +2191,16 @@ DropDownList GetRailTypeDropDownList(bool for_replacement, bool all_option)
}
Dimension d = { 0, 0 };
RailType rt;
/* Get largest icon size, to ensure text is aligned on each menu item. */
if (!for_replacement) {
FOR_ALL_SORTED_RAILTYPES(rt) {
for (const auto &rt : _sorted_railtypes) {
if (!HasBit(used_railtypes, rt)) continue;
const RailtypeInfo *rti = GetRailTypeInfo(rt);
d = maxdim(d, GetSpriteSize(rti->gui_sprites.build_x_rail));
}
}
FOR_ALL_SORTED_RAILTYPES(rt) {
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;