Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2006, 12:48:16 AM (19 years ago)
Author:
patrick
Message:

cr: deep structure with Collision and CollisionEvent created. list cleanup missing.

File:
1 edited

Legend:

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

    r7947 r7964  
    1818
    1919
    20 
     20#include "collision.h"
     21#include "collision_event.h"
    2122
    2223using namespace std;
     
    7576 *  @param collision the collision objects containing all collision informations
    7677 */
    77 void CollisionHandle::registerCollision(Collision* collision)
     78void CollisionHandle::registerCollisionEvent(CollisionEvent* collisionEvent)
    7879{
    79   this->collisionList.push_back(collision);
     80  // first element only
     81  if( this->collisionList.empty())
     82  {
     83    Collision* c = CREngine::getInstance()->popCollisionObject();
     84    c->collide(collisionEvent->getEntityA(), collisionEvent->getEntityB());
     85    this->collisionList.push_back(c);
     86  }
     87  if( ((this->collisionList.back())->getEntityA() == collisionEvent->getEntityA()) &&
     88        ((this->collisionList.back())->getEntityB() == collisionEvent->getEntityB()))
     89  {
     90    (this->collisionList.back())->registerCollisionEvent(collisionEvent);
     91  }
     92
     93  //this->collisionList.push_back(collisionEvent);
    8094}
    8195
     
    8599void CollisionHandle::flushCollisions()
    86100{
    87   std::vector<Collision*>::iterator it;
    88   for( it = this->collisionList.begin(); it != this->collisionList.end(); it++)
    89     CREngine::getInstance()->pushCollisionObject(*it);
    90101  this->collisionList.clear();
    91102}
Note: See TracChangeset for help on using the changeset viewer.