summaryrefslogtreecommitdiff
path: root/src/signs_cmd.cpp
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-05-29 16:09:25 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-29 19:02:18 +0200
commit2e136285e1dfb4435c11769bf7cabb1ec2057e08 (patch)
treebd6cd67422cc6649a2b75761b52ad220de71b24e /src/signs_cmd.cpp
parent661728558e9ce2eb8cfdb6afd7182b85e1f19a67 (diff)
downloadopenttd-2e136285e1dfb4435c11769bf7cabb1ec2057e08.tar.xz
Codechange: move from C-string to std::string for DoCommand
Diffstat (limited to 'src/signs_cmd.cpp')
-rw-r--r--src/signs_cmd.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/signs_cmd.cpp b/src/signs_cmd.cpp
index 6ffb6cda1..0dd821157 100644
--- a/src/signs_cmd.cpp
+++ b/src/signs_cmd.cpp
@@ -36,13 +36,13 @@ SignID _new_sign_id;
* @param text unused
* @return the cost of this operation or an error
*/
-CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
/* Try to locate a new sign */
if (!Sign::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_SIGNS);
/* Check sign text length if any */
- if (!StrEmpty(text) && Utf8StringLength(text) >= MAX_LENGTH_SIGN_NAME_CHARS) return CMD_ERROR;
+ if (Utf8StringLength(text) >= MAX_LENGTH_SIGN_NAME_CHARS) return CMD_ERROR;
/* When we execute, really make the sign */
if (flags & DC_EXEC) {
@@ -53,7 +53,7 @@ CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
si->x = x;
si->y = y;
si->z = GetSlopePixelZ(x, y);
- if (!StrEmpty(text)) {
+ if (!text.empty()) {
si->name = text;
}
si->UpdateVirtCoord();
@@ -75,14 +75,14 @@ CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
* @param text the new name or an empty string when resetting to the default
* @return the cost of this operation or an error
*/
-CommandCost CmdRenameSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRenameSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
Sign *si = Sign::GetIfValid(p1);
if (si == nullptr) return CMD_ERROR;
if (si->owner == OWNER_DEITY && _current_company != OWNER_DEITY && _game_mode != GM_EDITOR) return CMD_ERROR;
/* Rename the signs when empty, otherwise remove it */
- if (!StrEmpty(text)) {
+ if (!text.empty()) {
if (Utf8StringLength(text) >= MAX_LENGTH_SIGN_NAME_CHARS) return CMD_ERROR;
if (flags & DC_EXEC) {