summaryrefslogtreecommitdiff
path: root/players.c
diff options
context:
space:
mode:
Diffstat (limited to 'players.c')
-rw-r--r--players.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/players.c b/players.c
index 2ea429994..34d458555 100644
--- a/players.c
+++ b/players.c
@@ -856,13 +856,15 @@ int32 CmdPlayerCtrl(int x, int y, uint32 flags, uint32 p1, uint32 p2)
_local_player = ci->client_playas - 1;
NetworkSend_Command(0, 0, 0, CMD_CHANGE_PRESIDENT_NAME, NULL);
_local_player = player_backup;
+ _network_game_info.companies_on++;
}
}
- } else if (_network_server) {
+ } else if (_network_server) { // Creating player failed, defer client to spectator
/* 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 = &_network_client_info[pid];
ci->client_playas = OWNER_SPECTATOR;
+ _network_game_info.spectators_on++;
NetworkUpdateClientInfo(ci->client_index);
}
#else
@@ -901,6 +903,9 @@ int32 CmdPlayerCtrl(int x, int y, uint32 flags, uint32 p1, uint32 p2)
p->is_active = false;
}
RemoveAllEngineReplacementForPlayer(p);
+#ifdef ENABLE_NETWORK
+ _network_game_info.companies_on--;
+#endif /* ENABLE_NETWORK */
} break;