dedicated: never let Bot become an admin

This commit is contained in:
Igor Popov
2013-01-06 19:00:36 +04:00
committed by Chris Forbes
parent e10920d4ea
commit 395aa0fc10

View File

@@ -314,7 +314,7 @@ namespace OpenRA.Server
lobbyInfo.Clients.Add(client);
//Assume that first validated client is server admin
if(lobbyInfo.Clients.Count==1)
if(lobbyInfo.Clients.Where(c1 => c1.Bot == null).Count()==1)
client.IsAdmin=true;
OpenRA.Network.Session.Client clientAdmin = lobbyInfo.Clients.Where(c1 => c1.IsAdmin).Single();
@@ -506,10 +506,10 @@ namespace OpenRA.Server
// reassign admin if necessary
if ( lobbyInfo.GlobalSettings.Dedicated && dropClient.IsAdmin && !GameStarted)
{
if (lobbyInfo.Clients.Count() > 0)
if (lobbyInfo.Clients.Where(c1 => c1.Bot == null).Count() > 0)
{
// client was not alone on the server but he was admin: set admin to the last connected client
OpenRA.Network.Session.Client lastClient = lobbyInfo.Clients.Last();
OpenRA.Network.Session.Client lastClient = lobbyInfo.Clients.Where(c1 => c1.Bot == null).Last();
lastClient.IsAdmin = true;
SendChat(toDrop, "Admin left! {0} is a new admin now!".F(lastClient.Name));
}