mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add const version of NewsItemQueue::operator[]
This commit is contained in:
parent
b519247bad
commit
a94fc10c77
|
@ -75,6 +75,11 @@ NewsItem* news_item_get(int32_t index)
|
||||||
}
|
}
|
||||||
|
|
||||||
NewsItem& NewsItemQueue::operator[](size_t index)
|
NewsItem& NewsItemQueue::operator[](size_t index)
|
||||||
|
{
|
||||||
|
return const_cast<NewsItem&>(const_cast<const NewsItemQueue&>(*this)[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const NewsItem& NewsItemQueue::operator[](size_t index) const
|
||||||
{
|
{
|
||||||
if (index < NEWS_ITEM_HISTORY_START)
|
if (index < NEWS_ITEM_HISTORY_START)
|
||||||
return Recent[index];
|
return Recent[index];
|
||||||
|
|
|
@ -68,6 +68,7 @@ extern const uint8_t news_type_properties[10];
|
||||||
struct NewsItemQueue
|
struct NewsItemQueue
|
||||||
{
|
{
|
||||||
NewsItem& operator[](size_t index);
|
NewsItem& operator[](size_t index);
|
||||||
|
const NewsItem& operator[](size_t index) const;
|
||||||
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;
|
||||||
|
|
Loading…
Reference in New Issue