forked from rosebudai/OpenRCT2-Web
Refactor RAILING_ENTRY_FLAG_* to enum class + FlagHolder (#27154)
This commit is contained in:
1 parent
5024df12f7
commit
f67271b57b
7 files changed
+22
-20
No files matched your search
@@ -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();
|
||||
|
||||
@@ -91,12 +91,12 @@ namespace OpenRCT2
|
||||
SupportType = ParseSupportType(Json::GetString(properties["supportType"]));
|
||||
ScrollingMode = Json::GetNumber<uint8_t>(properties["scrollingMode"]);
|
||||
Colour = Drawing::colourFromString(Json::GetString(properties["colour"]), Drawing::kColourNull);
|
||||
Flags = Json::GetFlags<uint8_t>(
|
||||
Flags = Json::GetFlagHolder<RailingEntryFlags, RailingEntryFlag>(
|
||||
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 },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = {};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<uint8_t, RailingEntryFlag>;
|
||||
|
||||
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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user