1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 05:23:04 +01:00

Use constant for 255 tile element height (#11928)

This commit is contained in:
Michael Steenbeek
2020-06-10 23:18:26 +02:00
committed by GitHub
parent eb154c7b48
commit 1ea1d24f00
6 changed files with 9 additions and 7 deletions

View File

@@ -1825,7 +1825,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
break;
}
if (loc.z == 0xFF)
if (loc.z == MAX_ELEMENT_HEIGHT)
return;
tileElement = lastPathElement;

View File

@@ -1976,7 +1976,7 @@ private:
{
auto src = &_s4.tile_elements[index];
auto dst = &gTileElements[index + dstOffset];
if (src->base_height == 0xFF)
if (src->base_height == RCT12_MAX_ELEMENT_HEIGHT)
{
std::memcpy(dst, src, sizeof(*src));
}

View File

@@ -67,6 +67,8 @@ constexpr const uint32_t RCT12_RESEARCHED_ITEMS_END = 0xFFFFFFFE;
// Extra end of list entry. Leftover from RCT1.
constexpr const uint32_t RCT12_RESEARCHED_ITEMS_END_2 = 0xFFFFFFFD;
constexpr const uint8_t RCT12_MAX_ELEMENT_HEIGHT = 255;
enum class RCT12TrackDesignVersion : uint8_t
{
TD4,

View File

@@ -1413,7 +1413,7 @@ void S6Exporter::ExportTileElements()
{
auto src = &gTileElements[index];
auto dst = &_s6.tile_elements[index];
if (src->base_height == 0xFF)
if (src->base_height == MAX_ELEMENT_HEIGHT)
{
std::memcpy(dst, src, sizeof(*dst));
}

View File

@@ -1013,7 +1013,7 @@ public:
{
auto src = &_s6.tile_elements[index];
auto dst = &gTileElements[index];
if (src->base_height == 0xFF)
if (src->base_height == RCT12_MAX_ELEMENT_HEIGHT)
{
std::memcpy(dst, src, sizeof(*src));
}

View File

@@ -955,7 +955,7 @@ void tile_element_remove(TileElement* tileElement)
// Mark the latest element with the last element flag.
(tileElement - 1)->SetLastForTile(true);
tileElement->base_height = 0xFF;
tileElement->base_height = MAX_ELEMENT_HEIGHT;
if ((tileElement + 1) == gNextFreeTileElement)
{
@@ -1178,7 +1178,7 @@ TileElement* tile_element_insert(const CoordsXYZ& loc, int32_t occupiedQuadrants
{
// Copy over map element
*newTileElement = *originalTileElement;
originalTileElement->base_height = 255;
originalTileElement->base_height = MAX_ELEMENT_HEIGHT;
originalTileElement++;
newTileElement++;
@@ -1211,7 +1211,7 @@ TileElement* tile_element_insert(const CoordsXYZ& loc, int32_t occupiedQuadrants
{
// Copy over map element
*newTileElement = *originalTileElement;
originalTileElement->base_height = 255;
originalTileElement->base_height = MAX_ELEMENT_HEIGHT;
originalTileElement++;
newTileElement++;
} while (!((newTileElement - 1)->IsLastForTile()));