1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 15:54:31 +01:00

Replace more direct accesses to base/clearance Z with getter/setter (#10454)

This commit is contained in:
Michael Steenbeek
2019-12-27 15:26:40 +01:00
committed by GitHub
parent 26cce7e82b
commit 8ca0cf52a7
27 changed files with 85 additions and 64 deletions

View File

@@ -121,10 +121,10 @@ void SurfaceElement::UpdateGrassLength(CoordsXY coords)
// Grass can't grow any further than CLUMPS_2 but this code also cuts grass
// if there is an object placed on top of it.
int32_t z0 = base_height;
int32_t z1 = base_height + 2;
int32_t zLow = GetBaseZ();
int32_t zHigh = GetBaseZ() + (2 * 8);
if (Slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
z1 += 2;
zHigh += (2 * 8);
// Check objects above grass
TileElement* tileElementAbove = (TileElement*)this;
@@ -166,9 +166,9 @@ void SurfaceElement::UpdateGrassLength(CoordsXY coords)
// Grass should not be affected by ghost elements.
if (tileElementAbove->IsGhost())
continue;
if (z0 >= tileElementAbove->clearance_height)
if (zLow >= tileElementAbove->GetClearanceZ())
continue;
if (z1 < tileElementAbove->base_height)
if (zHigh < tileElementAbove->GetBaseZ())
continue;
if (grassLengthTmp != GRASS_LENGTH_CLEAR_0)