xoreos  0.0.5
objectcontainer.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef ENGINES_KOTOR2_OBJECTCONTAINER_H
26 #define ENGINES_KOTOR2_OBJECTCONTAINER_H
27 
28 #include <list>
29 #include <map>
30 
31 #include "src/common/types.h"
32 
34 
36 
37 namespace Engines {
38 
39 namespace KotOR2 {
40 
41 class Object;
42 class Module;
43 class Area;
44 class Waypoint;
45 class Situated;
46 class Placeable;
47 class Door;
48 class Creature;
49 
52 public:
53  ObjectDistanceSort(const KotOR2::Object &target);
54 
56 
57 private:
58  float xt, yt, zt;
59 
60  float getDistance(KotOR2::Object &a);
61 };
62 
64 public:
67 
68  void clearObjects();
69 
71  void addObject(KotOR2::Object &object);
73  void removeObject(KotOR2::Object &object);
74 
77 
80 
82 
83  static Module *toModule (Aurora::NWScript::Object *object);
84  static Area *toArea (Aurora::NWScript::Object *object);
88  static Door *toDoor (Aurora::NWScript::Object *object);
90  static Creature *toPC (Aurora::NWScript::Object *object);
92 
93 private:
94  typedef std::list<KotOR2::Object *> ObjectList;
95  typedef std::map<ObjectType, ObjectList> ObjectMap;
96 
98 };
99 
100 } // End of namespace KotOR2
101 
102 } // End of namespace Engines
103 
104 #endif // ENGINES_KOTOR2_OBJECTCONTAINER_H
void addObject(KotOR2::Object &object)
Add an object to this container.
A class able to sort objects by distance to a target object.
float getDistance(KotOR2::Object &a)
bool operator()(KotOR2::Object *a, KotOR2::Object *b)
static Creature * toPartyMember(Aurora::NWScript::Object *object)
::Aurora::NWScript::ObjectSearch * findObjectsByType(ObjectType type) const
Return a search context to iterate over all objects of this type.
static Placeable * toPlaceable(Aurora::NWScript::Object *object)
void removeObject(KotOR2::Object &object)
Remove an object from this container.
Basic Star Wars: Knights of the Old Republic II - The Sith Lords type definitions.
static Creature * toPC(Aurora::NWScript::Object *object)
Low-level type definitions to handle fixed width types portably.
ObjectDistanceSort(const KotOR2::Object &target)
::Aurora::NWScript::Object * getFirstObjectByType(ObjectType type) const
Return the first object of this type.
static Door * toDoor(Aurora::NWScript::Object *object)
std::map< ObjectType, ObjectList > ObjectMap
static Waypoint * toWaypoint(Aurora::NWScript::Object *object)
ObjectType
Object type, matches the bitfield in nwscript.nss.
Definition: types.h:33
static KotOR2::Object * toObject(::Aurora::NWScript::Object *object)
std::list< KotOR2::Object * > ObjectList
static Area * toArea(Aurora::NWScript::Object *object)
An NWScript object container.
static Situated * toSituated(Aurora::NWScript::Object *object)
An area in Star Wars: Knights of the Old Republic II - The Sith Lords, holding all objects and rooms ...
Definition: area.h:64
static Module * toModule(Aurora::NWScript::Object *object)
static Creature * toCreature(Aurora::NWScript::Object *object)