diff --git a/src/openrct2/object/FootpathObject.cpp b/src/openrct2/object/FootpathObject.cpp index 3863da65c2..f89dbcb7b0 100644 --- a/src/openrct2/object/FootpathObject.cpp +++ b/src/openrct2/object/FootpathObject.cpp @@ -56,7 +56,7 @@ namespace OpenRCT2 _pathRailingsDescriptor.name = _legacyType.string_idx; _pathRailingsDescriptor.bridgeImage = _legacyType.bridge_image; _pathRailingsDescriptor.previewImage = _legacyType.GetPreviewImage(); - _pathRailingsDescriptor.flags = _legacyType.flags; + _pathRailingsDescriptor.flags.holder = _legacyType.flags; _pathRailingsDescriptor.scrollingMode = _legacyType.scrolling_mode; _pathRailingsDescriptor.supportType = _legacyType.support_type; _pathRailingsDescriptor.railingsImage = _legacyType.GetRailingsImage(); diff --git a/src/openrct2/object/FootpathRailingsObject.cpp b/src/openrct2/object/FootpathRailingsObject.cpp index 54ac1efed7..d1cc942f0f 100644 --- a/src/openrct2/object/FootpathRailingsObject.cpp +++ b/src/openrct2/object/FootpathRailingsObject.cpp @@ -91,12 +91,12 @@ namespace OpenRCT2 SupportType = ParseSupportType(Json::GetString(properties["supportType"])); ScrollingMode = Json::GetNumber(properties["scrollingMode"]); Colour = Drawing::colourFromString(Json::GetString(properties["colour"]), Drawing::kColourNull); - Flags = Json::GetFlags( + Flags = Json::GetFlagHolder( properties, { - { "hasSupportImages", RAILING_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE }, - { "hasElevatedPathImages", RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS }, - { "noQueueBanner", RAILING_ENTRY_FLAG_NO_QUEUE_BANNER }, + { "hasSupportImages", RailingEntryFlag::hasSupportBaseSprite }, + { "hasElevatedPathImages", RailingEntryFlag::drawPathOverSupports }, + { "noQueueBanner", RailingEntryFlag::noQueueBanner }, }); } diff --git a/src/openrct2/object/FootpathRailingsObject.h b/src/openrct2/object/FootpathRailingsObject.h index e8b1842c7a..84c0ef53a9 100644 --- a/src/openrct2/object/FootpathRailingsObject.h +++ b/src/openrct2/object/FootpathRailingsObject.h @@ -22,7 +22,7 @@ namespace OpenRCT2 uint32_t BridgeImageId{}; uint32_t RailingsImageId{}; RailingEntrySupportType SupportType{}; - uint8_t Flags{}; + RailingEntryFlags Flags{}; uint8_t ScrollingMode{}; Drawing::Colour Colour{}; PathRailingsDescriptor _descriptor = {}; diff --git a/src/openrct2/paint/support/MetalSupports.cpp b/src/openrct2/paint/support/MetalSupports.cpp index 38e301c1f6..d097cb0988 100644 --- a/src/openrct2/paint/support/MetalSupports.cpp +++ b/src/openrct2/paint/support/MetalSupports.cpp @@ -603,7 +603,7 @@ bool PathPoleSupportsPaintSetup( uint16_t baseHeight; if ((supportSegments[segment].slope & kTileSlopeAboveTrackOrScenery) || (height - supportSegments[segment].height < 6) - || !(railings.flags & RAILING_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE)) + || !railings.flags.has(RailingEntryFlag::hasSupportBaseSprite)) { baseHeight = supportSegments[segment].height; } diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index efd9d06543..74e58f9d2f 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -345,7 +345,7 @@ static void PathPaintFencesAndQueueBannersQueue( } } - if (pathElement.hasQueueBanner() && !(railings.flags & RAILING_ENTRY_FLAG_NO_QUEUE_BANNER)) + if (pathElement.hasQueueBanner() && !railings.flags.has(RailingEntryFlag::noQueueBanner)) { PathPaintQueueBanner(session, pathElement, height, railings, imageTemplate); } @@ -360,7 +360,7 @@ static void PathPaintFencesAndQueueBannersNonQueue( uint32_t drawnCorners = 0; // If the path is not drawn over the supports, then no corner sprites will be drawn (making double-width paths // look like connected series of intersections). - if (pathPaintInfo.railings.flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS) + if (pathPaintInfo.railings.flags.has(RailingEntryFlag::drawPathOverSupports)) { drawnCorners = (connectedEdges & FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK) >> 4; } @@ -945,7 +945,7 @@ static void PathPaintBoxSupport( PaintAddImageAsParent(session, imageTemplate.WithIndex(bridgeBaseImageIndex), { 0, 0, height }, boundbox); - if (pathElement.isQueue() || (pathPaintInfo.railings.flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS)) + if (pathElement.isQueue() || pathPaintInfo.railings.flags.has(RailingEntryFlag::drawPathOverSupports)) { PaintAddImageAsChild(session, imageTemplate.WithIndex(surfaceBaseImageIndex), { 0, 0, height }, boundbox); } @@ -1000,7 +1000,7 @@ static void PathPaintPoleSupport( PaintAddImageAsParent(session, imageTemplate.WithIndex(bridgeBaseImageIndex), { 0, 0, height }, boundbox); - if (pathElement.isQueue() || (pathPaintInfo.railings.flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS)) + if (pathElement.isQueue() || pathPaintInfo.railings.flags.has(RailingEntryFlag::drawPathOverSupports)) { PaintAddImageAsChild(session, imageTemplate.WithIndex(surfaceBaseImageIndex), { 0, 0, height }, boundbox); } diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index 3ab9c89fa9..a1bde622ab 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -11,6 +11,7 @@ #include "../Identifiers.h" #include "../actions/CommandFlag.h" +#include "../core/FlagHolder.hpp" #include "../drawing/Colour.h" #include "../drawing/ImageIndexType.h" #include "../drawing/ScrollingText.h" @@ -42,6 +43,14 @@ namespace OpenRCT2 count }; + enum class RailingEntryFlag : uint8_t + { + hasSupportBaseSprite, + drawPathOverSupports, // When elevated + noQueueBanner, + }; + using RailingEntryFlags = FlagHolder; + struct PathSurfaceDescriptor { StringId name = kStringIdNone; @@ -58,7 +67,7 @@ namespace OpenRCT2 ImageIndex railingsImage{}; RailingEntrySupportType supportType{}; Drawing::Colour supportColour = Drawing::kColourNull; - uint8_t flags{}; + RailingEntryFlags flags{}; uint8_t scrollingMode = kScrollingModeNone; }; @@ -120,13 +129,6 @@ namespace OpenRCT2 } }; - enum - { - RAILING_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE = (1 << 0), - RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS = (1 << 1), // When elevated - RAILING_ENTRY_FLAG_NO_QUEUE_BANNER = (1 << 2), - }; - enum { FOOTPATH_SEARCH_SUCCESS, diff --git a/src/openrct2/world/tile_element/PathElement.cpp b/src/openrct2/world/tile_element/PathElement.cpp index 26ee6c2f2a..f8cec96084 100644 --- a/src/openrct2/world/tile_element/PathElement.cpp +++ b/src/openrct2/world/tile_element/PathElement.cpp @@ -278,7 +278,7 @@ namespace OpenRCT2 { // TODO: make this an actual decision of the tile element. const auto* const railings = getRailingsDescriptor(); - return railings != nullptr ? railings->flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS : false; + return railings != nullptr ? railings->flags.has(RailingEntryFlag::drawPathOverSupports) : false; } void PathElement::setShouldDrawPathOverSupports(bool on)