From 9c595ccaa71bd5c638e2951d9df71b7d9833651c Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Fri, 1 Jul 2022 00:09:27 +0200 Subject: [PATCH] Replace 16 with new constant WATER_HEIGHT_STEP --- src/openrct2/paint/Supports.cpp | 6 +++--- src/openrct2/rct12/RCT12.cpp | 2 +- src/openrct2/world/Map.h | 1 + src/openrct2/world/Surface.cpp | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/openrct2/paint/Supports.cpp b/src/openrct2/paint/Supports.cpp index 71b0b41cb7..45801967e4 100644 --- a/src/openrct2/paint/Supports.cpp +++ b/src/openrct2/paint/Supports.cpp @@ -563,7 +563,7 @@ bool wooden_a_supports_paint_setup( // Draw repeated supports for left over space while (height != 0) { - if ((z & 16) == 0 && height >= 2 && z + 16 != session.WaterHeight) + if ((z & 16) == 0 && height >= 2 && z + WATER_HEIGHT_STEP != session.WaterHeight) { // Full support auto imageId = imageTemplate.WithIndex(WoodenSupportImageIds[supportType].full); @@ -738,7 +738,7 @@ bool wooden_b_supports_paint_setup( { while (heightSteps > 0) { - if (baseHeight & 0x10 || heightSteps == 1 || baseHeight + 16 == session.WaterHeight) + if (baseHeight & 0x10 || heightSteps == 1 || baseHeight + WATER_HEIGHT_STEP == session.WaterHeight) { auto imageId = imageTemplate.WithIndex(WoodenSupportImageIds[supportType].half); PaintAddImageAsParent(session, imageId, { 0, 0, baseHeight }, { 32, 32, ((heightSteps == 1) ? 7 : 12) }); @@ -1274,7 +1274,7 @@ bool path_a_supports_paint_setup( while (heightSteps > 0) { - if (baseHeight & 0x10 || heightSteps == 1 || baseHeight + 16 == session.WaterHeight) + if (baseHeight & 0x10 || heightSteps == 1 || baseHeight + WATER_HEIGHT_STEP == session.WaterHeight) { uint32_t imageId = (supportType * 24) + pathPaintInfo.BridgeImageId + 23; diff --git a/src/openrct2/rct12/RCT12.cpp b/src/openrct2/rct12/RCT12.cpp index 282a53fca8..be6ca60bb5 100644 --- a/src/openrct2/rct12/RCT12.cpp +++ b/src/openrct2/rct12/RCT12.cpp @@ -85,7 +85,7 @@ uint8_t RCT12SurfaceElement::GetOwnership() const uint32_t RCT12SurfaceElement::GetWaterHeight() const { - return (terrain & RCT12_TILE_ELEMENT_SURFACE_WATER_HEIGHT_MASK) * 16; + return (terrain & RCT12_TILE_ELEMENT_SURFACE_WATER_HEIGHT_MASK) * WATER_HEIGHT_STEP; } uint8_t RCT12SurfaceElement::GetParkFences() const diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index 9c56c87b7a..c1ae17aa53 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -28,6 +28,7 @@ constexpr const int32_t MAXIMUM_MAP_SIZE_BIG = COORDS_XY_STEP * MAXIMUM_MAP_SIZE_TECHNICAL; constexpr const int32_t MAXIMUM_TILE_START_XY = MAXIMUM_MAP_SIZE_BIG - COORDS_XY_STEP; constexpr const int32_t LAND_HEIGHT_STEP = 2 * COORDS_Z_STEP; +constexpr const int32_t WATER_HEIGHT_STEP = 2 * COORDS_Z_STEP; constexpr const int32_t MINIMUM_LAND_HEIGHT_BIG = MINIMUM_LAND_HEIGHT * COORDS_Z_STEP; constexpr const TileCoordsXY DEFAULT_MAP_SIZE = { 150, 150 }; diff --git a/src/openrct2/world/Surface.cpp b/src/openrct2/world/Surface.cpp index 35b46959bc..203e592596 100644 --- a/src/openrct2/world/Surface.cpp +++ b/src/openrct2/world/Surface.cpp @@ -51,12 +51,12 @@ void SurfaceElement::SetEdgeStyle(uint32_t newStyle) int32_t SurfaceElement::GetWaterHeight() const { - return WaterHeight * 16; + return WaterHeight * WATER_HEIGHT_STEP; } void SurfaceElement::SetWaterHeight(int32_t newWaterHeight) { - WaterHeight = newWaterHeight / 16; + WaterHeight = newWaterHeight / WATER_HEIGHT_STEP; } bool SurfaceElement::CanGrassGrow() const