Unstable v0.15.17.0 (Hex is out of town edition)
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
public enum DeliveryMethod : byte
|
||||
public enum DeliveryMethod : int
|
||||
{
|
||||
Unreliable = 0x0,
|
||||
Reliable = 0x1,
|
||||
ReliableOrdered = 0x2
|
||||
}
|
||||
|
||||
public enum ConnectionInitialization : byte
|
||||
public enum ConnectionInitialization : int
|
||||
{
|
||||
//used by all peer implementations
|
||||
SteamTicketAndVersion = 0x1,
|
||||
@@ -22,7 +22,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum PacketHeader : byte
|
||||
public enum PacketHeader : int
|
||||
{
|
||||
//used by all peer implementations
|
||||
None = 0x0,
|
||||
@@ -34,5 +34,23 @@ namespace Barotrauma.Networking
|
||||
IsServerMessage = 0x8,
|
||||
IsHeartbeatMessage = 0x10
|
||||
}
|
||||
|
||||
public static class NetworkEnumExtensions
|
||||
{
|
||||
public static bool IsCompressed(this PacketHeader h)
|
||||
=> h.IsBitSet(PacketHeader.IsCompressed);
|
||||
|
||||
public static bool IsConnectionInitializationStep(this PacketHeader h)
|
||||
=> h.IsBitSet(PacketHeader.IsConnectionInitializationStep);
|
||||
|
||||
public static bool IsDisconnectMessage(this PacketHeader h)
|
||||
=> h.IsBitSet(PacketHeader.IsDisconnectMessage);
|
||||
|
||||
public static bool IsServerMessage(this PacketHeader h)
|
||||
=> h.IsBitSet(PacketHeader.IsServerMessage);
|
||||
|
||||
public static bool IsHeartbeatMessage(this PacketHeader h)
|
||||
=> h.IsBitSet(PacketHeader.IsHeartbeatMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
internal static void EnsureBufferSize(ref byte[] buf, int numberOfBits)
|
||||
{
|
||||
int byteLen = ((numberOfBits + 7) >> 3);
|
||||
int byteLen = (numberOfBits + 7) / 8;
|
||||
if (buf == null)
|
||||
{
|
||||
buf = new byte[byteLen + MsgConstants.BufferOverAllocateAmount];
|
||||
@@ -461,7 +461,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
get
|
||||
{
|
||||
return (LengthBits + ((8 - (LengthBits % 8)) % 8)) / 8;
|
||||
return (LengthBits + 7) / 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user