summaryrefslogtreecommitdiff
path: root/src/subsidy_gui.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-07-01 17:43:26 +0000
committersmatz <smatz@openttd.org>2009-07-01 17:43:26 +0000
commitf4d0d94184ba53d4c5d1343b69bb05e7fa735bff (patch)
treedea54822153f6e578140cbdd847bc5f4ed864230 /src/subsidy_gui.cpp
parent023f78b5ff76b15777d6d7db73adcb9a6673c543 (diff)
downloadopenttd-f4d0d94184ba53d4c5d1343b69bb05e7fa735bff.tar.xz
(svn r16711) -Codechange: use FOR_ALL_SUBSIDIES macro when iterating over all subsidies
Diffstat (limited to 'src/subsidy_gui.cpp')
-rw-r--r--src/subsidy_gui.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp
index 14ae1348a..071fb327d 100644
--- a/src/subsidy_gui.cpp
+++ b/src/subsidy_gui.cpp
@@ -43,8 +43,10 @@ struct SubsidyListWindow : Window {
if (y < 0) return;
uint num = 0;
- for (const Subsidy *s = _subsidies; s != endof(_subsidies); s++) {
- if (s->cargo_type != CT_INVALID && s->age < 12) {
+
+ const Subsidy *s;
+ FOR_ALL_SUBSIDIES(s) {
+ if (s->age < 12) {
y -= FONT_HEIGHT_NORMAL;
if (y < 0) {
this->HandleClick(s);
@@ -62,8 +64,8 @@ struct SubsidyListWindow : Window {
y -= 11; // "Services already subsidised:"
if (y < 0) return;
- for (const Subsidy *s = _subsidies; s != endof(_subsidies); s++) {
- if (s->cargo_type != CT_INVALID && s->age >= 12) {
+ FOR_ALL_SUBSIDIES(s) {
+ if (s->age >= 12) {
y -= FONT_HEIGHT_NORMAL;
if (y < 0) {
this->HandleClick(s);
@@ -127,8 +129,8 @@ struct SubsidyListWindow : Window {
y += FONT_HEIGHT_NORMAL;
uint num = 0;
- for (s = _subsidies; s != endof(_subsidies); s++) {
- if (s->cargo_type != CT_INVALID && s->age < 12) {
+ FOR_ALL_SUBSIDIES(s) {
+ if (s->age < 12) {
/* Displays the two offered towns */
SetupSubsidyDecodeParam(s, 1);
SetDParam(7, _date - ymd.day + 384 - s->age * 32);
@@ -149,8 +151,8 @@ struct SubsidyListWindow : Window {
y += FONT_HEIGHT_NORMAL;
num = 0;
- for (s = _subsidies; s != endof(_subsidies); s++) {
- if (s->cargo_type != CT_INVALID && s->age >= 12) {
+ FOR_ALL_SUBSIDIES(s) {
+ if (s->age >= 12) {
SetupSubsidyDecodeParam(s, 1);
SetDParam(3, Station::Get(s->to)->owner);
SetDParam(4, _date - ymd.day + 768 - s->age * 32);