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

Method OnDropdownSelect

src/vehicle_gui.cpp:2174–2212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2172 }
2173
2174 void OnDropdownSelect(WidgetID widget, int index, int) override
2175 {
2176 switch (widget) {
2177 case WID_VL_GROUP_BY_PULLDOWN:
2178 this->UpdateVehicleGroupBy(static_cast<GroupBy>(index));
2179 break;
2180
2181 case WID_VL_SORT_BY_PULLDOWN:
2182 this->vehgroups.SetSortType(index);
2183 break;
2184
2185 case WID_VL_FILTER_BY_CARGO:
2186 this->SetCargoFilter(index);
2187 break;
2188
2189 case WID_VL_MANAGE_VEHICLES_DROPDOWN:
2190 assert(!this->vehicles.empty());
2191
2192 switch (index) {
2193 case ADI_REPLACE: // Replace window
2194 ShowReplaceGroupVehicleWindow(ALL_GROUP, this->vli.vtype);
2195 break;
2196 case ADI_SERVICE: // Send for servicing
2197 case ADI_DEPOT: // Send to Depots
2198 Command<CMD_SEND_VEHICLE_TO_DEPOT>::Post(GetCmdSendToDepotMsg(this->vli.vtype), VehicleID::Invalid(), (index == ADI_SERVICE ? DepotCommandFlag::Service : DepotCommandFlags{}) | DepotCommandFlag::MassSend, this->vli);
2199 break;
2200
2201 case ADI_CREATE_GROUP: // Create group
2202 Command<CMD_ADD_VEHICLE_GROUP>::Post(CcAddVehicleNewGroup, NEW_GROUP, VehicleID::Invalid(), false, this->vli);
2203 break;
2204
2205 default: NOT_REACHED();
2206 }
2207 break;
2208
2209 default: NOT_REACHED();
2210 }
2211 this->SetDirty();
2212 }
2213
2214 void OnGameTick() override
2215 {

Callers

nothing calls this directly

Calls 9

GetCmdSendToDepotMsgFunction · 0.85
InvalidFunction · 0.85
NOT_REACHEDFunction · 0.85
UpdateVehicleGroupByMethod · 0.80
SetSortTypeMethod · 0.80
SetCargoFilterMethod · 0.80
emptyMethod · 0.45
SetDirtyMethod · 0.45

Tested by

no test coverage detected