Simplify admin promotion check in ValidateClient.
This also fixes a crash if we want to allow multiple admins in a server.
This commit is contained in:
@@ -293,12 +293,11 @@ namespace OpenRA.Server
|
||||
|
||||
lobbyInfo.Clients.Add(client);
|
||||
|
||||
// Assume that first validated client is server admin
|
||||
if (lobbyInfo.Clients.Where(c1 => c1.Bot == null).Count() == 1)
|
||||
// Promote to admin if this is the first client
|
||||
var clientAdmin = lobbyInfo.Clients.Where(c1 => c1.IsAdmin).FirstOrDefault() ?? client;
|
||||
if (clientAdmin == client)
|
||||
client.IsAdmin = true;
|
||||
|
||||
OpenRA.Network.Session.Client clientAdmin = lobbyInfo.Clients.Where(c1 => c1.IsAdmin).Single();
|
||||
|
||||
Log.Write("server", "Client {0}: Accepted connection from {1}.",
|
||||
newConn.PlayerIndex, newConn.socket.RemoteEndPoint);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user