From 7491b792e2201bb6c3fa62a1c99a5b6d83304d31 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 16 May 2008 07:08:04 +0000 Subject: (svn r13114) -Codechange: use InvalidateData instead of direct window access to modify the state of the statusbar from outside the statusbar. --- src/statusbar_gui.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/statusbar_gui.cpp') diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 535636e4c..18d103918 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -18,6 +18,7 @@ #include "window_gui.h" #include "variables.h" #include "window_func.h" +#include "statusbar_gui.h" #include "table/strings.h" #include "table/sprites.h" @@ -107,7 +108,13 @@ static void StatusBarWndProc(Window *w, WindowEvent *e) } break; case WE_INVALIDATE_DATA: - WP(w, def_d).data_3 = e->we.invalidate.data; + switch (e->we.invalidate.data) { + default: NOT_REACHED(); + case SBI_SAVELOAD_START: WP(w, def_d).data_3 = true; break; + case SBI_SAVELOAD_FINISH: WP(w, def_d).data_3 = false; break; + case SBI_SHOW_TICKER: WP(w, def_d).data_1 = 360; break; + case SBI_SHOW_REMINDER: WP(w, def_d).data_2 = 91; break; + } break; case WE_CLICK: @@ -152,6 +159,15 @@ static WindowDesc _main_status_desc = { StatusBarWndProc }; +/** + * Checks whether the news ticker is currently being used. + */ +bool IsNewsTickerShown() +{ + const Window *w = FindWindowById(WC_STATUS_BAR, 0); + return w != NULL && WP(w, const def_d).data_1 > -1280; +} + void ShowStatusBar() { _main_status_desc.top = _screen.height - 12; -- cgit v1.2.3-54-g00ecf