Changeset 9939 in orxonox.OLD for branches/coll_rect/src/lib/collision_reaction/collision.h
- Timestamp:
- Nov 20, 2006, 12:53:27 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/coll_rect/src/lib/collision_reaction/collision.h
r9892 r9939 32 32 { 33 33 public: 34 34 35 Collision(); 35 36 virtual ~Collision(); … … 39 40 40 41 42 /* list stuff */ 43 public: 44 typedef std::vector<CollisionEvent*> collisionVector; //!< the vector containing all collision events 45 typedef std::vector<CollisionEvent*>::iterator iterator; //!< iterator definition 46 typedef std::vector<CollisionEvent*>::const_iterator const_iterator; //!< constant iterator definition 47 48 /** registers a @param event CollisionEvent to take place */ 49 inline void registerCollisionEvent(CollisionEvent* event) { this->_collisionEvents.push_back(event); this->bDispatched = false;} 50 /** @returns a vector of collision events */ 51 inline const std::vector<CollisionEvent*>& getCollisionEvents() const { return this->_collisionEvents; } 52 53 void flushCollisionEvents(); 54 55 56 /** @returns iterator pointing to the beginning of the collision event vector */ 57 inline iterator begin() { return this->_collisionEvents.begin(); } 58 /** @returns const iterator pointing to the beginning of the collision event vector */ 59 inline const_iterator begin() const { return this->_collisionEvents.begin(); } 60 /** @returns iterator pointing to the end of the collision event vector */ 61 inline iterator end() { return this->_collisionEvents.end(); } 62 /** @returns const iterator pointing to the end of the collision event vector */ 63 inline const_iterator end() const { return this->_collisionEvents.end(); } 64 65 66 private: 67 collisionVector _collisionEvents; //!< the collision event list 68 69 70 71 /* misc interface functions */ 72 public: 41 73 /** @return Collision WorldEntity A */ 42 74 inline WorldEntity* getEntityA() const { return this->entityA; } 43 75 /** @return Collision WorldEntity B */ 44 76 inline WorldEntity* getEntityB() const { return this->entityB; } 77 inline bool match(const WorldEntity& entityA, WorldEntity& entityB) const { 78 return ((this->entityA == &entityA && this->entityB == &entityB) || (this->entityA == &entityB && this->entityB == &entityA)); } 79 45 80 /** @return true if Entity A collides */ 46 81 inline bool isEntityACollide() const { return this->entityACollide; } … … 53 88 54 89 55 inline bool match(const WorldEntity& entityA, WorldEntity& entityB) const { 56 return ((this->entityA == &entityA && this->entityB == &entityB) || (this->entityA == &entityB && this->entityB == &entityA)); } 90 57 91 /** @returns true if this Collision has already been dispatched */ 58 92 inline bool isDispatched() { return this->bDispatched; } 59 93 /** sets the dispatched flag to true */ 60 94 inline void dispatched() { this->bDispatched = true; } 61 62 /** registers a @param event CollisionEvent to take place */63 inline void registerCollisionEvent(CollisionEvent* event) { this->collisionEvents.push_back(event); this->bDispatched = false;}64 /** @returns a vector of collision events */65 inline const std::vector<CollisionEvent*>& getCollisionEvents() const { return this->collisionEvents; }66 67 68 void flushCollisionEvents();69 70 95 71 96 private: … … 77 102 bool bDispatched; //!< true if this collision has already been dispatched 78 103 79 std::vector<CollisionEvent*> collisionEvents; //!< the collision event list80 104 }; 81 105 }
Note: See TracChangeset
for help on using the changeset viewer.