forked from rosebudai/OpenRCT2-Web
Replace the unscoped WATER_FLAGS_ALLOW_DUCKS constant with the WaterObjectFlag enum class and a WaterObjectFlags FlagHolder, as part of the ongoing move away from unscoped flag enums. No functional change is intended.
This commit is contained in:
1 parent
282218d306
commit
c5550ef4ae
5 files changed
+11
-8
No files matched your search
@@ -269,6 +269,7 @@ Appreciation for contributors who have provided substantial work, but are no lon
|
||||
* Michael Hlas (mhlas7)
|
||||
* (byteraidhost)
|
||||
* Ray (RayKoopa)
|
||||
* (itu-itis24-iyigun24)
|
||||
|
||||
## Toolchain
|
||||
* (Balletie) - macOS
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRCT2
|
||||
.mainPalette = SPR_GAME_DEFAULT_PALETTE,
|
||||
.waterWavesPalette = SPR_GAME_PALETTE_WATER,
|
||||
.waterSparklesPalette = SPR_GAME_PALETTE_3,
|
||||
.flags = 0,
|
||||
.flags = {},
|
||||
};
|
||||
|
||||
const WaterObjectEntry& getActiveWaterEntry()
|
||||
|
||||
@@ -9,16 +9,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../core/FlagHolder.hpp"
|
||||
#include "../drawing/ImageIndexType.h"
|
||||
#include "../localisation/StringIdType.h"
|
||||
#include "ObjectTypes.h"
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
enum
|
||||
enum class WaterObjectFlag : uint8_t
|
||||
{
|
||||
WATER_FLAGS_ALLOW_DUCKS = (1 << 0)
|
||||
allowDucks,
|
||||
};
|
||||
using WaterObjectFlags = FlagHolder<uint16_t, WaterObjectFlag>;
|
||||
|
||||
struct WaterObjectEntry
|
||||
{
|
||||
@@ -28,7 +30,7 @@ namespace OpenRCT2
|
||||
ImageIndex mainPalette;
|
||||
ImageIndex waterWavesPalette;
|
||||
ImageIndex waterSparklesPalette;
|
||||
uint16_t flags;
|
||||
WaterObjectFlags flags;
|
||||
};
|
||||
|
||||
const WaterObjectEntry& getActiveWaterEntry();
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRCT2
|
||||
void WaterObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
|
||||
{
|
||||
stream->Seek(14, STREAM_SEEK_CURRENT);
|
||||
_legacyType.flags = stream->ReadValue<uint16_t>();
|
||||
_legacyType.flags = stream->ReadValue<WaterObjectFlags>();
|
||||
|
||||
GetStringTable().Read(context, stream, ObjectStringID::name);
|
||||
GetImageTable().Read(context, stream);
|
||||
@@ -69,10 +69,10 @@ namespace OpenRCT2
|
||||
|
||||
if (properties.is_object())
|
||||
{
|
||||
_legacyType.flags = Json::GetFlags<uint16_t>(
|
||||
_legacyType.flags = Json::GetFlagHolder<WaterObjectFlags, WaterObjectFlag>(
|
||||
properties,
|
||||
{
|
||||
{ "allowDucks", WATER_FLAGS_ALLOW_DUCKS },
|
||||
{ "allowDucks", WaterObjectFlag::allowDucks },
|
||||
});
|
||||
|
||||
auto jPalettes = properties["palettes"];
|
||||
|
||||
@@ -306,7 +306,7 @@ static void ScenarioWeekUpdate()
|
||||
RideUpdateFavouritedStat();
|
||||
|
||||
const auto& waterEntry = getActiveWaterEntry();
|
||||
if (month <= MONTH_APRIL && waterEntry.flags & WATER_FLAGS_ALLOW_DUCKS)
|
||||
if (month <= MONTH_APRIL && waterEntry.flags.has(WaterObjectFlag::allowDucks))
|
||||
{
|
||||
// 100 attempts at finding some water to create a few ducks at
|
||||
for (int32_t i = 0; i < 100; i++)
|
||||
|
||||
Reference in new issue
Block a user