summaryrefslogtreecommitdiff
path: root/players.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-01-25 18:11:06 +0000
committerDarkvater <Darkvater@openttd.org>2006-01-25 18:11:06 +0000
commit082aa38f79930b31a5b9177e507a74cba0738e7a (patch)
tree2e2b02a496376c4fb097825d484c2c4a6f6f5492 /players.c
parent063aa48b0bad3a8e8f046b9dc8e51f8a67b9678c (diff)
downloadopenttd-082aa38f79930b31a5b9177e507a74cba0738e7a.tar.xz
(svn r3427) - Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console.
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;