Changeset 7946 in orxonox.OLD for branches/cr/src
- Timestamp:
- May 29, 2006, 1:04:39 AM (19 years ago)
- Location:
- branches/cr/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cr/src/lib/collision_reaction/collision_handle.cc
r7945 r7946 43 43 { 44 44 // delete what has to be deleted here 45 } 46 47 /** 48 * restores the CollisionHandle to its initial state 49 */ 50 void CollisionHandle::reset() 51 { 52 this->flushCollisions(); 45 53 } 46 54 -
branches/cr/src/lib/collision_reaction/collision_handle.h
r7945 r7946 27 27 virtual ~CollisionHandle(); 28 28 29 void reset(); 29 30 30 31 void addTarget(long classID); 31 32 32 void registerCollision(Collision* collision); 33 33 -
branches/cr/src/lib/collision_reaction/cr_engine.cc
r7945 r7946 64 64 65 65 66 /** 67 * flushes the CollisionHandles and restores the CREngine to the initial state 68 */ 66 69 void CREngine::reset() 67 70 { … … 69 72 std::vector<CollisionHandle*>::iterator it; 70 73 for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++) 74 { 75 (*it)->reset(); 71 76 delete *it; 77 } 72 78 this->collisionHandles.clear(); 73 79 } … … 78 84 * @param owner: the WE to subscribe 79 85 * @param type: the type of collision reaction to perform 86 * @return the newly created CollisionHandle 80 87 */ 81 88 CollisionHandle* CREngine::subscribeReaction(WorldEntity* owner, CRType type) … … 86 93 87 94 88 bool CREngine::unsubscribeReaction(WorldEntity* worldEntity) 89 {} 90 91 95 /** 96 * unsubscribe reaction from the reaction list 97 * @param collisionHandle the CollisionHandle to remove 98 * @param returns true if worked collrectly 99 */ 92 100 bool CREngine::unsubscribeReaction(CollisionHandle* collisionHandle) 93 {} 101 { 102 std::vector<CollisionHandle*>::iterator it; 103 for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++) 104 { 105 if( *it == collisionHandle) 106 { 107 this->collisionHandles.erase(it); 108 delete collisionHandle; 109 return true; 110 } 111 } 112 return false; 113 } 94 114 95 115 -
branches/cr/src/lib/collision_reaction/cr_engine.h
r7945 r7946 46 46 CollisionHandle* subscribeReaction(WorldEntity* worldEntity, CRType type); 47 47 48 bool unsubscribeReaction(WorldEntity* worldEntity);49 48 bool unsubscribeReaction(CollisionHandle* collisionHandle); 50 49 -
branches/cr/src/world_entities/world_entity.cc
r7945 r7946 94 94 if (this->healthWidget != NULL) 95 95 delete this->healthWidget; 96 97 this->unsubscribeReaction(); 96 98 } 97 99 … … 263 265 264 266 /** 267 * unsubscribes a specific reaction from the worldentity 268 * @param type the reaction to unsubscribe 269 */ 270 void WorldEntity::unsubscribeReaction(CREngine::CRType type) 271 { 272 if( this->collisionHandles[type] == NULL) 273 return; 274 275 CREngine::getInstance()->unsubscribeReaction(this->collisionHandles[type]); 276 this->collisionHandles[type] = NULL; 277 } 278 279 280 /** 281 * unsubscribes all collision reactions 282 */ 283 void WorldEntity::unsubscribeReaction() 284 { 285 for( int i = 0; i < CREngine::CR_NUMBER; i++) 286 this->unsubscribeReaction((CREngine::CRType)i); 287 } 288 289 290 /** 265 291 * registers a new collision to this world entity 266 292 * @param collisionEvent the event -
branches/cr/src/world_entities/world_entity.h
r7945 r7946 71 71 /* --- Collision Reaction Block --- */ 72 72 void subscribeReaction(CREngine::CRType type, int nrOfTargets, long target, ...); 73 void unsubscribeReaction(CREngine::CRType type); 74 void unsubscribeReaction(); 73 75 bool registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB); 74 76
Note: See TracChangeset
for help on using the changeset viewer.