1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Merge pull request #3998 from gDanix/fix-3324

Fix #3324: Opening tile inspector then footpath closes both windows.
This commit is contained in:
Ted John
2016-07-06 20:59:54 +01:00
committed by GitHub
2 changed files with 11 additions and 17 deletions

View File

@@ -66,6 +66,7 @@ Includes all git commit authors. Aliases are GitHub user names.
* Martin Černáč (octaroot) * Martin Černáč (octaroot)
* (marcovmun) * (marcovmun)
* Sven Slootweg (joepie91) * Sven Slootweg (joepie91)
* Daniel Trujillo Viedma (gDanix)
## Toolchain ## Toolchain
* (Balletie) - OSX * (Balletie) - OSX

View File

@@ -15,6 +15,7 @@
#pragma endregion #pragma endregion
#include "../addresses.h" #include "../addresses.h"
#include "../input.h"
#include "../localisation/localisation.h" #include "../localisation/localisation.h"
#include "../interface/themes.h" #include "../interface/themes.h"
#include "../interface/widget.h" #include "../interface/widget.h"
@@ -99,13 +100,11 @@ static int window_tile_inspector_tile_x;
static int window_tile_inspector_tile_y; static int window_tile_inspector_tile_y;
static int window_tile_inspector_item_count; static int window_tile_inspector_item_count;
static void window_tile_inspector_close(rct_window *w);
static void window_tile_inspector_mouseup(rct_window *w, int widgetIndex); static void window_tile_inspector_mouseup(rct_window *w, int widgetIndex);
static void window_tile_inspector_resize(rct_window *w); static void window_tile_inspector_resize(rct_window *w);
static void window_title_editor_update(rct_window *w); static void window_tile_inspector_update(rct_window *w);
static void window_tile_inspector_tool_update(rct_window* w, int widgetIndex, int x, int y); static void window_tile_inspector_tool_update(rct_window* w, int widgetIndex, int x, int y);
static void window_tile_inspector_tool_down(rct_window* w, int widgetIndex, int x, int y); static void window_tile_inspector_tool_down(rct_window* w, int widgetIndex, int x, int y);
static void window_tile_inspector_tool_abort(rct_window *w, int widgetIndex);
static void window_tile_inspector_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height); static void window_tile_inspector_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height);
static void window_tile_inspector_scrollmousedown(rct_window *w, int scrollIndex, int x, int y); static void window_tile_inspector_scrollmousedown(rct_window *w, int scrollIndex, int x, int y);
static void window_tile_inspector_scrollmouseover(rct_window *w, int scrollIndex, int x, int y); static void window_tile_inspector_scrollmouseover(rct_window *w, int scrollIndex, int x, int y);
@@ -116,20 +115,20 @@ static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *
static void window_tile_inspector_auto_set_buttons(rct_window *w); static void window_tile_inspector_auto_set_buttons(rct_window *w);
static rct_window_event_list window_tile_inspector_events = { static rct_window_event_list window_tile_inspector_events = {
window_tile_inspector_close, NULL,
window_tile_inspector_mouseup, window_tile_inspector_mouseup,
window_tile_inspector_resize, window_tile_inspector_resize,
NULL, NULL,
NULL, NULL,
NULL, NULL,
window_title_editor_update, window_tile_inspector_update,
NULL, NULL,
NULL, NULL,
window_tile_inspector_tool_update, window_tile_inspector_tool_update,
window_tile_inspector_tool_down, window_tile_inspector_tool_down,
NULL, NULL,
NULL, NULL,
window_tile_inspector_tool_abort, NULL,
NULL, NULL,
window_tile_inspector_scrollgetsize, window_tile_inspector_scrollgetsize,
window_tile_inspector_scrollmousedown, window_tile_inspector_scrollmousedown,
@@ -181,11 +180,6 @@ void window_tile_inspector_open()
tool_set(window, WIDX_BACKGROUND, 12); tool_set(window, WIDX_BACKGROUND, 12);
} }
static void window_tile_inspector_close(rct_window *w)
{
tool_cancel();
}
static void corrupt_element() { static void corrupt_element() {
rct_map_element* mapElement; rct_map_element* mapElement;
mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y); mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
@@ -285,6 +279,7 @@ static void window_tile_inspector_mouseup(rct_window *w, int widgetIndex)
{ {
switch (widgetIndex) { switch (widgetIndex) {
case WIDX_CLOSE: case WIDX_CLOSE:
tool_cancel();
window_close(w); window_close(w);
break; break;
case WIDX_CORRUPT: case WIDX_CORRUPT:
@@ -332,7 +327,7 @@ static void window_tile_inspector_resize(rct_window *w)
} }
} }
static void window_title_editor_update(rct_window *w) static void window_tile_inspector_update(rct_window *w)
{ {
// Check if the mouse is hovering over the list // Check if the mouse is hovering over the list
if (!widget_is_highlighted(w, WIDX_LIST)) if (!widget_is_highlighted(w, WIDX_LIST))
@@ -340,6 +335,9 @@ static void window_title_editor_update(rct_window *w)
window_tile_inspector_highlighted_index = -1; window_tile_inspector_highlighted_index = -1;
widget_invalidate(w, WIDX_LIST); widget_invalidate(w, WIDX_LIST);
} }
if(gCurrentToolWidget.window_classification != WC_TILE_INSPECTOR)
window_close(w);
} }
static void window_tile_inspector_tool_update(rct_window* w, int widgetIndex, int x, int y) static void window_tile_inspector_tool_update(rct_window* w, int widgetIndex, int x, int y)
@@ -403,11 +401,6 @@ static void window_tile_inspector_tool_down(rct_window* w, int widgetIndex, int
window_invalidate(w); window_invalidate(w);
} }
static void window_tile_inspector_tool_abort(rct_window *w, int widgetIndex)
{
window_close(w);
}
static void window_tile_inspector_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height) static void window_tile_inspector_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height)
{ {
*width = WW - 30; *width = WW - 30;