Make bots first-class players.
- Bots have their own Clients, with unique ClientIDs - Hosts can set bot team/color in the lobby - Bots are kicked when switching to a smaller map without enough slots - Order validator assumes that only client 0 has permission to issue bot orders
This commit is contained in:
@@ -129,10 +129,11 @@ namespace OpenRA.Server
|
||||
* for manual spawnpoint choosing.
|
||||
* - 256 max players is a dirty hack
|
||||
*/
|
||||
int ChooseFreePlayerIndex()
|
||||
public int ChooseFreePlayerIndex()
|
||||
{
|
||||
for (var i = 0; i < 256; i++)
|
||||
if (conns.All(c => c.PlayerIndex != i) && preConns.All(c => c.PlayerIndex != i))
|
||||
if (conns.All(c => c.PlayerIndex != i) && preConns.All(c => c.PlayerIndex != i)
|
||||
&& lobbyInfo.Clients.All(c => c.Index != i))
|
||||
return i;
|
||||
|
||||
throw new InvalidOperationException("Already got 256 players");
|
||||
|
||||
Reference in New Issue
Block a user