fixed #2540 AI orders misinterpreted as an exploit on dedicated
This commit is contained in:
@@ -57,6 +57,7 @@ namespace OpenRA.Network
|
||||
public int Team;
|
||||
public string Slot; // slot ID, or null for observer
|
||||
public string Bot; // Bot type, null for real clients
|
||||
public int BotControllerClientIndex; // who added the bot to the slot
|
||||
public bool IsAdmin;
|
||||
public bool IsReady { get { return State == ClientState.Ready; } }
|
||||
public bool IsObserver { get { return Slot == null; } }
|
||||
|
||||
@@ -528,9 +528,11 @@ namespace OpenRA.Server
|
||||
SendDisconnected(toDrop); /* Report disconnection */
|
||||
|
||||
lobbyInfo.Clients.RemoveAll(c => c.Index == toDrop.PlayerIndex);
|
||||
// remove the bots he added
|
||||
lobbyInfo.Clients.RemoveAll(c => c.BotControllerClientIndex == toDrop.PlayerIndex);
|
||||
|
||||
// reassign admin if necessary
|
||||
if ( lobbyInfo.GlobalSettings.Dedicated && dropClient.IsAdmin && State == ServerState.WaitingPlayers)
|
||||
if (lobbyInfo.GlobalSettings.Dedicated && dropClient.IsAdmin && State == ServerState.WaitingPlayers)
|
||||
{
|
||||
if (lobbyInfo.Clients.Where(c1 => c1.Bot == null).Count() > 0)
|
||||
{
|
||||
@@ -545,7 +547,7 @@ namespace OpenRA.Server
|
||||
|
||||
if (conns.Count != 0 || lobbyInfo.GlobalSettings.Dedicated)
|
||||
SyncLobbyInfo();
|
||||
if ( !lobbyInfo.GlobalSettings.Dedicated && dropClient.IsAdmin )
|
||||
if (!lobbyInfo.GlobalSettings.Dedicated && dropClient.IsAdmin)
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,7 @@ namespace OpenRA.Traits
|
||||
return false;
|
||||
}
|
||||
|
||||
// Hack: Assumes bots always run on clientId 0.
|
||||
var isBotOrder = subjectClient.Bot != null && clientId == 0;
|
||||
var isBotOrder = subjectClient.Bot != null && clientId == subjectClient.BotControllerClientIndex;
|
||||
|
||||
// Drop exploiting orders
|
||||
if (subjectClientId != clientId && !isBotOrder)
|
||||
|
||||
Reference in New Issue
Block a user