mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-19 21:13:05 +01:00
Fix raise/lowering water at edge of map (#9979)
This commit is contained in:
committed by
Michael Steenbeek
parent
a11762b11a
commit
2e5f46fcf1
@@ -72,7 +72,7 @@ private:
|
||||
res->Position.z = z;
|
||||
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
|
||||
uint8_t minHeight = GetLowestHeight();
|
||||
uint8_t minHeight = GetLowestHeight(validRange);
|
||||
bool hasChanged = false;
|
||||
for (int32_t y = validRange.GetTop(); y <= validRange.GetBottom(); y += 32)
|
||||
{
|
||||
@@ -119,12 +119,13 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t GetLowestHeight() const
|
||||
uint8_t GetLowestHeight(MapRange validRange) const
|
||||
{
|
||||
// The lowest height to lower the water to is the highest water level in the selection
|
||||
uint8_t minHeight{ 0 };
|
||||
for (int32_t y = _range.GetTop(); y <= _range.GetBottom(); y += 32)
|
||||
for (int32_t y = validRange.GetTop(); y <= validRange.GetBottom(); y += 32)
|
||||
{
|
||||
for (int32_t x = _range.GetLeft(); x <= _range.GetRight(); x += 32)
|
||||
for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += 32)
|
||||
{
|
||||
auto* surfaceElement = map_get_surface_element_at({ x, y });
|
||||
if (surfaceElement == nullptr)
|
||||
|
||||
@@ -73,7 +73,7 @@ private:
|
||||
res->Position.z = z;
|
||||
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
|
||||
uint8_t maxHeight = GetHighestHeight();
|
||||
uint8_t maxHeight = GetHighestHeight(validRange);
|
||||
bool hasChanged = false;
|
||||
for (int32_t y = validRange.GetTop(); y <= validRange.GetBottom(); y += 32)
|
||||
{
|
||||
@@ -126,12 +126,13 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t GetHighestHeight() const
|
||||
uint8_t GetHighestHeight(MapRange validRange) const
|
||||
{
|
||||
// The highest height to raise the water to is the lowest water level in the selection
|
||||
uint8_t maxHeight{ 255 };
|
||||
for (int32_t y = _range.GetTop(); y <= _range.GetBottom(); y += 32)
|
||||
for (int32_t y = validRange.GetTop(); y <= validRange.GetBottom(); y += 32)
|
||||
{
|
||||
for (int32_t x = _range.GetLeft(); x <= _range.GetRight(); x += 32)
|
||||
for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += 32)
|
||||
{
|
||||
auto* surfaceElement = map_get_surface_element_at({ x, y });
|
||||
if (surfaceElement == nullptr)
|
||||
|
||||
Reference in New Issue
Block a user