Introduce new functions to stop direct access

This commit is contained in:
duncanspumpkin 2019-02-26 09:08:22 +00:00
parent c68af628c2
commit 354cce71eb
4 changed files with 101 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);