diff --git a/src/modules/physics/include/eepp/physics/physicsmanager.hpp b/src/modules/physics/include/eepp/physics/physicsmanager.hpp
index 0f1e8d9cc..f9a16040e 100644
--- a/src/modules/physics/include/eepp/physics/physicsmanager.hpp
+++ b/src/modules/physics/include/eepp/physics/physicsmanager.hpp
@@ -61,10 +61,10 @@ class EE_PHYSICS_API PhysicsManager {
friend class Space;
bool mMemoryManager;
- std::list
mBodysFree;
- std::list mShapesFree;
- std::list mConstraintFree;
- std::list mSpaces;
+ std::vector mBodysFree;
+ std::vector mShapesFree;
+ std::vector mConstraintFree;
+ std::vector mSpaces;
PhysicsManager();
diff --git a/src/modules/physics/include/eepp/physics/space.hpp b/src/modules/physics/include/eepp/physics/space.hpp
index c003dc04a..26f4dded5 100644
--- a/src/modules/physics/include/eepp/physics/space.hpp
+++ b/src/modules/physics/include/eepp/physics/space.hpp
@@ -167,7 +167,7 @@ class EE_PHYSICS_API Space {
void removeShape( Shape* shape );
- void removeStatiShape( Shape* shape );
+ void removeStaticShape( Shape* shape );
void removeBody( Body* body );
@@ -243,12 +243,12 @@ class EE_PHYSICS_API Space {
cpSpace* mSpace;
Body* mStatiBody;
void* mData;
- std::list mBodys;
- std::list mShapes;
- std::list mConstraints;
+ std::vector mBodys;
+ std::vector mShapes;
+ std::vector mConstraints;
std::map mCollisions;
CollisionHandler mCollisionsDefault;
- std::list mPostStepCallbacks;
+ std::vector mPostStepCallbacks;
};
}} // namespace EE::Physics
diff --git a/src/modules/physics/src/eepp/physics/physicsmanager.cpp b/src/modules/physics/src/eepp/physics/physicsmanager.cpp
index d8faf5afe..afb77eb57 100644
--- a/src/modules/physics/src/eepp/physics/physicsmanager.cpp
+++ b/src/modules/physics/src/eepp/physics/physicsmanager.cpp
@@ -15,19 +15,19 @@ PhysicsManager::~PhysicsManager() {
if ( mMemoryManager ) {
mMemoryManager = false;
- std::list::iterator its = mSpaces.begin();
+ std::vector::iterator its = mSpaces.begin();
for ( ; its != mSpaces.end(); ++its )
eeSAFE_DELETE( *its );
- std::list::iterator itb = mBodysFree.begin();
+ std::vector::iterator itb = mBodysFree.begin();
for ( ; itb != mBodysFree.end(); ++itb )
eeSAFE_DELETE( *itb );
- std::list::iterator itp = mShapesFree.begin();
+ std::vector::iterator itp = mShapesFree.begin();
for ( ; itp != mShapesFree.end(); ++itp )
eeSAFE_DELETE( *itp );
- std::list::iterator itc = mConstraintFree.begin();
+ std::vector::iterator itc = mConstraintFree.begin();
for ( ; itc != mConstraintFree.end(); ++itc )
eeSAFE_DELETE( *itc );
}
@@ -54,7 +54,9 @@ void PhysicsManager::addBodyFree( Body* body ) {
void PhysicsManager::removeBodyFree( Body* body ) {
if ( mMemoryManager ) {
- mBodysFree.remove( body );
+ auto foundIt = std::find( mBodysFree.begin(), mBodysFree.end(), body );
+ if ( foundIt != mBodysFree.end() )
+ mBodysFree.erase( foundIt );
}
}
@@ -67,7 +69,9 @@ void PhysicsManager::addShapeFree( Shape* shape ) {
void PhysicsManager::removeShapeFree( Shape* shape ) {
if ( mMemoryManager ) {
- mShapesFree.remove( shape );
+ auto foundIt = std::find( mShapesFree.begin(), mShapesFree.end(), shape );
+ if ( foundIt != mShapesFree.end() )
+ mShapesFree.erase( foundIt );
}
}
@@ -81,7 +85,9 @@ void PhysicsManager::addConstraintFree( Constraint* constraint ) {
void PhysicsManager::removeConstraintFree( Constraint* constraint ) {
if ( mMemoryManager ) {
- mConstraintFree.remove( constraint );
+ auto foundIt = std::find( mConstraintFree.begin(), mConstraintFree.end(), constraint );
+ if ( foundIt != mConstraintFree.end() )
+ mConstraintFree.erase( foundIt );
}
}
@@ -94,7 +100,9 @@ void PhysicsManager::addSpace( Space* space ) {
void PhysicsManager::removeSpace( Space* space ) {
if ( mMemoryManager ) {
- mSpaces.remove( space );
+ auto foundIt = std::find( mSpaces.begin(), mSpaces.end(), space );
+ if ( foundIt != mSpaces.end() )
+ mSpaces.erase( foundIt );
}
}
diff --git a/src/modules/physics/src/eepp/physics/space.cpp b/src/modules/physics/src/eepp/physics/space.cpp
index 54b86f509..e47c87cea 100644
--- a/src/modules/physics/src/eepp/physics/space.cpp
+++ b/src/modules/physics/src/eepp/physics/space.cpp
@@ -29,15 +29,15 @@ Space::Space() : mData( NULL ) {
Space::~Space() {
cpSpaceFree( mSpace );
- std::list::iterator itc = mConstraints.begin();
+ std::vector::iterator itc = mConstraints.begin();
for ( ; itc != mConstraints.end(); ++itc )
eeSAFE_DELETE( *itc );
- std::list::iterator its = mShapes.begin();
+ std::vector::iterator its = mShapes.begin();
for ( ; its != mShapes.end(); ++its )
eeSAFE_DELETE( *its );
- std::list::iterator itb = mBodys.begin();
+ std::vector::iterator itb = mBodys.begin();
for ( ; itb != mBodys.end(); ++itb )
eeSAFE_DELETE( *itb );
@@ -200,17 +200,21 @@ void Space::removeShape( Shape* shape ) {
if ( NULL != shape ) {
cpSpaceRemoveShape( mSpace, shape->getShape() );
- mShapes.remove( shape );
+ auto foundIt = std::find( mShapes.begin(), mShapes.end(), shape );
+ if ( foundIt != mShapes.end() )
+ mShapes.erase( foundIt );
PhysicsManager::instance()->addShapeFree( shape );
}
}
-void Space::removeStatiShape( Shape* shape ) {
+void Space::removeStaticShape( Shape* shape ) {
if ( NULL != shape ) {
cpSpaceRemoveStaticShape( mSpace, shape->getShape() );
- mShapes.remove( shape );
+ auto foundIt = std::find( mShapes.begin(), mShapes.end(), shape );
+ if ( foundIt != mShapes.end() )
+ mShapes.erase( foundIt );
PhysicsManager::instance()->addShapeFree( shape );
}
@@ -220,7 +224,9 @@ void Space::removeBody( Body* body ) {
if ( NULL != body ) {
cpSpaceRemoveBody( mSpace, body->getBody() );
- mBodys.remove( body );
+ auto foundIt = std::find( mBodys.begin(), mBodys.end(), body );
+ if ( foundIt != mBodys.end() )
+ mBodys.erase( foundIt );
PhysicsManager::instance()->removeBodyFree( body );
}
@@ -230,7 +236,9 @@ void Space::removeConstraint( Constraint* constraint ) {
if ( NULL != constraint ) {
cpSpaceRemoveConstraint( mSpace, constraint->getConstraint() );
- mConstraints.remove( constraint );
+ auto foundIt = std::find( mConstraints.begin(), mConstraints.end(), constraint );
+ if ( foundIt != mConstraints.end() )
+ mConstraints.erase( foundIt );
PhysicsManager::instance()->addConstraintFree( constraint );
}
@@ -503,7 +511,10 @@ void Space::onPostStepCallback( void* obj, void* data ) {
Cb->Callback( this, obj, Cb->Data );
}
- mPostStepCallbacks.remove( Cb );
+ auto foundIt = std::find( mPostStepCallbacks.begin(), mPostStepCallbacks.end(), Cb );
+ if ( foundIt != mPostStepCallbacks.end() )
+ mPostStepCallbacks.erase( foundIt );
+
eeSAFE_DELETE( Cb );
}
diff --git a/src/thirdparty/efsw b/src/thirdparty/efsw
index 527ddca9a..960d474c7 160000
--- a/src/thirdparty/efsw
+++ b/src/thirdparty/efsw
@@ -1 +1 @@
-Subproject commit 527ddca9a95d6d3a01975849e7e09cdec7752921
+Subproject commit 960d474c745b8401caca7169a33410ea64aa797b