Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2006, 12:53:27 AM (17 years ago)
Author:
patrick
Message:

removed some comilation problems.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/coll_rect/src/lib/collision_reaction/collision.h

    r9892 r9939  
    3232  {
    3333  public:
     34
    3435    Collision();
    3536    virtual ~Collision();
     
    3940
    4041
     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:
    4173    /** @return Collision WorldEntity A */
    4274    inline WorldEntity* getEntityA() const { return this->entityA; }
    4375    /** @return Collision WorldEntity B */
    4476    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
    4580    /** @return true if Entity A collides */
    4681    inline bool isEntityACollide() const { return this->entityACollide; }
     
    5388
    5489
    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
    5791    /** @returns true if this Collision has already been dispatched */
    5892    inline bool isDispatched() { return this->bDispatched; }
    5993    /** sets the dispatched flag to true */
    6094    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 
    7095
    7196  private:
     
    77102    bool                         bDispatched;                   //!< true if this collision has already been dispatched
    78103
    79     std::vector<CollisionEvent*> collisionEvents;               //!< the collision event list
    80104  };
    81105}
Note: See TracChangeset for help on using the changeset viewer.