mirror of https://github.com/OpenTTD/OpenTTD
(svn r25272) -Feature: show the approximate monthly supply to a station of the different cargoes (fonsinchen)
parent
d220c1d208
commit
15b67dbafa
|
@ -2971,8 +2971,8 @@ STR_STATIOV_VIEW_EXCLUSIVE_RIGHTS_COMPANY :{YELLOW}{COMPAN
|
||||||
|
|
||||||
STR_STATION_VIEW_RATINGS_BUTTON :{BLACK}Ratings
|
STR_STATION_VIEW_RATINGS_BUTTON :{BLACK}Ratings
|
||||||
STR_STATION_VIEW_RATINGS_TOOLTIP :{BLACK}Show station ratings
|
STR_STATION_VIEW_RATINGS_TOOLTIP :{BLACK}Show station ratings
|
||||||
STR_STATION_VIEW_CARGO_RATINGS_TITLE :{BLACK}Local rating of transport service:
|
STR_STATION_VIEW_SUPPLY_RATINGS_TITLE :{BLACK}Monthly supply and local rating:
|
||||||
STR_STATION_VIEW_CARGO_RATING :{WHITE}{STRING}: {YELLOW}{STRING} ({COMMA}%)
|
STR_STATION_VIEW_CARGO_SUPPLY_RATING :{WHITE}{STRING}: {YELLOW}{COMMA} / {STRING} ({COMMA}%)
|
||||||
|
|
||||||
############ range for rating starts
|
############ range for rating starts
|
||||||
STR_CARGO_RATING_APPALLING :Appalling
|
STR_CARGO_RATING_APPALLING :Appalling
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "core/geometry_func.hpp"
|
#include "core/geometry_func.hpp"
|
||||||
#include "vehiclelist.h"
|
#include "vehiclelist.h"
|
||||||
#include "town.h"
|
#include "town.h"
|
||||||
|
#include "linkgraph/linkgraph.h"
|
||||||
|
|
||||||
#include "widgets/station_widget.h"
|
#include "widgets/station_widget.h"
|
||||||
|
|
||||||
|
@ -1075,7 +1076,7 @@ struct StationViewWindow : public Window {
|
||||||
y += WD_PAR_VSEP_WIDE;
|
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;
|
y += FONT_HEIGHT_NORMAL;
|
||||||
|
|
||||||
const CargoSpec *cs;
|
const CargoSpec *cs;
|
||||||
|
@ -1083,10 +1084,12 @@ struct StationViewWindow : public Window {
|
||||||
const GoodsEntry *ge = &st->goods[cs->Index()];
|
const GoodsEntry *ge = &st->goods[cs->Index()];
|
||||||
if (!ge->HasRating()) continue;
|
if (!ge->HasRating()) continue;
|
||||||
|
|
||||||
|
const LinkGraph *lg = LinkGraph::GetIfValid(ge->link_graph);
|
||||||
SetDParam(0, cs->name);
|
SetDParam(0, cs->name);
|
||||||
SetDParam(2, ToPercent8(ge->rating));
|
SetDParam(1, lg != NULL ? lg->Monthly((*lg)[ge->node].Supply()) : 0);
|
||||||
SetDParam(1, STR_CARGO_RATING_APPALLING + (ge->rating >> 5));
|
SetDParam(2, 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(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;
|
y += FONT_HEIGHT_NORMAL;
|
||||||
}
|
}
|
||||||
return CeilDiv(y - r.top - WD_FRAMERECT_TOP, FONT_HEIGHT_NORMAL);
|
return CeilDiv(y - r.top - WD_FRAMERECT_TOP, FONT_HEIGHT_NORMAL);
|
||||||
|
|
Loading…
Reference in New Issue