MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / onDropdown

Function onDropdown

src/OpenLoco/src/Ui/Windows/BuildVehicle.cpp:1004–1095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1002 }
1003
1004 static void onDropdown(Window& self, WidgetIndex_t widgetIndex, [[maybe_unused]] const WidgetId id, int16_t itemIndex)
1005 {
1006 if (itemIndex < 0)
1007 {
1008 return;
1009 }
1010
1011 if (widgetIndex == widx::filterDropdown)
1012 {
1013 if (itemIndex == 0)
1014 {
1015 _vehicleFilterFlags ^= VehicleFilterFlags::unpowered;
1016 }
1017 if (itemIndex == 1)
1018 {
1019 _vehicleFilterFlags ^= VehicleFilterFlags::powered;
1020 }
1021 if (itemIndex == 3)
1022 {
1023 _vehicleFilterFlags ^= VehicleFilterFlags::unlocked;
1024 }
1025 if (itemIndex == 4)
1026 {
1027 _vehicleFilterFlags ^= VehicleFilterFlags::locked;
1028 }
1029 }
1030 else if (widgetIndex == widx::sortDropdown)
1031 {
1032 if (itemIndex == 0)
1033 {
1034 _vehicleSortBy = VehicleSortBy::designYear;
1035 }
1036 else if (itemIndex == 1)
1037 {
1038 _vehicleSortBy = VehicleSortBy::name;
1039 }
1040 else if (itemIndex == 2)
1041 {
1042 _vehicleSortBy = VehicleSortBy::cost;
1043 }
1044 else if (itemIndex == 3)
1045 {
1046 _vehicleSortBy = VehicleSortBy::capacity;
1047 }
1048 else if (itemIndex == 4)
1049 {
1050 _vehicleSortBy = VehicleSortBy::power;
1051 }
1052 else if (itemIndex == 5)
1053 {
1054 _vehicleSortBy = VehicleSortBy::maxSpeed;
1055 }
1056 else if (itemIndex == 6)
1057 {
1058 _vehicleSortBy = VehicleSortBy::obsolete;
1059 }
1060 else if (itemIndex == 7)
1061 {

Callers

nothing calls this directly

Calls 3

getItemArgumentFunction · 0.85
sub_4B92A5Function · 0.85
invalidateMethod · 0.45

Tested by

no test coverage detected