summaryrefslogtreecommitdiff
path: root/src/station_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-03-11 22:29:37 +0000
committerpeter1138 <peter1138@openttd.org>2007-03-11 22:29:37 +0000
commit1c55149e1fb8aca7b94d0343779f8d7231a0259c (patch)
tree49cb13e61217d7044e42b67888a00f56896ebad1 /src/station_gui.cpp
parent4cc3551ef2f9598a2267bd53cf65f672d4d77da3 (diff)
downloadopenttd-1c55149e1fb8aca7b94d0343779f8d7231a0259c.tar.xz
(svn r9127) -Codechange: Check if a cargo is valid before displaying it in a station's cargo rating list. (And duff up the block a little)
Diffstat (limited to 'src/station_gui.cpp')
-rw-r--r--src/station_gui.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 98115f973..309e311a1 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -777,13 +777,17 @@ static void DrawStationViewWindow(Window *w)
y = 77;
for (CargoID i = 0; i != NUM_CARGO; i++) {
- if (st->goods[i].enroute_from != INVALID_STATION) {
- SetDParam(0, GetCargo(i)->name);
- SetDParam(2, st->goods[i].rating * 101 >> 8);
- SetDParam(1, STR_3035_APPALLING + (st->goods[i].rating >> 5));
- DrawString(8, y, STR_303D, 0);
- y += 10;
- }
+ const CargoSpec *cs = GetCargo(i);
+ if (!cs->IsValid()) continue;
+
+ const GoodsEntry *ge = &st->goods[i];
+ if (ge->enroute_from == INVALID_STATION) continue;
+
+ SetDParam(0, cs->name);
+ SetDParam(2, ge->rating * 101 >> 8);
+ SetDParam(1, STR_3035_APPALLING + (ge->rating >> 5));
+ DrawString(8, y, STR_303D, 0);
+ y += 10;
}
}
}