1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 15:24:30 +01:00

Fix news items counts

This commit is contained in:
Michał Janiszewski
2016-09-03 17:45:31 +02:00
parent d5eb3b9488
commit a5af67e481

View File

@@ -46,7 +46,7 @@ static int news_item_get_new_history_slot();
bool news_item_is_valid_idx(int index)
{
if (index > MAX_NEWS_ITEMS) {
if (index >= MAX_NEWS_ITEMS) {
log_error("Tried to get news item past MAX_NEWS.");
return false;
}
@@ -157,7 +157,7 @@ void news_item_close_current()
newsItems[i] = newsItems[0];
// Set the end of the end of the history list
if (i < MAX_NEWS_ITEMS)
if (i < MAX_NEWS_ITEMS - 1)
newsItems[i + 1].type = NEWS_ITEM_NULL;
// Invalidate the news window
@@ -402,7 +402,7 @@ void news_item_disable_news(uint8 type, uint32 assoc)
}
}
for (int i = 11; i <= MAX_NEWS_ITEMS; i++) {
for (int i = 11; i < MAX_NEWS_ITEMS; i++) {
if (!news_item_is_empty(i)) {
rct_news_item * const newsItem = news_item_get(i);
if (type == newsItem->type && assoc == newsItem->assoc) {