summaryrefslogtreecommitdiff
path: root/src/company_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/company_cmd.cpp')
-rw-r--r--src/company_cmd.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index 5a2b9ba1d..f00db97c5 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -807,7 +807,7 @@ void CompanyAdminRemove(CompanyID company_id, CompanyRemoveReason reason)
* @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 tile, DoCommandFlag flags, uint32 p1, uint3
* @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(TileIndex tile, DoCommandFlag flags, uint32
* @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<Colours, 0, 8>(p2);
LiveryScheme scheme = Extract<LiveryScheme, 0, 8>(p1);
@@ -1067,9 +1067,9 @@ static bool IsUniqueCompanyName(const std::string &name)
* @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 std::string &name)
* @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 tile, DoCommandFlag flags, uint32 p1, u
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::GetTramTotal() const
* @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;