Fix #11914: Notification spam when opening a new scenario

This commit is contained in:
hdpoliveira 2020-06-11 18:28:44 -03:00 committed by GitHub
parent 8287ef4e7a
commit 5660a59c18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -114,8 +114,17 @@ bool NewsItemQueues::IsEmpty() const
* *
* rct2: 0x0066DF32 * rct2: 0x0066DF32
*/ */
void NewsItemQueues::Clear()
{
Recent.clear();
Archived.clear();
}
void news_item_init_queue() void news_item_init_queue()
{ {
gNewsItems.Clear();
assert(gNewsItems.IsEmpty());
// Throttles for warning types (PEEP_*_WARNING) // Throttles for warning types (PEEP_*_WARNING)
for (auto& warningThrottle : gPeepWarningThrottle) for (auto& warningThrottle : gPeepWarningThrottle)
{ {

View File

@ -179,6 +179,11 @@ public:
return N; return N;
} }
void clear() noexcept
{
front().Type = NEWS_ITEM_NULL;
}
private: private:
std::array<NewsItem, N> Queue; std::array<NewsItem, N> Queue;
}; };
@ -190,7 +195,7 @@ struct NewsItemQueues
NewsItem* At(int32_t index); NewsItem* At(int32_t index);
const NewsItem* At(int32_t index) const; const NewsItem* At(int32_t index) const;
bool IsEmpty() const; bool IsEmpty() const;
void Init(); void Clear();
uint16_t IncrementTicks(); uint16_t IncrementTicks();
NewsItem& Current(); NewsItem& Current();
const NewsItem& Current() const; const NewsItem& Current() const;