/// <summary> /// /// </summary> /// <param name="client">Reference to the GridClient object</param> /// <param name="address">IPEndPoint of the simulator</param> /// <param name="handle">handle of the simulator</param> public Simulator(GridClient client, IPEndPoint address, ulong handle) : base(address) { Client = client; if (Client.Settings.POOL_PARCEL_DATA || Client.Settings.CACHE_PRIMITIVES) { SimulatorDataPool.SimulatorAdd(this); DataPool = SimulatorDataPool.GetSimulatorData(Handle); } Handle = handle; Network = Client.Network; PacketArchive = new IncomingPacketIDCollection(Settings.PACKET_ARCHIVE_SIZE); InBytes = new Queue<long>(Client.Settings.STATS_QUEUE_SIZE); OutBytes = new Queue<long>(Client.Settings.STATS_QUEUE_SIZE); if (client.Settings.STORE_LAND_PATCHES) { Terrain = new TerrainPatch[16 * 16]; WindSpeeds = new Vector2[16 * 16]; } }
public static SimulatorDataPool GetSimulatorData(ulong hndl) { SimulatorDataPool dict; lock (SimulatorDataPools) { if (!SimulatorDataPools.TryGetValue(hndl, out dict)) { dict = SimulatorDataPools[hndl] = new SimulatorDataPool(hndl); } } return dict; }