summaryrefslogtreecommitdiff
path: root/misc_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-23 15:16:47 +0000
committertron <tron@openttd.org>2005-01-23 15:16:47 +0000
commit1cd455b8be2782590f708804f861a47a8d2fef29 (patch)
tree60b41a28cf18bba61bcff993ba254ea2000a083c /misc_cmd.c
parent98b06abd59c067c568d5677e47d1c2d95515d17c (diff)
downloadopenttd-1cd455b8be2782590f708804f861a47a8d2fef29.tar.xz
(svn r1616) Introduce ttd_strlcat() and use it to de-uglify some piece of code in misc_cmd.
While here rename the len parameter of ttd_strlcpy() to size, because it is a buffer size and not a string length. Also add -Wwrite-strings to the Makefile, because the above mentioned piece of code was the only part which triggered this warning.
Diffstat (limited to 'misc_cmd.c')
-rw-r--r--misc_cmd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/misc_cmd.c b/misc_cmd.c
index 6d26c1d5c..865324acc 100644
--- a/misc_cmd.c
+++ b/misc_cmd.c
@@ -158,10 +158,8 @@ int32 CmdChangePresidentName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
DeleteName(old_str);
if (p->name_1 == STR_SV_UNNAMED) {
- byte *s = " Transport";
- byte *d = (byte*)_decode_parameters, b;
- d--; do d++; while (*d);
- do *d++ = b = *s++; while(d != (byte*)endof(_decode_parameters) && b != 0);
+ ttd_strlcat(
+ (char*)_decode_parameters, " Transport", sizeof(_decode_parameters));
DoCommandByTile(0, p1, 0, DC_EXEC, CMD_CHANGE_COMPANY_NAME);
}
MarkWholeScreenDirty();