private void AddPacketToDeferredMap(DeferrablePacket deferrablePacket, AbsoluteEntityCell cell) { lock (deferredPacketsByAbsoluteCell) { if (!deferredPacketsByAbsoluteCell.ContainsKey(cell)) { deferredPacketsByAbsoluteCell.Add(cell, new Queue <Packet>()); } deferredPacketsByAbsoluteCell[cell].Enqueue(deferrablePacket); } }
private void AddPacketToDeferredMap(DeferrablePacket deferrablePacket, AbsoluteEntityCell cell) { lock (deferredPacketsByAbsoluteCell) { Queue <Packet> queue; if (!deferredPacketsByAbsoluteCell.TryGetValue(cell, out queue)) { deferredPacketsByAbsoluteCell[cell] = queue = new Queue <Packet>(); } queue.Enqueue(deferrablePacket); } }
private bool PacketWasDeferred(Packet packet) { if (packet is DeferrablePacket) { DeferrablePacket deferrablePacket = (DeferrablePacket)packet; if (visibleCells.Contains(deferrablePacket.AbsoluteEntityCell)) { return(false); } Log.Debug($"Packet {packet} was deferred, cell not loaded (with required lod): {deferrablePacket.AbsoluteEntityCell}"); AddPacketToDeferredMap(deferrablePacket, deferrablePacket.AbsoluteEntityCell); return(true); } return(false); }