summaryrefslogtreecommitdiff
path: root/src/company_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-12-23 11:55:46 +0000
committerrubidium <rubidium@openttd.org>2008-12-23 11:55:46 +0000
commitf8f7febe41311ff3562c57a10672e3a62174104b (patch)
tree0e0f56357371c5504e04f2c93c6baebc89f00607 /src/company_cmd.cpp
parent52fb6b7d7cec0734fb341939adce5199eeca7db6 (diff)
downloadopenttd-f8f7febe41311ff3562c57a10672e3a62174104b.tar.xz
(svn r14725) -Change: make it clearer why (and that) MAX_CLIENTS isn't the amount of slots in the array, but one less as a dedicated server takes a slot too.
Diffstat (limited to 'src/company_cmd.cpp')
-rw-r--r--src/company_cmd.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index 16c2610bf..8a36945a6 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -812,7 +812,8 @@ CommandCost CmdCompanyCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* Has the network client a correct ClientIndex? */
if (!(flags & DC_EXEC)) return CommandCost();
- if (cid >= MAX_CLIENT_INFO) return CommandCost();
+ NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(cid);
+ if (ci != NULL) return CommandCost();
/* Delete multiplayer progress bar */
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
@@ -822,7 +823,6 @@ CommandCost CmdCompanyCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* A new company could not be created, revert to being a spectator */
if (c == NULL) {
if (_network_server) {
- NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(cid);
ci->client_playas = COMPANY_SPECTATOR;
NetworkUpdateClientInfo(ci->client_id);
} else if (_local_company == COMPANY_SPECTATOR) {
@@ -858,7 +858,6 @@ CommandCost CmdCompanyCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* XXX - UGLY! p2 (pid) is mis-used to fetch the client-id, done at
* server-side in network_server.c:838, function
* DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) */
- NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(cid);
ci->client_playas = c->index;
NetworkUpdateClientInfo(ci->client_id);