[157] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * |
---|
| 4 | * |
---|
| 5 | * License notice: |
---|
| 6 | * |
---|
| 7 | * This program is free software: you can redistribute it and/or modify |
---|
| 8 | * it under the terms of the GNU General Public License as published by |
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or |
---|
| 10 | * (at your option) any later version. |
---|
| 11 | * |
---|
| 12 | * This program is distributed in the hope that it will be useful, |
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | * GNU General Public License for more details. |
---|
| 16 | * |
---|
| 17 | * You should have received a copy of the GNU General Public License |
---|
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
| 19 | * |
---|
| 20 | * |
---|
| 21 | * Author: |
---|
| 22 | * Reto Grieder |
---|
| 23 | * Co-authors: |
---|
| 24 | * ... |
---|
| 25 | * |
---|
| 26 | */ |
---|
| 27 | |
---|
[161] | 28 | #include "OgreSceneManager.h" |
---|
| 29 | |
---|
[169] | 30 | #include "weapon.h" |
---|
[157] | 31 | #include "weapon_manager.h" |
---|
| 32 | |
---|
| 33 | |
---|
[169] | 34 | namespace orxonox { |
---|
[161] | 35 | using namespace Ogre; |
---|
[157] | 36 | |
---|
[169] | 37 | Weapon** WeaponManager::weaponList_s = NULL; |
---|
| 38 | |
---|
| 39 | WeaponManager::WeaponManager(SceneManager *sceneMgr, SceneNode *node, |
---|
| 40 | int slotSize) |
---|
| 41 | : sceneMgr_(sceneMgr), node_(node), slotSize_(slotSize), slotIndex_(0) |
---|
[161] | 42 | { |
---|
[169] | 43 | slots_ = new Weapon*[slotSize]; |
---|
[161] | 44 | } |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | WeaponManager::~WeaponManager() |
---|
| 48 | { |
---|
[169] | 49 | if (slots_) |
---|
| 50 | delete slots_; |
---|
[161] | 51 | } |
---|
| 52 | |
---|
[169] | 53 | |
---|
| 54 | bool WeaponManager::addWeapon(const Ogre::String &name) |
---|
| 55 | { |
---|
| 56 | if (name == weaponList_s[0]->name_) |
---|
| 57 | { |
---|
| 58 | // this is ugly, but for the time being, it has to fit. |
---|
| 59 | slots_[slotIndex_++] = weaponList_s[0]; |
---|
| 60 | return true; |
---|
| 61 | } |
---|
| 62 | else |
---|
| 63 | return false; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | // static |
---|
| 68 | bool WeaponManager::loadWeapons() |
---|
| 69 | { |
---|
| 70 | weaponList_s[0] = new Weapon("Barrel Gun", 10, 2); |
---|
| 71 | return true; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | // static |
---|
| 76 | void WeaponManager::destroyWeapons() |
---|
| 77 | { |
---|
| 78 | delete weaponList_s[0]; |
---|
| 79 | } |
---|
| 80 | |
---|
[157] | 81 | } |
---|