Overhaul player disconnect notifications.
This commit is contained in:
@@ -79,16 +79,19 @@ namespace OpenRA.Network
|
||||
return ms.GetBuffer();
|
||||
}
|
||||
|
||||
public static bool TryParseDisconnect(byte[] packet, out int clientId)
|
||||
public static bool TryParseDisconnect((int FromClient, byte[] Data) packet, out (int Frame, int ClientId) disconnect)
|
||||
{
|
||||
if (packet.Length == Order.DisconnectOrderLength + 4 && packet[4] == (byte)OrderType.Disconnect)
|
||||
// Valid Disconnect packets are only ever generated by the server
|
||||
if (packet.FromClient != 0 || packet.Data.Length != Order.DisconnectOrderLength + 4 || packet.Data[4] != (byte)OrderType.Disconnect)
|
||||
{
|
||||
clientId = BitConverter.ToInt32(packet, 5);
|
||||
return true;
|
||||
disconnect = (0, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
clientId = 0;
|
||||
return false;
|
||||
var frame = BitConverter.ToInt32(packet.Data, 0);
|
||||
var clientId = BitConverter.ToInt32(packet.Data, 5);
|
||||
disconnect = (frame, clientId);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TryParseSync(byte[] packet, out (int Frame, int SyncHash, ulong DefeatState) data)
|
||||
|
||||
Reference in New Issue
Block a user