1111INLINE void PhysicsManager::
1212attach_physical (Physical *p) {
1313 p->_physics_manager = this ;
14- _physicals.push_back (p);
14+ vector< Physical * >::iterator found;
15+ found = find (_physicals.begin (), _physicals.end (), p);
16+ if (found == _physicals.end ())
17+ _physicals.push_back (p);
1518}
1619
1720// //////////////////////////////////////////////////////////////////
@@ -21,7 +24,11 @@ attach_physical(Physical *p) {
2124// //////////////////////////////////////////////////////////////////
2225INLINE void PhysicsManager::
2326add_linear_force (LinearForce *f) {
24- _linear_forces.push_back (f);
27+ vector< PT (LinearForce) >::iterator found;
28+ PT (LinearForce) ptlf = f;
29+ found = find (_linear_forces.begin (), _linear_forces.end (), ptlf);
30+ if (found == _linear_forces.end ())
31+ _linear_forces.push_back (f);
2532}
2633
2734// //////////////////////////////////////////////////////////////////
@@ -52,7 +59,11 @@ clear_linear_forces(void) {
5259// //////////////////////////////////////////////////////////////////
5360INLINE void PhysicsManager::
5461add_angular_force (AngularForce *f) {
55- _angular_forces.push_back (f);
62+ vector< PT (AngularForce) >::iterator found;
63+ PT (AngularForce) ptaf = f;
64+ found = find (_angular_forces.begin (), _angular_forces.end (), ptaf);
65+ if (found == _angular_forces.end ())
66+ _angular_forces.push_back (f);
5667}
5768
5869// //////////////////////////////////////////////////////////////////
0 commit comments