forked from mirror/OpenTTD
(svn r13114) -Codechange: use InvalidateData instead of direct window access to modify the state of the statusbar from outside the statusbar.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user