summaryrefslogtreecommitdiff
path: root/src/station_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-05-20 19:57:38 +0000
committerrubidium <rubidium@openttd.org>2013-05-20 19:57:38 +0000
commit15b67dbafa1d7824ba97dbd5387eacdbb6b5a104 (patch)
tree3dfa3b5e37ce9bb464d4314369a1fe4d3298a026 /src/station_gui.cpp
parentd220c1d208fd109e8cea352f7084a07de18223af (diff)
downloadopenttd-15b67dbafa1d7824ba97dbd5387eacdbb6b5a104.tar.xz
(svn r25272) -Feature: show the approximate monthly supply to a station of the different cargoes (fonsinchen)
Diffstat (limited to 'src/station_gui.cpp')
-rw-r--r--src/station_gui.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 1071ca429..5623edb32 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -30,6 +30,7 @@
#include "core/geometry_func.hpp"
#include "vehiclelist.h"
#include "town.h"
+#include "linkgraph/linkgraph.h"
#include "widgets/station_widget.h"
@@ -1075,7 +1076,7 @@ struct StationViewWindow : public Window {
y += WD_PAR_VSEP_WIDE;
}
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_STATION_VIEW_CARGO_RATINGS_TITLE);
+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_STATION_VIEW_SUPPLY_RATINGS_TITLE);
y += FONT_HEIGHT_NORMAL;
const CargoSpec *cs;
@@ -1083,10 +1084,12 @@ struct StationViewWindow : public Window {
const GoodsEntry *ge = &st->goods[cs->Index()];
if (!ge->HasRating()) continue;
+ const LinkGraph *lg = LinkGraph::GetIfValid(ge->link_graph);
SetDParam(0, cs->name);
- SetDParam(2, ToPercent8(ge->rating));
- SetDParam(1, STR_CARGO_RATING_APPALLING + (ge->rating >> 5));
- DrawString(r.left + WD_FRAMERECT_LEFT + 6, r.right - WD_FRAMERECT_RIGHT - 6, y, STR_STATION_VIEW_CARGO_RATING);
+ SetDParam(1, lg != NULL ? lg->Monthly((*lg)[ge->node].Supply()) : 0);
+ SetDParam(2, STR_CARGO_RATING_APPALLING + (ge->rating >> 5));
+ SetDParam(3, ToPercent8(ge->rating));
+ DrawString(r.left + WD_FRAMERECT_LEFT + 6, r.right - WD_FRAMERECT_RIGHT - 6, y, STR_STATION_VIEW_CARGO_SUPPLY_RATING);
y += FONT_HEIGHT_NORMAL;
}
return CeilDiv(y - r.top - WD_FRAMERECT_TOP, FONT_HEIGHT_NORMAL);