diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -807,7 +807,7 @@ void CompanyAdminRemove(CompanyID compan * @param text unused * @return the cost of this operation or an error */ -CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) +CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text) { InvalidateWindowData(WC_COMPANY_LEAGUE, 0, 0); CompanyID company_id = (CompanyID)GB(p1, 16, 8); @@ -932,7 +932,7 @@ CommandCost CmdCompanyCtrl(TileIndex til * @param text unused * @return the cost of this operation or an error */ -CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) +CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text) { CompanyManagerFace cmf = (CompanyManagerFace)p2; @@ -956,7 +956,7 @@ CommandCost CmdSetCompanyManagerFace(Til * @param text unused * @return the cost of this operation or an error */ -CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) +CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text) { Colours colour = Extract(p2); LiveryScheme scheme = Extract(p1); @@ -1067,9 +1067,9 @@ static bool IsUniqueCompanyName(const st * @param text the new name or an empty string when resetting to the default * @return the cost of this operation or an error */ -CommandCost CmdRenameCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) +CommandCost CmdRenameCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text) { - bool reset = StrEmpty(text); + bool reset = text.empty(); if (!reset) { if (Utf8StringLength(text) >= MAX_LENGTH_COMPANY_NAME_CHARS) return CMD_ERROR; @@ -1113,9 +1113,9 @@ static bool IsUniquePresidentName(const * @param text the new name or an empty string when resetting to the default * @return the cost of this operation or an error */ -CommandCost CmdRenamePresident(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) +CommandCost CmdRenamePresident(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text) { - bool reset = StrEmpty(text); + bool reset = text.empty(); if (!reset) { if (Utf8StringLength(text) >= MAX_LENGTH_PRESIDENT_NAME_CHARS) return CMD_ERROR; @@ -1131,10 +1131,7 @@ CommandCost CmdRenamePresident(TileIndex c->president_name = text; if (c->name_1 == STR_SV_UNNAMED && c->name.empty()) { - char buf[80]; - - seprintf(buf, lastof(buf), "%s Transport", text); - DoCommand(0, 0, 0, DC_EXEC, CMD_RENAME_COMPANY, buf); + DoCommand(0, 0, 0, DC_EXEC, CMD_RENAME_COMPANY, text + " Transport"); } } @@ -1201,7 +1198,7 @@ uint32 CompanyInfrastructure::GetTramTot * @param text unused * @return the cost of this operation or an error */ -CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) +CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text) { if (!_settings_game.economy.give_money) return CMD_ERROR;