1
0
Fork 0

(svn r26957) -Codechange: Spread the station cargo icons out by GUI scale.

release/1.5
peter1138 2014-10-04 20:18:25 +00:00
parent 51c7d2ab6f
commit d6ac7d6fda
1 changed files with 5 additions and 3 deletions

View File

@ -31,6 +31,7 @@
#include "vehiclelist.h" #include "vehiclelist.h"
#include "town.h" #include "town.h"
#include "linkgraph/linkgraph.h" #include "linkgraph/linkgraph.h"
#include "zoom_func.h"
#include "widgets/station_widget.h" #include "widgets/station_widget.h"
@ -802,15 +803,16 @@ static const NWidgetPart _nested_station_view_widgets[] = {
*/ */
static void DrawCargoIcons(CargoID i, uint waiting, int left, int right, int y) static void DrawCargoIcons(CargoID i, uint waiting, int left, int right, int y)
{ {
uint num = min((waiting + 5) / 10, (right - left) / 10); // maximum is width / 10 icons so it won't overflow int width = UnScaleByZoom(4 * 10, ZOOM_LVL_GUI);
uint num = min((waiting + (width / 2)) / width, (right - left) / width); // maximum is width / 10 icons so it won't overflow
if (num == 0) return; if (num == 0) return;
SpriteID sprite = CargoSpec::Get(i)->GetCargoIcon(); SpriteID sprite = CargoSpec::Get(i)->GetCargoIcon();
int x = _current_text_dir == TD_RTL ? left : right - num * 10; int x = _current_text_dir == TD_RTL ? left : right - num * width;
do { do {
DrawSprite(sprite, PAL_NONE, x, y); DrawSprite(sprite, PAL_NONE, x, y);
x += 10; x += width;
} while (--num); } while (--num);
} }