Changeset 9869 in orxonox.OLD for trunk/src/lib/collision_reaction/collision_handle.cc
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_reaction/collision_handle.cc
r9406 r9869 30 30 31 31 32 32 ObjectListDefinition(CollisionHandle); 33 33 34 34 /** … … 38 38 CollisionHandle::CollisionHandle (WorldEntity* owner, CREngine::CRType type) 39 39 { 40 this-> setClassID(CL_COLLISION_HANDLE, "CollisionHandle");40 this->registerObject(this, CollisionHandle::_objectList); 41 41 42 42 this->owner = owner; … … 94 94 * @param classID the classid to look for 95 95 */ 96 void CollisionHandle::addTarget( longtarget)96 void CollisionHandle::addTarget(const ClassID& target) 97 97 { 98 98 // make sure there is no dublicate 99 std::vector< long>::iterator it = this->targetList.begin();99 std::vector<ClassID>::iterator it = this->targetList.begin(); 100 100 for( ; it < this->targetList.end(); it++) 101 101 if( (*it) == target) 102 102 return; 103 103 104 104 105 // add element 105 PRINTF(5)("addTarget: %i \n", target); 106 107 this->targetList.push_back(target); 106 this->targetList.push_back(target); 107 PRINTF(5)("addTarget: %i \n", target.id()); 108 108 } 109 109 … … 227 227 bool CollisionHandle::filterCollisionEvent(CollisionEvent* collisionEvent) 228 228 { 229 std::vector< long>::iterator it = this->targetList.begin();229 std::vector<ClassID>::iterator it = this->targetList.begin(); 230 230 for(; it < this->targetList.end(); it++) 231 231 { … … 253 253 254 254 if( collisionEvent->getEntityA() == this->owner) { 255 if( collisionEvent->getEntityB()->isA(( ClassID)(*it))) {255 if( collisionEvent->getEntityB()->isA((*it))) { 256 256 PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(), 257 collisionEvent->getEntityB()->getClassCName(), *it);257 collisionEvent->getEntityB()->getClassCName(), (*it).id()); 258 258 return true; } 259 259 } 260 260 else { 261 if( collisionEvent->getEntityA()->isA(( ClassID)(*it))) {261 if( collisionEvent->getEntityA()->isA((*it))) { 262 262 PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(), 263 collisionEvent->getEntityA()->getClassCName(), *it);263 collisionEvent->getEntityA()->getClassCName(), (*it).id()); 264 264 return true; } 265 265 } … … 276 276 bool CollisionHandle::filterCollision(Collision* collision) 277 277 { 278 std::vector< long>::iterator it = this->targetList.begin();278 std::vector<ClassID>::iterator it = this->targetList.begin(); 279 279 for(; it < this->targetList.end(); it++) 280 280 { … … 302 302 303 303 if( collision->getEntityA() == this->owner) { 304 if( collision->getEntityA()->isA( (ClassID)(*it)))304 if( collision->getEntityA()->isA(*it)) 305 305 return true; } 306 306 else { 307 if( collision->getEntityB()->isA( (ClassID)(*it)))307 if( collision->getEntityB()->isA(*it)) 308 308 return true; } 309 309 }
Note: See TracChangeset
for help on using the changeset viewer.