mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-07-20 19:06:13 +01:00
Fix: Unnecessary status bar redraws when there is no news to show (#8691)
InvalidateWindowData with mode SBI_NEWS_DELETED was called on the status bar when checking for a new item of news to be shown in the ticker, even if there is no news queued and no change occurs.
This commit is contained in:
parent
e059a88533
commit
55ed7d16f7
@ -666,8 +666,6 @@ static void MoveToNextTickerItem()
|
|||||||
* there is no status bar but possible news. */
|
* there is no status bar but possible news. */
|
||||||
if (FindWindowById(WC_STATUS_BAR, 0) == nullptr) return;
|
if (FindWindowById(WC_STATUS_BAR, 0) == nullptr) return;
|
||||||
|
|
||||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar
|
|
||||||
|
|
||||||
/* if we're not at the last item, then move on */
|
/* if we're not at the last item, then move on */
|
||||||
while (_statusbar_news_item != _latest_news) {
|
while (_statusbar_news_item != _latest_news) {
|
||||||
_statusbar_news_item = (_statusbar_news_item == nullptr) ? _oldest_news : _statusbar_news_item->next;
|
_statusbar_news_item = (_statusbar_news_item == nullptr) ? _oldest_news : _statusbar_news_item->next;
|
||||||
@ -766,6 +764,7 @@ static void DeleteNewsItem(NewsItem *ni)
|
|||||||
_statusbar_news_item = ni->prev;
|
_statusbar_news_item = ni->prev;
|
||||||
|
|
||||||
/* About to remove the currently displayed item (ticker, or just a reminder) */
|
/* About to remove the currently displayed item (ticker, or just a reminder) */
|
||||||
|
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar
|
||||||
MoveToNextTickerItem();
|
MoveToNextTickerItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user