MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SelectGroupBy

Method SelectGroupBy

src/station_gui.cpp:2084–2122  ·  view source on GitHub ↗

* Select a new grouping mode for the cargo view. * @param index Row being selected in the grouping drop down. */

Source from the content-addressed store, hash-verified

2082 * @param index Row being selected in the grouping drop down.
2083 */
2084 void SelectGroupBy(int index)
2085 {
2086 this->grouping_index = index;
2087 _settings_client.gui.station_gui_group_order = index;
2088 this->GetWidget<NWidgetCore>(WID_SV_GROUP_BY)->SetString(StationViewWindow::group_names[index]);
2089 switch (StationViewWindow::group_names[index]) {
2090 case STR_STATION_VIEW_GROUP_S_V_D:
2091 this->groupings[1] = GR_SOURCE;
2092 this->groupings[2] = GR_NEXT;
2093 this->groupings[3] = GR_DESTINATION;
2094 break;
2095 case STR_STATION_VIEW_GROUP_S_D_V:
2096 this->groupings[1] = GR_SOURCE;
2097 this->groupings[2] = GR_DESTINATION;
2098 this->groupings[3] = GR_NEXT;
2099 break;
2100 case STR_STATION_VIEW_GROUP_V_S_D:
2101 this->groupings[1] = GR_NEXT;
2102 this->groupings[2] = GR_SOURCE;
2103 this->groupings[3] = GR_DESTINATION;
2104 break;
2105 case STR_STATION_VIEW_GROUP_V_D_S:
2106 this->groupings[1] = GR_NEXT;
2107 this->groupings[2] = GR_DESTINATION;
2108 this->groupings[3] = GR_SOURCE;
2109 break;
2110 case STR_STATION_VIEW_GROUP_D_S_V:
2111 this->groupings[1] = GR_DESTINATION;
2112 this->groupings[2] = GR_SOURCE;
2113 this->groupings[3] = GR_NEXT;
2114 break;
2115 case STR_STATION_VIEW_GROUP_D_V_S:
2116 this->groupings[1] = GR_DESTINATION;
2117 this->groupings[2] = GR_NEXT;
2118 this->groupings[3] = GR_SOURCE;
2119 break;
2120 }
2121 this->SetDirty();
2122 }
2123
2124 void OnDropdownSelect(WidgetID widget, int index, int) override
2125 {

Callers 2

StationViewWindowMethod · 0.95
OnDropdownSelectMethod · 0.95

Calls 2

SetStringMethod · 0.45
SetDirtyMethod · 0.45

Tested by

no test coverage detected