diff --git a/src/openrct2/rct12/RCT12.cpp b/src/openrct2/rct12/RCT12.cpp index c72f8be87a..963da8f07c 100644 --- a/src/openrct2/rct12/RCT12.cpp +++ b/src/openrct2/rct12/RCT12.cpp @@ -79,8 +79,7 @@ uint8_t RCT12SurfaceElement::GetSlope() const uint32_t RCT12SurfaceElement::GetSurfaceStyle() const { uint32_t retVal = (terrain >> 5) & 7; - if (type & 1) - retVal |= (1 << 3); + retVal |= (type & RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK) << 3; return retVal; } @@ -557,11 +556,9 @@ void RCT12LargeSceneryElement::SetBannerIndex(uint8_t newIndex) void RCT12SurfaceElement::SetSurfaceStyle(uint32_t newStyle) { - // Bit 3 for terrain is stored in element.type bit 0 - if (newStyle & 8) - type |= 1; - else - type &= ~1; + // Bits 3, 4 for terrain are stored in element.type bit 0, 1 + type &= ~RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK; + type |= (newStyle >> 3) & RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK; // Bits 0, 1, 2 for terrain are stored in element.terrain bit 5, 6, 7 terrain &= ~0xE0; diff --git a/src/openrct2/rct12/RCT12.h b/src/openrct2/rct12/RCT12.h index a4faf68c3f..0a9bf98d06 100644 --- a/src/openrct2/rct12/RCT12.h +++ b/src/openrct2/rct12/RCT12.h @@ -89,6 +89,12 @@ enum class RCT12TrackDesignVersion : uint8_t unknown }; +enum +{ + RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK = 0b00000011, + RCT12_SURFACE_ELEMENT_TYPE_EDGE_MASK = 0b01000000, +}; + enum { RCT12_TILE_ELEMENT_FLAG_GHOST = (1 << 4),