diff options
author | smatz <smatz@openttd.org> | 2009-01-09 20:42:17 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-01-09 20:42:17 +0000 |
commit | 11822aa8ef242001084b5d59b151b3d60dd39c7d (patch) | |
tree | 1d0452dcb858922d011ce28cb9427233c1ce1e43 | |
parent | 7175ff116e97d43b9505d1794cfcbf74553a3f13 (diff) | |
download | openttd-11822aa8ef242001084b5d59b151b3d60dd39c7d.tar.xz |
(svn r14940) -Fix: let the statusbar know the current news are invalid or bad things will happen
-rw-r--r-- | src/news_gui.cpp | 13 | ||||
-rw-r--r-- | src/statusbar_gui.cpp | 4 | ||||
-rw-r--r-- | src/statusbar_gui.h | 1 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/news_gui.cpp b/src/news_gui.cpp index d626c2af2..5ba424d5c 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -449,7 +449,8 @@ static bool ReadyForNextItem() /** Move to the next news item */ static void MoveToNextItem() { - DeleteWindowById(WC_NEWS_WINDOW, 0); + InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar + DeleteWindowById(WC_NEWS_WINDOW, 0); // close the newspapers window if shown _forced_news = NULL; /* if we're not at the last item, then move on */ @@ -526,13 +527,9 @@ void AddNewsItem(StringID string, NewsSubtype subtype, uint data_a, uint data_b, /** Delete a news item from the queue */ static void DeleteNewsItem(NewsItem *ni) { - if (_forced_news == ni) { - /* about to remove the currently forced item; skip to next */ - MoveToNextItem(); - } - - if ((_current_news == ni) && (FindWindowById(WC_NEWS_WINDOW, 0) != NULL)) { - /* about to remove the currently displayed item; also skip */ + if (_forced_news == ni || _current_news == ni) { + /* about to remove the currently forced item (shown as newspapers) || + * about to remove the currently displayed item (newspapers, ticker, or just a reminder) */ MoveToNextItem(); } diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index c125b16cc..5283a01a5 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -126,6 +126,10 @@ struct StatusBarWindow : Window { case SBI_SAVELOAD_FINISH: this->saving = false; break; case SBI_SHOW_TICKER: this->ticker_scroll = 360; break; case SBI_SHOW_REMINDER: this->reminder_timeout = 91; break; + case SBI_NEWS_DELETED: + this->ticker_scroll = -1280; // reset ticker ... + this->reminder_timeout = 0; // ... and reminder + break; } } diff --git a/src/statusbar_gui.h b/src/statusbar_gui.h index 8003bf6ea..0c3f0eb21 100644 --- a/src/statusbar_gui.h +++ b/src/statusbar_gui.h @@ -11,6 +11,7 @@ enum StatusBarInvalidate SBI_SAVELOAD_FINISH, SBI_SHOW_TICKER, SBI_SHOW_REMINDER, + SBI_NEWS_DELETED, SBI_END }; |