Replace 16 with new constant WATER_HEIGHT_STEP

This commit is contained in:
Hielke Morsink 2022-07-01 00:09:27 +02:00 committed by GitHub
parent 8e509d9669
commit 9c595ccaa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 6 deletions

View File

@ -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;

View File

@ -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

View File

@ -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 };

View File

@ -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