From fb7ccc6820f2d4d6ec1a72f39210f06f8c22b323 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 23 Dec 2008 12:26:19 +0000 Subject: (svn r14726) -Fix (r14720): making new companies in network kinda failed... --- src/company_cmd.cpp | 2 +- src/network/network_client.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 8a36945a6..860246f5c 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -813,7 +813,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) /* Has the network client a correct ClientIndex? */ if (!(flags & DC_EXEC)) return CommandCost(); NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(cid); - if (ci != NULL) return CommandCost(); + if (ci == NULL) return CommandCost(); /* Delete multiplayer progress bar */ DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 9c3e2639a..f4d49539e 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -420,8 +420,11 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO) } // We don't have this client_id yet, find an empty client_id, and put the data there - ci = NetworkFindClientInfoFromClientID(INVALID_CLIENT_ID); - if (ci != NULL) { + for (int i = 0; i < MAX_CLIENT_SLOTS; i++) { + ci = GetNetworkClientInfo(i); + if (!ci->IsValid()) break; + } + if (ci != GetNetworkClientInfo(MAX_CLIENT_SLOTS)) { ci->client_id = client_id; ci->client_playas = playas; -- cgit v1.2.3-70-g09d2