1
0
Fork 0

Codechange: do not use ScriptCompany::CompanyID outside of the script API

pull/13506/head
Rubidium 2025-02-09 11:01:07 +01:00 committed by rubidium42
parent 30ddbeed8d
commit 1193852007
3 changed files with 11 additions and 11 deletions

View File

@ -306,7 +306,7 @@ CommandCost CmdGoalQuestionAnswer(DoCommandFlag flags, uint16_t uniqueid, uint8_
}
if (flags & DC_EXEC) {
Game::NewEvent(new ScriptEventGoalQuestionAnswer(uniqueid, (ScriptCompany::CompanyID)(uint8_t)_current_company, (ScriptGoal::QuestionButton)(1 << button)));
Game::NewEvent(new ScriptEventGoalQuestionAnswer(uniqueid, _current_company, (ScriptGoal::QuestionButton)(1 << button)));
}
return CommandCost();

View File

@ -1034,10 +1034,10 @@ public:
* @param company The company that is replying.
* @param button The button the company pressed.
*/
ScriptEventGoalQuestionAnswer(uint16_t uniqueid, ScriptCompany::CompanyID company, ScriptGoal::QuestionButton button) :
ScriptEventGoalQuestionAnswer(uint16_t uniqueid, ::CompanyID company, ScriptGoal::QuestionButton button) :
ScriptEvent(ET_GOAL_QUESTION_ANSWER),
uniqueid(uniqueid),
company(company),
company(ScriptCompany::ToScriptCompanyID(company)),
button(button)
{}
#endif /* DOXYGEN_API */
@ -1085,9 +1085,9 @@ public:
* @param company The company.
* @param town The town.
*/
ScriptEventCompanyTown(ScriptEventType event, ScriptCompany::CompanyID company, TownID town) :
ScriptEventCompanyTown(ScriptEventType event, ::CompanyID company, TownID town) :
ScriptEvent(event),
company(company),
company(ScriptCompany::ToScriptCompanyID(company)),
town(town)
{}
#endif /* DOXYGEN_API */
@ -1128,7 +1128,7 @@ public:
* @param company The company.
* @param town The town.
*/
ScriptEventExclusiveTransportRights(ScriptCompany::CompanyID company, TownID town) :
ScriptEventExclusiveTransportRights(::CompanyID company, TownID town) :
ScriptEventCompanyTown(ET_EXCLUSIVE_TRANSPORT_RIGHTS, company, town)
{}
#endif /* DOXYGEN_API */
@ -1153,7 +1153,7 @@ public:
* @param company The company.
* @param town The town.
*/
ScriptEventRoadReconstruction(ScriptCompany::CompanyID company, TownID town) :
ScriptEventRoadReconstruction(::CompanyID company, TownID town) :
ScriptEventCompanyTown(ET_ROAD_RECONSTRUCTION, company, town)
{}
#endif /* DOXYGEN_API */

View File

@ -3390,8 +3390,8 @@ static CommandCost TownActionRoadRebuild(Town *t, DoCommandFlag flags)
AddNewsItem(
TimerGameEconomy::UsingWallclockUnits() ? STR_NEWS_ROAD_REBUILDING_MINUTES : STR_NEWS_ROAD_REBUILDING_MONTHS,
NewsType::General, NewsStyle::Normal, {}, NewsReferenceType::Town, t->index, NewsReferenceType::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));
AI::BroadcastNewEvent(new ScriptEventRoadReconstruction(_current_company, t->index));
Game::NewEvent(new ScriptEventRoadReconstruction(_current_company, t->index));
}
return CommandCost();
}
@ -3545,8 +3545,8 @@ static CommandCost TownActionBuyRights(Town *t, DoCommandFlag flags)
SetDParam(2, t->index);
SetDParamStr(3, cni->company_name);
AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NewsType::General, NewsStyle::Company, {}, NewsReferenceType::Town, t->index, NewsReferenceType::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));
AI::BroadcastNewEvent(new ScriptEventExclusiveTransportRights(_current_company, t->index));
Game::NewEvent(new ScriptEventExclusiveTransportRights(_current_company, t->index));
}
return CommandCost();
}