Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/main_reto/src/weapon_manager.cc @ 172

Last change on this file since 172 was 171, checked in by rgrieder, 17 years ago
  • added all my own files in the src directory
  • edited CMakeLists.txt in the src folder to match my files
File size: 1.8 KB
Line 
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
28#include "OgreSceneManager.h"
29
30#include "weapon.h"
31#include "weapon_manager.h"
32
33
34namespace orxonox {
35  using namespace Ogre;
36
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)
42  {
43        slots_ = new Weapon*[slotSize];
44  }
45
46
47  WeaponManager::~WeaponManager()
48  {
49    if (slots_)
50      delete slots_;
51  }
52
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
81}
Note: See TracBrowser for help on using the repository browser.