diff options
author | smatz <smatz@openttd.org> | 2009-05-26 21:55:49 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-05-26 21:55:49 +0000 |
commit | aa62ec0a1f7cc2416e0397eeccc90156d27b8b44 (patch) | |
tree | cd7239709be18313c128a285cde01c5466fa350a /src | |
parent | bacbafe51094ab88c1e215d441566715040846c9 (diff) | |
download | openttd-aa62ec0a1f7cc2416e0397eeccc90156d27b8b44.tar.xz |
(svn r16438) -Fix (r16436): set 'old_company' after modifying '_current_company'
Diffstat (limited to 'src')
-rw-r--r-- | src/command.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/command.cpp b/src/command.cpp index abc87daba..19805d7f8 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -503,8 +503,6 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac StringID error_part1 = GB(cmd, 16, 16); _additional_cash_required = 0; - CompanyID old_company = _current_company; - /* get pointer to command handler */ byte cmd_id = cmd & CMD_ID_MASK; assert(cmd_id < lengthof(_command_proc_table)); @@ -523,6 +521,8 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac /* Always execute server and spectator commands as spectator */ if (cmd_flags & (CMD_SPECTATOR | CMD_SERVER)) _current_company = COMPANY_SPECTATOR; + CompanyID old_company = _current_company; + /* If the company isn't valid it may only do server command or start a new company! * The server will ditch any server commands a client sends to it, so effectively * this guards the server from executing functions for an invalid company. */ |