Fix #11072: Land and water tools work out of bounds (#11179)

Tool tried to act out of bounds, where it shouldn't do anything
This commit is contained in:
Olivier Wervers 2020-04-18 00:34:32 +02:00 committed by GitHub
parent c17127f65b
commit 506b06bd73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View File

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

View File

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