Add Tick scale plumbing
This commit is contained in:
@@ -133,6 +133,27 @@ namespace OpenRA.Network
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TryParseTickScale((int FromClient, byte[] Data) packet, out float scale)
|
||||
{
|
||||
// Valid tick scale commands are only ever generated by the server
|
||||
if (packet.FromClient != 0 || packet.Data.Length != 9 || packet.Data[4] != (byte)OrderType.TickScale)
|
||||
{
|
||||
scale = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Valid tick scale packets always have frame 0
|
||||
var frame = BitConverter.ToInt32(packet.Data, 0);
|
||||
if (frame != 0)
|
||||
{
|
||||
scale = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
scale = BitConverter.ToSingle(packet.Data, 5);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TryParsePingRequest((int FromClient, byte[] Data) packet, out long timestamp)
|
||||
{
|
||||
// Valid Ping requests are only ever generated by the server
|
||||
|
||||
Reference in New Issue
Block a user