diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 1aae2a2949..c4fe6371e9 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,7 +1,7 @@ 0.2.6+ (in development) ------------------------------------------------------------------------ - Feature: [#11231] Change shortcut window list order to be more intuitive, and split it into logical sections. - +- Fix: [#11072] Land and water tools working out of bounds (original bug). 0.2.6 (2020-04-17) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index c9adba89e5..b63b2dafd8 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -327,6 +327,7 @@ static money32 selection_raise_land(uint8_t flags); static ClearAction GetClearAction(); static bool _menuDropdownIncludesTwitch; +static bool _landToolBlocked; static uint8_t _unkF64F0E; static int16_t _unkF64F0A; // rct2: 0x00F64F15 @@ -3008,12 +3009,20 @@ static void window_top_toolbar_tool_down(rct_window* w, rct_widgetindex widgetIn gCurrentToolId = TOOL_UP_DOWN_ARROW; } + else + { + _landToolBlocked = true; + } break; case WIDX_WATER: if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) { gCurrentToolId = TOOL_UP_DOWN_ARROW; } + else + { + _landToolBlocked = true; + } break; case WIDX_SCENERY: window_top_toolbar_scenery_tool_down(screenCoords.x, screenCoords.y, w, widgetIndex); @@ -3218,11 +3227,17 @@ static void window_top_toolbar_tool_drag(rct_window* w, rct_widgetindex widgetIn } else { - window_top_toolbar_land_tool_drag(screenCoords.x, screenCoords.y); + if (!_landToolBlocked) + { + window_top_toolbar_land_tool_drag(screenCoords.x, screenCoords.y); + } } break; case WIDX_WATER: - window_top_toolbar_water_tool_drag(screenCoords.x, screenCoords.y); + if (!_landToolBlocked) + { + window_top_toolbar_water_tool_drag(screenCoords.x, screenCoords.y); + } break; case WIDX_SCENERY: if (gWindowSceneryPaintEnabled & 1) @@ -3239,6 +3254,7 @@ static void window_top_toolbar_tool_drag(rct_window* w, rct_widgetindex widgetIn */ static void window_top_toolbar_tool_up(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords) { + _landToolBlocked = false; switch (widgetIndex) { case WIDX_LAND: @@ -3711,6 +3727,7 @@ static void toggle_land_window(rct_window* topToolbar, rct_widgetindex widgetInd } else { + _landToolBlocked = false; show_gridlines(); tool_set(topToolbar, widgetIndex, TOOL_DIG_DOWN); input_set_flag(INPUT_FLAG_6, true); @@ -3751,6 +3768,7 @@ static void toggle_water_window(rct_window* topToolbar, rct_widgetindex widgetIn } else { + _landToolBlocked = false; show_gridlines(); tool_set(topToolbar, widgetIndex, TOOL_WATER_DOWN); input_set_flag(INPUT_FLAG_6, true);