diff --git a/OpenRA.Game/Network/Connection.cs b/OpenRA.Game/Network/Connection.cs index 1e423552733e..1365792ea1cb 100644 --- a/OpenRA.Game/Network/Connection.cs +++ b/OpenRA.Game/Network/Connection.cs @@ -68,11 +68,13 @@ public virtual void Send(int frame, List orders) public virtual void SendImmediate(List orders) { - var ms = new MemoryStream(); - ms.WriteArray(BitConverter.GetBytes(0)); foreach (var o in orders) + { + var ms = new MemoryStream(); + ms.WriteArray(BitConverter.GetBytes(0)); ms.WriteArray(o); - Send(ms.ToArray()); + Send(ms.ToArray()); + } } public virtual void SendSync(int frame, byte[] syncData) diff --git a/OpenRA.Game/Network/OrderManager.cs b/OpenRA.Game/Network/OrderManager.cs index b861bc9673dd..dc7cceb889f6 100644 --- a/OpenRA.Game/Network/OrderManager.cs +++ b/OpenRA.Game/Network/OrderManager.cs @@ -179,8 +179,8 @@ public void Tick() if (!IsReadyForNextFrame) throw new InvalidOperationException(); - Connection.Send(NetFrameNumber + FramesAhead, localOrders.Select(o => o.Serialize()).ToList()); - localOrders.Clear(); + Connection.Send(NetFrameNumber + FramesAhead, localOrders.Where(o => !o.IsImmediate).Select(o => o.Serialize()).ToList()); + localOrders.RemoveAll(o => !o.IsImmediate); foreach (var order in frameData.OrdersForFrame(World, NetFrameNumber)) UnitOrders.ProcessOrder(this, World, order.Client, order.Order);