diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index d106053dd4..1623118c3d 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -868,8 +868,9 @@ + - \ No newline at end of file + diff --git a/src/openrct2/world/TileElement.cpp b/src/openrct2/world/TileElement.cpp index 3b9edb7f07..46c6ecd7bb 100644 --- a/src/openrct2/world/TileElement.cpp +++ b/src/openrct2/world/TileElement.cpp @@ -18,63 +18,6 @@ #include "Location.hpp" #include "Scenery.h" -uint8_t TileElementBase::GetType() const -{ - return this->type & TILE_ELEMENT_TYPE_MASK; -} - -void TileElementBase::SetType(uint8_t newType) -{ - this->type &= ~TILE_ELEMENT_TYPE_MASK; - this->type |= (newType & TILE_ELEMENT_TYPE_MASK); -} - -Direction TileElementBase::GetDirection() const -{ - return this->type & TILE_ELEMENT_DIRECTION_MASK; -} - -void TileElementBase::SetDirection(Direction direction) -{ - this->type &= ~TILE_ELEMENT_DIRECTION_MASK; - this->type |= (direction & TILE_ELEMENT_DIRECTION_MASK); -} - -Direction TileElementBase::GetDirectionWithOffset(uint8_t offset) const -{ - return ((this->type & TILE_ELEMENT_DIRECTION_MASK) + offset) & TILE_ELEMENT_DIRECTION_MASK; -} - -bool TileElementBase::IsLastForTile() const -{ - return (this->Flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0; -} - -void TileElementBase::SetLastForTile(bool on) -{ - if (on) - Flags |= TILE_ELEMENT_FLAG_LAST_TILE; - else - Flags &= ~TILE_ELEMENT_FLAG_LAST_TILE; -} - -bool TileElementBase::IsGhost() const -{ - return (this->Flags & TILE_ELEMENT_FLAG_GHOST) != 0; -} - -void TileElementBase::SetGhost(bool isGhost) -{ - if (isGhost) - { - this->Flags |= TILE_ELEMENT_FLAG_GHOST; - } - else - { - this->Flags &= ~TILE_ELEMENT_FLAG_GHOST; - } -} - bool tile_element_is_underground(TileElement* tileElement) { do @@ -167,11 +110,6 @@ void TileElement::ClearAs(uint8_t newType) std::fill_n(pad_08, sizeof(pad_08), 0x00); } -void TileElementBase::Remove() -{ - tile_element_remove(static_cast(this)); -} - // Rotate both of the values amount const QuarterTile QuarterTile::Rotate(uint8_t amount) const { @@ -214,45 +152,3 @@ const QuarterTile QuarterTile::Rotate(uint8_t amount) const return QuarterTile{ 0 }; } } - -uint8_t TileElementBase::GetOccupiedQuadrants() const -{ - return Flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK; -} - -void TileElementBase::SetOccupiedQuadrants(uint8_t quadrants) -{ - Flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK; - Flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK); -} - -int32_t TileElementBase::GetBaseZ() const -{ - return base_height * COORDS_Z_STEP; -} - -void TileElementBase::SetBaseZ(int32_t newZ) -{ - base_height = (newZ / COORDS_Z_STEP); -} - -int32_t TileElementBase::GetClearanceZ() const -{ - return clearance_height * COORDS_Z_STEP; -} - -void TileElementBase::SetClearanceZ(int32_t newZ) -{ - clearance_height = (newZ / COORDS_Z_STEP); -} - -uint8_t TileElementBase::GetOwner() const -{ - return owner & OWNER_MASK; -} - -void TileElementBase::SetOwner(uint8_t newOwner) -{ - owner &= ~OWNER_MASK; - owner |= (newOwner & OWNER_MASK); -} diff --git a/src/openrct2/world/TileElementBase.cpp b/src/openrct2/world/TileElementBase.cpp new file mode 100644 index 0000000000..17c08b6e27 --- /dev/null +++ b/src/openrct2/world/TileElementBase.cpp @@ -0,0 +1,115 @@ +/***************************************************************************** + * Copyright (c) 2014-2021 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "Map.h" +#include "TileElement.h" + +uint8_t TileElementBase::GetType() const +{ + return this->type & TILE_ELEMENT_TYPE_MASK; +} + +void TileElementBase::SetType(uint8_t newType) +{ + this->type &= ~TILE_ELEMENT_TYPE_MASK; + this->type |= (newType & TILE_ELEMENT_TYPE_MASK); +} + +Direction TileElementBase::GetDirection() const +{ + return this->type & TILE_ELEMENT_DIRECTION_MASK; +} + +void TileElementBase::SetDirection(Direction direction) +{ + this->type &= ~TILE_ELEMENT_DIRECTION_MASK; + this->type |= (direction & TILE_ELEMENT_DIRECTION_MASK); +} + +Direction TileElementBase::GetDirectionWithOffset(uint8_t offset) const +{ + return ((this->type & TILE_ELEMENT_DIRECTION_MASK) + offset) & TILE_ELEMENT_DIRECTION_MASK; +} + +bool TileElementBase::IsLastForTile() const +{ + return (this->Flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0; +} + +void TileElementBase::SetLastForTile(bool on) +{ + if (on) + Flags |= TILE_ELEMENT_FLAG_LAST_TILE; + else + Flags &= ~TILE_ELEMENT_FLAG_LAST_TILE; +} + +bool TileElementBase::IsGhost() const +{ + return (this->Flags & TILE_ELEMENT_FLAG_GHOST) != 0; +} + +void TileElementBase::SetGhost(bool isGhost) +{ + if (isGhost) + { + this->Flags |= TILE_ELEMENT_FLAG_GHOST; + } + else + { + this->Flags &= ~TILE_ELEMENT_FLAG_GHOST; + } +} + +void TileElementBase::Remove() +{ + tile_element_remove(static_cast(this)); +} + +uint8_t TileElementBase::GetOccupiedQuadrants() const +{ + return Flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK; +} + +void TileElementBase::SetOccupiedQuadrants(uint8_t quadrants) +{ + Flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK; + Flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK); +} + +int32_t TileElementBase::GetBaseZ() const +{ + return base_height * COORDS_Z_STEP; +} + +void TileElementBase::SetBaseZ(int32_t newZ) +{ + base_height = (newZ / COORDS_Z_STEP); +} + +int32_t TileElementBase::GetClearanceZ() const +{ + return clearance_height * COORDS_Z_STEP; +} + +void TileElementBase::SetClearanceZ(int32_t newZ) +{ + clearance_height = (newZ / COORDS_Z_STEP); +} + +uint8_t TileElementBase::GetOwner() const +{ + return owner & OWNER_MASK; +} + +void TileElementBase::SetOwner(uint8_t newOwner) +{ + owner &= ~OWNER_MASK; + owner |= (newOwner & OWNER_MASK); +}