Revert "OBT1.1.0 Merge branch 'dev_pte' into dev"
This reverts commit177cf89756, reversing changes made to42ba733cd4.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Barotrauma.IO;
|
||||
@@ -21,10 +20,10 @@ namespace Barotrauma
|
||||
|
||||
public const ushort MaxEntityCount = ushort.MaxValue - 4; //ushort.MaxValue - 4 because the 4 values above are reserved values
|
||||
|
||||
private static readonly ConcurrentDictionary<ushort, Entity> dictionary = new ConcurrentDictionary<ushort, Entity>();
|
||||
private static readonly Dictionary<ushort, Entity> dictionary = new Dictionary<ushort, Entity>();
|
||||
public static IReadOnlyCollection<Entity> GetEntities()
|
||||
{
|
||||
return (IReadOnlyCollection<Entity>)dictionary.Values;
|
||||
return dictionary.Values;
|
||||
}
|
||||
|
||||
public static int EntityCount => dictionary.Count;
|
||||
@@ -123,11 +122,13 @@ namespace Barotrauma
|
||||
//give a unique ID
|
||||
ID = DetermineID(id, submarine);
|
||||
|
||||
if (!dictionary.TryAdd(ID, this))
|
||||
if (dictionary.ContainsKey(ID))
|
||||
{
|
||||
throw new Exception($"ID {ID} is taken by {dictionary[ID]}");
|
||||
}
|
||||
|
||||
dictionary.Add(ID, this);
|
||||
|
||||
CreationStackTrace = "";
|
||||
#if DEBUG
|
||||
var st = new StackTrace(skipFrames: 2, fNeedFileInfo: true);
|
||||
@@ -146,6 +147,7 @@ namespace Barotrauma
|
||||
CreationStackTrace += $"{fileName}@{fileLineNumber}; ";
|
||||
}
|
||||
#endif
|
||||
#warning TODO: consider removing this mutex, entity creation probably shouldn't be multithreaded
|
||||
lock (creationCounterMutex)
|
||||
{
|
||||
CreationIndex = creationCounter;
|
||||
@@ -259,7 +261,7 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError($"Error while removing item \"{item}\"", exception);
|
||||
}
|
||||
}
|
||||
Item.ClearAllItemCollections();
|
||||
Item.ItemList.Clear();
|
||||
}
|
||||
if (Character.CharacterList.Count > 0)
|
||||
{
|
||||
@@ -323,7 +325,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
dictionary.TryRemove(ID, out _);
|
||||
dictionary.Remove(ID);
|
||||
}
|
||||
IdFreed = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user