Removed Connection.PlayerIndex == 0 checks if favor of Session.Player.IsAdmin

This commit is contained in:
Nikita Tsukanov
2012-01-09 15:37:55 +04:00
parent 85293a482e
commit ad29926391
4 changed files with 27 additions and 23 deletions

View File

@@ -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);