diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index cb93de98a9df..a91f79f18585 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1982,7 +1982,7 @@ void window_guest_inventory_paint(rct_window* w, rct_drawpixelinfo* dpi) gfx_draw_string_left(dpi, STR_CARRYING, nullptr, COLOUR_BLACK, screenCoords); screenCoords.y += 10; - for (ShopItem item = ShopItem::Balloon; item < ShopItem::Count; item = ShopItem(EnumValue(item) + 1)) + for (ShopItem item = ShopItem::Balloon; item < ShopItem::Count; item++) { if (screenCoords.y >= maxY) break; diff --git a/src/openrct2/ride/ShopItem.cpp b/src/openrct2/ride/ShopItem.cpp index 6c42518b8ac4..4f9ccf55d0cd 100644 --- a/src/openrct2/ride/ShopItem.cpp +++ b/src/openrct2/ride/ShopItem.cpp @@ -13,6 +13,11 @@ #include "../localisation/StringIds.h" #include "../sprites.h" +ShopItem& operator++(ShopItem& d, int) +{ + return d = (d == ShopItem::Count) ? ShopItem::Balloon : ShopItem(EnumValue(d) + 1); +} + uint64_t gSamePriceThroughoutPark; // clang-format off diff --git a/src/openrct2/ride/ShopItem.h b/src/openrct2/ride/ShopItem.h index 80bdb945150f..854dd2bcbf75 100644 --- a/src/openrct2/ride/ShopItem.h +++ b/src/openrct2/ride/ShopItem.h @@ -13,7 +13,7 @@ #include "../util/Util.h" struct Ride; -enum PeepThoughtType : uint8_t; +enum class PeepThoughtType : uint8_t; enum class ShopItem : uint8_t { @@ -72,6 +72,8 @@ enum class ShopItem : uint8_t None = 255 }; +ShopItem& operator++(ShopItem& d, int); + using ShopItemIndex = ShopItem; struct ShopItemStrings