1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 13:03:11 +01:00

Close #12397: Refactor NEWS_ITEM_* to use strong enum

This commit is contained in:
pizza2004
2020-07-26 02:46:22 -06:00
parent fa2bd4cad6
commit cee7f8d34c
21 changed files with 178 additions and 148 deletions

View File

@@ -1659,19 +1659,19 @@ static int32_t cc_add_news_item([[maybe_unused]] InteractiveConsole& console, [[
if (argv.size() < 3)
{
console.WriteLineWarning("Too few arguments");
static_assert(NEWS_ITEM_TYPE_COUNT == 10, "NEWS_ITEM_TYPE_COUNT changed, update console command!");
static_assert(News::ItemTypeCount == 10, "News::ItemType::Count changed, update console command!");
console.WriteLine("add_news_item <type> <message> <assoc>");
console.WriteLine("type is one of:");
console.WriteLine(" 0 (NEWS_ITEM_NULL)");
console.WriteLine(" 1 (NEWS_ITEM_RIDE)");
console.WriteLine(" 2 (NEWS_ITEM_PEEP_ON_RIDE)");
console.WriteLine(" 3 (NEWS_ITEM_PEEP)");
console.WriteLine(" 4 (NEWS_ITEM_MONEY)");
console.WriteLine(" 5 (NEWS_ITEM_BLANK)");
console.WriteLine(" 6 (NEWS_ITEM_RESEARCH)");
console.WriteLine(" 7 (NEWS_ITEM_PEEPS)");
console.WriteLine(" 8 (NEWS_ITEM_AWARD)");
console.WriteLine(" 9 (NEWS_ITEM_GRAPH)");
console.WriteLine(" 0 (News::ItemType::Null)");
console.WriteLine(" 1 (News::ItemType::Ride)");
console.WriteLine(" 2 (News::ItemType::PeepOnRide)");
console.WriteLine(" 3 (News::ItemType::Peep)");
console.WriteLine(" 4 (News::ItemType::Money)");
console.WriteLine(" 5 (News::ItemType::Blank)");
console.WriteLine(" 6 (News::ItemType::Research)");
console.WriteLine(" 7 (News::ItemType::Peeps)");
console.WriteLine(" 8 (News::ItemType::Award)");
console.WriteLine(" 9 (News::ItemType::Graph)");
console.WriteLine("message is the message to display, wrapped in quotes for multiple words");
console.WriteLine("assoc is the associated id of ride/peep/tile/etc.");
return 1;
@@ -1679,7 +1679,7 @@ static int32_t cc_add_news_item([[maybe_unused]] InteractiveConsole& console, [[
auto type = atoi(argv[0].c_str());
auto msg = argv[1].c_str();
auto assoc = atoi(argv[2].c_str());
news_item_add_to_queue_raw(type, msg, assoc);
news_item_add_to_queue_raw(static_cast<News::ItemType>(type), msg, assoc);
return 0;
}