diff options
author | Darkvater <darkvater@openttd.org> | 2005-05-11 12:46:19 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2005-05-11 12:46:19 +0000 |
commit | 6cdb9580e2cca96f4ad96504ed22a9e93cb06dd6 (patch) | |
tree | eae5566ea27edecc49e426270a4ef77af6965b32 /misc_cmd.c | |
parent | 5e6923e9369a5a531d9b64da45fcfcc91f7687de (diff) | |
download | openttd-6cdb9580e2cca96f4ad96504ed22a9e93cb06dd6.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.c | 18 |
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; } |