Merge pull request #3561 from pchote/more-playtest-fixes

More playtest regression fixes.
This commit is contained in:
Matthias Mailänder
2013-07-14 01:39:55 -07:00
3 changed files with 18 additions and 9 deletions

View File

@@ -25,6 +25,7 @@ namespace OpenRA.Server
public int ExpectLength = 8; public int ExpectLength = 8;
public int Frame = 0; public int Frame = 0;
public int MostRecentFrame = 0; public int MostRecentFrame = 0;
public const int MaxOrderLength = 131072;
/* client data */ /* client data */
public int PlayerIndex; public int PlayerIndex;
@@ -65,7 +66,7 @@ namespace OpenRA.Server
if (e.SocketErrorCode == SocketError.WouldBlock) break; if (e.SocketErrorCode == SocketError.WouldBlock) break;
server.DropClient(this); server.DropClient(this);
Log.Write("server", "Dropping client {0} because reading the data failed: {1}", this.PlayerIndex.ToString(), e); Log.Write("server", "Dropping client {0} because reading the data failed: {1}", PlayerIndex, e);
return false; return false;
} }
} }
@@ -86,6 +87,13 @@ namespace OpenRA.Server
ExpectLength = BitConverter.ToInt32(bytes, 0) - 4; ExpectLength = BitConverter.ToInt32(bytes, 0) - 4;
Frame = BitConverter.ToInt32(bytes, 4); Frame = BitConverter.ToInt32(bytes, 4);
State = ReceiveState.Data; State = ReceiveState.Data;
if (ExpectLength < 0 || ExpectLength > MaxOrderLength)
{
server.DropClient(this);
Log.Write("server", "Dropping client {0} for excessive order length = {1}", PlayerIndex, ExpectLength);
return;
}
} break; } break;
case ReceiveState.Data: case ReceiveState.Data:

View File

@@ -30,9 +30,10 @@ namespace OpenRA.Mods.Cnc
class ProductionAirdrop : Production class ProductionAirdrop : Production
{ {
public ProductionAirdrop(ProductionAirdropInfo info) : base(info) {} public ProductionAirdrop(ProductionAirdropInfo info)
: base(info) { }
public override bool Produce( Actor self, ActorInfo producee ) public override bool Produce(Actor self, ActorInfo producee)
{ {
var owner = self.Owner; var owner = self.Owner;
@@ -53,13 +54,13 @@ namespace OpenRA.Mods.Cnc
{ {
var a = w.CreateActor(actorType, new TypeDictionary var a = w.CreateActor(actorType, new TypeDictionary
{ {
new LocationInit( startPos ), new LocationInit(startPos),
new OwnerInit( owner ), new OwnerInit(owner),
new FacingInit( 64 ), new FacingInit(64),
new AltitudeInit( Rules.Info[actorType].Traits.Get<PlaneInfo>().CruiseAltitude ), new AltitudeInit(Rules.Info[actorType].Traits.Get<PlaneInfo>().CruiseAltitude),
}); });
a.QueueActivity(Fly.ToCell(self.Location + new CVec(6, 0))); a.QueueActivity(Fly.ToCell(self.Location + new CVec(9, 0)));
a.QueueActivity(new Land(Target.FromActor(self))); a.QueueActivity(new Land(Target.FromActor(self)));
a.QueueActivity(new CallFunc(() => a.QueueActivity(new CallFunc(() =>
{ {

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.RA.Move
Log.Write("debug", "Actor {0} asked for a path from {1} tick(s) ago", self.ActorID, world.FrameNumber - cached.tick); Log.Write("debug", "Actor {0} asked for a path from {1} tick(s) ago", self.ActorID, world.FrameNumber - cached.tick);
if (world.FrameNumber - cached.tick > MaxPathAge) if (world.FrameNumber - cached.tick > MaxPathAge)
CachedPaths.Remove(cached); CachedPaths.Remove(cached);
return emptyPath; return new List<CPos>(cached.result);
} }
var mi = self.Info.Traits.Get<MobileInfo>(); var mi = self.Info.Traits.Get<MobileInfo>();