mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-07-23 03:02:50 +03:00
Removed more std::list usages.
This commit is contained in:
@@ -61,10 +61,10 @@ class EE_PHYSICS_API PhysicsManager {
|
||||
friend class Space;
|
||||
|
||||
bool mMemoryManager;
|
||||
std::list<Body*> mBodysFree;
|
||||
std::list<Shape*> mShapesFree;
|
||||
std::list<Constraint*> mConstraintFree;
|
||||
std::list<Space*> mSpaces;
|
||||
std::vector<Body*> mBodysFree;
|
||||
std::vector<Shape*> mShapesFree;
|
||||
std::vector<Constraint*> mConstraintFree;
|
||||
std::vector<Space*> mSpaces;
|
||||
|
||||
PhysicsManager();
|
||||
|
||||
|
||||
@@ -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<Body*> mBodys;
|
||||
std::list<Shape*> mShapes;
|
||||
std::list<Constraint*> mConstraints;
|
||||
std::vector<Body*> mBodys;
|
||||
std::vector<Shape*> mShapes;
|
||||
std::vector<Constraint*> mConstraints;
|
||||
std::map<cpHashValue, CollisionHandler> mCollisions;
|
||||
CollisionHandler mCollisionsDefault;
|
||||
std::list<PostStepCallbackCont*> mPostStepCallbacks;
|
||||
std::vector<PostStepCallbackCont*> mPostStepCallbacks;
|
||||
};
|
||||
|
||||
}} // namespace EE::Physics
|
||||
|
||||
@@ -15,19 +15,19 @@ PhysicsManager::~PhysicsManager() {
|
||||
if ( mMemoryManager ) {
|
||||
mMemoryManager = false;
|
||||
|
||||
std::list<Space*>::iterator its = mSpaces.begin();
|
||||
std::vector<Space*>::iterator its = mSpaces.begin();
|
||||
for ( ; its != mSpaces.end(); ++its )
|
||||
eeSAFE_DELETE( *its );
|
||||
|
||||
std::list<Body*>::iterator itb = mBodysFree.begin();
|
||||
std::vector<Body*>::iterator itb = mBodysFree.begin();
|
||||
for ( ; itb != mBodysFree.end(); ++itb )
|
||||
eeSAFE_DELETE( *itb );
|
||||
|
||||
std::list<Shape*>::iterator itp = mShapesFree.begin();
|
||||
std::vector<Shape*>::iterator itp = mShapesFree.begin();
|
||||
for ( ; itp != mShapesFree.end(); ++itp )
|
||||
eeSAFE_DELETE( *itp );
|
||||
|
||||
std::list<Constraint*>::iterator itc = mConstraintFree.begin();
|
||||
std::vector<Constraint*>::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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,15 +29,15 @@ Space::Space() : mData( NULL ) {
|
||||
Space::~Space() {
|
||||
cpSpaceFree( mSpace );
|
||||
|
||||
std::list<Constraint*>::iterator itc = mConstraints.begin();
|
||||
std::vector<Constraint*>::iterator itc = mConstraints.begin();
|
||||
for ( ; itc != mConstraints.end(); ++itc )
|
||||
eeSAFE_DELETE( *itc );
|
||||
|
||||
std::list<Shape*>::iterator its = mShapes.begin();
|
||||
std::vector<Shape*>::iterator its = mShapes.begin();
|
||||
for ( ; its != mShapes.end(); ++its )
|
||||
eeSAFE_DELETE( *its );
|
||||
|
||||
std::list<Body*>::iterator itb = mBodys.begin();
|
||||
std::vector<Body*>::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 );
|
||||
}
|
||||
|
||||
|
||||
2
src/thirdparty/efsw
vendored
2
src/thirdparty/efsw
vendored
Submodule src/thirdparty/efsw updated: 527ddca9a9...960d474c74
Reference in New Issue
Block a user