|
@@ -46,13 +46,13 @@
|
|
|
*/
|
|
|
static void StationsWndShowStationRating(int left, int right, int y, CargoID type, uint amount, byte rating)
|
|
|
{
|
|
|
static const uint units_full = 576; ///< number of units to show station as 'full'
|
|
|
static const uint rating_full = 224; ///< rating needed so it is shown as 'full'
|
|
|
|
|
|
const CargoSpec *cs = GetCargo(type);
|
|
|
const CargoSpec *cs = CargoSpec::Get(type);
|
|
|
if (!cs->IsValid()) return;
|
|
|
|
|
|
int colour = cs->rating_colour;
|
|
|
uint w = (minu(amount, units_full) + 5) / 36;
|
|
|
|
|
|
/* Draw total cargo (limited) on station (fits into 16 pixels) */
|
|
@@ -255,22 +255,22 @@ public:
|
|
|
this->resize.step_height = 10;
|
|
|
this->resize.height = this->height - 10 * 7; // minimum if 5 in the list
|
|
|
|
|
|
/* Add cargo filter buttons */
|
|
|
uint num_active = 0;
|
|
|
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
|
|
if (GetCargo(c)->IsValid()) num_active++;
|
|
|
if (CargoSpec::Get(c)->IsValid()) num_active++;
|
|
|
}
|
|
|
|
|
|
this->widget_count += num_active;
|
|
|
this->widget = ReallocT(this->widget, this->widget_count + 1);
|
|
|
this->widget[this->widget_count].type = WWT_LAST;
|
|
|
|
|
|
uint i = 0;
|
|
|
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
|
|
if (!GetCargo(c)->IsValid()) continue;
|
|
|
if (!CargoSpec::Get(c)->IsValid()) continue;
|
|
|
|
|
|
Widget *wi = &this->widget[SLW_CARGOSTART + i];
|
|
|
wi->type = WWT_PANEL;
|
|
|
wi->display_flags = RESIZE_NONE;
|
|
|
wi->colour = COLOUR_GREY;
|
|
|
wi->left = 89 + i * 14;
|
|
@@ -343,13 +343,13 @@ public:
|
|
|
int x = 89;
|
|
|
int y = 14;
|
|
|
int xb = 2; ///< offset from left of widget
|
|
|
|
|
|
uint i = 0;
|
|
|
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
|
|
const CargoSpec *cs = GetCargo(c);
|
|
|
const CargoSpec *cs = CargoSpec::Get(c);
|
|
|
if (!cs->IsValid()) continue;
|
|
|
|
|
|
cg_ofst = HasBit(this->cargo_filter, c) ? 2 : 1;
|
|
|
GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour);
|
|
|
DrawString(x + cg_ofst, x + 12 + cg_ofst, y + cg_ofst, cs->abbrev, TC_BLACK, SA_CENTER);
|
|
|
x += 14;
|
|
@@ -454,13 +454,13 @@ public:
|
|
|
this->SetDirty();
|
|
|
break;
|
|
|
|
|
|
case SLW_CARGOALL: {
|
|
|
uint i = 0;
|
|
|
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
|
|
if (!GetCargo(c)->IsValid()) continue;
|
|
|
if (!CargoSpec::Get(c)->IsValid()) continue;
|
|
|
this->LowerWidget(i + SLW_CARGOSTART);
|
|
|
i++;
|
|
|
}
|
|
|
this->LowerWidget(SLW_NOCARGOWAITING);
|
|
|
this->LowerWidget(SLW_CARGOALL);
|
|
|
|
|
@@ -504,13 +504,13 @@ public:
|
|
|
default:
|
|
|
if (widget >= SLW_CARGOSTART) { // change cargo_filter
|
|
|
/* Determine the selected cargo type */
|
|
|
CargoID c;
|
|
|
int i = 0;
|
|
|
for (c = 0; c < NUM_CARGO; c++) {
|
|
|
if (!GetCargo(c)->IsValid()) continue;
|
|
|
if (!CargoSpec::Get(c)->IsValid()) continue;
|
|
|
if (widget - SLW_CARGOSTART == i) break;
|
|
|
i++;
|
|
|
}
|
|
|
|
|
|
if (_ctrl_pressed) {
|
|
|
ToggleBit(this->cargo_filter, c);
|
|
@@ -721,13 +721,13 @@ static const NWidgetPart _nested_station
|
|
|
NWidget(WWT_RESIZEBOX, COLOUR_GREY, SVW_RESIZE),
|
|
|
EndContainer(),
|
|
|
};
|
|
|
|
|
|
SpriteID GetCargoSprite(CargoID i)
|
|
|
{
|
|
|
const CargoSpec *cs = GetCargo(i);
|
|
|
const CargoSpec *cs = CargoSpec::Get(i);
|
|
|
SpriteID sprite;
|
|
|
|
|
|
if (cs->sprite == 0xFFFF) {
|
|
|
/* A value of 0xFFFF indicates we should draw a custom icon */
|
|
|
sprite = GetCustomCargoSprite(cs);
|
|
|
} else {
|
|
@@ -921,13 +921,13 @@ struct StationViewWindow : public Window
|
|
|
first = false;
|
|
|
} else {
|
|
|
/* Add a comma if this is not the first item */
|
|
|
*b++ = ',';
|
|
|
*b++ = ' ';
|
|
|
}
|
|
|
b = InlineString(b, GetCargo(i)->name);
|
|
|
b = InlineString(b, CargoSpec::Get(i)->name);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* If first is still true then no cargo is accepted */
|
|
|
if (first) b = InlineString(b, STR_JUST_NOTHING);
|
|
|
|
|
@@ -942,13 +942,13 @@ struct StationViewWindow : public Window
|
|
|
y = this->widget[SVW_RATINGLIST].top + 1;
|
|
|
|
|
|
DrawString(this->widget[SVW_ACCEPTLIST].left + 2, this->widget[SVW_ACCEPTLIST].right - 2, y, STR_STATION_VIEW_CARGO_RATINGS_TITLE);
|
|
|
y += 10;
|
|
|
|
|
|
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
|
|
const CargoSpec *cs = GetCargo(i);
|
|
|
const CargoSpec *cs = CargoSpec::Get(i);
|
|
|
if (!cs->IsValid()) continue;
|
|
|
|
|
|
const GoodsEntry *ge = &st->goods[i];
|
|
|
if (!HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP)) continue;
|
|
|
|
|
|
SetDParam(0, cs->name);
|