summaryrefslogtreecommitdiff
path: root/src/subsidy_gui.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-12-17 21:22:15 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-12-21 20:13:03 +0100
commit0b489f99249a8c62ee3826e490ed17f29377581c (patch)
treec5289a92bbb98d40d38e3320276e6e02f732f633 /src/subsidy_gui.cpp
parent847e5f33d4749568cda696b8940ec10b540bd6fb (diff)
downloadopenttd-0b489f99249a8c62ee3826e490ed17f29377581c.tar.xz
Codechange: Replace FOR_ALL_SUBSIDIES with range-based for loops
Diffstat (limited to 'src/subsidy_gui.cpp')
-rw-r--r--src/subsidy_gui.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp
index 1a6b2ab4a..f9a17f7b7 100644
--- a/src/subsidy_gui.cpp
+++ b/src/subsidy_gui.cpp
@@ -42,8 +42,7 @@ struct SubsidyListWindow : Window {
int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SUL_PANEL, WD_FRAMERECT_TOP);
int num = 0;
- const Subsidy *s;
- FOR_ALL_SUBSIDIES(s) {
+ for (const Subsidy *s : Subsidy::Iterate()) {
if (!s->IsAwarded()) {
y--;
if (y == 0) {
@@ -62,7 +61,7 @@ struct SubsidyListWindow : Window {
y -= 2; // "Services already subsidised:"
if (y < 0) return;
- FOR_ALL_SUBSIDIES(s) {
+ for (const Subsidy *s : Subsidy::Iterate()) {
if (s->IsAwarded()) {
y--;
if (y == 0) {
@@ -110,8 +109,7 @@ struct SubsidyListWindow : Window {
/* Count number of (non) awarded subsidies */
uint num_awarded = 0;
uint num_not_awarded = 0;
- const Subsidy *s;
- FOR_ALL_SUBSIDIES(s) {
+ for (const Subsidy *s : Subsidy::Iterate()) {
if (!s->IsAwarded()) {
num_not_awarded++;
} else {
@@ -159,8 +157,7 @@ struct SubsidyListWindow : Window {
pos++;
uint num = 0;
- const Subsidy *s;
- FOR_ALL_SUBSIDIES(s) {
+ for (const Subsidy *s : Subsidy::Iterate()) {
if (!s->IsAwarded()) {
if (IsInsideMM(pos, 0, cap)) {
/* Displays the two offered towns */
@@ -184,7 +181,7 @@ struct SubsidyListWindow : Window {
pos++;
num = 0;
- FOR_ALL_SUBSIDIES(s) {
+ for (const Subsidy *s : Subsidy::Iterate()) {
if (s->IsAwarded()) {
if (IsInsideMM(pos, 0, cap)) {
SetupSubsidyDecodeParam(s, true);