From d744cfe21b0f6a8098a2abe70d2e89c54fffa539 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 24 Aug 2010 18:51:25 +1200 Subject: [PATCH] change exploit order check to cope with PlayerId not matching ClientId, because it doesnt. --- OpenRA.Game/Network/UnitOrders.cs | 5 ++++- OpenRA.Game/Player.cs | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index ffea4a8f02..a53dc323e9 100755 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -19,8 +19,11 @@ namespace OpenRA.Network public static void ProcessOrder( World world, int clientId, Order order ) { // Drop exploiting orders - if (order.Subject != null && order.Subject.Owner != world.players[clientId]) + if (order.Subject != null && order.Subject.Owner.ClientIndex != clientId) + { + Game.Debug("Detected exploit order from {0}: {1}".F(clientId, order.OrderString)); return; + } switch( order.OrderString ) { diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index cd7bb7228e..b687cba371 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -35,7 +35,8 @@ namespace OpenRA public readonly string InternalName; public readonly CountryInfo Country; public readonly int Index; - public readonly bool NonCombatant = false; + public readonly bool NonCombatant = false; + public readonly int ClientIndex; public ShroudRenderer Shroud; public World World { get; private set; } @@ -50,7 +51,8 @@ namespace OpenRA Index = index; Palette = "player"+index; Color = pr.Color; - Color2 = pr.Color2; + Color2 = pr.Color2; + ClientIndex = 0; /* it's a map player, "owned" by host */ PlayerName = InternalName = pr.Name; NonCombatant = pr.NonCombatant; @@ -75,7 +77,9 @@ namespace OpenRA InternalName = "Multi{0}".F(client.Index); Country = world.GetCountries() .FirstOrDefault(c => client != null && client.Country == c.Race) - ?? world.GetCountries().Random(world.SharedRandom); + ?? world.GetCountries().Random(world.SharedRandom); + + ClientIndex = client.Index; RegisterPlayerColor(world, Palette); }