You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-16 07:06:30 +09:00
Major refactoring of sending messages to multiple recipients
This commit is contained in:
@@ -63,12 +63,12 @@ namespace Lidgren.Network
|
||||
public void Enqueue(T item)
|
||||
{
|
||||
#if DEBUG
|
||||
if (typeof(T) == typeof(NetOutgoingMessage))
|
||||
if (typeof(T) == typeof(NetSending))
|
||||
{
|
||||
NetOutgoingMessage om = item as NetOutgoingMessage;
|
||||
NetSending om = item as NetSending;
|
||||
if (om != null)
|
||||
if (om.m_type == NetMessageType.Error)
|
||||
throw new NetException("Enqueuing error message!");
|
||||
if (om.MessageType == NetMessageType.Error)
|
||||
throw new NetException("Enqueuing NetSending with MessageType.Error!");
|
||||
}
|
||||
#endif
|
||||
lock (m_lock)
|
||||
@@ -153,6 +153,19 @@ namespace Lidgren.Network
|
||||
}
|
||||
}
|
||||
|
||||
public T TryPeek(int offset)
|
||||
{
|
||||
if (m_size == 0)
|
||||
return default(T);
|
||||
|
||||
lock (m_lock)
|
||||
{
|
||||
if (m_size == 0)
|
||||
return default(T);
|
||||
return m_items[(m_head + offset) % m_items.Length];
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(T item)
|
||||
{
|
||||
lock (m_lock)
|
||||
|
||||
Reference in New Issue
Block a user