|
|
|
@ -244,7 +244,15 @@ protected:
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Constants for sorting stations */
|
|
|
|
|
static const StringID sorter_names[];
|
|
|
|
|
static inline const StringID 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,
|
|
|
|
|
INVALID_STRING_ID
|
|
|
|
|
};
|
|
|
|
|
static const std::initializer_list<GUIStationList::SortFunction * const> sorter_funcs;
|
|
|
|
|
|
|
|
|
|
FilterState filter;
|
|
|
|
@ -400,7 +408,7 @@ public:
|
|
|
|
|
if (HasBit(this->filter.facilities, i)) this->LowerWidget(i + WID_STL_TRAIN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()];
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->widget_data = CompanyStationsWindow::sorter_names[this->stations.SortType()];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~CompanyStationsWindow()
|
|
|
|
@ -627,7 +635,7 @@ public:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WID_STL_SORTDROPBTN: // select sorting criteria dropdown menu
|
|
|
|
|
ShowDropDownMenu(this, this->sorter_names, this->stations.SortType(), WID_STL_SORTDROPBTN, 0, 0);
|
|
|
|
|
ShowDropDownMenu(this, CompanyStationsWindow::sorter_names, this->stations.SortType(), WID_STL_SORTDROPBTN, 0, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WID_STL_CARGODROPDOWN:
|
|
|
|
@ -644,7 +652,7 @@ public:
|
|
|
|
|
this->stations.SetSortType(index);
|
|
|
|
|
|
|
|
|
|
/* Display the current sort variant */
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()];
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->widget_data = CompanyStationsWindow::sorter_names[this->stations.SortType()];
|
|
|
|
|
|
|
|
|
|
this->SetDirty();
|
|
|
|
|
}
|
|
|
|
@ -728,17 +736,6 @@ const std::initializer_list<GUIStationList::SortFunction * const> CompanyStation
|
|
|
|
|
&StationRatingMinSorter
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* 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,
|
|
|
|
|
INVALID_STRING_ID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static constexpr NWidgetPart _nested_company_stations_widgets[] = {
|
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
|
|
|
@ -1291,8 +1288,24 @@ struct StationViewWindow : public Window {
|
|
|
|
|
ALH_ACCEPTS = 3, ///< Height of the accepted cargo view.
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const StringID _sort_names[]; ///< Names of the sorting options in the dropdown.
|
|
|
|
|
static const StringID _group_names[]; ///< Names of the grouping options in the dropdown.
|
|
|
|
|
/** Names of the sorting options in the dropdown. */
|
|
|
|
|
static inline const StringID sort_names[] = {
|
|
|
|
|
STR_STATION_VIEW_WAITING_STATION,
|
|
|
|
|
STR_STATION_VIEW_WAITING_AMOUNT,
|
|
|
|
|
STR_STATION_VIEW_PLANNED_STATION,
|
|
|
|
|
STR_STATION_VIEW_PLANNED_AMOUNT,
|
|
|
|
|
INVALID_STRING_ID
|
|
|
|
|
};
|
|
|
|
|
/** Names of the grouping options in the dropdown. */
|
|
|
|
|
static inline const StringID group_names[] = {
|
|
|
|
|
STR_STATION_VIEW_GROUP_S_V_D,
|
|
|
|
|
STR_STATION_VIEW_GROUP_S_D_V,
|
|
|
|
|
STR_STATION_VIEW_GROUP_V_S_D,
|
|
|
|
|
STR_STATION_VIEW_GROUP_V_D_S,
|
|
|
|
|
STR_STATION_VIEW_GROUP_D_S_V,
|
|
|
|
|
STR_STATION_VIEW_GROUP_D_V_S,
|
|
|
|
|
INVALID_STRING_ID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sort types of the different 'columns'.
|
|
|
|
@ -1977,14 +1990,14 @@ struct StationViewWindow : public Window {
|
|
|
|
|
* sorting criteria for columns 1, 2, and 3. Column 0 is always
|
|
|
|
|
* sorted by cargo ID. The others can theoretically be sorted
|
|
|
|
|
* by different things but there is no UI for that. */
|
|
|
|
|
ShowDropDownMenu(this, _sort_names,
|
|
|
|
|
ShowDropDownMenu(this, StationViewWindow::sort_names,
|
|
|
|
|
this->current_mode * 2 + (this->sortings[1] == CargoSortType::Count ? 1 : 0),
|
|
|
|
|
WID_SV_SORT_BY, 0, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case WID_SV_GROUP_BY: {
|
|
|
|
|
ShowDropDownMenu(this, _group_names, this->grouping_index, WID_SV_GROUP_BY, 0, 0);
|
|
|
|
|
ShowDropDownMenu(this, StationViewWindow::group_names, this->grouping_index, WID_SV_GROUP_BY, 0, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2015,7 +2028,7 @@ struct StationViewWindow : public Window {
|
|
|
|
|
void SelectSortBy(int index)
|
|
|
|
|
{
|
|
|
|
|
_settings_client.gui.station_gui_sort_by = index;
|
|
|
|
|
switch (_sort_names[index]) {
|
|
|
|
|
switch (StationViewWindow::sort_names[index]) {
|
|
|
|
|
case STR_STATION_VIEW_WAITING_STATION:
|
|
|
|
|
this->current_mode = MODE_WAITING;
|
|
|
|
|
this->sortings[1] = this->sortings[2] = this->sortings[3] = CargoSortType::AsGrouping;
|
|
|
|
@ -2036,7 +2049,7 @@ struct StationViewWindow : public Window {
|
|
|
|
|
NOT_REACHED();
|
|
|
|
|
}
|
|
|
|
|
/* Display the current sort variant */
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_SV_SORT_BY)->widget_data = _sort_names[index];
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_SV_SORT_BY)->widget_data = StationViewWindow::sort_names[index];
|
|
|
|
|
this->SetDirty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2048,8 +2061,8 @@ struct StationViewWindow : public Window {
|
|
|
|
|
{
|
|
|
|
|
this->grouping_index = index;
|
|
|
|
|
_settings_client.gui.station_gui_group_order = index;
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_SV_GROUP_BY)->widget_data = _group_names[index];
|
|
|
|
|
switch (_group_names[index]) {
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_SV_GROUP_BY)->widget_data = StationViewWindow::group_names[index];
|
|
|
|
|
switch (StationViewWindow::group_names[index]) {
|
|
|
|
|
case STR_STATION_VIEW_GROUP_S_V_D:
|
|
|
|
|
this->groupings[1] = GR_SOURCE;
|
|
|
|
|
this->groupings[2] = GR_NEXT;
|
|
|
|
@ -2122,24 +2135,6 @@ struct StationViewWindow : public Window {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const StringID StationViewWindow::_sort_names[] = {
|
|
|
|
|
STR_STATION_VIEW_WAITING_STATION,
|
|
|
|
|
STR_STATION_VIEW_WAITING_AMOUNT,
|
|
|
|
|
STR_STATION_VIEW_PLANNED_STATION,
|
|
|
|
|
STR_STATION_VIEW_PLANNED_AMOUNT,
|
|
|
|
|
INVALID_STRING_ID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const StringID StationViewWindow::_group_names[] = {
|
|
|
|
|
STR_STATION_VIEW_GROUP_S_V_D,
|
|
|
|
|
STR_STATION_VIEW_GROUP_S_D_V,
|
|
|
|
|
STR_STATION_VIEW_GROUP_V_S_D,
|
|
|
|
|
STR_STATION_VIEW_GROUP_V_D_S,
|
|
|
|
|
STR_STATION_VIEW_GROUP_D_S_V,
|
|
|
|
|
STR_STATION_VIEW_GROUP_D_V_S,
|
|
|
|
|
INVALID_STRING_ID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static WindowDesc _station_view_desc(
|
|
|
|
|
WDP_AUTO, "view_station", 249, 117,
|
|
|
|
|
WC_STATION_VIEW, WC_NONE,
|
|
|
|
|