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:
@@ -1154,7 +1154,7 @@ namespace Barotrauma
|
|||||||
Item.ItemList.Clear();
|
Item.ItemList.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicsBody.list.Clear();
|
PhysicsBody.RemoveAll();
|
||||||
|
|
||||||
Ragdoll.list.Clear();
|
Ragdoll.list.Clear();
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,11 @@ namespace Barotrauma
|
|||||||
Circle, Rectangle, Capsule
|
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
|
//the farseer physics body of the item
|
||||||
private Body body;
|
private Body body;
|
||||||
@@ -534,6 +538,15 @@ namespace Barotrauma
|
|||||||
DisposeProjSpecific();
|
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();
|
partial void DisposeProjSpecific();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace Barotrauma
|
|||||||
sub.SetPrevTransform(sub.Position);
|
sub.SetPrevTransform(sub.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (PhysicsBody pb in PhysicsBody.list)
|
foreach (PhysicsBody pb in PhysicsBody.List)
|
||||||
{
|
{
|
||||||
pb.SetPrevTransform(pb.SimPosition, pb.Rotation);
|
pb.SetPrevTransform(pb.SimPosition, pb.Rotation);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user