From 354cce71ebb904019177b1ebb485c9d2eff68f68 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Tue, 26 Feb 2019 09:08:22 +0000 Subject: [PATCH] Introduce new functions to stop direct access --- src/openrct2/ride/Track.cpp | 34 ++++++++++++++++++++++++++++ src/openrct2/world/Footpath.cpp | 35 +++++++++++++++++++++++++++++ src/openrct2/world/LargeScenery.cpp | 17 ++++++++++++++ src/openrct2/world/TileElement.h | 15 +++++++++++++ 4 files changed, 101 insertions(+) diff --git a/src/openrct2/ride/Track.cpp b/src/openrct2/ride/Track.cpp index 74d3903c0b..d196a83515 100644 --- a/src/openrct2/ride/Track.cpp +++ b/src/openrct2/ride/Track.cpp @@ -1718,6 +1718,40 @@ void TrackElement::SetInverted(bool inverted) } } +bool TrackElement::BlockBrakeClosed() const +{ + return (flags & TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED) != 0; +} + +void TrackElement::SetBlockBrakeClosed(bool isClosed) +{ + if (isClosed) + { + flags |= TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED; + } + else + { + flags &= ~TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED; + } +} + +bool TrackElement::IsIndestructible() const +{ + return (flags & TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE) != 0; +} + +void TrackElement::SetIsIndestructible(bool isIndestructible) +{ + if (isIndestructible) + { + flags |= TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE; + } + else + { + flags &= ~TILE_ELEMENT_FLAG_INDESTRUCTIBLE_TRACK_PIECE; + } +} + uint8_t TrackElement::GetBrakeBoosterSpeed() const { return (sequence >> 4) << 1; diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 08ec1123e0..7c4f5786a3 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -2035,6 +2035,41 @@ void PathElement::SetHasQueueBanner(bool hasQueueBanner) entryIndex |= FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER; } + +bool PathElement::IsBroken() const +{ + return (flags & TILE_ELEMENT_FLAG_BROKEN) != 0; +} + +void PathElement::SetIsBroken(bool isBroken) +{ + if (isBroken == true) + { + flags |= TILE_ELEMENT_FLAG_BROKEN; + } + else + { + flags &= ~TILE_ELEMENT_FLAG_BROKEN; + } +} + +bool PathElement::IsBlockedByVehicle() const +{ + return (flags & TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE) != 0; +} + +void PathElement::SetIsBlockedByVehicle(bool isBlocked) +{ + if (isBlocked == true) + { + flags |= TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE; + } + else + { + flags &= ~TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE; + } +} + uint8_t PathElement::GetStationIndex() const { return (additions & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK) >> 4; diff --git a/src/openrct2/world/LargeScenery.cpp b/src/openrct2/world/LargeScenery.cpp index 8514746082..ce9b671a88 100644 --- a/src/openrct2/world/LargeScenery.cpp +++ b/src/openrct2/world/LargeScenery.cpp @@ -50,6 +50,23 @@ void LargeSceneryElement::SetBannerIndex(BannerIndex newIndex) colour[1] |= (newIndex & 7) << 5; } +bool LargeSceneryElement::IsAccounted() const +{ + return flags & TILE_ELEMENT_FLAG_LARGE_SCENERY_ACCOUNTED; +} + +void LargeSceneryElement::SetIsAccounted(bool isAccounted) +{ + if (isAccounted) + { + flags |= TILE_ELEMENT_FLAG_LARGE_SCENERY_ACCOUNTED; + } + else + { + flags &= ~TILE_ELEMENT_FLAG_LARGE_SCENERY_ACCOUNTED; + } +} + uint32_t LargeSceneryElement::GetEntryIndex() const { return entryIndex & TILE_ELEMENT_LARGE_TYPE_MASK; diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index a6758c9add..2eb2c7747a 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -210,6 +210,12 @@ public: bool HasQueueBanner() const; void SetHasQueueBanner(bool hasQueueBanner); + bool IsBroken() const; + void SetIsBroken(bool isBroken); + + bool IsBlockedByVehicle() const; + void SetIsBlockedByVehicle(bool isBlocked); + uint8_t GetEdges() const; void SetEdges(uint8_t newEdges); uint8_t GetCorners() const; @@ -286,6 +292,12 @@ public: bool IsInverted() const; void SetInverted(bool inverted); + bool BlockBrakeClosed() const; + void SetBlockBrakeClosed(bool isClosed); + + bool IsIndestructible() const; + void SetIsIndestructible(bool isIndestructible); + uint8_t GetBrakeBoosterSpeed() const; void SetBrakeBoosterSpeed(uint8_t speed); @@ -360,6 +372,9 @@ public: BannerIndex GetBannerIndex() const; void SetBannerIndex(BannerIndex newIndex); + + bool IsAccounted() const; + void SetIsAccounted(bool isAccounted); }; assert_struct_size(LargeSceneryElement, 8);