Codechange: Use enum class for NewsType.

This commit is contained in:
2025-02-02 17:58:55 +00:00
committed by Peter Nelson
parent 4fd1929bf7
commit ca75a8ce19
19 changed files with 111 additions and 110 deletions

View File

@@ -2229,7 +2229,7 @@ std::tuple<CommandCost, Money, TownID> CmdFoundTown(DoCommandFlag flags, TileInd
if (_current_company == OWNER_DEITY) {
SetDParam(0, t->index);
AddTileNewsItem(STR_NEWS_NEW_TOWN_UNSPONSORED, NT_INDUSTRY_OPEN, tile);
AddTileNewsItem(STR_NEWS_NEW_TOWN_UNSPONSORED, NewsType::IndustryOpen, tile);
} else {
SetDParam(0, _current_company);
std::string company_name = GetString(STR_COMPANY_NAME);
@@ -2237,7 +2237,7 @@ std::tuple<CommandCost, Money, TownID> CmdFoundTown(DoCommandFlag flags, TileInd
SetDParamStr(0, company_name);
SetDParam(1, t->index);
AddTileNewsItem(STR_NEWS_NEW_TOWN, NT_INDUSTRY_OPEN, tile);
AddTileNewsItem(STR_NEWS_NEW_TOWN, NewsType::IndustryOpen, tile);
}
AI::BroadcastNewEvent(new ScriptEventTownFounded(t->index));
Game::NewEvent(new ScriptEventTownFounded(t->index));
@@ -3388,7 +3388,7 @@ static CommandCost TownActionRoadRebuild(Town *t, DoCommandFlag flags)
AddNewsItem(
TimerGameEconomy::UsingWallclockUnits() ? STR_NEWS_ROAD_REBUILDING_MINUTES : STR_NEWS_ROAD_REBUILDING_MONTHS,
NT_GENERAL, NewsStyle::Normal, {}, NR_TOWN, t->index, NR_NONE, UINT32_MAX);
NewsType::General, NewsStyle::Normal, {}, NR_TOWN, t->index, NR_NONE, UINT32_MAX);
AI::BroadcastNewEvent(new ScriptEventRoadReconstruction((ScriptCompany::CompanyID)(Owner)_current_company, t->index));
Game::NewEvent(new ScriptEventRoadReconstruction((ScriptCompany::CompanyID)(Owner)_current_company, t->index));
}
@@ -3543,7 +3543,7 @@ static CommandCost TownActionBuyRights(Town *t, DoCommandFlag flags)
SetDParam(1, TimerGameEconomy::UsingWallclockUnits() ? STR_NEWS_EXCLUSIVE_RIGHTS_DESCRIPTION_MINUTES : STR_NEWS_EXCLUSIVE_RIGHTS_DESCRIPTION_MONTHS);
SetDParam(2, t->index);
SetDParamStr(3, cni->company_name);
AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NT_GENERAL, NewsStyle::Company, {}, NR_TOWN, t->index, NR_NONE, UINT32_MAX, std::move(cni));
AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NewsType::General, NewsStyle::Company, {}, NR_TOWN, t->index, NR_NONE, UINT32_MAX, std::move(cni));
AI::BroadcastNewEvent(new ScriptEventExclusiveTransportRights((ScriptCompany::CompanyID)(Owner)_current_company, t->index));
Game::NewEvent(new ScriptEventExclusiveTransportRights((ScriptCompany::CompanyID)(Owner)_current_company, t->index));
}