Create enum class+FlagHolder for EntranceElementFlag

This commit is contained in:
Gymnasiast committed 2026-08-12 18:42:23 +02:00
1 parent 7b1b014fce
commit 4ebed48631
2 files changed
+8 -6

No files matched your search

@@ -66,7 +66,7 @@ namespace OpenRCT2
bool EntranceElement::hasLegacyPathEntry() const
{
return (flags2 & ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY) != 0;
return flags2.has(EntranceElementFlag::isLegacyPathEntry);
}
ObjectEntryIndex EntranceElement::getLegacyPathEntryIndex() const
@@ -86,7 +86,7 @@ namespace OpenRCT2
void EntranceElement::setLegacyPathEntryIndex(ObjectEntryIndex newPathType)
{
pathType = newPathType;
flags2 |= ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
flags2.set(EntranceElementFlag::isLegacyPathEntry);
}
ObjectEntryIndex EntranceElement::getSurfaceEntryIndex() const
@@ -106,7 +106,7 @@ namespace OpenRCT2
void EntranceElement::setSurfaceEntryIndex(ObjectEntryIndex newIndex)
{
pathType = newIndex;
flags2 &= ~ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY;
flags2.unset(EntranceElementFlag::isLegacyPathEntry);
}
const PathSurfaceDescriptor* EntranceElement::getPathSurfaceDescriptor() const
@@ -10,6 +10,7 @@
#pragma once
#include "../../Identifiers.h"
#include "../../core/FlagHolder.hpp"
#include "../../object/ObjectTypes.h"
#include "TileElementBase.h"
@@ -28,10 +29,11 @@ namespace OpenRCT2
parkEntrance
};
enum
enum class EntranceElementFlag : uint8_t
{
ENTRANCE_ELEMENT_FLAGS2_LEGACY_PATH_ENTRY = (1 << 0),
isLegacyPathEntry,
};
using EntranceElementFlags = FlagHolder<uint8_t, EntranceElementFlag>;
enum class ParkEntranceSequence : uint8_t
{
@@ -52,7 +54,7 @@ namespace OpenRCT2
StationIndex stationIndex; // 7
ObjectEntryIndex pathType; // 8
RideId rideIndex; // A
uint8_t flags2; // C
EntranceElementFlags flags2; // C
ObjectEntryIndex entryIndex; // D
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"