| Line | |
|---|
| 1 | /* |
|---|
| 2 | orxonox - the future of 3D-vertical-scrollers |
|---|
| 3 | |
|---|
| 4 | Copyright (C) 2004 orx |
|---|
| 5 | |
|---|
| 6 | This program is free software; you can redistribute it and/or modify |
|---|
| 7 | it under the terms of the GNU General Public License as published by |
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
|---|
| 9 | any later version. |
|---|
| 10 | |
|---|
| 11 | ### File Specific: |
|---|
| 12 | main-programmer: Patrick Boenzli |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION_REACTION |
|---|
| 16 | |
|---|
| 17 | #include "collision_handle.h" |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | using namespace std; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | /** |
|---|
| 26 | * standard constructor |
|---|
| 27 | * @todo this constructor is not jet implemented - do it |
|---|
| 28 | */ |
|---|
| 29 | CollisionHandle::CollisionHandle (WorldEntity* owner, CREngine::CRType type) |
|---|
| 30 | { |
|---|
| 31 | this->setClassID(CL_COLLISION_HANDLE, "CollisionHandle"); |
|---|
| 32 | |
|---|
| 33 | this->owner = owner; |
|---|
| 34 | this->type = type; |
|---|
| 35 | |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | /** |
|---|
| 40 | * standard deconstructor |
|---|
| 41 | */ |
|---|
| 42 | CollisionHandle::~CollisionHandle () |
|---|
| 43 | { |
|---|
| 44 | // delete what has to be deleted here |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | /** |
|---|
| 49 | * add more filter targets to this collision handle |
|---|
| 50 | * @param classID the classid to look for |
|---|
| 51 | */ |
|---|
| 52 | void 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 | } |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | /** |
|---|
| 66 | * this is the function to be called on a collision event for this handle |
|---|
| 67 | * @param collision the collision objects containing all collision informations |
|---|
| 68 | */ |
|---|
| 69 | void CollisionHandle::registerCollision(Collision* collision) |
|---|
| 70 | { |
|---|
| 71 | this->collisionList.push_back(collision); |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.