git repos / saland

commit 2862af0e

sago007 · 2018-09-09 11:10
2862af0ed2a23626abec5274623f1d243fb792bb patch · browse files
parent 6e755a365e41c24eb8f768c3324e10b336c46d91

Destroy all fixtures for the destroyed bodies

Changed files

M src/saland/model/World.cpp before
diff --git a/src/saland/model/World.cpp b/src/saland/model/World.cpp index 87a243d..e2a1f5e 100644 --- a/src/saland/model/World.cpp +++ b/src/saland/model/World.cpp
@@ -89,6 +89,12 @@ static b2Body* AddStaticTilesToWorld(b2World* world, const sago::tiled::TileMap&
void World::init_physics(std::shared_ptr<b2World>& world) {
for (b2Body* b : managed_bodies) {
+ b2Fixture* f = b->GetFixtureList();
+ while (f) {
+ b2Fixture* next_f = f->GetNext();
+ b->DestroyFixture(f);
+ f = next_f;
+ }
world->DestroyBody(b);
}
managed_bodies.clear();