[4838] | 1 | /*! |
---|
[5629] | 2 | * @file object_manager.h |
---|
[6142] | 3 | * @brief Definition of the ObjectManager. |
---|
| 4 | */ |
---|
[3655] | 5 | |
---|
[5629] | 6 | #ifndef _OBJECT_MANAGER_H |
---|
| 7 | #define _OBJECT_MANAGER_H |
---|
[3655] | 8 | |
---|
| 9 | #include "base_object.h" |
---|
[5682] | 10 | #include <list> |
---|
[6142] | 11 | #include <vector> |
---|
[3655] | 12 | |
---|
[6142] | 13 | /// Enumerator for Managed Object Lists |
---|
| 14 | typedef enum { |
---|
| 15 | OM_NULL = 0, |
---|
| 16 | OM_DEAD, |
---|
| 17 | OM_DEAD_TICK, |
---|
| 18 | OM_ENVIRON_NOTICK, |
---|
| 19 | OM_ENVIRON, |
---|
| 20 | OM_COMMON, |
---|
[3655] | 21 | |
---|
[6142] | 22 | OM_GROUP_00, |
---|
| 23 | OM_GROUP_00_PROJ, |
---|
| 24 | OM_GROUP_01, |
---|
| 25 | OM_GROUP_01_PROJ, |
---|
| 26 | OM_GROUP_02, |
---|
| 27 | OM_GROUP_02_PROJ, |
---|
| 28 | OM_GROUP_03, |
---|
| 29 | OM_GROUP_03_PROJ, |
---|
| 30 | OM_GROUP_04, |
---|
| 31 | OM_GROUP_04_PROJ, |
---|
| 32 | OM_GROUP_05, |
---|
| 33 | OM_GROUP_05_PROJ, |
---|
| 34 | OM_GROUP_06, |
---|
| 35 | OM_GROUP_06_PROJ, |
---|
| 36 | OM_GROUP_07, |
---|
| 37 | OM_GROUP_07_PROJ, |
---|
| 38 | OM_GROUP_08, |
---|
| 39 | OM_GROUP_08_PROJ, |
---|
| 40 | OM_GROUP_09, |
---|
| 41 | OM_GROUP_09_PROJ, |
---|
| 42 | OM_GROUP_10, |
---|
| 43 | OM_GROUP_10_PROJ, |
---|
| 44 | OM_GROUP_11, |
---|
| 45 | OM_GROUP_11_PROJ, |
---|
| 46 | OM_GROUP_12, |
---|
| 47 | OM_GROUP_12_PROJ, |
---|
| 48 | OM_GROUP_13, |
---|
| 49 | OM_GROUP_13_PROJ, |
---|
| 50 | OM_GROUP_14, |
---|
| 51 | OM_GROUP_14_PROJ, |
---|
| 52 | OM_GROUP_15, |
---|
| 53 | OM_GROUP_15_PROJ, |
---|
[5682] | 54 | |
---|
[6142] | 55 | OM_SIZE, |
---|
[5682] | 56 | |
---|
| 57 | |
---|
[6142] | 58 | OM_INIT = -1, //!< DO NOT USE THIS. (WorldEntity Internal). |
---|
| 59 | } OM_LIST; |
---|
[5682] | 60 | |
---|
[6142] | 61 | #define OM_DEFAULT_LIST OM_NULL |
---|
[5682] | 62 | |
---|
[6142] | 63 | |
---|
| 64 | // FORWARD DECLARATION |
---|
| 65 | class PNode; |
---|
| 66 | class WorldEntity; |
---|
| 67 | |
---|
| 68 | //! A powerfull handler for the Object (WorldEntities) in the World. |
---|
[7368] | 69 | class ObjectManager : public BaseObject |
---|
| 70 | { |
---|
| 71 | public: |
---|
| 72 | typedef std::list<WorldEntity*> EntityList; //!< A type definition to make it easy to use EntityLists. |
---|
[3655] | 73 | |
---|
[7368] | 74 | ObjectManager(); |
---|
| 75 | virtual ~ObjectManager(); |
---|
[3655] | 76 | |
---|
[6142] | 77 | void flush(); |
---|
[5682] | 78 | |
---|
[6142] | 79 | void toList (WorldEntity* entity, OM_LIST omList = OM_DEFAULT_LIST); |
---|
[7221] | 80 | void toList (WorldEntity* entity, const std::string& omList); |
---|
[6142] | 81 | |
---|
| 82 | |
---|
[7368] | 83 | /** @returns the List (listnumber) of objects. @param listNumber the List to get. */ |
---|
| 84 | EntityList& getObjectList(OM_LIST listNumber) { return this->objectLists[listNumber]; } |
---|
| 85 | /** @returns a constant LIST of Objects. @param listNumber the objectList to returns */ |
---|
| 86 | const EntityList& getObjectList(OM_LIST listNumber) const { return this->objectLists[listNumber]; } |
---|
[6142] | 87 | |
---|
[7368] | 88 | static void distanceFromObject(EntityList& entities, const PNode& center, float radius, ClassID classID); |
---|
[5795] | 89 | |
---|
[6142] | 90 | void debug(OM_LIST omList, unsigned int level = 0) const; |
---|
[7221] | 91 | void debug(const std::string& listName = "", unsigned int level = 0); |
---|
[5682] | 92 | |
---|
[7221] | 93 | static OM_LIST StringToOMList(const std::string& listName); |
---|
[6142] | 94 | static const char* OMListToString(OM_LIST omList); |
---|
| 95 | |
---|
[7785] | 96 | |
---|
| 97 | void toReflectionList( WorldEntity* entity) { this->reflectionList.push_back(entity); } |
---|
| 98 | /** @returns the list of all reflected objects in the world */ |
---|
| 99 | EntityList& getReflectionList() { return this->reflectionList; } |
---|
| 100 | /** @returns the static list of all reflected objects in the world */ |
---|
| 101 | const EntityList& getReflectionList() const { return this->reflectionList; } |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | |
---|
[7368] | 106 | private: |
---|
| 107 | const std::list<BaseObject>* pNodeList; //!< The List of PNodes. |
---|
[5682] | 108 | |
---|
[7368] | 109 | EntityList objectLists[OM_SIZE]; //!< The ObjectLists. |
---|
[5682] | 110 | |
---|
[6142] | 111 | static const char* objectManagerListNames[]; //!< Names of all the lists |
---|
[7785] | 112 | |
---|
| 113 | EntityList reflectionList; //!< A list of all reflected objects in the world |
---|
[3655] | 114 | }; |
---|
| 115 | |
---|
[5629] | 116 | #endif /* _OBJECT_MANAGER_H */ |
---|