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_SONIC_OBJECTCONTAINER_H
26 #define ENGINES_SONIC_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 Sonic {
40 
41 class Object;
42 class Module;
43 class Area;
44 class Placeable;
45 
48 public:
49  ObjectDistanceSort(const Sonic::Object &target);
50 
52 
53 private:
54  float xt, yt, zt;
55 
56  float getDistance(Sonic::Object &a);
57 };
58 
60 public:
63 
64  void clearObjects();
65 
67  void addObject(Sonic::Object &object);
69  void removeObject(Sonic::Object &object);
70 
73 
76 
78 
79  static Module *toModule (Aurora::NWScript::Object *object);
80  static Area *toArea (Aurora::NWScript::Object *object);
82 
83 private:
84  typedef std::list<Sonic::Object *> ObjectList;
85  typedef std::map<ObjectType, ObjectList> ObjectMap;
86 
88 };
89 
90 } // End of namespace Sonic
91 
92 } // End of namespace Engines
93 
94 #endif // ENGINES_SONIC_OBJECTCONTAINER_H
static Area * toArea(Aurora::NWScript::Object *object)
std::map< ObjectType, ObjectList > ObjectMap
void addObject(Sonic::Object &object)
Add an object to this container.
A class able to sort objects by distance to a target object.
Basic Sonic Chronicles: The Dark Brotherhood types and defines.
An object within a Sonic area.
Definition: object.h:40
static Sonic::Object * toObject(::Aurora::NWScript::Object *object)
std::list< Sonic::Object * > ObjectList
float getDistance(Sonic::Object &a)
ObjectDistanceSort(const Sonic::Object &target)
::Aurora::NWScript::Object * getFirstObjectByType(ObjectType type) const
Return the first object of this type.
static Placeable * toPlaceable(Aurora::NWScript::Object *object)
Low-level type definitions to handle fixed width types portably.
A Sonic module.
Definition: module.h:45
static Module * toModule(Aurora::NWScript::Object *object)
::Aurora::NWScript::ObjectSearch * findObjectsByType(ObjectType type) const
Return a search context to iterate over all objects of this type.
void removeObject(Sonic::Object &object)
Remove an object from this container.
bool operator()(Sonic::Object *a, Sonic::Object *b)
An NWScript object container.