diff options
author | rubidium <rubidium@openttd.org> | 2008-12-28 14:37:19 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-12-28 14:37:19 +0000 |
commit | 87e5a8b52bf2f200467d65c1e17fd79548d31129 (patch) | |
tree | 36bbbb5d389d41119ee184607bc012666dda7812 /src/signs.cpp | |
parent | 53679122af1e0a68bbe4e9c1f73526dd7e118df6 (diff) | |
download | openttd-87e5a8b52bf2f200467d65c1e17fd79548d31129.tar.xz |
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
Diffstat (limited to 'src/signs.cpp')
-rw-r--r-- | src/signs.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/signs.cpp b/src/signs.cpp index 503462651..1c2d846cd 100644 --- a/src/signs.cpp +++ b/src/signs.cpp @@ -98,7 +98,7 @@ static void MarkSignDirty(Sign *si) * @param p1 unused * @param p2 unused */ -CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) +CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text) { /* Try to locate a new sign */ if (!Sign::CanAllocateItem()) return_cmd_error(STR_2808_TOO_MANY_SIGNS); @@ -130,14 +130,13 @@ CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) * @param p2 unused * @return 0 if succesfull, otherwise CMD_ERROR */ -CommandCost CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) +CommandCost CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text) { if (!IsValidSignID(p1)) return CMD_ERROR; - /* If _cmd_text 0 means the new text for the sign is non-empty. - * So rename the sign. If it is empty, it has no name, so delete it */ - if (!StrEmpty(_cmd_text)) { - if (strlen(_cmd_text) >= MAX_LENGTH_SIGN_NAME_BYTES) return CMD_ERROR; + /* Rename the signs when empty, otherwise remove it */ + if (!StrEmpty(text)) { + if (strlen(text) >= MAX_LENGTH_SIGN_NAME_BYTES) return CMD_ERROR; if (flags & DC_EXEC) { Sign *si = GetSign(p1); @@ -145,7 +144,7 @@ CommandCost CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) /* Delete the old name */ free(si->name); /* Assign the new one */ - si->name = strdup(_cmd_text); + si->name = strdup(text); si->owner = _current_company; /* Update; mark sign dirty twice, because it can either becom longer, or shorter */ @@ -191,7 +190,7 @@ void CcPlaceSign(bool success, TileIndex tile, uint32 p1, uint32 p2) */ void PlaceProc_Sign(TileIndex tile) { - DoCommandP(tile, 0, 0, CcPlaceSign, CMD_PLACE_SIGN | CMD_MSG(STR_2809_CAN_T_PLACE_SIGN_HERE)); + DoCommandP(tile, 0, 0, CMD_PLACE_SIGN | CMD_MSG(STR_2809_CAN_T_PLACE_SIGN_HERE), CcPlaceSign); } /** |