change exploit order check to cope with PlayerId not matching ClientId, because it doesnt.

This commit is contained in:
Chris Forbes
2010-08-24 18:51:25 +12:00
parent 6ae7da77ae
commit d744cfe21b
2 changed files with 11 additions and 4 deletions

View File

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

View File

@@ -36,6 +36,7 @@ namespace OpenRA
public readonly CountryInfo Country;
public readonly int Index;
public readonly bool NonCombatant = false;
public readonly int ClientIndex;
public ShroudRenderer Shroud;
public World World { get; private set; }
@@ -51,6 +52,7 @@ namespace OpenRA
Palette = "player"+index;
Color = pr.Color;
Color2 = pr.Color2;
ClientIndex = 0; /* it's a map player, "owned" by host */
PlayerName = InternalName = pr.Name;
NonCombatant = pr.NonCombatant;
@@ -77,6 +79,8 @@ namespace OpenRA
.FirstOrDefault(c => client != null && client.Country == c.Race)
?? world.GetCountries().Random(world.SharedRandom);
ClientIndex = client.Index;
RegisterPlayerColor(world, Palette);
}