- Timestamp:
- Aug 22, 2006, 3:09:23 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/collision_reaction
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/collision_reaction/collision.cc
r9406 r9688 18 18 #include "collision.h" 19 19 #include "debug.h" 20 21 22 23 20 24 21 /** -
branches/new_class_id/src/lib/collision_reaction/collision.h
r8490 r9688 21 21 class Collision 22 22 { 23 24 23 public: 25 24 Collision(); -
branches/new_class_id/src/lib/collision_reaction/collision_event.cc
r9406 r9688 18 18 #include "collision_event.h" 19 19 #include "debug.h" 20 21 22 23 20 24 21 /** -
branches/new_class_id/src/lib/collision_reaction/collision_event.h
r8894 r9688 20 20 //! A class representing a simple collision 21 21 class CollisionEvent { 22 23 22 public: 24 23 CollisionEvent(); -
branches/new_class_id/src/lib/collision_reaction/collision_handle.cc
r9406 r9688 30 30 31 31 32 32 NewObjectListDefinition(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 NewClassID& target) 97 97 { 98 98 // make sure there is no dublicate 99 std::vector< long>::iterator it = this->targetList.begin();99 std::vector<NewClassID>::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<NewClassID>::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<NewClassID>::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 } -
branches/new_class_id/src/lib/collision_reaction/collision_handle.h
r8490 r9688 23 23 class CollisionHandle : public BaseObject 24 24 { 25 25 NewObjectListDeclaration(CollisionHandle); 26 26 public: 27 27 CollisionHandle(WorldEntity* owner, CREngine::CRType type); … … 30 30 void reset(); 31 31 32 void addTarget( longtarget);32 void addTarget(const NewClassID& target); 33 33 Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB); 34 34 void registerSharedCollision(Collision* collision); … … 64 64 65 65 std::vector<Collision*> collisionList; //!< a list full of collisions 66 std::vector< long> targetList; //!< a list of target classes for filtering66 std::vector<NewClassID> targetList; //!< a list of target classes for filtering @TODO TAKE SET INSTEAD OF VECTOR HERE 67 67 68 68 CollisionReaction* collisionReaction; //!< reference to the collision reaction object -
branches/new_class_id/src/lib/collision_reaction/collision_reaction.cc
r9406 r9688 20 20 21 21 22 22 NewObjectListDefinition(CollisionReaction); 23 23 24 24 /** … … 28 28 : BaseObject() 29 29 { 30 this-> setClassID(CL_COLLISION_REACTION, "CollisionReaction");30 this->registerObject(this, CollisionReaction::_objectList); 31 31 } 32 32 -
branches/new_class_id/src/lib/collision_reaction/collision_reaction.h
r8490 r9688 18 18 class CollisionReaction : public BaseObject 19 19 { 20 20 NewObjectListDeclaration(CollisionReaction); 21 21 public: 22 22 CollisionReaction(); -
branches/new_class_id/src/lib/collision_reaction/cr_engine.cc
r9406 r9688 29 29 30 30 31 31 NewObjectListDefinition(CREngine); 32 32 /** 33 33 * standard constructor … … 36 36 : BaseObject() 37 37 { 38 this->setClassID(CL_CR_ENGINE, "CREngine");38 this->registerObject(this, CREngine::_objectList); 39 39 this->setName("CREngine"); 40 40 -
branches/new_class_id/src/lib/collision_reaction/cr_engine.h
r9235 r9688 25 25 class CREngine : public BaseObject 26 26 { 27 NewObjectListDeclaration(CREngine); 27 28 28 29 public: -
branches/new_class_id/src/lib/collision_reaction/cr_object_damage.cc
r9406 r9688 28 28 29 29 30 30 NewObjectListDefinition(CRObjectDamage); 31 31 /** 32 32 * standard constructor … … 35 35 : CollisionReaction() 36 36 { 37 this->setClassID(CL_CR_OBJECT_DAMAGE, "CRObjectDamage"); 38 37 this->registerObject(this, CRObjectDamage::_objectList); 39 38 } 40 39 -
branches/new_class_id/src/lib/collision_reaction/cr_object_damage.h
r8190 r9688 15 15 class CRObjectDamage : public CollisionReaction 16 16 { 17 NewObjectListDeclaration(CRObjectDamage); 17 18 public: 18 19 CRObjectDamage(); -
branches/new_class_id/src/lib/collision_reaction/cr_physics_full_walk.cc
r9406 r9688 35 35 36 36 37 37 NewObjectListDefinition(CRPhysicsFullWalk); 38 38 /** 39 39 * standard constructor … … 42 42 : CollisionReaction() 43 43 { 44 this-> setClassID(CL_CR_PHYSICS_FULL_WALK, "CRPhysicsFullWalk");44 this->registerObject(this, CRPhysicsFullWalk::_objectList); 45 45 } 46 46 -
branches/new_class_id/src/lib/collision_reaction/cr_physics_full_walk.h
r9235 r9688 15 15 class CRPhysicsFullWalk : public CollisionReaction 16 16 { 17 NewObjectListDeclaration(CRPhysicsFullWalk); 17 18 public: 18 19 CRPhysicsFullWalk(); -
branches/new_class_id/src/lib/collision_reaction/cr_physics_ground_walk.cc
r9406 r9688 35 35 36 36 37 37 NewObjectListDefinition(CRPhysicsGroundWalk); 38 38 /** 39 39 * standard constructor … … 42 42 : CollisionReaction() 43 43 { 44 this-> setClassID(CL_CR_PHYSICS_GROUND_WALK, "CRPhysicsGroundWalk");44 this->registerObject(this, CRPhysicsGroundWalk::_objectList); 45 45 } 46 46 -
branches/new_class_id/src/lib/collision_reaction/cr_physics_ground_walk.h
r8894 r9688 15 15 class CRPhysicsGroundWalk : public CollisionReaction 16 16 { 17 NewObjectListDeclaration(CRPhysicsGroundWalk); 17 18 public: 18 19 CRPhysicsGroundWalk();
Note: See TracChangeset
for help on using the changeset viewer.