summaryrefslogtreecommitdiff
path: root/misc_cmd.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-05-11 12:46:19 +0000
committerDarkvater <Darkvater@openttd.org>2005-05-11 12:46:19 +0000
commit7648e9290bba72adceee320366a2fdd0d42ce8c6 (patch)
treeeae5566ea27edecc49e426270a4ef77af6965b32 /misc_cmd.c
parentb43331c931e2e8f8586080c9d8bee022bfe3aa5b (diff)
downloadopenttd-7648e9290bba72adceee320366a2fdd0d42ce8c6.tar.xz
(svn r2291) - Fix (regression): When a client joined it changed the server-player's name. Funny effect; but not desired. Thanks for pointing it out Tron. It needed a bit of hacking, but is not less of a hack than the one used before :)
Diffstat (limited to 'misc_cmd.c')
-rw-r--r--misc_cmd.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/misc_cmd.c b/misc_cmd.c
index f27d78fa0..52f237ba2 100644
--- a/misc_cmd.c
+++ b/misc_cmd.c
@@ -126,7 +126,7 @@ int32 CmdDecreaseLoan(int x, int y, uint32 flags, uint32 p1, uint32 p2)
*/
int32 CmdChangeCompanyName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
- StringID str,old_str;
+ StringID str;
Player *p;
str = AllocateNameUnique((const char*)_decode_parameters, 4);
@@ -134,13 +134,11 @@ int32 CmdChangeCompanyName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
p = DEREF_PLAYER(_current_player);
- old_str = p->name_1;
+ DeleteName(p->name_1);
p->name_1 = str;
- DeleteName(old_str);
MarkWholeScreenDirty();
- } else {
+ } else
DeleteName(str);
- }
return 0;
}
@@ -152,7 +150,7 @@ int32 CmdChangeCompanyName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
*/
int32 CmdChangePresidentName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
- StringID str,old_str;
+ StringID str;
Player *p;
str = AllocateNameUnique((const char*)_decode_parameters, 4);
@@ -160,18 +158,16 @@ int32 CmdChangePresidentName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
p = DEREF_PLAYER(_current_player);
- old_str = p->president_name_1;
+ DeleteName(p->president_name_1);
p->president_name_1 = str;
- DeleteName(old_str);
if (p->name_1 == STR_SV_UNNAMED) {
ttd_strlcat((char*)_decode_parameters, " Transport", sizeof(_decode_parameters));
- DoCommandByTile(0, p1, 0, DC_EXEC, CMD_CHANGE_COMPANY_NAME);
+ DoCommandByTile(0, 0, 0, DC_EXEC, CMD_CHANGE_COMPANY_NAME);
}
MarkWholeScreenDirty();
- } else {
+ } else
DeleteName(str);
- }
return 0;
}