1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 23:33:04 +01:00

Make news item fields lowerCamelCase

This commit is contained in:
Gymnasiast
2025-05-23 21:16:30 +02:00
parent 323a3c9119
commit 47bb449e34
11 changed files with 113 additions and 113 deletions

View File

@@ -244,12 +244,12 @@ namespace OpenRCT2::Ui::Windows
auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget.midX(), middleOutsetWidget.top + 11 }; auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget.midX(), middleOutsetWidget.top + 11 };
int32_t itemWidth = middleOutsetWidget.width() - 62; int32_t itemWidth = middleOutsetWidget.width() - 62;
DrawNewsTicker( DrawNewsTicker(
rt, screenCoords, itemWidth, COLOUR_BRIGHT_GREEN, STR_BOTTOM_TOOLBAR_NEWS_TEXT, newsItem->Text, rt, screenCoords, itemWidth, COLOUR_BRIGHT_GREEN, STR_BOTTOM_TOOLBAR_NEWS_TEXT, newsItem->text,
newsItem->Ticks); newsItem->ticks);
const auto& newsSubjectWidget = widgets[WIDX_NEWS_SUBJECT]; const auto& newsSubjectWidget = widgets[WIDX_NEWS_SUBJECT];
screenCoords = windowPos + ScreenCoordsXY{ newsSubjectWidget.left, newsSubjectWidget.top }; screenCoords = windowPos + ScreenCoordsXY{ newsSubjectWidget.left, newsSubjectWidget.top };
switch (newsItem->Type) switch (newsItem->type)
{ {
case News::ItemType::Ride: case News::ItemType::Ride:
GfxDrawSprite(rt, ImageId(SPR_RIDE), screenCoords); GfxDrawSprite(rt, ImageId(SPR_RIDE), screenCoords);
@@ -257,7 +257,7 @@ namespace OpenRCT2::Ui::Windows
case News::ItemType::PeepOnRide: case News::ItemType::PeepOnRide:
case News::ItemType::Peep: case News::ItemType::Peep:
{ {
if (newsItem->HasButton()) if (newsItem->hasButton())
break; break;
RenderTarget clippedRT; RenderTarget clippedRT;
@@ -266,7 +266,7 @@ namespace OpenRCT2::Ui::Windows
break; break;
} }
auto peep = TryGetEntity<Peep>(EntityId::FromUnderlying(newsItem->Assoc)); auto peep = TryGetEntity<Peep>(EntityId::FromUnderlying(newsItem->assoc));
if (peep == nullptr) if (peep == nullptr)
return; return;
@@ -325,7 +325,7 @@ namespace OpenRCT2::Ui::Windows
GfxDrawSprite(rt, ImageId(SPR_FINANCE), screenCoords); GfxDrawSprite(rt, ImageId(SPR_FINANCE), screenCoords);
break; break;
case News::ItemType::Research: case News::ItemType::Research:
GfxDrawSprite(rt, ImageId(newsItem->Assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE), screenCoords); GfxDrawSprite(rt, ImageId(newsItem->assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE), screenCoords);
break; break;
case News::ItemType::Peeps: case News::ItemType::Peeps:
GfxDrawSprite(rt, ImageId(SPR_GUESTS), screenCoords); GfxDrawSprite(rt, ImageId(SPR_GUESTS), screenCoords);
@@ -452,7 +452,7 @@ namespace OpenRCT2::Ui::Windows
break; break;
case WIDX_NEWS_SUBJECT: case WIDX_NEWS_SUBJECT:
newsItem = News::GetItem(0); newsItem = News::GetItem(0);
News::OpenSubject(newsItem->Type, newsItem->Assoc); News::OpenSubject(newsItem->type, newsItem->assoc);
break; break;
case WIDX_NEWS_LOCATE: case WIDX_NEWS_LOCATE:
if (News::IsQueueEmpty()) if (News::IsQueueEmpty())
@@ -461,7 +461,7 @@ namespace OpenRCT2::Ui::Windows
{ {
newsItem = News::GetItem(0); newsItem = News::GetItem(0);
auto subjectLoc = News::GetSubjectLocation(newsItem->Type, newsItem->Assoc); auto subjectLoc = News::GetSubjectLocation(newsItem->type, newsItem->assoc);
if (!subjectLoc.has_value()) if (!subjectLoc.has_value())
break; break;
@@ -591,18 +591,18 @@ namespace OpenRCT2::Ui::Windows
disabled_widgets &= ~(1uLL << WIDX_NEWS_LOCATE); disabled_widgets &= ~(1uLL << WIDX_NEWS_LOCATE);
// Find out if the news item is no longer valid // Find out if the news item is no longer valid
auto subjectLoc = News::GetSubjectLocation(newsItem->Type, newsItem->Assoc); auto subjectLoc = News::GetSubjectLocation(newsItem->type, newsItem->assoc);
if (!subjectLoc.has_value()) if (!subjectLoc.has_value())
disabled_widgets |= (1uLL << WIDX_NEWS_LOCATE); disabled_widgets |= (1uLL << WIDX_NEWS_LOCATE);
if (!(newsItem->TypeHasSubject())) if (!(newsItem->typeHasSubject()))
{ {
disabled_widgets |= (1uLL << WIDX_NEWS_SUBJECT); disabled_widgets |= (1uLL << WIDX_NEWS_SUBJECT);
widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty; widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty;
} }
if (newsItem->HasButton()) if (newsItem->hasButton())
{ {
disabled_widgets |= (1uLL << WIDX_NEWS_SUBJECT); disabled_widgets |= (1uLL << WIDX_NEWS_SUBJECT);
disabled_widgets |= (1uLL << WIDX_NEWS_LOCATE); disabled_widgets |= (1uLL << WIDX_NEWS_LOCATE);

View File

@@ -102,19 +102,19 @@ namespace OpenRCT2::Ui::Windows
} }
const auto& newsItem = gameState.newsItems.GetArchived()[j]; const auto& newsItem = gameState.newsItems.GetArchived()[j];
if (newsItem.HasButton()) if (newsItem.hasButton())
{ {
return; return;
} }
if (_pressedButtonIndex == 1) if (_pressedButtonIndex == 1)
{ {
News::OpenSubject(newsItem.Type, newsItem.Assoc); News::OpenSubject(newsItem.type, newsItem.assoc);
} }
else if (_pressedButtonIndex > 1) else if (_pressedButtonIndex > 1)
{ {
static WindowBase* _mainWindow; static WindowBase* _mainWindow;
auto subjectLoc = News::GetSubjectLocation(newsItem.Type, newsItem.Assoc); auto subjectLoc = News::GetSubjectLocation(newsItem.type, newsItem.assoc);
if (subjectLoc.has_value() && (_mainWindow = WindowGetMain()) != nullptr) if (subjectLoc.has_value() && (_mainWindow = WindowGetMain()) != nullptr)
{ {
WindowScrollToLocation(*_mainWindow, subjectLoc.value()); WindowScrollToLocation(*_mainWindow, subjectLoc.value());
@@ -138,18 +138,18 @@ namespace OpenRCT2::Ui::Windows
{ {
if (mutableScreenCoords.y < itemHeight) if (mutableScreenCoords.y < itemHeight)
{ {
if (newsItem.HasButton() || mutableScreenCoords.y < 14 || mutableScreenCoords.y >= 38 if (newsItem.hasButton() || mutableScreenCoords.y < 14 || mutableScreenCoords.y >= 38
|| mutableScreenCoords.x < 328) || mutableScreenCoords.x < 328)
{ {
buttonIndex = 0; buttonIndex = 0;
break; break;
} }
if (mutableScreenCoords.x < 351 && newsItem.TypeHasSubject()) if (mutableScreenCoords.x < 351 && newsItem.typeHasSubject())
{ {
buttonIndex = 1; buttonIndex = 1;
break; break;
} }
if (mutableScreenCoords.x < 376 && newsItem.TypeHasLocation()) if (mutableScreenCoords.x < 376 && newsItem.typeHasLocation())
{ {
buttonIndex = 2; buttonIndex = 2;
break; break;
@@ -200,20 +200,20 @@ namespace OpenRCT2::Ui::Windows
// Date text // Date text
{ {
auto ft = Formatter(); auto ft = Formatter();
ft.Add<StringId>(DateDayNames[newsItem.Day - 1]); ft.Add<StringId>(DateDayNames[newsItem.day - 1]);
ft.Add<StringId>(DateGameMonthNames[DateGetMonth(newsItem.MonthYear)]); ft.Add<StringId>(DateGameMonthNames[DateGetMonth(newsItem.monthYear)]);
DrawTextBasic(rt, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::Small }); DrawTextBasic(rt, { 2, y }, STR_NEWS_DATE_FORMAT, ft, { COLOUR_WHITE, FontStyle::Small });
} }
// Item text // Item text
{ {
auto ft = Formatter(); auto ft = Formatter();
ft.Add<const char*>(newsItem.Text.c_str()); ft.Add<const char*>(newsItem.text.c_str());
DrawTextWrapped( DrawTextWrapped(
rt, { 2, y + lineHeight }, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, ft, rt, { 2, y + lineHeight }, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, ft,
{ COLOUR_BRIGHT_GREEN, FontStyle::Small }); { COLOUR_BRIGHT_GREEN, FontStyle::Small });
} }
// Subject button // Subject button
if ((newsItem.TypeHasSubject()) && !(newsItem.HasButton())) if ((newsItem.typeHasSubject()) && !(newsItem.hasButton()))
{ {
auto screenCoords = ScreenCoordsXY{ 328, y + lineHeight + 4 }; auto screenCoords = ScreenCoordsXY{ 328, y + lineHeight + 4 };
@@ -228,7 +228,7 @@ namespace OpenRCT2::Ui::Windows
} }
GfxFillRectInset(rt, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], press); GfxFillRectInset(rt, { screenCoords, screenCoords + ScreenCoordsXY{ 23, 23 } }, colours[2], press);
switch (newsItem.Type) switch (newsItem.type)
{ {
case News::ItemType::Ride: case News::ItemType::Ride:
GfxDrawSprite(rt, ImageId(SPR_RIDE), screenCoords); GfxDrawSprite(rt, ImageId(SPR_RIDE), screenCoords);
@@ -242,7 +242,7 @@ namespace OpenRCT2::Ui::Windows
break; break;
} }
auto peep = TryGetEntity<Peep>(EntityId::FromUnderlying(newsItem.Assoc)); auto peep = TryGetEntity<Peep>(EntityId::FromUnderlying(newsItem.assoc));
if (peep == nullptr) if (peep == nullptr)
{ {
break; break;
@@ -276,7 +276,7 @@ namespace OpenRCT2::Ui::Windows
GfxDrawSprite(rt, ImageId(SPR_FINANCE), screenCoords); GfxDrawSprite(rt, ImageId(SPR_FINANCE), screenCoords);
break; break;
case News::ItemType::Research: case News::ItemType::Research:
GfxDrawSprite(rt, ImageId(newsItem.Assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE), screenCoords); GfxDrawSprite(rt, ImageId(newsItem.assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE), screenCoords);
break; break;
case News::ItemType::Peeps: case News::ItemType::Peeps:
GfxDrawSprite(rt, ImageId(SPR_GUESTS), screenCoords); GfxDrawSprite(rt, ImageId(SPR_GUESTS), screenCoords);
@@ -295,7 +295,7 @@ namespace OpenRCT2::Ui::Windows
} }
// Location button // Location button
if ((newsItem.TypeHasLocation()) && !(newsItem.HasButton())) if ((newsItem.typeHasLocation()) && !(newsItem.hasButton()))
{ {
auto screenCoords = ScreenCoordsXY{ 352, y + lineHeight + 4 }; auto screenCoords = ScreenCoordsXY{ 352, y + lineHeight + 4 };

View File

@@ -354,7 +354,7 @@ namespace OpenRCT2
_currentRecording.reset(); _currentRecording.reset();
News::Item* news = News::AddItemToQueue(News::ItemType::Blank, "Replay recording stopped", 0); News::Item* news = News::AddItemToQueue(News::ItemType::Blank, "Replay recording stopped", 0);
news->SetFlags(News::ItemFlags::HasButton); // Has no subject. news->setFlags(News::ItemFlags::HasButton); // Has no subject.
return result; return result;
} }
@@ -480,7 +480,7 @@ namespace OpenRCT2
if (_mode == ReplayMode::PLAYING) if (_mode == ReplayMode::PLAYING)
{ {
News::Item* news = News::AddItemToQueue(News::ItemType::Blank, "Replay playback complete", 0); News::Item* news = News::AddItemToQueue(News::ItemType::Blank, "Replay playback complete", 0);
news->SetFlags(News::ItemFlags::HasButton); // Has no subject. news->setFlags(News::ItemFlags::HasButton); // Has no subject.
} }
// When normalizing the output we don't touch the mode. // When normalizing the output we don't touch the mode.

View File

@@ -121,7 +121,7 @@ void News::InitQueue(GameState_t& gameState)
uint16_t News::ItemQueues::IncrementTicks() uint16_t News::ItemQueues::IncrementTicks()
{ {
return ++Current().Ticks; return ++Current().ticks;
} }
static void TickCurrent() static void TickCurrent()
@@ -137,7 +137,7 @@ static void TickCurrent()
int32_t News::ItemQueues::RemoveTime() const int32_t News::ItemQueues::RemoveTime() const
{ {
if (!Recent[5].IsEmpty() && !Recent[4].IsEmpty() && !Recent[3].IsEmpty() && !Recent[2].IsEmpty()) if (!Recent[5].isEmpty() && !Recent[4].isEmpty() && !Recent[3].isEmpty() && !Recent[2].isEmpty())
{ {
return 256; return 256;
} }
@@ -146,7 +146,7 @@ int32_t News::ItemQueues::RemoveTime() const
bool News::ItemQueues::CurrentShouldBeArchived() const bool News::ItemQueues::CurrentShouldBeArchived() const
{ {
return Current().Ticks >= RemoveTime(); return Current().ticks >= RemoveTime();
} }
/** /**
@@ -299,7 +299,7 @@ News::Item* News::ItemQueues::FirstOpenOrNewSlot()
// The for loop above guarantees there is always an extra element to use // The for loop above guarantees there is always an extra element to use
assert(Recent.capacity() - Recent.size() >= 2); assert(Recent.capacity() - Recent.size() >= 2);
auto newsItem = res + 1; auto newsItem = res + 1;
newsItem->Type = News::ItemType::Null; newsItem->type = News::ItemType::Null;
return &*res; return &*res;
} }
@@ -327,13 +327,13 @@ News::Item* News::AddItemToQueue(News::ItemType type, const utf8* text, uint32_t
{ {
auto& date = GetDate(); auto& date = GetDate();
News::Item* newsItem = getGameState().newsItems.FirstOpenOrNewSlot(); News::Item* newsItem = getGameState().newsItems.FirstOpenOrNewSlot();
newsItem->Type = type; newsItem->type = type;
newsItem->Flags = 0; newsItem->flags = 0;
newsItem->Assoc = assoc; // Make optional for Award, Money, Graph and Null newsItem->assoc = assoc; // Make optional for Award, Money, Graph and Null
newsItem->Ticks = 0; newsItem->ticks = 0;
newsItem->MonthYear = static_cast<uint16_t>(date.GetMonthsElapsed()); newsItem->monthYear = static_cast<uint16_t>(date.GetMonthsElapsed());
newsItem->Day = date.GetDay() + 1; newsItem->day = date.GetDay() + 1;
newsItem->Text = text; newsItem->text = text;
return newsItem; return newsItem;
} }
@@ -439,9 +439,9 @@ void News::DisableNewsItems(News::ItemType type, uint32_t assoc)
auto& gameState = getGameState(); auto& gameState = getGameState();
// TODO: write test invalidating windows // TODO: write test invalidating windows
gameState.newsItems.ForeachRecentNews([type, assoc, &gameState](auto& newsItem) { gameState.newsItems.ForeachRecentNews([type, assoc, &gameState](auto& newsItem) {
if (type == newsItem.Type && assoc == newsItem.Assoc) if (type == newsItem.type && assoc == newsItem.assoc)
{ {
newsItem.SetFlags(News::ItemFlags::HasButton); newsItem.setFlags(News::ItemFlags::HasButton);
if (&newsItem == &gameState.newsItems.Current()) if (&newsItem == &gameState.newsItems.Current())
{ {
auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS); auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS);
@@ -451,9 +451,9 @@ void News::DisableNewsItems(News::ItemType type, uint32_t assoc)
}); });
gameState.newsItems.ForeachArchivedNews([type, assoc](auto& newsItem) { gameState.newsItems.ForeachArchivedNews([type, assoc](auto& newsItem) {
if (type == newsItem.Type && assoc == newsItem.Assoc) if (type == newsItem.type && assoc == newsItem.assoc)
{ {
newsItem.SetFlags(News::ItemFlags::HasButton); newsItem.setFlags(News::ItemFlags::HasButton);
auto* windowMgr = Ui::GetWindowManager(); auto* windowMgr = Ui::GetWindowManager();
windowMgr->InvalidateByClass(WindowClass::RecentNews); windowMgr->InvalidateByClass(WindowClass::RecentNews);
} }
@@ -473,7 +473,7 @@ void News::RemoveItem(int32_t index)
auto& gameState = getGameState(); auto& gameState = getGameState();
// News item is already null, no need to remove it // News item is already null, no need to remove it
if (gameState.newsItems[index].Type == News::ItemType::Null) if (gameState.newsItems[index].type == News::ItemType::Null)
return; return;
size_t newsBoundary = index < News::ItemHistoryStart ? News::ItemHistoryStart : News::MaxItems; size_t newsBoundary = index < News::ItemHistoryStart ? News::ItemHistoryStart : News::MaxItems;
@@ -481,7 +481,7 @@ void News::RemoveItem(int32_t index)
{ {
gameState.newsItems[i] = gameState.newsItems[i + 1]; gameState.newsItems[i] = gameState.newsItems[i + 1];
} }
gameState.newsItems[newsBoundary - 1].Type = News::ItemType::Null; gameState.newsItems[newsBoundary - 1].type = News::ItemType::Null;
} }
void News::importNewsItems( void News::importNewsItems(

View File

@@ -64,22 +64,22 @@ namespace OpenRCT2::News
*/ */
struct Item struct Item
{ {
News::ItemType Type = News::ItemType::Null; News::ItemType type = News::ItemType::Null;
uint8_t Flags{}; uint8_t flags{};
uint32_t Assoc{}; uint32_t assoc{};
uint16_t Ticks{}; uint16_t ticks{};
uint16_t MonthYear{}; uint16_t monthYear{};
uint8_t Day{}; uint8_t day{};
std::string Text{}; std::string text{};
constexpr bool IsEmpty() const noexcept constexpr bool isEmpty() const noexcept
{ {
return Type == News::ItemType::Null; return type == News::ItemType::Null;
} }
constexpr uint8_t GetTypeProperties() const constexpr uint8_t getTypeProperties() const
{ {
switch (Type) switch (type)
{ {
case News::ItemType::Blank: case News::ItemType::Blank:
return News::ItemTypeProperty::HasLocation; return News::ItemTypeProperty::HasLocation;
@@ -101,24 +101,24 @@ namespace OpenRCT2::News
} }
} }
void SetFlags(uint8_t flag) void setFlags(uint8_t flag)
{ {
Flags |= flag; flags |= flag;
} }
constexpr bool TypeHasSubject() const constexpr bool typeHasSubject() const
{ {
return this->GetTypeProperties() & News::ItemTypeProperty::HasSubject; return this->getTypeProperties() & News::ItemTypeProperty::HasSubject;
} }
constexpr bool TypeHasLocation() const constexpr bool typeHasLocation() const
{ {
return this->GetTypeProperties() & News::ItemTypeProperty::HasLocation; return this->getTypeProperties() & News::ItemTypeProperty::HasLocation;
} }
constexpr bool HasButton() const noexcept constexpr bool hasButton() const noexcept
{ {
return Flags & News::ItemFlags::HasButton; return flags & News::ItemFlags::HasButton;
} }
}; };
@@ -146,7 +146,7 @@ namespace OpenRCT2::News
ItemQueue() ItemQueue()
{ {
std::get<0>(Queue).Type = News::ItemType::Null; std::get<0>(Queue).type = News::ItemType::Null;
} }
constexpr iterator begin() noexcept constexpr iterator begin() noexcept
@@ -163,7 +163,7 @@ namespace OpenRCT2::News
} }
iterator end() noexcept iterator end() noexcept
{ {
return std::find_if(std::begin(Queue), std::end(Queue), [](const_reference item) { return item.IsEmpty(); }); return std::find_if(std::begin(Queue), std::end(Queue), [](const_reference item) { return item.isEmpty(); });
} }
const_iterator end() const noexcept const_iterator end() const noexcept
{ {
@@ -171,12 +171,12 @@ namespace OpenRCT2::News
} }
const_iterator cend() const noexcept const_iterator cend() const noexcept
{ {
return std::find_if(std::cbegin(Queue), std::cend(Queue), [](const_reference item) { return item.IsEmpty(); }); return std::find_if(std::cbegin(Queue), std::cend(Queue), [](const_reference item) { return item.isEmpty(); });
} }
constexpr bool empty() const noexcept constexpr bool empty() const noexcept
{ {
return std::get<0>(Queue).IsEmpty(); return std::get<0>(Queue).isEmpty();
} }
size_type size() const noexcept size_type size() const noexcept
@@ -204,7 +204,7 @@ namespace OpenRCT2::News
void pop_front() void pop_front()
{ {
std::move(std::begin(Queue) + 1, std::end(Queue), std::begin(Queue)); std::move(std::begin(Queue) + 1, std::end(Queue), std::begin(Queue));
Queue[N - 1].Type = News::ItemType::Null; Queue[N - 1].type = News::ItemType::Null;
} }
void push_back(const_reference item) void push_back(const_reference item)
@@ -221,7 +221,7 @@ namespace OpenRCT2::News
*it = item; *it = item;
++it; ++it;
if (std::distance(it, std::end(Queue))) if (std::distance(it, std::end(Queue)))
it->Type = News::ItemType::Null; it->type = News::ItemType::Null;
} }
} }

View File

@@ -1155,20 +1155,20 @@ namespace OpenRCT2
static void ReadWriteNewsItem(OrcaStream::ChunkStream& cs, News::Item& item) static void ReadWriteNewsItem(OrcaStream::ChunkStream& cs, News::Item& item)
{ {
cs.ReadWrite(item.Type); cs.ReadWrite(item.type);
cs.ReadWrite(item.Flags); cs.ReadWrite(item.flags);
cs.ReadWrite(item.Assoc); cs.ReadWrite(item.assoc);
cs.ReadWrite(item.Ticks); cs.ReadWrite(item.ticks);
cs.ReadWrite(item.MonthYear); cs.ReadWrite(item.monthYear);
cs.ReadWrite(item.Day); cs.ReadWrite(item.day);
if (cs.GetMode() == OrcaStream::Mode::READING) if (cs.GetMode() == OrcaStream::Mode::READING)
{ {
auto s = cs.Read<std::string>(); auto s = cs.Read<std::string>();
item.Text = s; item.text = s;
} }
else else
{ {
cs.Write(std::string_view(item.Text)); cs.Write(std::string_view(item.text));
} }
} }

View File

@@ -2209,25 +2209,25 @@ namespace OpenRCT2::RCT1
if (src.Type == 0) if (src.Type == 0)
break; break;
dst.Type = static_cast<News::ItemType>(src.Type); dst.type = static_cast<News::ItemType>(src.Type);
dst.Flags = src.Flags; dst.flags = src.Flags;
dst.Ticks = src.Ticks; dst.ticks = src.Ticks;
dst.MonthYear = src.MonthYear; dst.monthYear = src.MonthYear;
dst.Day = src.Day; dst.day = src.Day;
dst.Text = ConvertFormattedStringToOpenRCT2(std::string_view(src.Text, sizeof(src.Text))); dst.text = ConvertFormattedStringToOpenRCT2(std::string_view(src.Text, sizeof(src.Text)));
if (dst.Type == News::ItemType::Research) if (dst.type == News::ItemType::Research)
{ {
uint8_t researchItem = src.Assoc & 0x000000FF; uint8_t researchItem = src.Assoc & 0x000000FF;
uint8_t researchType = (src.Assoc & 0x00FF0000) >> 16; uint8_t researchType = (src.Assoc & 0x00FF0000) >> 16;
::ResearchItem tmpResearchItem = {}; ::ResearchItem tmpResearchItem = {};
ConvertResearchEntry(&tmpResearchItem, researchItem, researchType); ConvertResearchEntry(&tmpResearchItem, researchItem, researchType);
dst.Assoc = tmpResearchItem.rawValue; dst.assoc = tmpResearchItem.rawValue;
} }
else else
{ {
dst.Assoc = src.Assoc; dst.assoc = src.Assoc;
} }
output.emplace_back(dst); output.emplace_back(dst);

View File

@@ -339,13 +339,13 @@ namespace OpenRCT2::RCT2
} }
News::Item dst{}; News::Item dst{};
dst.Type = static_cast<News::ItemType>(src.Type); dst.type = static_cast<News::ItemType>(src.Type);
dst.Flags = src.Flags; dst.flags = src.Flags;
dst.Assoc = src.Assoc; dst.assoc = src.Assoc;
dst.Ticks = src.Ticks; dst.ticks = src.Ticks;
dst.MonthYear = src.MonthYear; dst.monthYear = src.MonthYear;
dst.Day = src.Day; dst.day = src.Day;
dst.Text = ConvertFormattedStringToOpenRCT2(std::string_view(src.Text, sizeof(src.Text))); dst.text = ConvertFormattedStringToOpenRCT2(std::string_view(src.Text, sizeof(src.Text)));
output.emplace_back(dst); output.emplace_back(dst);
index++; index++;

View File

@@ -370,11 +370,11 @@ namespace OpenRCT2::Scripting
// End the lists by setting next item to null // End the lists by setting next item to null
if (index < News::ItemHistoryStart) if (index < News::ItemHistoryStart)
{ {
gameState.newsItems[index].Type = News::ItemType::Null; gameState.newsItems[index].type = News::ItemType::Null;
} }
if (archiveIndex < News::MaxItems) if (archiveIndex < News::MaxItems)
{ {
gameState.newsItems[archiveIndex].Type = News::ItemType::Null; gameState.newsItems[archiveIndex].type = News::ItemType::Null;
} }
} }

View File

@@ -56,7 +56,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
return msg->MonthYear; return msg->monthYear;
} }
return 0; return 0;
} }
@@ -67,7 +67,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
msg->MonthYear = value; msg->monthYear = value;
} }
} }
@@ -76,7 +76,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
return msg->Day; return msg->day;
} }
return 0; return 0;
} }
@@ -87,7 +87,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
msg->Day = value; msg->day = value;
} }
} }
@@ -96,7 +96,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
return msg->Ticks; return msg->ticks;
} }
return 0; return 0;
} }
@@ -107,7 +107,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
msg->Ticks = value; msg->ticks = value;
} }
} }
@@ -116,7 +116,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
return GetParkMessageType(msg->Type); return GetParkMessageType(msg->type);
} }
return {}; return {};
} }
@@ -127,7 +127,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
msg->Type = GetParkMessageType(value); msg->type = GetParkMessageType(value);
} }
} }
@@ -136,7 +136,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
return msg->Assoc; return msg->assoc;
} }
return 0; return 0;
} }
@@ -147,7 +147,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
msg->Assoc = value; msg->assoc = value;
} }
} }
@@ -156,7 +156,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
return msg->Text; return msg->text;
} }
return {}; return {};
} }
@@ -167,7 +167,7 @@ namespace OpenRCT2::Scripting
auto msg = GetMessage(); auto msg = GetMessage();
if (msg != nullptr) if (msg != nullptr)
{ {
msg->Text = value; msg->text = value;
} }
} }

View File

@@ -52,12 +52,12 @@ namespace OpenRCT2::Scripting
inline News::Item FromDuk(const DukValue& value) inline News::Item FromDuk(const DukValue& value)
{ {
News::Item result{}; News::Item result{};
result.Type = GetParkMessageType(value["type"].as_string()); result.type = GetParkMessageType(value["type"].as_string());
result.Assoc = value["subject"].as_uint(); result.assoc = value["subject"].as_uint();
result.Ticks = value["tickCount"].as_uint(); result.ticks = value["tickCount"].as_uint();
result.MonthYear = value["month"].as_uint(); result.monthYear = value["month"].as_uint();
result.Day = value["day"].as_uint(); result.day = value["day"].as_uint();
result.Text = value["text"].as_string(); result.text = value["text"].as_string();
return result; return result;
} }