From a8ef34cc4d9abe34df531e15c9892aafd6dddf20 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sat, 11 May 2024 11:10:52 +0200 Subject: [PATCH] Deal with remaining -Wdeprecated-anon-enum-enum-conversion warnings --- src/openrct2-ui/windows/Ride.cpp | 12 ++++++++---- src/openrct2-ui/windows/RideList.cpp | 9 +++++++-- src/openrct2-ui/windows/ScenarioSelect.cpp | 20 +++++++++++++++----- src/openrct2-ui/windows/StaffList.cpp | 10 ++++++++-- src/openrct2-ui/windows/TileInspector.cpp | 5 ++++- 5 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 66f6aad99d50..b43382b65ee2 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -2039,9 +2039,9 @@ static_assert(std::size(RatingNames) == 6); for (size_t i = 0; i < _entranceDropdownData.size(); i++) { gDropdownItems[i].Args = _entranceDropdownData[i].LabelId; - gDropdownItems[i].Format = _entranceDropdownData[i].EntranceTypeId == ride->entrance_style - ? STR_DROPDOWN_MENU_LABEL_SELECTED - : STR_DROPDOWN_MENU_LABEL; + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; + if (_entranceDropdownData[i].EntranceTypeId == ride->entrance_style) + gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL_SELECTED; } WindowDropdownShowTextCustomWidth( @@ -2417,7 +2417,11 @@ static_assert(std::size(RatingNames) == 6); const RideComponentName stationName = GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.station); ft.Add(ride->num_stations > 1 ? stationName.number : stationName.singular); ft.Add(vehicle->current_station.ToUnderlying() + 1); - return stringId != STR_CRASHING && stringId != STR_CRASHED_0 ? STR_BLACK_STRING : STR_RED_OUTLINED_STRING; + + if (stringId != STR_CRASHING && stringId != STR_CRASHED_0) + return STR_BLACK_STRING; + else + return STR_RED_OUTLINED_STRING; } StringId GetStatusStation(Formatter& ft) const diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 9efda22713e0..5d8a00ed1b95 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -547,12 +547,17 @@ static Widget _rideListWidgets[] = { auto y = 0; for (size_t i = 0; i < _rideList.size(); i++) { - StringId format = (_quickDemolishMode ? STR_RED_STRINGID : STR_BLACK_STRING); + StringId format = STR_BLACK_STRING; + if (_quickDemolishMode) + format = STR_RED_STRINGID; + if (i == static_cast(selected_list_item)) { // Background highlight GfxFilterRect(dpi, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::PaletteDarken1); - format = (_quickDemolishMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID); + format = STR_WINDOW_COLOUR_2_STRINGID; + if (_quickDemolishMode) + format = STR_LIGHTPINK_STRINGID; } // Get ride diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index b7cbb22b0ea9..abd34d630f29 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -164,13 +164,18 @@ static Widget _scenarioSelectWidgets[] = { void OnDraw(DrawPixelInfo& dpi) override { - int32_t format; const ScenarioIndexEntry* scenario; DrawWidgets(dpi); - format = ScenarioSelectUseSmallFont() ? STR_SMALL_WINDOW_COLOUR_2_STRINGID : STR_WINDOW_COLOUR_2_STRINGID; - FontStyle fontStyle = ScenarioSelectUseSmallFont() ? FontStyle::Small : FontStyle::Medium; + StringId format = STR_WINDOW_COLOUR_2_STRINGID; + FontStyle fontStyle = FontStyle::Medium; + + if (ScenarioSelectUseSmallFont()) + { + format = STR_SMALL_WINDOW_COLOUR_2_STRINGID; + fontStyle = FontStyle::Small; + } // Text for each tab for (uint32_t i = 0; i < std::size(kScenarioOriginStringIds); i++) @@ -391,8 +396,13 @@ static Widget _scenarioSelectWidgets[] = { uint8_t paletteIndex = ColourMapA[colours[1]].mid_light; GfxClear(dpi, paletteIndex); - StringId highlighted_format = ScenarioSelectUseSmallFont() ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID; - StringId unhighlighted_format = ScenarioSelectUseSmallFont() ? STR_WHITE_STRING : STR_BLACK_STRING; + StringId highlighted_format = STR_WINDOW_COLOUR_2_STRINGID; + StringId unhighlighted_format = STR_BLACK_STRING; + if (ScenarioSelectUseSmallFont()) + { + highlighted_format = STR_WHITE_STRING; + unhighlighted_format = STR_WHITE_STRING; + } const auto& listWidget = widgets[WIDX_SCENARIOLIST]; int32_t listWidth = listWidget.width() - 12; diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index f9abb1fed264..98af402fda7c 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -405,12 +405,18 @@ static Widget _staffListWidgets[] = { { continue; } - int32_t format = (_quickFireMode ? STR_RED_STRINGID : STR_BLACK_STRING); + + StringId format = STR_BLACK_STRING; + if (_quickFireMode) + format = STR_RED_STRINGID; if (i == _highlightedIndex) { GfxFilterRect(dpi, { 0, y, 800, y + (kScrollableRowHeight - 1) }, FilterPaletteID::PaletteDarken1); - format = (_quickFireMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID); + + format = STR_WINDOW_COLOUR_2_STRINGID; + if (_quickFireMode) + format = STR_LIGHTPINK_STRINGID; } auto ft = Formatter(); diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 292565d376ed..c3fdeb5f0135 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1612,7 +1612,10 @@ static uint64_t PageDisabledWidgets[] = { else if (((windowTileInspectorElementCount - i) & 1) == 0) GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].light | 0x1000000); - const StringId stringFormat = (selectedRow || hoveredRow) ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID; + StringId stringFormat = STR_WINDOW_COLOUR_2_STRINGID; + if (selectedRow || hoveredRow) + stringFormat = STR_WHITE_STRING; + auto checkboxFormatter = Formatter(); checkboxFormatter.Add(STR_STRING); checkboxFormatter.Add(CheckBoxMarkString);