Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7932 in orxonox.OLD for branches


Ignore:
Timestamp:
May 28, 2006, 9:00:40 PM (19 years ago)
Author:
patrick
Message:

cr: reaction subscription stuff

Location:
branches/cr/src
Files:
6 edited

Legend:

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

    r7927 r7932  
    1616
    1717#include "collision_handle.h"
     18
     19
     20
    1821
    1922using namespace std;
     
    4144  // delete what has to be deleted here
    4245}
     46
     47
     48/**
     49 * add more filter targets to this collision handle
     50 *  @param classID the classid to look for
     51 */
     52void CollisionHandle::addTarget(long classID)
     53{
     54  // make sure there is no dublicate
     55  std::vector<long>::iterator it;
     56  for(  it = this->targetList.begin(); it != this->targetList.end(); it++)
     57    if(*it == classID)
     58      return;
     59
     60  // add element
     61  this->targetList.push_back(classID);
     62}
  • branches/cr/src/lib/collision_reaction/collision_handle.h

    r7927 r7932  
    2727
    2828
    29   void addTarget();
     29  void addTarget(long classID);
    3030
    3131  void registerCollision(Collision* collision);
  • branches/cr/src/lib/collision_reaction/cr_engine.cc

    r7927 r7932  
    4747
    4848
    49 CollisionHandle* CREngine::subscribeReaction(WorldEntity* owner, CRType type, int nrOfTargets, ...)
     49CollisionHandle* CREngine::subscribeReaction(WorldEntity* owner, CRType type)
    5050{
    5151
    52   va_list itemlist;
    53   va_start (itemlist, type);
    54 //  for (int i = 0; i < nrOfTargets; i++)
    55   //  this->targetList.push_back(va_arg(itemlist, int));
    56   va_end(itemlist);
    5752}
    5853
  • branches/cr/src/lib/collision_reaction/cr_engine.h

    r7927 r7932  
    4141  inline static CREngine* getInstance(void) { if (!singletonRef) singletonRef = new CREngine();  return singletonRef; };
    4242
    43 
    44   CollisionHandle* subscribeReaction(WorldEntity* worldEntity, CRType type, int nrOfTargets, ...);
     43  CollisionHandle* subscribeReaction(WorldEntity* worldEntity, CRType type);
    4544
    4645  bool unsubscribeReaction(WorldEntity* worldEntity);
     
    5150
    5251  /** @returns an instance to a collision object. instead of creating new object this ones can be resycled */
    53 inline Collision* getCollisionObject() { /* return the first element of the cache list*/ }
     52  inline Collision* getCollisionObject() { /* return the first element of the cache list*/ }
    5453  /** @param collision: returns the Collision object back to the cache list */
    5554  inline void putCollisionObject(Collision* collision) { this->cachedCollisions.push_back(collision); }
  • branches/cr/src/world_entities/world_entity.cc

    r7927 r7932  
    6969
    7070  this->toList(OM_NULL);
    71 
    72   //this->collisionHandles = new *CollisionHandle[CREngine::CR_NUMBER]();
    7371}
    7472
     
    242240 */
    243241void WorldEntity::subscribeReaction(CREngine::CRType type, int nrOfTargets, ...)
    244 {}
     242{
     243
     244  this->collisionHandles[type] = CREngine::getInstance()->subscribeReaction(this, type);
     245
     246  va_list itemlist;
     247  va_start (itemlist, CREngine::CRType);
     248  for (int i = 0; i < nrOfTargets; i++)
     249    this->collisionHandles[type].push_back(va_arg(itemlist, long));
     250  va_end(itemlist);
     251}
    245252
    246253
  • branches/cr/src/world_entities/world_entity.h

    r7927 r7932  
    130130  bool                    bVisible;           //!< If it should be visible.
    131131
    132   OM_LIST                           objectListNumber;   //!< The ObjectList from ObjectManager this Entity is in.
    133   ObjectManager::EntityList::iterator objectListIterator; //!< The iterator position of this Entity in the given list of the ObjectManager.
     132  OM_LIST                           objectListNumber;             //!< The ObjectList from ObjectManager this Entity is in.
     133  ObjectManager::EntityList::iterator objectListIterator;         //!< The iterator position of this Entity in the given list of the ObjectManager.
    134134
    135   float                   scaling;
    136   CollisionHandle**       collisionHandles;
     135  float                   scaling;                                //!< the scaling of the model
     136  CollisionHandle*        collisionHandles[CREngine::CR_NUMBER];  //!< the list of the collision reactions
    137137
    138138
Note: See TracChangeset for help on using the changeset viewer.