- Timestamp:
- May 30, 2006, 7:23:23 PM (19 years ago)
- Location:
- branches/cr/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cr/src/lib/collision_reaction/collision_handle.cc
r7973 r7989 34 34 this->owner = owner; 35 35 this->type = type; 36 37 this->targetList.clear();38 36 } 39 37 … … 60 58 * @param classID the classid to look for 61 59 */ 62 void CollisionHandle::addTarget(long classID)60 void CollisionHandle::addTarget(long target) 63 61 { 64 printf("addTarget: %i this is target nr %i\n", classID, this->targetList.size());62 PRINTF(0)("addTarget: %i \n", target); 65 63 // make sure there is no dublicate 66 64 // for(int i = 0; i < this->targetList.size(); ++i) … … 73 71 // return; 74 72 73 75 74 // add element 76 this->targetList.push_back( classID);75 this->targetList.push_back(target); 77 76 } 78 77 -
branches/cr/src/lib/collision_reaction/collision_handle.h
r7967 r7989 11 11 12 12 #include <vector> 13 #include <list> 13 14 14 15 … … 28 29 void reset(); 29 30 30 void addTarget(long classID);31 void addTarget(long target); 31 32 Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB); 32 33 void registerCollisionEvent(CollisionEvent* collisionEvent); -
branches/cr/src/world_entities/world_entity.cc
r7970 r7989 76 76 77 77 // registering default reactions: 78 this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, 1,CL_WORLD_ENTITY);79 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND, 1,CL_TERRAIN);78 this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY); 79 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND, CL_TERRAIN); 80 80 81 81 this->toList(OM_NULL); … … 249 249 * subscribes this world entity to a collision reaction 250 250 * @param type the type of reaction to subscribe to 251 * @param target1 a filter target (classID) 252 */ 253 void WorldEntity::subscribeReaction(CREngine::CRType type, long target1) 254 { 255 this->subscribeReaction(type); 256 257 // add the target filter 258 this->collisionHandles[type]->addTarget(target1); 259 } 260 261 262 /** 263 * subscribes this world entity to a collision reaction 264 * @param type the type of reaction to subscribe to 265 * @param target1 a filter target (classID) 266 */ 267 void WorldEntity::subscribeReaction(CREngine::CRType type, long target1, long target2) 268 { 269 this->subscribeReaction(type); 270 271 // add the target filter 272 this->collisionHandles[type]->addTarget(target1); 273 this->collisionHandles[type]->addTarget(target2); 274 } 275 276 277 /** 278 * subscribes this world entity to a collision reaction 279 * @param type the type of reaction to subscribe to 280 * @param target1 a filter target (classID) 281 */ 282 void WorldEntity::subscribeReaction(CREngine::CRType type, long target1, long target2, long target3) 283 { 284 this->subscribeReaction(type); 285 286 // add the target filter 287 this->collisionHandles[type]->addTarget(target1); 288 this->collisionHandles[type]->addTarget(target2); 289 this->collisionHandles[type]->addTarget(target3); 290 } 291 292 293 /** 294 * subscribes this world entity to a collision reaction 295 * @param type the type of reaction to subscribe to 296 * @param target1 a filter target (classID) 297 */ 298 void WorldEntity::subscribeReaction(CREngine::CRType type, long target1, long target2, long target3, long target4) 299 { 300 this->subscribeReaction(type); 301 302 // add the target filter 303 this->collisionHandles[type]->addTarget(target1); 304 this->collisionHandles[type]->addTarget(target2); 305 this->collisionHandles[type]->addTarget(target3); 306 this->collisionHandles[type]->addTarget(target4); 307 } 308 309 310 /** 311 * subscribes this world entity to a collision reaction 312 * @param type the type of reaction to subscribe to 251 313 * @param nrOfTargets number of target filters 252 314 * @param ... the targets as classIDs 253 315 */ 254 void WorldEntity::subscribeReaction(CREngine::CRType type , int nrOfTargets, long target...)316 void WorldEntity::subscribeReaction(CREngine::CRType type) 255 317 { 256 318 if( this->collisionHandles[type] != NULL) { … … 260 322 261 323 this->collisionHandles[type] = CREngine::getInstance()->subscribeReaction(this, type); 262 263 // add the target filter264 va_list itemlist;265 va_start (itemlist, target);266 for (int i = 0; i < nrOfTargets; i++)267 this->collisionHandles[type]->addTarget(va_arg(itemlist, long));268 va_end(itemlist);269 324 270 325 // now there is at least one collision reaction subsribed -
branches/cr/src/world_entities/world_entity.h
r7958 r7989 70 70 71 71 /* --- Collision Reaction Block --- */ 72 void subscribeReaction(CREngine::CRType type, int nrOfTargets, long target, ...); 72 void subscribeReaction(CREngine::CRType type); 73 void subscribeReaction(CREngine::CRType type, long target1); 74 void subscribeReaction(CREngine::CRType type, long target1, long target2); 75 void subscribeReaction(CREngine::CRType type, long target1, long target2, long target3); 76 void subscribeReaction(CREngine::CRType type, long target1, long target2, long target3, long target4); 77 73 78 void unsubscribeReaction(CREngine::CRType type); 74 79 void unsubscribeReaction();
Note: See TracChangeset
for help on using the changeset viewer.