Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8125 in orxonox.OLD


Ignore:
Timestamp:
Jun 3, 2006, 2:53:37 PM (18 years ago)
Author:
patrick
Message:

cr: more bugs removed, more safty added

Location:
branches/cr/src/lib/collision_reaction
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/cr/src/lib/collision_reaction/collision_handle.cc

    r8124 r8125  
    108108/**
    109109 * register a Collision to the Collision handle.
    110  *  @param collision
     110 *  @param collision the collision object to register
     111 *
    111112 * This is used for internal collision registration: sharing the collision objects between Collision Reactions
    112113 * Therefore dispatching it only once
     
    114115void CollisionHandle::registerSharedCollision(Collision* collision)
    115116{
     117  // fist check if we are listening for this Collision
     118  if( !this->filterCollision(collision))
     119    return;
     120
    116121  // set the state to not dispatched
    117122  this->bDispatched = false;
     
    178183  vector<long>::iterator it = this->targetList.begin();
    179184  for(; it < this->targetList.end(); it++)
    180     if( collisionEvent->getEntityA()->isA((ClassID)(*it)))
    181       return true;
     185  {
     186    if( collisionEvent->getEntityA() == this->owner) {
     187      if( collisionEvent->getEntityA()->isA((ClassID)(*it)))
     188        return true; }
     189    else {
     190      if( collisionEvent->getEntityB()->isA((ClassID)(*it)))
     191        return true; }
     192  }
    182193
    183194  return false;
     
    185196
    186197
    187 
    188 
    189 
    190 
    191 
    192 
     198/**
     199 * filter Collisions that are not wanted to be reacted to
     200 *  @param collision the collision object to filter
     201 */
     202bool CollisionHandle::filterCollision(Collision* collision)
     203{
     204  vector<long>::iterator it = this->targetList.begin();
     205  for(; it < this->targetList.end(); it++)
     206  {
     207    if( collision->getEntityA() == this->owner) {
     208      if( collision->getEntityA()->isA((ClassID)(*it)))
     209        return true; }
     210      else {
     211        if( collision->getEntityB()->isA((ClassID)(*it)))
     212          return true; }
     213  }
     214
     215  return false;
     216}
     217
     218
     219
     220
     221
     222
     223
  • branches/cr/src/lib/collision_reaction/collision_handle.h

    r8109 r8125  
    4747    void flushCollisions();
    4848    bool filterCollisionEvent(CollisionEvent* collisionEvent);
     49    bool filterCollision(Collision* collision);
     50
    4951
    5052
Note: See TracChangeset for help on using the changeset viewer.