summaryrefslogtreecommitdiff
path: root/src/company_gui.cpp
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2021-04-28 21:49:58 +0100
committerPeterN <peter@fuzzle.org>2021-04-28 23:54:31 +0100
commit3b3d80c8efbf3310a80e0540b4436a7ded147378 (patch)
tree8b54f517b28ec05ecd0443f22027046ef2fb7b6e /src/company_gui.cpp
parentae7f07de74a8d242dce8a67eaece26be9d06f064 (diff)
downloadopenttd-3b3d80c8efbf3310a80e0540b4436a7ded147378.tar.xz
Cleanup: Replace FOR_ALL_SORTED_RAILTYPES macro with range iterator.
Diffstat (limited to 'src/company_gui.cpp')
-rw-r--r--src/company_gui.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index c9e3eaf86..3706db2f5 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -1840,8 +1840,7 @@ struct CompanyInfrastructureWindow : Window
size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_RAIL_SECT).width);
- RailType rt;
- FOR_ALL_SORTED_RAILTYPES(rt) {
+ for (const auto &rt : _sorted_railtypes) {
if (HasBit(this->railtypes, rt)) {
lines++;
SetDParam(0, GetRailTypeInfo(rt)->strings.name);
@@ -1973,8 +1972,7 @@ struct CompanyInfrastructureWindow : Window
if (this->railtypes != RAILTYPES_NONE) {
/* Draw name of each valid railtype. */
- RailType rt;
- FOR_ALL_SORTED_RAILTYPES(rt) {
+ for (const auto &rt : _sorted_railtypes) {
if (HasBit(this->railtypes, rt)) {
SetDParam(0, GetRailTypeInfo(rt)->strings.name);
DrawString(r.left + offs_left, r.right - offs_right, y += FONT_HEIGHT_NORMAL, STR_WHITE_STRING);
@@ -1991,8 +1989,7 @@ struct CompanyInfrastructureWindow : Window
case WID_CI_RAIL_COUNT: {
/* Draw infrastructure count for each valid railtype. */
uint32 rail_total = c->infrastructure.GetRailTotal();
- RailType rt;
- FOR_ALL_SORTED_RAILTYPES(rt) {
+ for (const auto &rt : _sorted_railtypes) {
if (HasBit(this->railtypes, rt)) {
this->DrawCountLine(r, y, c->infrastructure.rail[rt], RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total));
}