1
0
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:
lidgren
2010-06-21 19:22:21 +00:00
parent d843a5944a
commit 14d3f3b390
18 changed files with 417 additions and 302 deletions

View File

@@ -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)