Removed Connection.PlayerIndex == 0 checks if favor of Session.Player.IsAdmin
This commit is contained in:
@@ -121,7 +121,7 @@ namespace OpenRA.Server
|
||||
catch { }
|
||||
} ) { IsBackground = true }.Start();
|
||||
}
|
||||
|
||||
int nextPlayerIndex;
|
||||
/* lobby rework todo:
|
||||
* - "teams together" option for team games -- will eliminate most need
|
||||
* for manual spawnpoint choosing.
|
||||
@@ -129,12 +129,8 @@ namespace OpenRA.Server
|
||||
*/
|
||||
public int ChooseFreePlayerIndex()
|
||||
{
|
||||
for (var i = 0; i < 256; 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");
|
||||
nextPlayerIndex++;
|
||||
return nextPlayerIndex;
|
||||
}
|
||||
|
||||
void AcceptConnection()
|
||||
@@ -221,6 +217,9 @@ namespace OpenRA.Server
|
||||
SyncClientToPlayerReference(client, Map.Players[client.Slot]);
|
||||
|
||||
lobbyInfo.Clients.Add(client);
|
||||
//Assume that first validated client is server admin
|
||||
if(lobbyInfo.Clients.Count==1)
|
||||
client.IsAdmin=true;
|
||||
|
||||
Log.Write("server", "Client {0}: Accepted connection from {1}",
|
||||
newConn.PlayerIndex, newConn.socket.RemoteEndPoint);
|
||||
|
||||
Reference in New Issue
Block a user