Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8124 in orxonox.OLD for branches/cr


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

cr: some bugs found and solved, minor cleanup

Location:
branches/cr/src
Files:
4 edited

Legend:

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

    r8108 r8124  
    6666  this->entityBCollide = false;
    6767
     68  this->bDispatched = false;
     69
    6870  this->collisionEvents.clear();
    6971}
  • branches/cr/src/lib/collision_reaction/collision.h

    r8108 r8124  
    22 * @file collision.h
    33 *  Definition of a collision as a two WE hit each other
     4 *
     5 *  A is shared between two WorldEntity's CollisionHandles if both are subscribed to this event. In this case only one
     6 *  of the two CollisionHandles will calculate the CollisionReaction and the bDispatched flag will be set afterwards
     7 *  to signal that it's already cared about and should be ignored.
    48 */
    59
  • branches/cr/src/lib/collision_reaction/collision_handle.cc

    r8110 r8124  
    8080/**
    8181 * registers a new Collision Object
     82 *  @param entityA WorldEntity A of the collision
     83 *  @param entityB WorldEntity B of the collision
    8284 * if a there is already a collision object with the same stats
    8385 * registration will be skipped and the last collision object is returned
     
    9799  // now register it as a shared collision with the other collision entity
    98100  CollisionHandle* ch = entityB->getCollisionHandle(this->type);
    99   if( ch != NULL) {
     101  if( ch != NULL)
    100102    ch->registerSharedCollision(c);
    101     c->setEntityBCollide(true);
    102   }
    103103
    104104  return c;
     
    134134  this->bDispatched = false;
    135135
    136   // first element only
     136  // checks if these WorldEntities have already collided or if its a new collision -> create a new Collision object
    137137 Collision* c = this->registerCollision(collisionEvent->getEntityA(), collisionEvent->getEntityB());
    138138 c->setEntityACollide(true);
     
    178178  vector<long>::iterator it = this->targetList.begin();
    179179  for(; it < this->targetList.end(); it++)
    180   {
    181     if( !collisionEvent->getEntityA()->isA((ClassID)(*it)))
    182       return false;
    183   }
     180    if( collisionEvent->getEntityA()->isA((ClassID)(*it)))
     181      return true;
    184182
    185   return true;
     183  return false;
    186184}
    187185
  • branches/cr/src/world_entities/world_entity.cc

    r7989 r8124  
    323323  this->collisionHandles[type] = CREngine::getInstance()->subscribeReaction(this, type);
    324324
    325   // now there is at least one collision reaction subsribed
     325  // now there is at least one collision reaction subscribed
    326326  this->bReactive = true;
    327327}
     
    379379  // create a collision event
    380380  CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject();
    381   assert(c != NULL);
     381  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
    382382  c->collide(entityA, entityB, bvA, bvB);
    383383
    384   for(int i = 0; i < CREngine::CR_NUMBER; ++i)
     384  for( int i = 0; i < CREngine::CR_NUMBER; ++i)
    385385    if( this->collisionHandles[i] != NULL)
    386386      this->collisionHandles[i]->registerCollisionEvent(c);
Note: See TracChangeset for help on using the changeset viewer.