From 4d29aaa6bd41495cdf09a078478183e421fde721 Mon Sep 17 00:00:00 2001 From: adrian17 Date: Sat, 30 Aug 2014 14:31:36 +0200 Subject: [PATCH] Fix #385, made widget_is_enabled return 1 if true --- src/input.c | 7 ++----- src/widget.c | 4 ++-- src/window.c | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/input.c b/src/input.c index 38d75468f8..437a791c92 100644 --- a/src/input.c +++ b/src/input.c @@ -530,11 +530,8 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex) } break; default: - // comment check as it disables the rotate station/building button in construction window -// if (!widget_is_enabled(w, widgetIndex)) -// break; - if (widget_is_disabled(w, widgetIndex)) - break; + if (!widget_is_enabled(w, widgetIndex)) + break; sound_play_panned(SOUND_CLICK_1, w->x + (widget->left + widget->right) / 2); diff --git a/src/widget.c b/src/widget.c index 1006ca3f13..22226cd78f 100644 --- a/src/widget.c +++ b/src/widget.c @@ -946,12 +946,12 @@ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetI int widget_is_enabled(rct_window *w, int widgetIndex) { - return w->enabled_widgets & (1LL << widgetIndex); + return (w->enabled_widgets & (1LL << widgetIndex)) ? 1 : 0; } int widget_is_disabled(rct_window *w, int widgetIndex) { - return w->disabled_widgets & (1LL << widgetIndex); + return (w->disabled_widgets & (1LL << widgetIndex)) ? 1 : 0; } int widget_is_pressed(rct_window *w, int widgetIndex) diff --git a/src/window.c b/src/window.c index 27429674d7..355d5770bf 100644 --- a/src/window.c +++ b/src/window.c @@ -1150,7 +1150,7 @@ void window_draw_widgets(rct_window *w, rct_drawpixelinfo *dpi) if ((w->flags & WF_TRANSPARENT) && !(w->flags & WF_5)) gfx_fill_rect(dpi, w->x, w->y, w->x + w->width - 1, w->y + w->height - 1, 0x2000000 | 51); - //some code missing here? Between 006EB18C and 006EB260 + //todo: some code missing here? Between 006EB18C and 006EB260 widgetIndex = 0; for (widget = w->widgets; widget->type != WWT_LAST; widget++) { @@ -1162,7 +1162,7 @@ void window_draw_widgets(rct_window *w, rct_drawpixelinfo *dpi) widgetIndex++; } - //something missing here too? Between 006EC32B and 006EC369 + //todo: something missing here too? Between 006EC32B and 006EC369 if (w->flags & WF_WHITE_BORDER_MASK) { gfx_fill_rect_inset(dpi, w->x, w->y, w->x + w->width - 1, w->y + w->height - 1, 2, 0x10);