Skip to content

Commit

Permalink
Deal with -Wdeprecated-anon-enum-enum-conversion warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronVanGeffen committed May 11, 2024
1 parent 745ae0c commit 2b77804
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 20 deletions.
6 changes: 4 additions & 2 deletions src/openrct2-ui/scripting/CustomWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,10 @@ namespace OpenRCT2::Ui::Windows
const auto numItems = std::min<size_t>(items.size(), Dropdown::ItemsMaxSize);
for (size_t i = 0; i < numItems; i++)
{
gDropdownItems[i].Format = selectedIndex == static_cast<int32_t>(i) ? STR_OPTIONS_DROPDOWN_ITEM_SELECTED
: STR_OPTIONS_DROPDOWN_ITEM;
gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM;
if (selectedIndex == static_cast<int32_t>(i))
gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM_SELECTED;

auto sz = items[i].c_str();
std::memcpy(&gDropdownItems[i].Args, &sz, sizeof(const char*));
}
Expand Down
6 changes: 4 additions & 2 deletions src/openrct2-ui/windows/Cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,10 @@ static StringId window_cheats_page_titles[] = {
break;
}
case WINDOW_CHEATS_PAGE_MISC:
widgets[WIDX_OPEN_CLOSE_PARK].text = (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN) ? STR_CHEAT_CLOSE_PARK
: STR_CHEAT_OPEN_PARK;
widgets[WIDX_OPEN_CLOSE_PARK].text = STR_CHEAT_OPEN_PARK;
if (gameState.Park.Flags & PARK_FLAGS_PARK_OPEN)
widgets[WIDX_OPEN_CLOSE_PARK].text = STR_CHEAT_CLOSE_PARK;

SetCheckboxValue(WIDX_FORCE_PARK_RATING, Park::GetForcedRating() >= 0);
SetCheckboxValue(WIDX_FREEZE_WEATHER, gameState.Cheats.FreezeWeather);
SetCheckboxValue(WIDX_NEVERENDING_MARKETING, gameState.Cheats.NeverendingMarketing);
Expand Down
8 changes: 6 additions & 2 deletions src/openrct2-ui/windows/Park.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,10 +919,14 @@ static constexpr WindowParkAward _parkAwards[] = {
DrawTextBasic(dpi, screenCoords, STR_INCOME_FROM_ADMISSIONS, ft);

money64 parkEntranceFee = Park::GetEntranceFee();
auto stringId = parkEntranceFee == 0 ? STR_FREE : STR_BOTTOM_TOOLBAR_CASH;
screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_PRICE].left + 1, widgets[WIDX_PRICE].top + 1 };
ft = Formatter();
ft.Add<money64>(parkEntranceFee);

StringId stringId = STR_BOTTOM_TOOLBAR_CASH;
if (parkEntranceFee == 0)
stringId = STR_FREE;

screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_PRICE].left + 1, widgets[WIDX_PRICE].top + 1 };
DrawTextBasic(dpi, screenCoords, stringId, ft, { colours[1] });
}
#pragma endregion
Expand Down
12 changes: 8 additions & 4 deletions src/openrct2-ui/windows/Ride.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -2417,7 +2417,11 @@ static_assert(std::size(RatingNames) == 6);
const RideComponentName stationName = GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.station);
ft.Add<StringId>(ride->num_stations > 1 ? stationName.number : stationName.singular);
ft.Add<uint16_t>(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
Expand Down
9 changes: 7 additions & 2 deletions src/openrct2-ui/windows/RideList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>(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
Expand Down
20 changes: 15 additions & 5 deletions src/openrct2-ui/windows/ScenarioSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions src/openrct2-ui/windows/StaffList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 4 additions & 1 deletion src/openrct2-ui/windows/TileInspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<StringId>(STR_STRING);
checkboxFormatter.Add<char*>(CheckBoxMarkString);
Expand Down

0 comments on commit 2b77804

Please sign in to comment.