Add: [Script] Event for when a company's president name changes

This commit is contained in:
Rubidium
2024-12-30 23:47:20 +01:00
committed by rubidium42
parent 9ab936f76b
commit 29129e12fd
7 changed files with 67 additions and 3 deletions

View File

@@ -1241,6 +1241,11 @@ CommandCost CmdRenamePresident(DoCommandFlag flags, const std::string &text)
InvalidateWindowClassesData(WC_COMPANY, 1);
MarkWholeScreenDirty();
CompanyAdminUpdate(c);
SetDParam(0, c->index);
std::string new_name = GetString(STR_PRESIDENT_NAME);
AI::BroadcastNewEvent(new ScriptEventPresidentRenamed(c->index, new_name));
Game::NewEvent(new ScriptEventPresidentRenamed(c->index, new_name));
}
return CommandCost();