Refactor server orders
This commit is contained in:
@@ -52,6 +52,9 @@ namespace OpenRA
|
||||
// Length of orders with type OrderType.SyncHash
|
||||
public const int SyncHashOrderLength = 13;
|
||||
|
||||
// Length of orders with type OrderType.Disconnect
|
||||
public const int DisconnectOrderLength = 5;
|
||||
|
||||
public readonly string OrderString;
|
||||
public readonly Actor Subject;
|
||||
public readonly bool Queued;
|
||||
|
||||
@@ -131,8 +131,10 @@ namespace OpenRA.Network
|
||||
return;
|
||||
|
||||
var frame = BitConverter.ToInt32(packet, 0);
|
||||
if (packet.Length == 5 && packet[4] == (byte)OrderType.Disconnect)
|
||||
pendingPackets.Remove(clientId);
|
||||
if (packet.Length == Order.DisconnectOrderLength + 4 && packet[4] == (byte)OrderType.Disconnect)
|
||||
{
|
||||
pendingPackets.Remove(BitConverter.ToInt32(packet, 5));
|
||||
}
|
||||
else if (packet.Length > 4 && packet[4] == (byte)OrderType.SyncHash)
|
||||
{
|
||||
if (packet.Length != 4 + Order.SyncHashOrderLength)
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace OpenRA.Network
|
||||
continue;
|
||||
|
||||
var packet = tmpPacketPair.Packet;
|
||||
if (packet.Length == 5 && packet[4] == (byte)OrderType.Disconnect)
|
||||
if (packet.Length == Order.DisconnectOrderLength + 4 && packet[4] == (byte)OrderType.Disconnect)
|
||||
{
|
||||
var lastClientFrame = lastClientsFrame[client];
|
||||
var lastFramePacket = BitConverter.GetBytes(lastClientFrame);
|
||||
|
||||
Reference in New Issue
Block a user