mirror of https://github.com/OpenTTD/OpenTTD
(svn r16438) -Fix (r16436): set 'old_company' after modifying '_current_company'
parent
bacbafe510
commit
aa62ec0a1f
|
@ -503,8 +503,6 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
|
||||||
StringID error_part1 = GB(cmd, 16, 16);
|
StringID error_part1 = GB(cmd, 16, 16);
|
||||||
_additional_cash_required = 0;
|
_additional_cash_required = 0;
|
||||||
|
|
||||||
CompanyID old_company = _current_company;
|
|
||||||
|
|
||||||
/* get pointer to command handler */
|
/* get pointer to command handler */
|
||||||
byte cmd_id = cmd & CMD_ID_MASK;
|
byte cmd_id = cmd & CMD_ID_MASK;
|
||||||
assert(cmd_id < lengthof(_command_proc_table));
|
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 */
|
/* Always execute server and spectator commands as spectator */
|
||||||
if (cmd_flags & (CMD_SPECTATOR | CMD_SERVER)) _current_company = COMPANY_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!
|
/* 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
|
* 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. */
|
* this guards the server from executing functions for an invalid company. */
|
||||||
|
|
Loading…
Reference in New Issue