|
@@ -319,12 +319,19 @@ protected:
|
|
|
if (b->goods[j].HasRating()) minr2 = std::min(minr2, b->goods[j].rating);
|
|
|
}
|
|
|
|
|
|
return minr1 > minr2;
|
|
|
}
|
|
|
|
|
|
/** Sort stations by their dilapidation */
|
|
|
static bool StationDilapidationSorter(const Station* const& a, const Station* const& b)
|
|
|
{
|
|
|
if (a->dilapidation == b->dilapidation) return StationNameSorter(a, b); // fallback
|
|
|
return a->dilapidation < b->dilapidation;
|
|
|
}
|
|
|
|
|
|
/** Sort the stations list */
|
|
|
void SortStationsList()
|
|
|
{
|
|
|
if (!this->stations.Sort()) return;
|
|
|
|
|
|
/* Set the modified widget dirty */
|
|
@@ -457,13 +464,23 @@ public:
|
|
|
/* Do not do the complex check HasStationInUse here, it may be even false
|
|
|
* when the order had been removed and the station list hasn't been removed yet */
|
|
|
assert(st->owner == owner || st->owner == OWNER_NONE);
|
|
|
|
|
|
SetDParam(0, st->index);
|
|
|
SetDParam(1, st->facilities);
|
|
|
int x = DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y + (line_height - FONT_HEIGHT_NORMAL) / 2, STR_STATION_LIST_STATION);
|
|
|
int x;
|
|
|
|
|
|
if (_settings_game.economy.dilapidation_max_amount > 0 && st->dilapidation > 0)
|
|
|
{
|
|
|
SetDParam(2, st->dilapidation);
|
|
|
x = DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y + (line_height - FONT_HEIGHT_NORMAL) / 2, STR_STATION_LIST_STATION_WITH_DILAPIDATION);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
x = DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y + (line_height - FONT_HEIGHT_NORMAL) / 2, STR_STATION_LIST_STATION);
|
|
|
}
|
|
|
x += rtl ? -text_spacing : text_spacing;
|
|
|
|
|
|
/* show cargo waiting and station ratings */
|
|
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
|
|
CargoID cid = cs->Index();
|
|
|
if (st->goods[cid].cargo.TotalCount() > 0) {
|
|
@@ -696,23 +713,25 @@ CargoTypes CompanyStationsWindow::cargo_
|
|
|
GUIStationList::SortFunction * const CompanyStationsWindow::sorter_funcs[] = {
|
|
|
&StationNameSorter,
|
|
|
&StationTypeSorter,
|
|
|
&StationWaitingTotalSorter,
|
|
|
&StationWaitingAvailableSorter,
|
|
|
&StationRatingMaxSorter,
|
|
|
&StationRatingMinSorter
|
|
|
&StationRatingMinSorter,
|
|
|
&StationDilapidationSorter
|
|
|
};
|
|
|
|
|
|
/* Names of the sorting functions */
|
|
|
const StringID CompanyStationsWindow::sorter_names[] = {
|
|
|
STR_SORT_BY_NAME,
|
|
|
STR_SORT_BY_FACILITY,
|
|
|
STR_SORT_BY_WAITING_TOTAL,
|
|
|
STR_SORT_BY_WAITING_AVAILABLE,
|
|
|
STR_SORT_BY_RATING_MAX,
|
|
|
STR_SORT_BY_RATING_MIN,
|
|
|
STR_SORT_BY_DILAPIDATION,
|
|
|
INVALID_STRING_ID
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Make a horizontal row of cargo buttons, starting at widget #WID_STL_CARGOSTART.
|
|
|
* @param biggest_index Pointer to store biggest used widget number of the buttons.
|
|
@@ -1851,12 +1870,19 @@ struct StationViewWindow : public Window
|
|
|
if (st->town->exclusive_counter > 0) {
|
|
|
SetDParam(0, st->town->exclusivity);
|
|
|
y = DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, r.bottom, st->town->exclusivity == st->owner ? STR_STATION_VIEW_EXCLUSIVE_RIGHTS_SELF : STR_STATION_VIEW_EXCLUSIVE_RIGHTS_COMPANY);
|
|
|
y += WD_PAR_VSEP_WIDE;
|
|
|
}
|
|
|
|
|
|
if (_settings_game.economy.dilapidation_max_amount > 0) {
|
|
|
SetDParam(0, st->dilapidation);
|
|
|
SetDParam(1, _settings_game.economy.dilapidation_max_amount);
|
|
|
y = DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, r.bottom, STR_STATION_VIEW_DILAPIDATION);
|
|
|
y += WD_PAR_VSEP_WIDE;
|
|
|
}
|
|
|
|
|
|
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_STATION_VIEW_SUPPLY_RATINGS_TITLE);
|
|
|
y += FONT_HEIGHT_NORMAL;
|
|
|
|
|
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
|
|
const GoodsEntry *ge = &st->goods[cs->Index()];
|
|
|
if (!ge->HasRating()) continue;
|