Changeset 9994 in orxonox.OLD for branches/coll_rect/src/lib
- Timestamp:
- Dec 3, 2006, 6:24:08 PM (18 years ago)
- Location:
- branches/coll_rect/src/lib/collision_reaction
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/coll_rect/src/lib/collision_reaction/collision_tube.cc
r9985 r9994 34 34 ObjectListDefinition(CollisionTube); 35 35 36 CollisionTube* CollisionTube:: instance= NULL;36 CollisionTube* CollisionTube::singletonRef = NULL; 37 37 38 38 … … 67 67 void CollisionTube::registerCollisionEvent(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) 68 68 { 69 Collision* collision = this->_collisionList.back(); 69 Collision* collision = NULL; 70 if( !this->_collisionList.empty()) 71 collision = this->_collisionList.back(); 70 72 71 // check if there is already a collision defined between these objects 72 if( !collision->match(*entityA, *entityB))73 // check if there is already a collision defined between these objects or this is the first collision at all 74 if( collision != NULL || !collision->match(*entityA, *entityB)) 73 75 { 74 76 collision = CREngine::getInstance()->popCollisionObject(); … … 96 98 { 97 99 // get last collision 98 Collision* collision = this->_collisionList.back(); 100 Collision* collision = NULL; 101 if( !this->_collisionList.empty()) 102 collision = this->_collisionList.back(); 99 103 100 104 // check if there is already a collision defined between these objects -
branches/coll_rect/src/lib/collision_reaction/collision_tube.h
r9993 r9994 54 54 /* Constructor/Deconstructor/Singleton Interface */ 55 55 public: 56 inline static CollisionTube* getInstance() { if( CollisionTube::instance == NULL) CollisionTube::instance = new CollisionTube(); return CollisionTube::instance; } 56 inline static CollisionTube* getInstance() { if( !singletonRef) singletonRef = new CollisionTube(); return singletonRef; } 57 57 58 virtual ~CollisionTube(); 58 59 … … 61 62 CollisionTube(const CollisionTube& tube) {} 62 63 63 static CollisionTube* instance; //!< the singleton instance64 static CollisionTube* singletonRef; //!< the singleton instance 64 65 65 66
Note: See TracChangeset
for help on using the changeset viewer.