diff options
author | rubidium <rubidium@openttd.org> | 2008-05-16 07:08:04 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-05-16 07:08:04 +0000 |
commit | 7491b792e2201bb6c3fa62a1c99a5b6d83304d31 (patch) | |
tree | 71b42c2570a5e13678d6722deaf7787da0a7ade9 /src/news_gui.cpp | |
parent | 7c7a4de3e58c4699e3c8f3ca5cf20fb874c1953c (diff) | |
download | openttd-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/news_gui.cpp')
-rw-r--r-- | src/news_gui.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 5fd782cfe..0c6928e37 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -18,6 +18,7 @@ #include "string_func.h" #include "widgets/dropdown_func.h" #include "map_func.h" +#include "statusbar_gui.h" #include "table/sprites.h" #include "table/strings.h" @@ -472,8 +473,7 @@ static void ShowTicker(const NewsItem *ni) if (_news_ticker_sound) SndPlayFx(SND_16_MORSE); _statusbar_news_item = *ni; - Window *w = FindWindowById(WC_STATUS_BAR, 0); - if (w != NULL) WP(w, def_d).data_1 = 360; + InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SHOW_TICKER); } @@ -490,8 +490,7 @@ static bool ReadyForNextItem() /* Ticker message * Check if the status bar message is still being displayed? */ - const Window *w = FindWindowById(WC_STATUS_BAR, 0); - if (w != NULL && WP(w, const def_d).data_1 > -1280) return false; + if (IsNewsTickerShown()) return false; /* Newspaper message, decrement duration counter */ if (ni->duration != 0) ni->duration--; @@ -517,15 +516,9 @@ static void MoveToNextItem() switch (_news_type_data[type].display) { default: NOT_REACHED(); - case ND_OFF: { // Off - show nothing only a small reminder in the status bar - Window *w = FindWindowById(WC_STATUS_BAR, 0); - - if (w != NULL) { - WP(w, def_d).data_2 = 91; - w->SetDirty(); - } + case ND_OFF: // Off - show nothing only a small reminder in the status bar + InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SHOW_REMINDER); break; - } case ND_SUMMARY: // Summary - show ticker, but if forced big, cascade to full if (!(ni->flags & NF_FORCE_BIG)) { |