summaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-12-04 13:57:04 +0000
committerrubidium <rubidium@openttd.org>2006-12-04 13:57:04 +0000
commit9a87e1e0ea23e4ca76ebc1b2d9bcc08110d5a674 (patch)
tree125f99fe661d756d29ba145bd871e0d44430dfd4 /window.c
parent756d6a6efb64d0025e24fc4ea98b37d93d17868c (diff)
downloadopenttd-9a87e1e0ea23e4ca76ebc1b2d9bcc08110d5a674.tar.xz
(svn r7356) -Codechange: replace 'for (i = 0, wi = w->widget; wi->type != WWT_LAST; i++, wi++)' type for loops with 'for (i = 0; i < w->window_count; i++) { wi = &w->widget[i];'-type for loops for better readability.
-Codechange: use IsWindowWidget(Disabled|Hidden) in favor of IsWidget(Disabled|Hidden).
Diffstat (limited to 'window.c')
-rw-r--r--window.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/window.c b/window.c
index e9ef7f7b7..2e4c3787c 100644
--- a/window.c
+++ b/window.c
@@ -100,10 +100,10 @@ static void DispatchLeftClickEvent(Window *w, int x, int y)
e.we.click.widget = GetWidgetFromPos(w, x, y);
if (e.we.click.widget < 0) return; /* exit if clicked outside of widgets */
- wi = &w->widget[e.we.click.widget];
-
/* don't allow any interaction if the button has been disabled */
- if (IsWidgetDisabled(wi)) return;
+ if (IsWindowWidgetDisabled(w, e.we.click.widget)) return;
+
+ wi = &w->widget[e.we.click.widget];
if (wi->type & WWB_MASK) {
/* special widget handling for buttons*/
@@ -1741,7 +1741,7 @@ void InvalidateWidget(const Window *w, byte widget_index)
const Widget *wi = &w->widget[widget_index];
/* Don't redraw the window if the widget is invisible or of no-type */
- if (wi->type == WWT_EMPTY || IsWidgetHidden(wi)) return;
+ if (wi->type == WWT_EMPTY || IsWindowWidgetHidden(w, widget_index)) return;
SetDirtyBlocks(w->left + wi->left, w->top + wi->top, w->left + wi->right + 1, w->top + wi->bottom + 1);
}