1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-23 20:24:12 +01:00

Codechange: Use enum class for NewsType.

This commit is contained in:
Peter Nelson
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

@@ -1722,7 +1722,7 @@ static void AdvertiseIndustryOpening(const Industry *ind)
} else {
SetDParam(1, ind->town->index);
}
AddIndustryNewsItem(ind_spc->new_industry_text, NT_INDUSTRY_OPEN, ind->index);
AddIndustryNewsItem(ind_spc->new_industry_text, NewsType::IndustryOpen, ind->index);
AI::BroadcastNewEvent(new ScriptEventIndustryOpen(ind->index));
Game::NewEvent(new ScriptEventIndustryOpen(ind->index));
}
@@ -2183,9 +2183,9 @@ CommandCost CmdIndustrySetProduction(DoCommandFlag flags, IndustryID ind_id, uin
if (show_news && str != STR_NULL) {
NewsType nt;
switch (WhoCanServiceIndustry(ind)) {
case 0: nt = NT_INDUSTRY_NOBODY; break;
case 1: nt = NT_INDUSTRY_OTHER; break;
case 2: nt = NT_INDUSTRY_COMPANY; break;
case 0: nt = NewsType::IndustryNobody; break;
case 1: nt = NewsType::IndustryOther; break;
case 2: nt = NewsType::IndustryCompany; break;
default: NOT_REACHED();
}
@@ -2769,9 +2769,9 @@ static void ReportNewsProductionChangeIndustry(Industry *ind, CargoType type, in
NewsType nt;
switch (WhoCanServiceIndustry(ind)) {
case 0: nt = NT_INDUSTRY_NOBODY; break;
case 1: nt = NT_INDUSTRY_OTHER; break;
case 2: nt = NT_INDUSTRY_COMPANY; break;
case 0: nt = NewsType::IndustryNobody; break;
case 1: nt = NewsType::IndustryOther; break;
case 2: nt = NewsType::IndustryCompany; break;
default: NOT_REACHED();
}
SetDParam(2, abs(percent));
@@ -2969,14 +2969,14 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
NewsType nt;
/* Compute news category */
if (closeit) {
nt = NT_INDUSTRY_CLOSE;
nt = NewsType::IndustryClose;
AI::BroadcastNewEvent(new ScriptEventIndustryClose(i->index));
Game::NewEvent(new ScriptEventIndustryClose(i->index));
} else {
switch (WhoCanServiceIndustry(i)) {
case 0: nt = NT_INDUSTRY_NOBODY; break;
case 1: nt = NT_INDUSTRY_OTHER; break;
case 2: nt = NT_INDUSTRY_COMPANY; break;
case 0: nt = NewsType::IndustryNobody; break;
case 1: nt = NewsType::IndustryOther; break;
case 2: nt = NewsType::IndustryCompany; break;
default: NOT_REACHED();
}
}