summaryrefslogtreecommitdiff
path: root/players.c
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-12-26 11:47:31 +0000
committerrubidium <rubidium@openttd.org>2006-12-26 11:47:31 +0000
commit80c3be09fce9f7c1ae41fa9f4984dd0941073feb (patch)
tree6ed7f9c4098595c494f840805bf5266398aaf904 /players.c
parent28844c088c5a84d696cdf5ea2a1cf0e315ed7ce7 (diff)
downloadopenttd-80c3be09fce9f7c1ae41fa9f4984dd0941073feb.tar.xz
(svn r7560) -Fix (r2300): p2 is not a PlayerID when creating a new company, but the ClientID (index in _network_client_info). Therefore it was not possible to create a new company if 8 or more clients were connected. Thanks to FlashFF for noticing this bug.
Diffstat (limited to 'players.c')
-rw-r--r--players.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/players.c b/players.c
index 5b3298398..1dc2b5601 100644
--- a/players.c
+++ b/players.c
@@ -820,9 +820,8 @@ int32 CmdPlayerCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* This command is only executed in a multiplayer game */
if (!_networking) return CMD_ERROR;
- /* ClientID would be valid up to MAX_CLIENT_INFO, but as it has to be a
- * new player, its valid range is restricted to that of players */
- if (!(flags & DC_EXEC) || !IsValidPlayer((PlayerID)cid)) return 0;
+ /* Has the network client a correct ClientID? */
+ if (!(flags & DC_EXEC) || cid >= MAX_CLIENT_INFO) return 0;
/* Delete multiplayer progress bar */
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);