Giving crew members an ID card with clearances based on spawnpoint, level collision bugfixes, level exit/enter "shafts", moar entity ID bugfixes

This commit is contained in:
Regalis
2015-07-09 20:33:53 +03:00
parent 2254585dac
commit 257835e609
25 changed files with 279 additions and 204 deletions
+7 -2
View File
@@ -7,7 +7,7 @@ namespace Subsurface
{
class Entity
{
public static Dictionary<int, Entity> dictionary = new Dictionary<int, Entity>();
private static Dictionary<int, Entity> dictionary = new Dictionary<int, Entity>();
private int id;
@@ -20,7 +20,11 @@ namespace Subsurface
get { return id; }
set
{
dictionary.Remove(id);
Entity thisEntity;
if (dictionary.TryGetValue(id, out thisEntity) && thisEntity == this)
{
dictionary.Remove(id);
}
//if there's already an entity with the same ID, give it the old ID of this one
Entity existingEntity;
if (dictionary.TryGetValue(value, out existingEntity))
@@ -76,6 +80,7 @@ namespace Subsurface
{
e.Remove();
}
dictionary.Clear();
}
public virtual void Remove()