All remaining physics bodies are removed at the end of submarine unloading (freeing debug bodyShapeTextures, etc). -> LevelTrigger bodies don't have to be removed separately during unloading
This commit is contained in:
@@ -1153,8 +1153,8 @@ namespace Barotrauma
|
||||
}
|
||||
Item.ItemList.Clear();
|
||||
}
|
||||
|
||||
PhysicsBody.list.Clear();
|
||||
|
||||
PhysicsBody.RemoveAll();
|
||||
|
||||
Ragdoll.list.Clear();
|
||||
|
||||
|
||||
@@ -65,7 +65,11 @@ namespace Barotrauma
|
||||
Circle, Rectangle, Capsule
|
||||
};
|
||||
|
||||
public static List<PhysicsBody> list = new List<PhysicsBody>();
|
||||
private static List<PhysicsBody> list = new List<PhysicsBody>();
|
||||
public static List<PhysicsBody> List
|
||||
{
|
||||
get { return list; }
|
||||
}
|
||||
|
||||
//the farseer physics body of the item
|
||||
private Body body;
|
||||
@@ -534,6 +538,15 @@ namespace Barotrauma
|
||||
DisposeProjSpecific();
|
||||
}
|
||||
|
||||
public static void RemoveAll()
|
||||
{
|
||||
for (int i = list.Count - 1; i >= 0; i--)
|
||||
{
|
||||
list[i].Remove();
|
||||
}
|
||||
System.Diagnostics.Debug.Assert(list.Count == 0);
|
||||
}
|
||||
|
||||
partial void DisposeProjSpecific();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace Barotrauma
|
||||
sub.SetPrevTransform(sub.Position);
|
||||
}
|
||||
|
||||
foreach (PhysicsBody pb in PhysicsBody.list)
|
||||
foreach (PhysicsBody pb in PhysicsBody.List)
|
||||
{
|
||||
pb.SetPrevTransform(pb.SimPosition, pb.Rotation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user