Codechange: Use std::list for News Items. (#12338)

This commit is contained in:
Peter Nelson
2024-04-04 07:53:14 +01:00
committed by GitHub
parent 08cf106fc6
commit f6a88e40a4
6 changed files with 155 additions and 196 deletions

View File

@@ -56,11 +56,12 @@ static void SurveyRecentNews(nlohmann::json &json)
json = nlohmann::json::array();
int i = 0;
for (NewsItem *news = _latest_news; i < 32 && news != nullptr; news = news->prev, i++) {
TimerGameCalendar::YearMonthDay ymd = TimerGameCalendar::ConvertDateToYMD(news->date);
for (const auto &news : GetNews()) {
TimerGameCalendar::YearMonthDay ymd = TimerGameCalendar::ConvertDateToYMD(news.date);
json.push_back(fmt::format("({}-{:02}-{:02}) StringID: {}, Type: {}, Ref1: {}, {}, Ref2: {}, {}",
ymd.year, ymd.month + 1, ymd.day, news->string_id, news->type,
news->reftype1, news->ref1, news->reftype2, news->ref2));
ymd.year, ymd.month + 1, ymd.day, news.string_id, news.type,
news.reftype1, news.ref1, news.reftype2, news.ref2));
if (++i > 32) break;
}
}