summaryrefslogtreecommitdiff
path: root/src/statusbar_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-16 07:08:04 +0000
committerrubidium <rubidium@openttd.org>2008-05-16 07:08:04 +0000
commit7491b792e2201bb6c3fa62a1c99a5b6d83304d31 (patch)
tree71b42c2570a5e13678d6722deaf7787da0a7ade9 /src/statusbar_gui.cpp
parent7c7a4de3e58c4699e3c8f3ca5cf20fb874c1953c (diff)
downloadopenttd-7491b792e2201bb6c3fa62a1c99a5b6d83304d31.tar.xz
(svn r13114) -Codechange: use InvalidateData instead of direct window access to modify the state of the statusbar from outside the statusbar.
Diffstat (limited to 'src/statusbar_gui.cpp')
-rw-r--r--src/statusbar_gui.cpp18
1 files changed, 17 insertions, 1 deletions
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;