Fix raise/lowering water at edge of map (#9979)

This commit is contained in:
Joseph Atkins-Turkish 2019-09-22 05:13:52 -07:00 committed by Michael Steenbeek
parent a11762b11a
commit 2e5f46fcf1
3 changed files with 11 additions and 8 deletions

View File

@ -15,6 +15,7 @@
- Fix: [#9625] Show correct cost in scenery selection.
- Fix: [#9669] The tile inspector shortcut key does not work with debugging tools disabled.
- Fix: [#9675] Guest entry point limit can be bypassed in scenario editor.
- Fix: [#9683] Cannot raise water level if part of the tool's area of effect is off of the map.
- Fix: [#9717] Scroll bars do not render correctly when using OpenGL renderer.
- Fix: [#9729] Peeps do not take into account height difference when deciding to pathfind to a ride entrance (original bug).
- Fix: [#9902] Doors/Portcullis do not check to make sure doors are open causing double opens.

View File

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

View File

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