mirror of https://github.com/OpenTTD/OpenTTD
(svn r24802) -Fix [FS#4224]: When displaying the previous news message, don't consider news which are turned off.
parent
b533523258
commit
7091f6640b
|
@ -890,19 +890,35 @@ static void ShowNewsMessage(const NewsItem *ni)
|
||||||
/** Show previous news item */
|
/** Show previous news item */
|
||||||
void ShowLastNewsMessage()
|
void ShowLastNewsMessage()
|
||||||
{
|
{
|
||||||
|
const NewsItem *ni = NULL;
|
||||||
if (_total_news == 0) {
|
if (_total_news == 0) {
|
||||||
return;
|
return;
|
||||||
} else if (_forced_news == NULL) {
|
} else if (_forced_news == NULL) {
|
||||||
/* Not forced any news yet, show the current one, unless a news window is
|
/* Not forced any news yet, show the current one, unless a news window is
|
||||||
* open (which can only be the current one), then show the previous item */
|
* open (which can only be the current one), then show the previous item */
|
||||||
const Window *w = FindWindowById(WC_NEWS_WINDOW, 0);
|
const Window *w = FindWindowById(WC_NEWS_WINDOW, 0);
|
||||||
ShowNewsMessage((w == NULL || (_current_news == _oldest_news)) ? _current_news : _current_news->prev);
|
ni = (w == NULL || (_current_news == _oldest_news)) ? _current_news : _current_news->prev;
|
||||||
} else if (_forced_news == _oldest_news) {
|
} else if (_forced_news == _oldest_news) {
|
||||||
/* We have reached the oldest news, start anew with the latest */
|
/* We have reached the oldest news, start anew with the latest */
|
||||||
ShowNewsMessage(_latest_news);
|
ni = _latest_news;
|
||||||
} else {
|
} else {
|
||||||
/* 'Scrolling' through news history show each one in turn */
|
/* 'Scrolling' through news history show each one in turn */
|
||||||
ShowNewsMessage(_forced_news->prev);
|
ni = _forced_news->prev;
|
||||||
|
}
|
||||||
|
bool wrap = false;
|
||||||
|
for (;;) {
|
||||||
|
if (_news_type_data[ni->type].display != ND_OFF) {
|
||||||
|
ShowNewsMessage(ni);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ni = ni->prev;
|
||||||
|
if (ni == NULL) {
|
||||||
|
if (wrap) break;
|
||||||
|
/* We have reached the oldest news, start anew with the latest */
|
||||||
|
ni = _latest_news;
|
||||||
|
wrap = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue