Changeset 9709 in orxonox.OLD for branches/new_class_id
- Timestamp:
- Aug 31, 2006, 10:51:08 PM (18 years ago)
- Location:
- branches/new_class_id/src
- Files:
-
- 193 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/defs/class_id.h
r9656 r9709 224 224 CL_FPS_SNIPER_RIFLE = 0x000003a7, 225 225 CL_FPS_LASER_RIFLE = 0x000003a8, 226 CL_BOOMERANG_GUN = 0x000003 09,226 CL_BOOMERANG_GUN = 0x000003a9, 227 227 228 228 // Projectiles … … 237 237 CL_GUIDED_MISSILE = 0x000003e8, 238 238 CL_HYPERBLAST = 0x000003e9, 239 CL_BOOMERANG_PROJECTILE = 0x000003 0a,239 CL_BOOMERANG_PROJECTILE = 0x000003ea, 240 240 241 241 // NPC's … … 253 253 254 254 CL_IMAGE_ENTITY = 0x00000513, 255 CL_IMAGE_PLANE = 0x0000051 4,255 CL_IMAGE_PLANE = 0x00000518, 256 256 CL_MODEL_ENTITY = 0x00000515, 257 257 CL_TEXT_ELEMENT = 0x00000516, /// TODO MOVE -
branches/new_class_id/src/lib/BuildLibs.am
r9668 r9709 1 1 2 2 libORXlibs_a_LIBRARIES_ = \ 3 $(LIB_PREFIX)/util/libORXlibutil.a \4 $(LIB_PREFIX)/shell/libORXshell.a \5 3 $(LIB_PREFIX)/event/libORXevent.a \ 6 4 $(LIB_PREFIX)/gui/qt/libORXqtgui.a \ 7 5 $(LIB_PREFIX)/gui/gl/libORXglgui.a \ 8 6 $(LIB_PREFIX)/gui/libORXbasegui.a \ 9 $(LIB_PREFIX)/script_engine/libORXscript.a \10 $(LIB_PREFIX)/graphics/importer/libORXimporter.a \11 7 $(LIB_PREFIX)/graphics/libORXgraphics.a \ 12 $(LIB_PREFIX)/graphics/importer/libtc.a \13 $(LIB_PREFIX)/sound/libORXsound.a \14 8 $(LIB_PREFIX)/particles/libORXparticles.a \ 15 9 $(LIB_PREFIX)/collision_detection/libORXcd.a \ … … 23 17 $(LIB_PREFIX)/physics/libORXphysics.a \ 24 18 $(LIB_PREFIX)/gui/gl/libORXglgui.a \ 19 \ 20 $(LIB_PREFIX)/util/libORXlibutil.a \ 21 \ 22 $(LIB_PREFIX)/graphics/importer/libORXimporter.a \ 23 $(LIB_PREFIX)/graphics/importer/libtc.a \ 24 $(LIB_PREFIX)/sound/libORXsound.a \ 25 25 $(LIB_PREFIX)/shell/libORXshell.a \ 26 $(LIB_PREFIX)/math/libORXmath.a \ 26 $(LIB_PREFIX)/script_engine/libORXscript.a \ 27 $(LIB_PREFIX)/util/libORXexecutor.a \ 27 28 $(LIB_PREFIX)/util/libORXlibutil.a \ 28 29 $(LIB_PREFIX)/lang/libORXlang.a \ 29 $(LIB_PREFIX)/libORXlibs.a 30 $(LIB_PREFIX)/libORXlibs.a \ 31 $(LIB_PREFIX)/math/libORXmath.a -
branches/new_class_id/src/lib/Makefile.am
r9705 r9709 16 16 data/data_tank.h 17 17 18 SUBDIRS = 19 #. \18 SUBDIRS = \ 19 . \ 20 20 math \ 21 21 lang \ -
branches/new_class_id/src/lib/coord/p_node.cc
r9691 r9709 29 29 #include "color.h" 30 30 31 32 NewObjectListDefinition(PNode); 31 33 /** 32 34 * @brief standard constructor -
branches/new_class_id/src/lib/graphics/effects/cloud_effect.cc
r9686 r9709 40 40 float CloudEffect::fadeTime; 41 41 42 NewObjectListDefinitionID(CloudEffect, CL_CLOUD_EFFECT); 42 43 43 44 … … 56 57 57 58 58 CREATE_FACTORY(CloudEffect, CL_CLOUD_EFFECT); 59 NewObjectListDefinitionID(CloudEffect, CL_CLOUD_EFFECT); 59 CREATE_FACTORY(CloudEffect); 60 60 61 61 CloudEffect::CloudEffect(const TiXmlElement* root) { -
branches/new_class_id/src/lib/graphics/effects/fog_effect.cc
r9686 r9709 22 22 #include "cloud_effect.h" 23 23 24 NewObjectListDefinition(FogEffect); 24 25 // Define shell commands 25 26 //SHELL_COMMAND(activate, FogEffect, activateFog); … … 37 38 ); 38 39 39 CREATE_FACTORY(FogEffect, CL_FOG_EFFECT); 40 NewObjectListDefinition(FogEffect); 40 CREATE_FACTORY(FogEffect); 41 41 42 42 /** -
branches/new_class_id/src/lib/graphics/effects/lense_flare.cc
r9686 r9709 35 35 #include "class_id.h" 36 36 37 CREATE_FACTORY(LenseFlare, CL_LENSE_FLARE);38 37 NewObjectListDefinitionID(LenseFlare, CL_LENSE_FLARE); 38 CREATE_FACTORY(LenseFlare); 39 39 40 40 /** -
branches/new_class_id/src/lib/graphics/effects/lightning_effect.cc
r9686 r9709 29 29 #include "class_id.h" 30 30 31 NewObjectListDefinitionID(LightningEffect, CL_LIGHTNING_EFFECT); 32 31 33 SHELL_COMMAND(activate, LightningEffect, activateLightning); 32 34 SHELL_COMMAND(deactivate, LightningEffect, deactivateLightning); … … 37 39 ); 38 40 39 CREATE_FACTORY(LightningEffect, CL_LIGHTNING_EFFECT); 40 NewObjectListDefinitionID(LightningEffect, CL_LIGHTNING_EFFECT); 41 CREATE_FACTORY(LightningEffect); 41 42 42 43 LightningEffect::LightningEffect(const TiXmlElement* root) { -
branches/new_class_id/src/lib/graphics/effects/rain_effect.cc
r9686 r9709 33 33 #include "class_id.h" 34 34 35 NewObjectListDefinitionID(RainEffect, CL_RAIN_EFFECT); 36 35 37 // Define shell commands 36 38 //SHELL_COMMAND(activate, RainEffect, activateRain); … … 48 50 ); 49 51 50 CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT); 51 NewObjectListDefinitionID(RainEffect, CL_RAIN_EFFECT); 52 CREATE_FACTORY(RainEffect); 52 53 53 54 /** -
branches/new_class_id/src/lib/graphics/effects/snow_effect.cc
r9686 r9709 32 32 #include "class_id.h" 33 33 34 NewObjectListDefinitionID(SnowEffect, CL_SNOW_EFFECT); 34 35 SHELL_COMMAND(activate, SnowEffect, activateSnow); 35 36 SHELL_COMMAND(deactivate, SnowEffect, deactivateSnow); … … 41 42 ); 42 43 43 CREATE_FACTORY(SnowEffect, CL_SNOW_EFFECT); 44 NewObjectListDefinitionID(SnowEffect, CL_SNOW_EFFECT); 44 CREATE_FACTORY(SnowEffect); 45 45 46 46 SnowEffect::SnowEffect(const TiXmlElement* root) -
branches/new_class_id/src/lib/graphics/effects/volfog_effect.cc
r9686 r9709 48 48 49 49 #include "class_id.h" 50 51 CREATE_FACTORY(VolFogEffect, CL_VOLFOG_EFFECT);52 50 NewObjectListDefinitionID(VolFogEffect, CL_VOLFOG_EFFECT); 51 CREATE_FACTORY(VolFogEffect); 53 52 54 53 VolFogEffect::VolFogEffect(const TiXmlElement* root) { -
branches/new_class_id/src/lib/graphics/light.cc
r9685 r9709 29 29 #include "class_id.h" 30 30 31 CREATE_FACTORY(Light, CL_LIGHT);32 31 NewObjectListDefinitionID(Light, CL_LIGHT); 32 CREATE_FACTORY(Light); 33 33 34 34 //! Definition of the Lights and their Names -
branches/new_class_id/src/lib/graphics/render2D/image_plane.cc
r9685 r9709 25 25 26 26 #include "class_id.h" 27 CREATE_FACTORY(ImagePlane, CL_IMAGE_ENTITY);28 27 29 NewObjectListDefinitionID(ImagePlane, CL_IMAGE_ENTITY); 28 NewObjectListDefinitionID(ImagePlane, CL_IMAGE_PLANE); 29 CREATE_FACTORY(ImagePlane); 30 30 31 31 -
branches/new_class_id/src/lib/gui/gl/glmenu/glmenu_imagescreen.cc
r9689 r9709 26 26 27 27 #include "class_id.h" 28 CREATE_FACTORY(GLMenuImageScreen, CL_GLMENU_IMAGE_SCREEN);29 28 NewObjectListDefinitionID(GLMenuImageScreen, CL_GLMENU_IMAGE_SCREEN); 29 CREATE_FACTORY(GLMenuImageScreen); 30 30 31 31 /** -
branches/new_class_id/src/lib/lang/base_object.h
r9705 r9709 44 44 //inline const std::string& getClassName() const { return this->className; } 45 45 /** @returns the className of the corresponding Object as a C-compliant string (const char*) */ 46 inline const char* getClassCName() const { return this->className.c_str(); };46 inline const char* getClassCName() const { return _classes.front()._objectList->name().c_str(); }; 47 47 /** @returns the ClassName of the Topmost Object of the ClassStack */ 48 inline const std::string& getClassName() const { return _classes.front()._objectList->name(); } 48 inline const std::string& getClassName() const { return _classes.front()._objectList->name(); }; 49 49 50 50 inline const NewClassID& getClassID() const { return *_leafClassID; } -
branches/new_class_id/src/lib/lang/new_class_id.cc
r9701 r9709 19 19 #include "new_object_list.h" 20 20 21 /** 22 * @brief a Default Constructor. 23 * this Always points to the ID of the NullClass. 24 */ 21 25 NewClassID::NewClassID() 22 26 { 23 *this = NullClass::classID();27 NullClass::acquireID(this->_id, this->_name); 24 28 }; 25 29 26 NewClassID::NewClassID(const NewObjectListBase* objList) 30 /** 31 * @brief Acquiring the ID of a objectList. 32 * @param objList The NewObjectList to acquire the ID from. 33 */ 34 NewClassID::NewClassID(const NewObjectListBase* const objList) 27 35 { 28 29 objList->acquireID(_id, _name); 30 36 objList->acquireID(this->_id, this->_name); 31 37 } 32 38 33 39 34 40 NewClassID NullClass::_classID; 41 42 int NullClass::_nullID; 43 const std::string NullClass::_nullName = std::string("NullClass"); -
branches/new_class_id/src/lib/lang/new_class_id.h
r9701 r9709 12 12 class NewObjectListBase; 13 13 14 //! A class to dynamically allocate ClassID's and support a isA operator 14 //! A class to dynamically allocate ClassID's and to support a isA operator 15 /** 16 * A NewClassID can only be aquired over a NewObjectList, 17 * thus enabling the developer to have permanent access to the correct ID and ClassName 18 * 19 * The Idea behind this concept is, that storing a NewClassID that changes its internal state 20 * all NewClassID's will be updated correctly. 21 * 22 * Since the Existance of any NewObjectList is a requirement during the working process all 23 * ID's should reference a valid ID and ClassName 24 */ 15 25 class NewClassID 16 26 { 17 27 public: 18 28 NewClassID(); 19 NewClassID(const NewObjectListBase* id); 20 // the copy constructor is also defined. 29 NewClassID(const NewObjectListBase* const id); 30 /// the copy constructor is also defined implicitely. 31 32 /** @returns A constant reference to the ID. */ 21 33 const int& id() const { return *_id; }; 34 /** @returns A constant reference to the Name. */ 22 35 const std::string& name() const { return *_name; }; 23 36 37 /** @param id the id to compare @returns true on match (match is same ID) @brief compares two id's */ 24 38 bool operator==(const NewClassID& id) const { return *_id == *id._id /* || _name == id._name */; }; 39 /** @param id the id to compare @returns true on match (match is same ID) @brief compares two id's */ 25 40 bool operator==(int id) const { return *_id == id; }; 41 /** @param name the id to compare @returns true on match (match is same Name) @brief compares an ID with a ClassName */ 26 42 bool operator==(const std::string& name) const { return *_name == name; }; 43 /** @param id the id to compare @returns false on match (match is same ID) @brief compares two id's */ 27 44 bool operator!=(const NewClassID& id) const { return *_id != *id._id /* && _name != id._name*/; }; 45 /** @param id the id to compare @returns false on match (match is same ID) @brief compares two id's */ 28 46 bool operator!=(int id) const { return *_id != id; }; 47 /** @param name the id to compare @returns false on match (match is same Name) @brief compares an ID with a ClassName */ 29 48 bool operator!=(const std::string& name) const { return *_name != name; }; 30 49 31 50 private: 32 const int* _id; 33 const std::string* _name; 51 const int* _id; //!< A pointer to the ID of the ClassID. 52 const std::string* _name; //!< A pointer to the Name of the ClassID. 34 53 }; 35 54 55 //! A NullClass. This is the Null of the ClassID. 56 /** 57 * implemented as a Class id can be used to reference NullObjects. 58 */ 36 59 class NullClass 37 60 { 38 61 public: 39 static NewClassID classID() { return NullClass::_classID; } 62 /** @returns the NullClass' ID. */ 63 static const NewClassID& classID() { return NullClass::_classID; } 64 /** @param id the ID to acquire @param name the name to acquire @brief acquires the ID of this Class */ 65 static void acquireID(const int*& id, const std::string*& name) { id = &_nullID; name = &_nullName; }; 66 40 67 private: 41 NullClass(); 68 NullClass() {}; //!< The Default Constructor is hidden from the User. 69 42 70 private: 43 static NewClassID _classID; 71 static NewClassID _classID; //!< The NullClass' ID 72 static const std::string _nullName; //!< The NullClass' Name ("NullClass") 73 static int _nullID; //!< The NullClass' ID 44 74 }; 45 75 -
branches/new_class_id/src/lib/lang/new_object_list.cc
r9705 r9709 20 20 21 21 22 #include <stdio.h> 23 22 24 /** 23 25 * @brief Constructor, that creates an ObjectList while checking (development mode) for uniqueness of all Keys (names and ID's) … … 27 29 */ 28 30 NewObjectListBase::NewObjectListBase(const std::string& className, int id) 29 : _name(className) 30 { 31 : _name(className) 32 { 33 printf("NewObjectList, Registered %s::%d\n", className.c_str(), id); 31 34 if (NewObjectListBase::_classesByID == NULL) 32 35 { … … 47 50 _id = id; 48 51 /// Some Output, that will fall out later 49 //std::cout << "register new ObjectList " << className << " ID: " << this->_id << std::endl;52 std::cout << "register new ObjectList " << className << " ID: " << this->_id << std::endl; 50 53 51 54 this->_identity = NewClassID(this); … … 98 101 * @return true if such a class already exists. 99 102 */ 103 bool NewObjectListBase::classIDExists(int id) 104 { 105 return (NewObjectListBase::_classesByID->find(id) != NewObjectListBase::_classesByID->end()); 106 } 107 108 /** 109 * @brief Checks if a Class with name already exists. 110 * @param name The Name of the Class to check. 111 * @return true if such a class already exists. 112 */ 100 113 bool NewObjectListBase::classNameExists(const std::string& name) 101 114 { … … 108 121 * @returns the ClassID if found and NullClass' identity if not. 109 122 */ 110 const NewClassID& NewOb ejctListBase::retrieveIdentity(int id)123 const NewClassID& NewObjectListBase::retrieveIdentity(int id) 111 124 { 112 125 const NewObjectListBase* const base = NewObjectListBase::getObjectList(id); … … 117 130 return NullClass::classID(); 118 131 } 132 119 133 120 134 /** … … 130 144 return base->_identity; 131 145 else 132 return NullObject::classID(); 133 } 134 135 136 /** 137 * @brief Checks if a Class with name already exists. 138 * @param name The Name of the Class to check. 139 * @return true if such a class already exists. 140 */ 141 bool NewObjectListBase::classIDExists(int id) 142 { 143 return (NewObjectListBase::_classesByID->find(id) != NewObjectListBase::_classesByID->end()); 146 return NullClass::classID(); 144 147 } 145 148 … … 230 233 } 231 234 235 #include "base_object.h" 236 237 /** 238 * @brief Prints out some debugging information about a given List. 239 */ 240 void NewObjectListBase::debug(unsigned int level) const 241 { 242 base_list list; 243 this->getBaseObjectList(&list); 244 245 if (level > 1 || !list.empty()) 246 printf(" ObjectList of class %s(id:%d) contains %d objects\n", this->name().c_str(), this->id(), list.size()); 247 248 if (level >= 2) 249 { 250 printf(" - listing Instances: \n"); 251 for (base_iterator it = list.begin(); 252 it != list.end(); 253 ++it) 254 { 255 printf(" + %s::%s\n", (*it)->getClassCName(), (*it)->getCName()); 256 } 257 } 258 } 259 260 261 void NewObjectListBase::debugAll(unsigned int level) 262 { 263 printf("Listing all %d ObjectLists \n", NewObjectListBase::_classesByID->size()); 264 265 for (classNameMap::const_iterator it = NewObjectListBase::_classesByName->begin(); 266 it != NewObjectListBase::_classesByName->end(); 267 ++it) 268 { 269 (*it).second->debug(level); 270 271 } 272 273 } 274 275 232 276 233 277 /** -
branches/new_class_id/src/lib/lang/new_object_list.h
r9705 r9709 48 48 class IteratorBase { }; 49 49 50 typedef std::list<BaseObject*> base_list; 51 typedef base_list::iterator base_iterator; 50 /** @brief A Typedefinition for the Base-List that can be retrieved with getBaseObjectList(base_list*) */ 51 typedef std::list<BaseObject*> base_list; 52 /** @brief An iterator for the base_list */ 53 typedef base_list::iterator base_iterator; 52 54 53 55 public: 54 56 /** @returns The Identity of the Class stored within. */ 55 inline const NewClassID& identity() const { return _identity; }57 inline const NewClassID& identity() const { return _identity; } 56 58 /** @returns the ID of the Identity of the ObjectList */ 57 inline int id() const { return _id; };59 inline int id() const { return _id; }; 58 60 /** @returns The Name of the Class stored in this ObjectList */ 59 inline const std::string& name() const { return _name; };61 inline const std::string& name() const { return _name; }; 60 62 /** @param id The id to compare @returns true on match, false otherwise */ 61 inline bool operator==(int id) const { return _id == id; };63 inline bool operator==(int id) const { return _id == id; }; 62 64 /** @param id The id to compare @returns true on match, false otherwise */ 63 inline bool operator==(const NewClassID& id) const { return id == _id; };65 inline bool operator==(const NewClassID& id) const { return id == _id; }; 64 66 /** @param name The name to compare @returns true on match, false otherwise */ 65 inline bool operator==(const std::string& name) const { return _name == name; };67 inline bool operator==(const std::string& name) const { return _name == name; }; 66 68 /** @param id The id to check @returns true on match, false otherwise */ 67 inline void acquireID(const int*& id, const std::string*& name) const { id = &_id; name = &_name; };69 inline void acquireID(const int*& id, const std::string*& name) const { id = &_id; name = &_name; }; 68 70 /** @brief fills a list of Objects into a BaseObject*-List. @param list the list to fill */ 69 virtual void getBaseObjectList(base_list* list) const = 0;70 71 static const NewClassID& retrieveIdentity(int id);72 static const NewClassID& retrieveIdentity(const std::string& name);71 virtual void getBaseObjectList(base_list* list) const = 0; 72 73 static const NewClassID& retrieveIdentity(int id); 74 static const NewClassID& retrieveIdentity(const std::string& name); 73 75 74 76 static const NewObjectListBase* const getObjectList(int classID); … … 76 78 static const NewObjectListBase* const getObjectList(const NewClassID& classID); 77 79 78 static BaseObject* getBaseObject(int classID, const std::string& objectName);79 static BaseObject* getBaseObject(const std::string& className, const std::string& objectName);80 static BaseObject* getBaseObject(const NewClassID& classID, const std::string& objectName);80 static BaseObject* getBaseObject(int classID, const std::string& objectName); 81 static BaseObject* getBaseObject(const std::string& className, const std::string& objectName); 82 static BaseObject* getBaseObject(const NewClassID& classID, const std::string& objectName); 81 83 82 84 /** @returns an Object with Name name out of this List @param name the name of the Object. */ 83 virtual BaseObject* getBaseObject(const std::string& name) const = 0;85 virtual BaseObject* getBaseObject(const std::string& name) const = 0; 84 86 85 87 static const std::list<std::string>& getClassNames(); 86 88 89 87 90 static unsigned int classCount(); 91 void debug(unsigned int level) const; 92 static void debugAll(unsigned int level); 93 88 94 static const std::string& IDToString(int classID); 89 95 static int StringToID(const std::string& className); 90 96 91 virtual void debug() const = 0;92 93 97 //! Only uset to unsubscribe a BaseObject. 94 virtual void unregisterObject(IteratorBase* _iterators) = 0;98 virtual void unregisterObject(IteratorBase* _iterators) = 0; 95 99 96 100 protected: … … 101 105 NewObjectListBase(const NewObjectListBase&); 102 106 103 static bool classIDExists(int id);104 static bool classNameExists(const std::string& className);107 static bool classIDExists(int id); 108 static bool classNameExists(const std::string& className); 105 109 106 110 … … 126 130 //! Defines a ObjectsList handler for objects of type T. 127 131 /** 132 * The ObjectList is a generic way to store every object created from a Class 'T' 133 * into a List. The list can be retrieved, and used constantly over iterators, 134 * as with normal std::list. 135 * 136 * Furthermore the linkage over the single Lists is given over the Superclass NewObjectListBase. 137 * 138 * 139 * 140 * 128 141 * To define a Class with a ObjectList, you have to: 129 142 * 1. Include 'NewObjectListDeclaration(T);' in its Declaration (at the beginning) … … 132 145 * 133 146 * @note The Class must define the compare with const std::string& operator for this to work. 147 * 148 * 149 * 150 * Limitations: 151 * ObjectList cannot be used with other Factory style Classes, if the class is also a BaseObject, 152 * and not loaded before the ObjectList. 153 * 154 * @example Iterating: Iteration is made easy, and fast as follows: 155 * for (NewObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin(); 156 * it != PlayerStats::objectList().end(); 157 * ++it) 158 * { 159 * (*it)->dosomething 160 * } 161 * 162 * @example Find an Object: 163 * Playable* playable = Playable::objectList("orxonox-super-rocket-fighter"); // searches an Object By its name. 164 * 134 165 */ 135 166 template<class T> … … 154 185 ~NewObjectList(); 155 186 156 virtual BaseObject* getBaseObject(const std::string& name) const; 157 T* getObject(const std::string& name) const; 158 inline const list& objects() const { return _objects; }; 159 bool exists(const T* const object) const; 160 161 inline iterator begin() { return _objects.begin(); }; 162 inline const_iterator begin() const { return _objects.begin(); }; 163 inline iterator end() { return _objects.end(); }; 164 inline const_iterator end() const { return _objects.end(); }; 165 166 inline bool empty() const { return _objects.empty(); }; 167 inline int size() const { return _objects.size(); }; 168 inline T* front() const { return _objects.front(); }; 169 inline T* back() const { return _objects.back(); }; 170 171 172 NewObjectListBase::IteratorBase* registerObject(T* object); 173 virtual void unregisterObject(IteratorBase* iterator); 174 175 virtual void debug() const; 187 virtual BaseObject* getBaseObject(const std::string& name) const; 188 T* getObject(const std::string& name) const; 189 inline const list& objects() const { return _objects; }; 190 bool exists(const T* const object) const; 191 192 /** @returns an Iterator to the beginning of the List. */ 193 inline iterator begin() { return _objects.begin(); }; 194 /** @returns a constant Iterator to the beginning of the List. */ 195 inline const_iterator begin() const { return _objects.begin(); }; 196 /** @returns an Iterator to the end of the List. */ 197 inline iterator end() { return _objects.end(); }; 198 /** @returns a constant Iterator to the beginning of the List. */ 199 inline const_iterator end() const { return _objects.end(); }; 200 201 /** @returns true if the List is empty. */ 202 inline bool empty() const { return _objects.empty(); }; 203 /** @returns the size of the List */ 204 inline int size() const { return _objects.size(); }; 205 /** @returns the frontmost Element of the list (normaly the last added Object). */ 206 inline T* front() const { return _objects.front(); }; 207 /** @returns the last added Object */ 208 inline T* back() const { return _objects.back(); }; 209 210 211 NewObjectListBase::IteratorBase* registerObject(T* object); 212 virtual void unregisterObject(IteratorBase* iterator); 176 213 177 214 protected: 178 virtual void getBaseObjectList(NewObjectListBase::base_list* list) const;215 virtual void getBaseObjectList(NewObjectListBase::base_list* list) const; 179 216 180 217 … … 184 221 185 222 private: 186 list _objects; 223 list _objects; //!< The List of stored Objects of Type T. 187 224 }; 188 225 … … 212 249 if (!_objects.empty()) 213 250 { 214 std::cout << "There are still Object in the ObjectList of " << this->name() << "(id:" << this->id() << ")\n"; 215 this->debug(); 251 // std::cout << "There are " << this->size() << " objects from class " << this->name() << "(id:" << this->id() << ") in existance\n"; 216 252 } 217 253 } … … 279 315 NewObjectListBase::IteratorBase* NewObjectList<T>::registerObject(T* object) 280 316 { 281 this->_objects.push_ front(object);282 return new Iterator( this->_objects.begin());317 this->_objects.push_back(object); 318 return new Iterator(--this->_objects.end()); 283 319 } 284 320 … … 294 330 } 295 331 296 /**297 * @brief print out some debug information298 * @note this function will most probably vanish from here and be completely moved to the base class.299 */300 template <class T>301 void NewObjectList<T>::debug() const302 {303 const_iterator it;304 for (it = this->_objects.begin(); it != this->_objects.end(); ++it)305 {306 std::cout << (*it)->getName() << std::endl;307 }308 }309 310 332 #endif /* _NEW_OBJECT_LIST_H */ -
branches/new_class_id/src/lib/network/monitor/network_stats_widget.cc
r9691 r9709 29 29 // SHELL_COMMAND(gui, NetworkStatsWidget, toggleGUI) 30 30 // ->setAlias("ProxyGui"); 31 32 NewObjectListDefinition(NetworkStatsWidget);33 31 34 32 HostWidget::HostWidget(const std::string& name, const IP& ip) … … 212 210 //======================================================// 213 211 212 213 NewObjectListDefinition(NetworkStatsWidget); 214 214 /** 215 215 * @brief standard constructor -
branches/new_class_id/src/lib/network/network_stream.cc
r9691 r9709 1194 1194 } 1195 1195 else 1196 1196 ; /// FIXME NEW_CLASS_ID :: b = Factory::fabricate( leafClassId ); 1197 1197 1198 1198 if ( !b ) -
branches/new_class_id/src/lib/network/player_stats.cc
r9691 r9709 32 32 #include "class_id.h" 33 33 34 CREATE_FACTORY(PlayerStats, CL_PLAYER_STATS);35 34 NewObjectListDefinitionID(PlayerStats, CL_PLAYER_STATS); 35 CREATE_FACTORY(PlayerStats); 36 36 37 37 /** -
branches/new_class_id/src/lib/particles/box_emitter.cc
r9686 r9709 26 26 #include "class_id.h" 27 27 28 CREATE_FACTORY(BoxEmitter, CL_BOX_EMITTER);29 28 NewObjectListDefinitionID(BoxEmitter, CL_BOX_EMITTER); 29 CREATE_FACTORY(BoxEmitter); 30 30 31 /** 31 32 * standard constructor -
branches/new_class_id/src/lib/particles/dot_emitter.cc
r9686 r9709 27 27 28 28 #include "class_id.h" 29 CREATE_FACTORY(DotEmitter, CL_DOT_EMITTER);30 29 NewObjectListDefinitionID(DotEmitter, CL_DOT_EMITTER); 30 CREATE_FACTORY(DotEmitter); 31 31 32 32 /** -
branches/new_class_id/src/lib/particles/dot_particles.cc
r9687 r9709 26 26 #include "class_id.h" 27 27 28 CREATE_FACTORY(DotParticles, CL_DOT_PARTICLES);29 28 NewObjectListDefinitionID(DotParticles, CL_DOT_PARTICLES); 29 CREATE_FACTORY(DotParticles); 30 30 31 31 SHELL_COMMAND(texture, DotParticles, setMaterialTexture) -
branches/new_class_id/src/lib/particles/model_particles.cc
r9687 r9709 26 26 #include "class_id.h" 27 27 28 CREATE_FACTORY(ModelParticles, CL_MODEL_PARTICLES);29 28 NewObjectListDefinitionID(ModelParticles, CL_MODEL_PARTICLES); 29 CREATE_FACTORY(ModelParticles); 30 30 31 31 SHELL_COMMAND(texture, ModelParticles, setMaterialTexture) -
branches/new_class_id/src/lib/particles/plane_emitter.cc
r9686 r9709 26 26 #include "class_id.h" 27 27 28 CREATE_FACTORY(PlaneEmitter, CL_PLANE_EMITTER);29 28 NewObjectListDefinitionID(PlaneEmitter, CL_PLANE_EMITTER); 29 CREATE_FACTORY(PlaneEmitter); 30 30 31 31 /** -
branches/new_class_id/src/lib/particles/spark_particles.cc
r9687 r9709 26 26 #include "class_id.h" 27 27 28 CREATE_FACTORY(SparkParticles, CL_SPARK_PARTICLES);29 28 NewObjectListDefinitionID(SparkParticles, CL_SPARK_PARTICLES); 29 CREATE_FACTORY(SparkParticles); 30 30 31 31 /** -
branches/new_class_id/src/lib/particles/sprite_particles.cc
r9687 r9709 26 26 #include "class_id.h" 27 27 28 CREATE_FACTORY(SpriteParticles, CL_SPRITE_PARTICLES);29 28 NewObjectListDefinitionID(SpriteParticles, CL_SPRITE_PARTICLES); 29 CREATE_FACTORY(SpriteParticles); 30 30 31 31 SHELL_COMMAND(texture, SpriteParticles, setMaterialTexture) -
branches/new_class_id/src/lib/physics/fields/gravity.cc
r9686 r9709 24 24 NewObjectListDefinitionID(Gravity, CL_FIELD_GRAVITY); 25 25 26 CREATE_FACTORY(Gravity , CL_FIELD_GRAVITY);26 CREATE_FACTORY(Gravity); 27 27 28 28 Gravity::Gravity(const TiXmlElement* root) -
branches/new_class_id/src/lib/physics/physics_connection.cc
r9686 r9709 28 28 29 29 #include "class_id.h" 30 31 CREATE_FACTORY(PhysicsConnection, CL_PHYSICS_CONNECTION);32 30 NewObjectListDefinition(PhysicsConnection); 31 CREATE_FACTORY(PhysicsConnection); 33 32 /** 34 33 * creates a PhysicsConnection -
branches/new_class_id/src/lib/script_engine/script.cc
r9699 r9709 22 22 #include "loading/load_param.h" 23 23 #include "parser/tinyxml/tinyxml.h" 24 25 NewObjectListDefinition(Script); 24 26 25 27 CREATE_SCRIPTABLE_CLASS(Script, Script::classID(), … … 30 32 ); 31 33 32 NewObjectListDefinition(Script);33 34 34 35 Script::Script(const TiXmlElement* root) -
branches/new_class_id/src/lib/script_engine/script_class.h
r9699 r9709 29 29 public: 30 30 virtual ~ScriptClass(); 31 32 const std::string& getName() const { return this->getName(); }33 bool operator==(const std::string& name) const { return (this->getName() == name); }34 bool operator==(NewClassID classID) const { return (this->_classID == classID); }35 31 36 32 virtual void registerClass(Script* script) = 0; -
branches/new_class_id/src/lib/shell/Makefile.am
r7428 r9709 18 18 shell_buffer.h \ 19 19 shell_input.h \ 20 shell_command_class.h \ 20 21 shell_command.h \ 21 shell_command_class.h \22 22 shell_completion.h \ 23 23 shell_completion_plugin.h -
branches/new_class_id/src/lib/shell/shell_command.cc
r9702 r9709 26 26 namespace OrxShell 27 27 { 28 NewObjectListDefinition(ShellCommand); 28 29 SHELL_COMMAND(debug, ShellCommandClass, help); 29 NewObjectListDefinition(ShellCommand);30 30 31 31 -
branches/new_class_id/src/lib/shell/shell_completion.cc
r9697 r9709 141 141 type = ClassCompletion; 142 142 143 /// FIXME 144 // if (!this->addToCompleteList(*boList, objectBegin, type)) 145 // return false; 143 NewObjectListBase::base_list list; 144 objectList->getBaseObjectList(&list); 145 146 if (!this->addToCompleteList(list, objectBegin, type)) 147 return false; 146 148 147 149 return true; -
branches/new_class_id/src/lib/shell/some_shell_commands.cc
r8623 r9709 34 34 SHELL_COMMAND(nick, PlayerStats, shellNick)->setAlias("nick"); 35 35 36 #include "class_list.h"37 SHELL_COMMAND(debug, ClassList, ClassList::debugS)38 ->describe("Shows all registered classes, if param1: is a valid ClassName only values of this class are shown. param2: how much output")39 ->defaultValues(MT_NULL, 1);36 // #include "class_list.h" 37 // SHELL_COMMAND(debug, ClassList, ClassList::debugS) 38 // ->describe("Shows all registered classes, if param1: is a valid ClassName only values of this class are shown. param2: how much output") 39 // ->defaultValues(MT_NULL, 1); 40 40 41 41 #include "p_node.h" -
branches/new_class_id/src/lib/util/Makefile.am
r9406 r9709 2 2 include $(MAINSRCDIR)/defs/include_paths.am 3 3 4 noinst_LIBRARIES = libORXlibutil.a 4 noinst_LIBRARIES = \ 5 libORXlibutil.a \ 6 libORXexecutor.a 7 8 libORXexecutor_a_SOURCES = \ 9 executor/executor.cc \ 10 executor/executor_functional.cc \ 11 executor/executor_lua.cc 5 12 6 13 libORXlibutil_a_SOURCES = \ … … 9 16 helper_functions.cc \ 10 17 multi_type.cc \ 11 executor/executor.cc \12 executor/executor_functional.cc \13 executor/executor_lua.cc \14 18 \ 15 19 loading/resource_manager.cc \ … … 19 23 loading/load_param_description.cc \ 20 24 loading/factory.cc \ 21 loading/ dynamic_loader.cc \25 loading/fast_factory.cc \ 22 26 \ 23 27 filesys/file.cc \ … … 28 32 threading.cc \ 29 33 timer.cc 34 35 # loading/dynamic_loader.cc 30 36 31 37 … … 55 61 loading/load_param_description.h \ 56 62 loading/factory.h \ 63 loading/fast_factory.h \ 57 64 loading/dynamic_loader.h \ 58 65 \ -
branches/new_class_id/src/lib/util/loading/dynamic_loader.cc
r9684 r9709 31 31 */ 32 32 DynamicLoader::DynamicLoader (const std::string& libName) 33 : Factory( NULL, 0)33 : Factory(libName) 34 34 { 35 35 this->registerObject(this, DynamicLoader::_objectList); -
branches/new_class_id/src/lib/util/loading/factory.cc
r9695 r9709 28 28 * set everything to zero and define factoryName 29 29 */ 30 Factory::Factory (const std::string& factoryName, intclassID)31 : _classID(classID) , _className(factoryName)30 Factory::Factory (const NewClassID& classID) 31 : _classID(classID) 32 32 { 33 this->registerObject(this, Factory::_objectList); 34 this->setName(factoryName); 33 printf("Factory::create(%s::%d)\n", classID.name().c_str(), classID.id()); 34 //this->registerObject(this, Factory::_objectList); 35 this->setName(classID.name()); 35 36 36 37 if( Factory::_factoryList == NULL) … … 79 80 } 80 81 81 /**82 * @brief Compares the Factories Name against a given ClassName83 * @param className the Name of the Class to Query84 * @returns true on match, false otherwise.85 */86 bool Factory::operator==(const char* className) const87 {88 return (className != NULL && this->_className == className);89 }90 82 91 83 /** … … 96 88 bool Factory::operator==(const std::string& className) const 97 89 { 98 return (this->_class Name== className);90 return (this->_classID.name() == className); 99 91 } 100 92 … … 143 135 } 144 136 145 146 137 /** 147 138 * @brief Creates a new Object of type classID … … 149 140 * @returns a new Object of Type classID on match, NULL otherwise 150 141 */ 151 BaseObject* Factory::fabricate( intclassID)142 BaseObject* Factory::fabricate(const NewClassID& classID) 152 143 { 153 144 if (Factory::_factoryList == NULL) … … 157 148 for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++) 158 149 if (*(*factory) == classID) 159 160 161 150 { 151 PRINTF(4)("Create a new Object of type %s\n", (*factory)->getCName()); 152 return (*factory)->fabricateObject(NULL); 162 153 163 164 PRINTF(2)("Could not Fabricate an Object of ClassID ' 0x%h'\n", classID);154 } 155 PRINTF(2)("Could not Fabricate an Object of ClassID '%d'\n", classID.id()); 165 156 return NULL; 166 157 } 167 168 169 /**170 * @brief Creates a new Object of type classID171 * @param classID the ClassID to match for the newly created Object172 * @returns a new Object of Type classID on match, NULL otherwise173 */174 BaseObject* Factory::fabricate(const NewClassID& classID)175 {176 return Factory::fabricate(classID.id());177 } -
branches/new_class_id/src/lib/util/loading/factory.h
r9691 r9709 20 20 21 21 22 #ifndef _ FACTORY_H23 #define _ FACTORY_H22 #ifndef __FACTORY_H 23 #define __FACTORY_H 24 24 25 25 class BaseObject; … … 27 27 #include "parser/tinyxml/tinyxml.h" 28 28 #include "base_object.h" 29 #include <vector>30 29 #include <list> 31 30 … … 34 33 * this should be used at the beginning of all the Classes that should be loadable (in the cc-file) 35 34 */ 36 #define CREATE_FACTORY(CLASS_NAME , CLASS_ID) \37 tFactory<CLASS_NAME>* global_##CLASS_NAME##_Factory = new tFactory<CLASS_NAME>( #CLASS_NAME, CLASS_ID)35 #define CREATE_FACTORY(CLASS_NAME) \ 36 tFactory<CLASS_NAME>* global_##CLASS_NAME##_Factory = new tFactory<CLASS_NAME>(CLASS_NAME::classID()) 38 37 39 38 //! The Factory is a loadable object handler … … 48 47 static BaseObject* fabricate(const std::string& className); 49 48 static BaseObject* fabricate(const NewClassID& classID); 50 static BaseObject* fabricate(int classID); 51 static BaseObject* fabricate(const TiXmlElement* root = NULL); 49 static BaseObject* fabricate(const TiXmlElement* root); 52 50 53 51 54 52 bool operator==(int classID) const; 55 bool operator==(const char* className) const;56 53 bool operator==(const std::string& className) const; 54 bool operator==(const NewClassID& classID) const { return _classID == classID; }; 57 55 58 56 protected: 59 Factory (const std::string& factoryName, int classID);57 Factory (const NewClassID& id); 60 58 virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const = 0; 61 59 60 private: 61 Factory (const Factory&) {}; 62 62 63 protected: 63 const int _classID; //!< The Class-Identifyer of the Factory. 64 const std::string _className; //!< The name of the Class. 64 const NewClassID _classID; //!< The Class-Identifyer of the Factory. 65 65 static std::list<Factory*>* _factoryList; //!< List of Registered Factories 66 66 }; … … 78 78 * @param classID the ID of the Class to be created. 79 79 */ 80 tFactory (const char* factoryName, intclassID)81 : Factory( factoryName,classID)80 tFactory (const NewClassID& classID) 81 : Factory(classID) 82 82 { } 83 83 84 84 private: 85 tFactory (const tFactory&) {}; 85 86 /** 86 87 * @brief fabricates an Object of type T, with the constructor T::T(const TiXmlElemnt*) -
branches/new_class_id/src/lib/util/loading/fast_factory.h
r9707 r9709 122 122 { 123 123 public: 124 static tFastFactory<T>* getFastFactory(const NewClassID& classID, const std::string& fastFactoryName = NULL);124 static tFastFactory<T>* getFastFactory(const NewClassID& classID, const std::string& fastFactoryName); 125 125 126 126 private: -
branches/new_class_id/src/orxonox.cc
r9406 r9709 46 46 47 47 #include "util/loading/factory.h" 48 #include " fast_factory.h"48 #include "loading/fast_factory.h" 49 49 50 50 #include "benchmark.h" 51 51 52 #include "class_list.h"53 52 #include "shell_command_class.h" 54 53 #include "shell_command.h" … … 97 96 REGISTER_ARG_ARG( _, write_dict, "compression", "writedict", "write packets to DATA/dicts/newdict", "numBytes" ); 98 97 98 NewObjectListDefinition(Orxonox); 99 99 100 100 /** … … 105 105 Orxonox::Orxonox () 106 106 { 107 this-> setClassID(CL_ORXONOX, "Orxonox");107 this->registerObject(this, Orxonox::_objectList); 108 108 this->setName("orxonox-main"); 109 109 … … 146 146 147 147 SDL_QuitSubSystem(SDL_INIT_TIMER); 148 ClassList::debug(); 148 149 150 NewObjectListBase::debugAll(1); 149 151 150 152 Preferences::getInstance()->save(); -
branches/new_class_id/src/orxonox.h
r7256 r9709 16 16 */ 17 17 class Orxonox : public BaseObject { 18 NewObjectListDeclaration(Orxonox); 18 19 19 20 public: -
branches/new_class_id/src/story_entities/campaign.cc
r9406 r9709 27 27 28 28 29 NewObjectListDefinition(Campaign); 29 30 30 31 /** … … 36 37 Campaign::Campaign ( TiXmlElement* root) 37 38 { 38 this-> setClassID(CL_CAMPAIGN, "Campaign");39 this->registerObject(this, Campaign::_objectList); 39 40 40 41 PRINTF(4)("Loading Campaign...\n"); -
branches/new_class_id/src/story_entities/campaign.h
r6874 r9709 18 18 class Campaign : public StoryEntity 19 19 { 20 20 NewObjectListDeclaration(Campaign); 21 21 public: 22 22 Campaign( TiXmlElement* root); -
branches/new_class_id/src/story_entities/campaign_data.cc
r9406 r9709 25 25 26 26 27 NewObjectListDefinition(CampaignData); 27 28 28 29 /** … … 31 32 CampaignData::CampaignData(const TiXmlElement* root) 32 33 { 33 this-> setClassID(CL_CAMPAIGN_DATA, "CampaignData");34 this->registerObject(this, CampaignData::_objectList); 34 35 35 36 this->currentEntity = NULL; -
branches/new_class_id/src/story_entities/campaign_data.h
r7370 r9709 16 16 class CampaignData : public DataTank 17 17 { 18 NewObjectListDeclaration(CampaignData); 18 19 19 20 public: -
branches/new_class_id/src/story_entities/dedicated_server_world.cc
r9406 r9709 21 21 22 22 #include "util/loading/load_param.h" 23 #include " fast_factory.h"23 #include "loading/fast_factory.h" 24 24 #include "util/loading/factory.h" 25 25 -
branches/new_class_id/src/story_entities/game_world.cc
r9494 r9709 22 22 #include "util/loading/resource_manager.h" 23 23 #include "state.h" 24 #include "class_list.h"25 24 26 25 #include "util/loading/game_loader.h" … … 40 39 #include "util/loading/factory.h" 41 40 #include "util/loading/load_param.h" 42 #include " fast_factory.h"41 #include "loading/fast_factory.h" 43 42 #include "shell_command.h" 44 43 … … 63 62 64 63 #include "script_class.h" 65 CREATE_SCRIPTABLE_CLASS(GameWorld, CL_GAME_WORLD, 64 NewObjectListDefinition(GameWorld); 65 CREATE_SCRIPTABLE_CLASS(GameWorld, GameWorld::classID(), 66 66 addMethod("setPlaymode", ExecutorLua1<GameWorld,const std::string&>(&GameWorld::setPlaymode)) 67 67 ->addMethod("setSoundtrack", ExecutorLua1<GameWorld, const std::string&>(&GameWorld::setSoundtrack)) … … 77 77 78 78 79 80 79 GameWorld::GameWorld() 81 80 : StoryEntity() 82 81 { 83 this-> setClassID(CL_GAME_WORLD, "GameWorld");82 this->registerObject(this, GameWorld::_objectList); 84 83 this->setName("Preloaded World - no name yet"); 85 84 … … 432 431 // TICK everything 433 432 for (i = 0; i < this->dataTank->tickLists.size(); ++i) 434 this->tick(this->dataTank->objectManager->get ObjectList(this->dataTank->tickLists[i]), this->dtS);433 this->tick(this->dataTank->objectManager->getEntityList(this->dataTank->tickLists[i]), this->dtS); 435 434 436 435 /* update tick the rest */ … … 471 470 { 472 471 // object-object collision detection 473 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_00),474 this->dataTank->objectManager->get ObjectList(OM_GROUP_01_PROJ));475 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),476 this->dataTank->objectManager->get ObjectList(OM_GROUP_00_PROJ));477 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),478 this->dataTank->objectManager->get ObjectList(OM_GROUP_00));479 480 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),481 this->dataTank->objectManager->get ObjectList(OM_GROUP_02));482 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_02),483 this->dataTank->objectManager->get ObjectList(OM_GROUP_01_PROJ));484 485 486 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_00),487 this->dataTank->objectManager->get ObjectList(OM_COMMON));488 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),489 this->dataTank->objectManager->get ObjectList(OM_COMMON));472 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_00), 473 this->dataTank->objectManager->getEntityList(OM_GROUP_01_PROJ)); 474 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01), 475 this->dataTank->objectManager->getEntityList(OM_GROUP_00_PROJ)); 476 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01), 477 this->dataTank->objectManager->getEntityList(OM_GROUP_00)); 478 479 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01), 480 this->dataTank->objectManager->getEntityList(OM_GROUP_02)); 481 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_02), 482 this->dataTank->objectManager->getEntityList(OM_GROUP_01_PROJ)); 483 484 485 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_00), 486 this->dataTank->objectManager->getEntityList(OM_COMMON)); 487 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01), 488 this->dataTank->objectManager->getEntityList(OM_COMMON)); 490 489 491 490 // ground collision detection: BSP Model 492 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->get ObjectList(OM_GROUP_00));493 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->get ObjectList(OM_GROUP_01));491 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_GROUP_00)); 492 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_GROUP_01)); 494 493 } 495 494 … … 567 566 // glLoadIdentity(); 568 567 569 const std::list<BaseObject*>* reflectedWaters;570 568 MappedWater* mw; 571 569 572 if( (reflectedWaters = ClassList::getList(CL_MAPPED_WATER)) != NULL) 573 { 574 std::list<BaseObject*>::const_iterator it; 575 for (it = reflectedWaters->begin(); it != reflectedWaters->end(); it++) 576 { 577 mw = dynamic_cast<MappedWater*>(*it); 578 579 //camera and light 580 //this->dataTank->localCamera->apply (); 581 //this->dataTank->localCamera->project (); 582 583 LightManager::getInstance()->draw(); 584 585 586 // prepare for reflection rendering 587 mw->activateReflection(); 588 589 // draw everything to be included in the reflection 590 this->drawEntityList(State::getObjectManager()->getReflectionList()); 591 // for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i) 592 // this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i])); 593 594 // clean up from reflection rendering 595 mw->deactivateReflection(); 596 } 570 for (NewObjectList<MappedWater>::const_iterator it = MappedWater::objectList().begin(); 571 it != MappedWater::objectList().end(); 572 ++it) 573 { 574 mw = (*it); 575 576 //camera and light 577 //this->dataTank->localCamera->apply (); 578 //this->dataTank->localCamera->project (); 579 580 LightManager::getInstance()->draw(); 581 582 583 // prepare for reflection rendering 584 mw->activateReflection(); 585 586 // draw everything to be included in the reflection 587 this->drawEntityList(State::getObjectManager()->getReflectionList()); 588 // for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i) 589 // this->drawEntityList(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i])); 590 591 // clean up from reflection rendering 592 mw->deactivateReflection(); 597 593 } 598 594 … … 609 605 //glLoadIdentity(); 610 606 611 const std::list<BaseObject*>* reflectedWaters;612 607 MappedWater* mw; 613 608 614 if( (reflectedWaters = ClassList::getList(CL_MAPPED_WATER)) != NULL) 615 { 616 std::list<BaseObject*>::const_iterator it; 617 for (it = reflectedWaters->begin(); it != reflectedWaters->end(); it++) 618 { 619 mw = dynamic_cast<MappedWater*>(*it); 620 621 //camera and light 622 //this->dataTank->localCamera->apply (); 623 //this->dataTank->localCamera->project (); 624 // prepare for reflection rendering 625 mw->activateRefraction(); 626 627 628 LightManager::getInstance()->draw(); 629 // draw everything to be included in the reflection 630 this->drawEntityList(State::getObjectManager()->getReflectionList()); 631 // for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i) 632 // this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i])); 633 634 // clean up from reflection rendering 635 mw->deactivateRefraction(); 636 } 609 for (NewObjectList<MappedWater>::const_iterator it = MappedWater::objectList().begin(); 610 it != MappedWater::objectList().end(); 611 ++it) 612 { 613 mw = dynamic_cast<MappedWater*>(*it); 614 615 //camera and light 616 //this->dataTank->localCamera->apply (); 617 //this->dataTank->localCamera->project (); 618 // prepare for reflection rendering 619 mw->activateRefraction(); 620 621 622 LightManager::getInstance()->draw(); 623 // draw everything to be included in the reflection 624 this->drawEntityList(State::getObjectManager()->getReflectionList()); 625 // for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i) 626 // this->drawEntityList(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i])); 627 628 // clean up from reflection rendering 629 mw->deactivateRefraction(); 637 630 } 638 631 } … … 659 652 { 660 653 /* Draw the BackGround */ 661 this->drawEntityList(State::getObjectManager()->get ObjectList(OM_BACKGROUND));654 this->drawEntityList(State::getObjectManager()->getEntityList(OM_BACKGROUND)); 662 655 engine->drawBackgroundElements(); 663 656 664 657 /* draw all WorldEntiy groups */ 665 658 for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i) 666 this->drawEntityList(State::getObjectManager()->get ObjectList(this->dataTank->drawLists[i]));659 this->drawEntityList(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i])); 667 660 668 661 AtmosphericEngine::getInstance()->draw(); … … 672 665 CDEngine* engine = CDEngine::getInstance(); 673 666 for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i) 674 engine->drawBV(State::getObjectManager()->get ObjectList(this->dataTank->drawLists[i]), this->showBVLevel);667 engine->drawBV(State::getObjectManager()->getEntityList(this->dataTank->drawLists[i]), this->showBVLevel); 675 668 } 676 669 -
branches/new_class_id/src/story_entities/game_world.h
r9235 r9709 31 31 class GameWorld : public StoryEntity 32 32 { 33 NewObjectListDeclaration(GameWorld); 34 33 35 public: 34 36 GameWorld (); -
branches/new_class_id/src/story_entities/game_world_data.cc
r9406 r9709 23 23 #include "util/loading/resource_manager.h" 24 24 #include "state.h" 25 #include "class_list.h"26 25 #include "substring.h" 27 26 … … 41 40 42 41 #include "util/loading/factory.h" 43 #include " fast_factory.h"42 #include "loading/fast_factory.h" 44 43 #include "util/loading/load_param.h" 45 44 46 45 #include "graphics_engine.h" 46 #include "effects/graphics_effect.h" 47 47 #include "effects/atmospheric_engine.h" 48 48 #include "event_handler.h" … … 61 61 62 62 63 64 65 63 NewObjectListDefinition(GameWorldData); 66 64 /** 67 65 * constructor of the GameWorldData … … 69 67 GameWorldData::GameWorldData() 70 68 { 71 this-> setClassID(CL_GAME_WORLD_DATA, "GameWorldData");69 this->registerObject(this, GameWorldData::_objectList); 72 70 73 71 this->glmis = NULL; … … 215 213 216 214 //todo do this more elegant 217 if( element->Value() == "SkyBox" && created->isA( CL_SKYBOX))215 if( element->Value() == "SkyBox" && created->isA(SkyBox::classID())) 218 216 { 219 217 this->sky = dynamic_cast<WorldEntity*>(created); 220 218 State::setSkyBox(dynamic_cast<SkyBox*>(this->sky)); 221 219 } 222 if( element->Value() == "Terrain" && created->isA( CL_TERRAIN))220 if( element->Value() == "Terrain" && created->isA(Terrain::classID())) 223 221 { 224 222 this->terrain = dynamic_cast<Terrain*>(created); … … 236 234 237 235 Playable* playable; 238 const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE); 239 if (playableList != NULL && !playableList->empty()) 236 if (!Playable::objectList().empty()) 240 237 { 241 238 /// TODO Make this also loadable 242 playable = dynamic_cast<Playable*>(playableList->front()); 243 this->localPlayer->setPlayable(playable); 239 this->localPlayer->setPlayable(Playable::objectList().back()); 244 240 } 245 241 … … 280 276 GraphicsEngine::getInstance()->displayFPS(false); 281 277 // erease everything that is left. 282 // delete PNode::getNullParent(); // not needed as this is also done in the next step (and also much cleaner)283 const std::list<BaseObject*>* nodeList;284 278 //secondary cleanup of PNodes; 285 nodeList = ClassList::getList(CL_PARENT_NODE); 286 if (nodeList != NULL) 287 while (!nodeList->empty()) 288 { 289 // ClassList::debug( 3, CL_PARENT_NODE); 290 // PNode::getNullParent()->debugNode(0); 291 // printf("%s::%s\n", nodeList->front()->getClassCName(), nodeList->front()->getName()); 292 delete nodeList->front(); 293 } 279 while (!PNode::objectList().empty()) 280 delete PNode::objectList().front(); 281 294 282 /* remove the player object */ 295 283 if( this->localPlayer) … … 302 290 this->terrain = NULL; 303 291 304 nodeList = ClassList::getList(CL_GRAPHICS_EFFECT); 305 if (nodeList != NULL) 306 while (!nodeList->empty()) 307 delete nodeList->front(); 308 309 310 nodeList = ClassList::getList(CL_ELEMENT_2D); 311 if (nodeList != NULL) 312 while (!nodeList->empty()) 313 delete nodeList->front(); 292 while (!GraphicsEffect::objectList().empty()) 293 delete GraphicsEffect::objectList().front(); 294 295 296 while (!Element2D::objectList().empty()) 297 delete Element2D::objectList().front(); 314 298 315 299 // At this Point all the WorldEntites should be unloaded. … … 414 398 PRINTF(2)("creating %s\n", element->Value()); 415 399 BaseObject* created = Factory::fabricate(element); 416 if (created != NULL && created->isA( CL_GAME_RULES))400 if (created != NULL && created->isA(GameRules::classID())) 417 401 { 418 402 this->gameRule = dynamic_cast<GameRules*>(created); -
branches/new_class_id/src/story_entities/game_world_data.h
r9406 r9709 30 30 class GameWorldData : public DataTank 31 31 { 32 NewObjectListDeclaration(GameWorldData); 32 33 public: 33 34 GameWorldData(); -
branches/new_class_id/src/story_entities/menu/game_menu.cc
r9656 r9709 22 22 23 23 #include "state.h" 24 #include "class_list.h"25 24 26 25 #include "util/loading/load_param.h" … … 43 42 #include "preferences.h" 44 43 44 #include "class_id.h" 45 45 //! This creates a Factory to fabricate a GameMenu 46 CREATE_FACTORY(GameMenu, CL_GAME_MENU);47 46 NewObjectListDefinitionID(GameMenu, CL_GAME_MENU); 47 CREATE_FACTORY(GameMenu); 48 48 49 49 … … 51 51 : GameWorld() 52 52 { 53 this-> setClassID(CL_GAME_MENU, "GameMenu");53 this->registerObject(this, GameMenu::_objectList); 54 54 this->setName("GameMenu uninitialized"); 55 55 … … 191 191 image->setForegroundColor(Color( 1,1,1,.6)); 192 192 193 const std::list<BaseObject*>* storyEntities = ClassList::getList(CL_STORY_ENTITY);194 std::list<BaseObject*>::const_iterator it;195 193 bool first = true; 196 for( it = storyEntities->begin(); it != storyEntities->end(); it++) 194 for(NewObjectList<StoryEntity>::const_iterator it = StoryEntity::objectList().begin(); 195 it != StoryEntity::objectList().end(); 196 ++it) 197 197 { 198 StoryEntity* se = dynamic_cast<StoryEntity*>(*it);198 StoryEntity* se = *it; 199 199 if( se->isContainedInMenu()) 200 200 { -
branches/new_class_id/src/story_entities/menu/game_menu.h
r9406 r9709 22 22 class GameMenu : virtual public GameWorld, virtual public EventListener 23 23 { 24 24 NewObjectListDeclaration(GameMenu); 25 25 public: 26 26 GameMenu(const TiXmlElement* root = NULL); … … 45 45 void showMultiPlayer(); 46 46 void showOptionsMenu(); 47 47 48 48 void showClientMenu(); 49 49 void connectToServer(); 50 50 51 51 void showServerMenu(); 52 52 void createMasterServer(); … … 69 69 void setSelectorSound(const std::string& selectorSound); 70 70 71 71 72 72 73 73 … … 76 76 OrxGui::GLGuiBox* levelsBox; 77 77 OrxGui::GLGuiBox* networkBox; 78 78 79 79 OrxGui::GLGuiBox* clientNetworkBox; 80 80 OrxGui::GLGuiInputLine* ipInputLine; 81 81 82 82 OrxGui::GLGuiBox* serverNetworkBox; 83 83 -
branches/new_class_id/src/story_entities/movie_loader.cc
r9406 r9709 25 25 26 26 27 28 CREATE_FACTORY(MovieLoader, CL_MOVIE_LOADER); 27 #include "class_id.h" 28 NewObjectListDefinitionID(MovieLoader, CL_MOVIE_LOADER); 29 CREATE_FACTORY(MovieLoader); 29 30 30 31 MovieLoader::MovieLoader(const TiXmlElement* root) 31 32 { 32 this-> setClassID(CL_MOVIE_LOADER, "MovieLoader");33 this->registerObject(this, MovieLoader::_objectList); 33 34 34 35 movie_player = new MoviePlayer(); -
branches/new_class_id/src/story_entities/movie_loader.h
r7221 r9709 15 15 class MovieLoader : public StoryEntity, virtual public EventListener 16 16 { 17 NewObjectListDeclaration(MovieLoader); 17 18 private: 18 19 MoviePlayer* movie_player; -
branches/new_class_id/src/story_entities/multi_player_world.cc
r9656 r9709 36 36 SHELL_COMMAND(debug, MultiPlayerWorld, debug); 37 37 38 38 #include "class_id.h" 39 39 //! This creates a Factory to fabricate a MultiPlayerWorld 40 CREATE_FACTORY(MultiPlayerWorld, CL_MULTI_PLAYER_WORLD);41 40 NewObjectListDefinitionID(MultiPlayerWorld, CL_MULTI_PLAYER_WORLD); 41 CREATE_FACTORY(MultiPlayerWorld); 42 42 43 43 MultiPlayerWorld::MultiPlayerWorld(const TiXmlElement* root) 44 44 : GameWorld() 45 45 { 46 this-> setClassID(CL_MULTI_PLAYER_WORLD, "MultiPlayerWorld");46 this->registerObject(this, MultiPlayerWorld::_objectList); 47 47 48 48 this->dataTank = new MultiPlayerWorldData(); … … 95 95 void MultiPlayerWorld::collisionDetection() 96 96 { 97 //CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_PLAYERS), this->dataTank->objectManager->getObjectList(OM_PLAYERS));97 //CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_PLAYERS), this->dataTank->objectManager->getEntityList(OM_PLAYERS)); 98 98 99 99 PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_GROUP_01_PROJ\n\n"); 100 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_PLAYERS),101 this->dataTank->objectManager->get ObjectList(OM_GROUP_00_PROJ));100 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_PLAYERS), 101 this->dataTank->objectManager->getEntityList(OM_GROUP_00_PROJ)); 102 102 PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_GROUP_01_PROJ\n\n"); 103 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_PLAYERS),104 this->dataTank->objectManager->get ObjectList(OM_GROUP_01_PROJ));103 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_PLAYERS), 104 this->dataTank->objectManager->getEntityList(OM_GROUP_01_PROJ)); 105 105 PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_PLAYERS_PROJ\n\n"); 106 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_PLAYERS),107 this->dataTank->objectManager->get ObjectList(OM_PLAYERS_PROJ));106 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_PLAYERS), 107 this->dataTank->objectManager->getEntityList(OM_PLAYERS_PROJ)); 108 108 109 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_00),110 this->dataTank->objectManager->get ObjectList(OM_PLAYERS));111 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),112 this->dataTank->objectManager->get ObjectList(OM_PLAYERS));109 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_00), 110 this->dataTank->objectManager->getEntityList(OM_PLAYERS)); 111 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01), 112 this->dataTank->objectManager->getEntityList(OM_PLAYERS)); 113 113 114 114 115 115 116 116 PRINTF(5)("\n-----------------------------------------\nchecking OM_GROUP_00 vs OM_GROUP_01_PROJ\n\n"); 117 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_00),118 this->dataTank->objectManager->get ObjectList(OM_GROUP_01_PROJ));117 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_00), 118 this->dataTank->objectManager->getEntityList(OM_GROUP_01_PROJ)); 119 119 PRINTF(5)("\n-----------------------------------------\nchecking OM_GROUP_00 vs OM_GROUP_01\n\n"); 120 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_00),121 this->dataTank->objectManager->get ObjectList(OM_GROUP_01));122 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_00),123 this->dataTank->objectManager->get ObjectList(OM_PLAYERS_PROJ));120 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_00), 121 this->dataTank->objectManager->getEntityList(OM_GROUP_01)); 122 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_00), 123 this->dataTank->objectManager->getEntityList(OM_PLAYERS_PROJ)); 124 124 125 125 PRINTF(5)("\n-----------------------------------------\nchecking OM_GROUP_01 vs OM_GROUP_00_PROJ\n\n"); 126 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),127 this->dataTank->objectManager->get ObjectList(OM_GROUP_00_PROJ));128 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),129 this->dataTank->objectManager->get ObjectList(OM_GROUP_00));130 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->get ObjectList(OM_GROUP_01),131 this->dataTank->objectManager->get ObjectList(OM_PLAYERS_PROJ));126 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01), 127 this->dataTank->objectManager->getEntityList(OM_GROUP_00_PROJ)); 128 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01), 129 this->dataTank->objectManager->getEntityList(OM_GROUP_00)); 130 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getEntityList(OM_GROUP_01), 131 this->dataTank->objectManager->getEntityList(OM_PLAYERS_PROJ)); 132 132 133 133 134 134 135 135 // ground collision detection: BSP Model 136 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->get ObjectList(OM_GROUP_00));137 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->get ObjectList(OM_GROUP_01));138 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->get ObjectList(OM_PLAYERS));136 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_GROUP_00)); 137 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_GROUP_01)); 138 CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getEntityList(OM_PLAYERS)); 139 139 } 140 140 -
branches/new_class_id/src/story_entities/multi_player_world.h
r8228 r9709 20 20 */ 21 21 class MultiPlayerWorld : public GameWorld { 22 22 NewObjectListDeclaration(MultiPlayerWorld); 23 23 public: 24 24 MultiPlayerWorld (const TiXmlElement* root = NULL); … … 26 26 27 27 virtual void loadParams(const TiXmlElement* root); 28 28 29 29 virtual ErrorMessage unloadData(); 30 30 -
branches/new_class_id/src/story_entities/multi_player_world_data.cc
r9494 r9709 20 20 #include "util/loading/resource_manager.h" 21 21 #include "state.h" 22 #include "class_list.h"23 22 #include "substring.h" 24 23 … … 40 39 41 40 #include "util/loading/factory.h" 42 #include " fast_factory.h"41 #include "loading/fast_factory.h" 43 42 #include "util/loading/load_param.h" 44 43 … … 50 49 51 50 #include "glmenu_imagescreen.h" 52 53 54 55 56 51 57 52 … … 313 308 { 314 309 PRINT(0)("==================================================\n"); 310 315 311 Playable* playable; 316 const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE); 317 assert(playableList != NULL); 318 std::list<BaseObject*>::const_iterator entity; 319 320 321 322 for (entity = playableList->begin(); entity != playableList->end(); entity++) 323 { 324 Playable* p = dynamic_cast<Playable*>(*entity); 312 313 for (NewObjectList<Playable>::const_iterator entity = Playable::objectList().begin(); 314 entity != Playable::objectList().end(); 315 ++entity) 316 { 317 Playable* p = *entity; 325 318 PRINTF(0)("Got a playable, class: %s, name: %s, uid: %i\n", (*entity)->getClassCName(), (*entity)->getCName(), p->getUniqueID()); 326 319 } … … 329 322 if( this->toggle) 330 323 { 331 playable = dynamic_cast<Playable*>(playableList->front());324 playable = Playable::objectList().front(); 332 325 this->localPlayer->setPlayable(playable); 333 326 this->toggle = !this->toggle; … … 335 328 else 336 329 { 337 playable = dynamic_cast<Playable*>(playableList->back());330 playable = Playable::objectList().back(); 338 331 this->localPlayer->setPlayable(playable); 339 332 this->toggle = !this->toggle; -
branches/new_class_id/src/story_entities/single_player_world.cc
r9406 r9709 20 20 21 21 #include "state.h" 22 #include "class_list.h"23 22 24 23 #include "util/loading/load_param.h" 25 #include " fast_factory.h"24 #include "loading/fast_factory.h" 26 25 #include "util/loading/factory.h" 27 26 … … 30 29 31 30 32 33 34 31 #include "class_id.h" 35 32 //! This creates a Factory to fabricate a SinglePlayerWorld 36 CREATE_FACTORY(SinglePlayerWorld, CL_SINGLE_PLAYER_WORLD); 37 38 33 NewObjectListDefinitionID(SinglePlayerWorld, CL_SINGLE_PLAYER_WORLD); 34 CREATE_FACTORY(SinglePlayerWorld); 39 35 40 36 SinglePlayerWorld::SinglePlayerWorld(const TiXmlElement* root) 41 37 : GameWorld() 42 38 { 43 this-> setClassID(CL_SINGLE_PLAYER_WORLD, "SinglePlayerWorld");39 this->registerObject(this, SinglePlayerWorld::_objectList); 44 40 this->setName("SinglePlayerWorld uninitialized"); 45 41 -
branches/new_class_id/src/story_entities/single_player_world.h
r6512 r9709 22 22 class SinglePlayerWorld : public GameWorld 23 23 { 24 NewObjectListDeclaration(SinglePlayerWorld); 24 25 25 26 public: -
branches/new_class_id/src/story_entities/story_entity.cc
r9406 r9709 27 27 28 28 29 29 NewObjectListDefinition(StoryEntity); 30 30 31 31 /** … … 34 34 StoryEntity::StoryEntity () 35 35 { 36 this-> setClassID(CL_STORY_ENTITY, "StoryEntity");36 this->registerObject(this, StoryEntity::_objectList); 37 37 38 38 this->bInit = false; -
branches/new_class_id/src/story_entities/story_entity.h
r8717 r9709 26 26 class StoryEntity : virtual public BaseObject 27 27 { 28 NewObjectListDeclaration(StoryEntity); 28 29 29 30 public: -
branches/new_class_id/src/subprojects/network/simple_sync.cc
r7954 r9709 23 23 24 24 #include "class_id.h" 25 #include " fast_factory.h"25 #include "loading/fast_factory.h" 26 26 #include "lib/util/loading/factory.h" 27 27 -
branches/new_class_id/src/util/Makefile.am
r9494 r9709 4 4 noinst_LIBRARIES = libORXutils.a 5 5 6 libORXutils_a_SOURCES = fast_factory.cc\6 libORXutils_a_SOURCES = \ 7 7 object_manager.cc \ 8 8 state.cc \ … … 31 31 track/track_node.cc 32 32 33 noinst_HEADERS = fast_factory.h\33 noinst_HEADERS = \ 34 34 object_manager.h \ 35 35 state.h \ -
branches/new_class_id/src/util/kill_target.cc
r9705 r9709 23 23 24 24 #include "class_id.h" 25 CREATE_FACTORY(KillTarget, CL_KILL_TARGET);26 25 NewObjectListDefinitionID(KillTarget, CL_KILL_TARGET); 26 CREATE_FACTORY(KillTarget); 27 27 28 28 -
branches/new_class_id/src/util/multiplayer_team_deathmatch.cc
r9705 r9709 50 50 #include "class_id.h" 51 51 52 CREATE_FACTORY(MultiplayerTeamDeathmatch, CL_MULTIPLAYER_TEAM_DEATHMATCH);53 52 NewObjectListDefinitionID(MultiplayerTeamDeathmatch, CL_MULTIPLAYER_TEAM_DEATHMATCH); 53 CREATE_FACTORY(MultiplayerTeamDeathmatch); 54 54 /** 55 55 * constructor -
branches/new_class_id/src/util/singleplayer_shootemup.cc
r9705 r9709 26 26 27 27 #include "class_id.h" 28 CREATE_FACTORY(SingleplayerShootemup, CL_SINGLEPLAYER_SHOOTEMUP);29 28 NewObjectListDefinitionID(SingleplayerShootemup, CL_SINGLEPLAYER_SHOOTEMUP); 29 CREATE_FACTORY(SingleplayerShootemup); 30 30 31 31 /** -
branches/new_class_id/src/world_entities/bsp_entity.cc
r9656 r9709 18 18 #include "util/loading/resource_manager.h" 19 19 20 CREATE_FACTORY(BspEntity, CL_BSP_ENTITY); 20 #include "class_id.h" 21 NewObjectListDefinitionID(BspEntity, CL_BSP_ENTITY); 22 CREATE_FACTORY(BspEntity); 21 23 22 24 … … 51 53 void BspEntity::init() 52 54 { 55 this->registerObject(this, BspEntity::_objectList); 53 56 54 57 this->bspManager = NULL; … … 69 72 if ( File(ResourceManager::getFullName(name)).exists() ) { 70 73 71 this->setClassID(CL_BSP_ENTITY, "BspEntity");72 74 this->bspManager = new BspManager(this); 73 75 -
branches/new_class_id/src/world_entities/character_attributes.cc
r9406 r9709 1 1 2 2 3 /* 3 /* 4 4 orxonox - the future of 3D-vertical-scrollers 5 5 … … 18 18 19 19 #include "character_attributes.h" 20 #include "stdincl.h" 21 22 20 21 22 NewObjectListDefinition(CharacterAttributes); 23 23 24 24 … … 27 27 @todo this constructor is not jet implemented - do it 28 28 */ 29 CharacterAttributes::CharacterAttributes () 30 { 31 this->setClassID(CL_CHARACTER_ATTRIBUTES, "CharacterAttributes");29 CharacterAttributes::CharacterAttributes () 30 { 31 this->registerObject(this, CharacterAttributes::_objectList); 32 32 } 33 33 … … 37 37 38 38 */ 39 CharacterAttributes::~CharacterAttributes () 39 CharacterAttributes::~CharacterAttributes () 40 40 { 41 41 } … … 97 97 98 98 /** 99 * sets maximum health 99 * sets maximum health 100 100 * @param health 101 101 … … 130 130 * adds shield strength 131 131 * @param strength 132 132 133 133 there is currently no limit to shieldstrength 134 134 */ … … 290 290 /*=====================energy=====================*/ 291 291 /** 292 * sets the amount of energy 292 * sets the amount of energy 293 293 * @param energy 294 294 */ … … 332 332 333 333 /** 334 * gets the amount of energy 334 * gets the amount of energy 335 335 * @returns energy 336 336 */ … … 358 358 return this->energyConsumption; 359 359 } 360 360 361 361 362 362 /** -
branches/new_class_id/src/world_entities/character_attributes.h
r5039 r9709 15 15 */ 16 16 class CharacterAttributes : public BaseObject { 17 NewObjectListDeclaration(CharacterAttributes); 17 18 18 19 public: -
branches/new_class_id/src/world_entities/creatures/fps_player.cc
r9494 r9709 32 32 33 33 #include "aabb.h" 34 34 #include "bsp_entity.h" 35 35 36 36 #include "key_mapper.h" … … 41 41 42 42 43 44 CREATE_FACTORY(FPSPlayer, CL_FPS_PLAYER); 43 #include "class_id.h" 44 NewObjectListDefinitionID(FPSPlayer, CL_FPS_PLAYER); 45 CREATE_FACTORY(FPSPlayer); 45 46 46 47 #include "script_class.h" 47 CREATE_SCRIPTABLE_CLASS(FPSPlayer, CL_FPS_PLAYER,48 CREATE_SCRIPTABLE_CLASS(FPSPlayer, FPSPlayer::classID(), 48 49 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 49 50 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) … … 85 86 void FPSPlayer::init() 86 87 { 87 this-> setClassID(CL_FPS_PLAYER, "FPSPlayer");88 this->registerObject(this, FPSPlayer::_objectList); 88 89 89 90 this->bLeft = false; … … 166 167 167 168 //subscribe to collision reaction 168 this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, CL_BSP_ENTITY);169 this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, BspEntity::classID()); 169 170 170 171 this->initWeapon = false; -
branches/new_class_id/src/world_entities/creatures/fps_player.h
r9235 r9709 16 16 class FPSPlayer : public Playable 17 17 { 18 NewObjectListDeclaration(FPSPlayer); 18 19 19 20 public: -
branches/new_class_id/src/world_entities/creatures/md2_creature.cc
r8724 r9709 37 37 #include "debug.h" 38 38 39 CREATE_FACTORY(MD2Creature, CL_MD2_CREATURE); 39 #include "class_id.h" 40 NewObjectListDefinitionID(MD2Creature, CL_MD2_CREATURE); 41 CREATE_FACTORY(MD2Creature); 40 42 41 43 /** … … 86 88 PRINTF(4)("MD2CREATURE INIT\n"); 87 89 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 88 this-> setClassID(CL_MD2_CREATURE, "MD2Creature");90 this->registerObject(this, MD2Creature::_objectList); 89 91 90 92 this->toList(OM_GROUP_01); … … 95 97 Weapon* wpLeft = new TestGun(1); 96 98 wpLeft->setName("testGun Left"); 97 Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate( CL_CANNON));99 Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate("Cannon")); 98 100 99 101 cannon->setName("BFG"); … … 112 114 this->cameraConnNode.addChild(State::getCameraNode()); 113 115 State::getCameraTargetNode()->setRelCoor(10,0,0); 114 116 115 117 116 118 -
branches/new_class_id/src/world_entities/creatures/md2_creature.h
r8724 r9709 16 16 class MD2Creature : public Playable 17 17 { 18 NewObjectListDeclaration(MD2Creature); 18 19 19 20 public: -
branches/new_class_id/src/world_entities/effects/billboard.cc
r9707 r9709 27 27 28 28 #include "class_id.h" 29 CREATE_FACTORY(Billboard, CL_BILLBOARD);30 29 NewObjectListDefinitionID(Billboard, CL_BILLBOARD); 30 CREATE_FACTORY(Billboard); 31 31 32 32 /** -
branches/new_class_id/src/world_entities/effects/explosion.cc
r9707 r9709 18 18 #include "explosion.h" 19 19 20 #include " fast_factory.h"20 #include "loading/fast_factory.h" 21 21 22 22 #include "state.h" … … 28 28 29 29 #include "class_id.h" 30 NewObjectListDefinitionID(Explosion, CL_EXPLOSION); 30 31 CREATE_FAST_FACTORY_STATIC(Explosion); 31 NewObjectListDefinitionID(Explosion, CL_EXPLOSION);32 32 33 33 /** -
branches/new_class_id/src/world_entities/effects/lightning_bolt.cc
r9406 r9709 25 25 26 26 27 28 CREATE_FACTORY(LightningBolt, CL_LIGHTNING_BOLT);29 27 #include "class_id.h" 28 NewObjectListDefinitionID(LightningBolt, CL_LIGHTNING_BOLT); 29 CREATE_FACTORY(LightningBolt); 30 30 31 31 /** … … 34 34 LightningBolt::LightningBolt (const TiXmlElement* root) 35 35 { 36 this-> setClassID(CL_LIGHTNING_BOLT, "LightningBolt");36 this->registerObject(this, LightningBolt::_objectList); 37 37 38 38 this->toList(OM_COMMON); -
branches/new_class_id/src/world_entities/effects/lightning_bolt.h
r7460 r9709 21 21 class LightningBolt : public WorldEntity 22 22 { 23 NewObjectListDeclaration(LightningBolt); 23 24 public: 24 25 LightningBolt(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/elements/image_entity.cc
r9406 r9709 30 30 31 31 32 CREATE_FACTORY(ImageEntity, CL_IMAGE_ENTITY); 32 #include "class_id.h" 33 NewObjectListDefinitionID(ImageEntity, CL_IMAGE_ENTITY); 34 CREATE_FACTORY(ImageEntity); 33 35 34 36 … … 59 61 void ImageEntity::init() 60 62 { 61 this-> setClassID(CL_IMAGE_ENTITY, "ImageEntity");63 this->registerObject(this, ImageEntity::_objectList); 62 64 this->setName("ImageEntity"); 63 65 -
branches/new_class_id/src/world_entities/elements/image_entity.h
r7751 r9709 21 21 //! A class that enables the 22 22 class ImageEntity : public PNode, public Element2D { 23 NewObjectListDeclaration(ImageEntity); 23 24 24 25 public: -
branches/new_class_id/src/world_entities/elements/text_element.cc
r9406 r9709 27 27 28 28 29 30 CREATE_FACTORY(TextElement, CL_TEXT_ELEMENT); 29 #include "class_id.h" 30 NewObjectListDefinitionID(TextElement, CL_TEXT_ELEMENT); 31 CREATE_FACTORY(TextElement); 31 32 32 33 … … 36 37 TextElement::TextElement (const TiXmlElement* root) 37 38 { 38 this-> setClassID(CL_TEXT_ELEMENT, "TextElement");39 this->registerObject(this, TextElement::_objectList); 39 40 this->setName("TextElement"); 40 41 -
branches/new_class_id/src/world_entities/elements/text_element.h
r7221 r9709 21 21 //! A class that enables the 22 22 class TextElement : public Text { 23 NewObjectListDeclaration(TextElement); 23 24 24 25 public: -
branches/new_class_id/src/world_entities/environment.cc
r9406 r9709 22 22 #include "util/loading/resource_manager.h" 23 23 24 #include "vector.h"25 24 #include "objModel.h" 26 25 #include "obb_tree.h" 27 26 #include "util/loading/factory.h" 28 27 29 30 CREATE_FACTORY(Environment, CL_ENVIRONMENT); 28 #include "class_id.h" 29 NewObjectListDefinitionID(Environment, CL_ENVIRONMENT); 30 CREATE_FACTORY(Environment); 31 31 32 32 /** … … 63 63 void Environment::init() 64 64 { 65 this-> setClassID(CL_ENVIRONMENT, "Environment");65 this->registerObject(this, Environment::_objectList); 66 66 this->toList(OM_ENVIRON); 67 67 } -
branches/new_class_id/src/world_entities/environment.h
r6512 r9709 16 16 class Environment : public WorldEntity 17 17 { 18 friend class World;18 NewObjectListDeclaration(Environment); 19 19 20 20 public: -
branches/new_class_id/src/world_entities/environments/building.cc
r9406 r9709 23 23 24 24 25 26 CREATE_FACTORY(Building, CL_BUILDING); 25 #include "class_id.h" 26 NewObjectListDefinitionID(Building, CL_BUILDING); 27 CREATE_FACTORY(Building); 27 28 28 29 /** … … 31 32 Building::Building(const TiXmlElement* root) 32 33 { 33 this-> setClassID(CL_BUILDING, "Building");34 this->registerObject(this, Building::_objectList); 34 35 this->toList(OM_ENVIRON_NOTICK); 35 36 -
branches/new_class_id/src/world_entities/environments/building.h
r7041 r9709 15 15 class Building : public WorldEntity 16 16 { 17 public: 17 NewObjectListDeclaration(Building); 18 public: 18 19 Building(const TiXmlElement* root); 19 20 -
branches/new_class_id/src/world_entities/environments/mapped_water.cc
r9406 r9709 25 25 #include "script_class.h" 26 26 27 CREATE_FACTORY(MappedWater, CL_MAPPED_WATER); 27 #include "class_id.h" 28 NewObjectListDefinitionID(MappedWater, CL_MAPPED_WATER); 29 CREATE_FACTORY(MappedWater); 28 30 29 31 SHELL_COMMAND(gui, MappedWater, toggleGui); 30 32 SHELL_COMMAND(output, MappedWater, saveParams); 31 33 32 CREATE_SCRIPTABLE_CLASS(MappedWater, CL_MAPPED_WATER,34 CREATE_SCRIPTABLE_CLASS(MappedWater, MappedWater::classID(), 33 35 addMethod("waterUV", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterUV)) 34 36 ->addMethod("waterFlow", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterFlow)) … … 47 49 MappedWater::MappedWater(const TiXmlElement* root) 48 50 { 49 this-> setClassID(CL_MAPPED_WATER, "MappedWater");51 this->registerObject(this, MappedWater::_objectList); 50 52 this->toList(OM_ENVIRON); 51 53 -
branches/new_class_id/src/world_entities/environments/mapped_water.h
r9021 r9709 35 35 class MappedWater : public WorldEntity 36 36 { 37 NewObjectListDeclaration(MappedWater); 37 38 public: 38 39 MappedWater(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/environments/model_entity.cc
r9656 r9709 23 23 24 24 25 26 CREATE_FACTORY(ModelEntity, CL_MODEL_ENTITY); 25 #include "class_id.h" 26 NewObjectListDefinitionID(ModelEntity, CL_MODEL_ENTITY); 27 CREATE_FACTORY(ModelEntity); 27 28 28 29 /** … … 31 32 ModelEntity::ModelEntity(const TiXmlElement* root) 32 33 { 33 this-> setClassID(CL_MODEL_ENTITY, "ModelEntity");34 this->registerObject(this, ModelEntity::_objectList); 34 35 this->toList(OM_ENVIRON); 35 36 -
branches/new_class_id/src/world_entities/environments/model_entity.h
r7048 r9709 15 15 class ModelEntity : public WorldEntity 16 16 { 17 NewObjectListDeclaration(ModelEntity); 17 18 public: 18 19 ModelEntity(const TiXmlElement* root); -
branches/new_class_id/src/world_entities/environments/water.cc
r9656 r9709 33 33 34 34 35 36 CREATE_FACTORY(Water, CL_WATER); 35 #include "class_id.h" 36 NewObjectListDefinitionID(Water, CL_WATER); 37 CREATE_FACTORY(Water); 37 38 38 39 39 40 Water::Water(const TiXmlElement* root) 40 41 { 41 this-> setClassID(CL_WATER, "Water");42 this->registerObject(this, Water::_objectList); 42 43 this->toList(OM_ENVIRON); 43 44 … … 217 218 void Water::tick(float dt) 218 219 { 219 ObjectManager::EntityList entityList = State::getObjectManager()->get ObjectList(OM_GROUP_01_PROJ);220 ObjectManager::EntityList entityList = State::getObjectManager()->getEntityList(OM_GROUP_01_PROJ); 220 221 ObjectManager::EntityList::iterator entity = entityList.begin(); 221 222 while (entity != entityList.end()) -
branches/new_class_id/src/world_entities/environments/water.h
r7954 r9709 22 22 class Water : public WorldEntity 23 23 { 24 public: 24 NewObjectListDeclaration(Water); 25 public: 25 26 Water(const TiXmlElement* root = NULL); 26 27 virtual ~Water(); … … 38 39 void draw() const; 39 40 void tick(float dt); 40 41 41 42 virtual void varChangeHandler( std::list<int> & id ); 42 43 … … 52 53 Material waterMaterial; 53 54 Shader* waterShader; 54 55 55 56 float height; //!< The hight of the Water 56 57 int height_handle; //!< Handle to notify about changes of height -
branches/new_class_id/src/world_entities/movie_entity.cc
r9406 r9709 21 21 22 22 23 24 CREATE_FACTORY(MovieEntity, CL_MOVIE_ENTITY); 23 #include "class_id.h" 24 NewObjectListDefinitionID(MovieEntity, CL_MOVIE_ENTITY); 25 CREATE_FACTORY(MovieEntity); 25 26 26 27 /** … … 29 30 MovieEntity::MovieEntity (const TiXmlElement* root) 30 31 { 31 this-> setClassID(CL_MOVIE_ENTITY, "MovieEntity");32 this->registerObject(this, MovieEntity::_objectList); 32 33 33 34 media_container = new MediaContainer(); -
branches/new_class_id/src/world_entities/movie_entity.h
r7221 r9709 14 14 class MovieEntity : public WorldEntity 15 15 { 16 NewObjectListDeclaration(MovieEntity); 16 17 private: 17 18 MediaContainer* media_container; -
branches/new_class_id/src/world_entities/npcs/attractor_mine.cc
r9235 r9709 33 33 #include "effects/explosion.h" 34 34 35 CREATE_FACTORY(AttractorMine, CL_ATTRACTOR_MINE); 35 #include "class_id.h" 36 NewObjectListDefinitionID(AttractorMine, CL_ATTRACTOR_MINE); 37 CREATE_FACTORY(AttractorMine); 36 38 #include "script_class.h" 37 CREATE_SCRIPTABLE_CLASS(AttractorMine, CL_ATTRACTOR_MINE,39 CREATE_SCRIPTABLE_CLASS(AttractorMine, AttractorMine::classID(), 38 40 addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName)) 39 41 //Coordinates … … 50 52 : NPC(NULL) 51 53 { 52 this-> setClassID(CL_ATTRACTOR_MINE, "AttractorMine");54 this->registerObject(this, AttractorMine::_objectList); 53 55 54 56 this->toList(OM_GROUP_02); -
branches/new_class_id/src/world_entities/npcs/attractor_mine.h
r9235 r9709 9 9 10 10 class AttractorMine : public NPC { 11 NewObjectListDeclaration(AttractorMine); 11 12 12 13 public: -
branches/new_class_id/src/world_entities/npcs/door.cc
r9406 r9709 25 25 26 26 #include "door.h" 27 #include "class_list.h"28 27 29 30 31 32 33 CREATE_FACTORY(Door, CL_DOOR); 28 #include "class_id.h" 29 NewObjectListDefinitionID(Door, CL_DOOR); 30 CREATE_FACTORY(Door); 34 31 35 32 … … 47 44 Door::Door(const TiXmlElement* root) 48 45 { 49 50 this->setClassID(CL_DOOR, "Door"); 46 this->registerObject(this, Door::_objectList); 51 47 this->scale = 1.0f; 52 48 this->actionRadius = 1.0; … … 152 148 153 149 154 150 #include "playable.h" 151 #include "generic_npc.h" 155 152 /** 156 153 * checks if the door is open … … 159 156 { 160 157 161 std::list<BaseObject*>::const_iterator it;162 const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);163 158 WorldEntity* entity; 164 159 float distance; 165 160 166 if( list == NULL)167 return false;168 161 for (NewObjectList<Playable>::const_iterator it = Playable::objectList().begin(); 162 it != Playable::objectList().end(); 163 ++it) 169 164 // for all players 170 for( it = list->begin(); it != list->end(); it++)171 165 { 172 entity = dynamic_cast<WorldEntity*>(*it);166 entity = (*it); 173 167 174 168 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len()); … … 178 172 179 173 180 list = ClassList::getList(CL_GENERIC_NPC); 181 if( list == NULL)182 return false;183 for( it = list->begin(); it != list->end(); it++)174 175 for (NewObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin(); 176 it != GenericNPC::objectList().end(); 177 ++it) 184 178 { 185 entity = dynamic_cast<WorldEntity*>(*it);179 entity = (*it); 186 180 187 181 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len()); -
branches/new_class_id/src/world_entities/npcs/door.h
r9110 r9709 21 21 class Door : public WorldEntity 22 22 { 23 NewObjectListDeclaration(Door); 24 23 25 public: 24 26 Door(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/npcs/gate.cc
r9406 r9709 25 25 26 26 #include "gate.h" 27 #include "class_list.h"28 29 27 #include "effects/explosion.h" 30 28 … … 33 31 34 32 35 36 CREATE_FACTORY(Gate, CL_GATE); 33 #include "class_id.h" 34 NewObjectListDefinitionID(Gate, CL_GATE); 35 CREATE_FACTORY(Gate); 37 36 38 37 39 38 #include "script_class.h" 40 CREATE_SCRIPTABLE_CLASS(Gate, CL_GATE,39 CREATE_SCRIPTABLE_CLASS(Gate, Gate::classID(), 41 40 addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide)) 42 41 ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide)) 43 ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy)) 42 ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy)) 44 43 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 45 44 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) … … 49 48 50 49 50 51 51 //! list of all different animations a std md2model supports 52 52 sAnim Gate::animationList[3] = … … 62 62 Gate::Gate(const TiXmlElement* root) 63 63 { 64 65 this->setClassID(CL_GATE, "Gate"); 64 this->registerObject(this, Gate::_objectList); 66 65 this->scale = 1.0f; 67 66 this->actionRadius = 1.0; … … 165 164 void Gate::close() 166 165 { 167 166 168 167 if( this->destroyed) 169 168 return; 170 169 171 170 this->setAnimation(GATE_CLOSE, MD2_ANIM_ONCE); 172 171 this->bOpen = false; … … 178 177 if( this->destroyed) 179 178 return; 180 179 181 180 this->setAnimation(GATE_DIE, MD2_ANIM_ONCE); 182 181 183 182 Explosion::explode(this, Vector(this->getScaling()/160,this->getScaling()/160,this->getScaling()/160)); 184 185 183 184 186 185 this->destroyed = true; 187 186 } 188 187 188 #include "playable.h" 189 #include "generic_npc.h" 189 190 190 191 /** … … 195 196 196 197 std::list<BaseObject*>::const_iterator it; 197 const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);198 198 WorldEntity* entity; 199 199 float distance; 200 200 201 if( list == NULL)202 return false;203 204 201 // for all players 205 for( it = list->begin(); it != list->end(); it++) 206 { 207 entity = dynamic_cast<WorldEntity*>(*it); 202 for (NewObjectList<Playable>::const_iterator it = Playable::objectList().begin(); 203 it != Playable::objectList().end(); 204 ++it) 205 { 206 entity = (*it); 208 207 209 208 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len()); … … 213 212 214 213 215 list = ClassList::getList(CL_GENERIC_NPC); 216 if( list == NULL) 217 return false; 218 for( it = list->begin(); it != list->end(); it++) 219 { 220 entity = dynamic_cast<WorldEntity*>(*it); 214 for (NewObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin(); 215 it != GenericNPC::objectList().end(); 216 ++it) 217 { 218 entity = (*it); 221 219 222 220 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len()); -
branches/new_class_id/src/world_entities/npcs/gate.h
r9298 r9709 22 22 class Gate : public WorldEntity 23 23 { 24 NewObjectListDeclaration(Gate); 25 24 26 public: 25 27 Gate(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/npcs/generic_npc.cc
r9235 r9709 30 30 #include "loading/resource_manager.h" 31 31 32 33 CREATE_FACTORY(GenericNPC, CL_GENERIC_NPC); 32 #include "bsp_entity.h" 33 34 #include "class_id.h" 35 NewObjectListDefinitionID(GenericNPC, CL_GENERIC_NPC); 36 CREATE_FACTORY(GenericNPC); 34 37 35 38 #include "script_class.h" 36 CREATE_SCRIPTABLE_CLASS(GenericNPC, CL_GENERIC_NPC,39 CREATE_SCRIPTABLE_CLASS(GenericNPC, GenericNPC::classID(), 37 40 // Move 38 41 addMethod("walkTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::walkTo)) … … 81 84 void GenericNPC::init() 82 85 { 83 this-> setClassID(CL_GENERIC_NPC, "GenericNPC");86 this->registerObject(this, GenericNPC::_objectList); 84 87 85 88 this->toList(OM_GROUP_00); … … 92 95 93 96 // collision reaction registration 94 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);97 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::classID()); 95 98 } 96 99 -
branches/new_class_id/src/world_entities/npcs/generic_npc.h
r9235 r9709 25 25 class GenericNPC : public NPC 26 26 { 27 NewObjectListDeclaration(GenericNPC); 27 28 28 29 -
branches/new_class_id/src/world_entities/npcs/ground_turret.cc
r9707 r9709 29 29 #include "effects/explosion.h" 30 30 31 #include "class_id.h" 31 32 32 CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET); 33 34 33 NewObjectListDefinitionID(GroundTurret, CL_GROUND_TURRET); 34 CREATE_FACTORY(GroundTurret); 35 35 36 36 … … 62 62 void GroundTurret::init() 63 63 { 64 this-> setClassID(CL_GROUND_TURRET, "GroundTurret");64 this->registerObject(this, GroundTurret::_objectList); 65 65 this->loadModel("models/ground_turret_#.obj", 5); 66 66 this->left = NULL; -
branches/new_class_id/src/world_entities/npcs/ground_turret.h
r9656 r9709 14 14 class GroundTurret : public NPC 15 15 { 16 NewObjectListDeclaration(GroundTurret); 16 17 17 18 public: -
branches/new_class_id/src/world_entities/npcs/network_turret.cc
r9656 r9709 31 31 #include "weapons/aiming_turret.h" 32 32 33 CREATE_FACTORY(NetworkTurret, CL_NETWORK_TURRET); 34 35 33 #include "class_id.h" 34 NewObjectListDefinitionID(NetworkTurret, CL_NETWORK_TURRET); 35 CREATE_FACTORY(NetworkTurret); 36 36 37 37 … … 62 62 void NetworkTurret::init() 63 63 { 64 this-> setClassID(CL_NETWORK_TURRET, "NetworkTurret");64 this->registerObject(this, NetworkTurret::_objectList); 65 65 this->loadModel("models/ground_turret_#.obj", 5); 66 66 … … 111 111 ObjectManager::EntityList::iterator entity; 112 112 Vector diffVec; 113 for (entity = State::getObjectManager()->get ObjectList((OM_LIST)this->targetGroup).begin();114 entity != State::getObjectManager()->get ObjectList((OM_LIST)this->targetGroup).end();113 for (entity = State::getObjectManager()->getEntityList((OM_LIST)this->targetGroup).begin(); 114 entity != State::getObjectManager()->getEntityList((OM_LIST)this->targetGroup).end(); 115 115 entity ++) 116 116 { -
branches/new_class_id/src/world_entities/npcs/network_turret.h
r9656 r9709 14 14 class NetworkTurret : public NPC 15 15 { 16 16 NewObjectListDeclaration(NetworkTurret); 17 17 public: 18 18 NetworkTurret(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/npcs/npc_test.cc
r9707 r9709 31 31 32 32 #include "class_id.h" 33 CREATE_FACTORY(NPC2, CL_NPC_TEST2);34 33 NewObjectListDefinitionID(NPC2, CL_NPC_TEST2); 34 CREATE_FACTORY(NPC2); 35 35 36 36 NPC2::NPC2(const TiXmlElement* root) -
branches/new_class_id/src/world_entities/npcs/repair_station.cc
r9406 r9709 25 25 26 26 #include "repair_station.h" 27 #include "class_list.h"28 27 29 30 31 32 33 CREATE_FACTORY(RepairStation, CL_DOOR); 28 #include "class_id.h" 29 NewObjectListDefinitionID(RepairStation, CL_DOOR +1 ); 30 CREATE_FACTORY(RepairStation); 34 31 35 32 … … 67 64 RepairStation::RepairStation(const TiXmlElement* root) 68 65 { 69 70 this->setClassID(CL_DOOR, "RepairStation"); 66 this->registerObject(this, RepairStation::_objectList); 71 67 this->scale = 1.0f; 72 68 -
branches/new_class_id/src/world_entities/npcs/repair_station.h
r9003 r9709 27 27 class RepairStation : public WorldEntity 28 28 { 29 NewObjectListDeclaration(RepairStation); 29 30 public: 30 31 RepairStation (); -
branches/new_class_id/src/world_entities/npcs/space_turret.cc
r9656 r9709 29 29 #include "effects/explosion.h" 30 30 31 CREATE_FACTORY(SpaceTurret, CL_SPACE_TURRET); 31 #include "class_id.h" 32 NewObjectListDefinitionID(SpaceTurret, CL_SPACE_TURRET); 33 CREATE_FACTORY(SpaceTurret); 32 34 33 35 /** … … 59 61 void SpaceTurret::init() 60 62 { 61 this-> setClassID(CL_SPACE_TURRET, "SpaceTurret");63 this->registerObject(this, SpaceTurret::_objectList); 62 64 this->loadModel("models/ground_turret_#.obj", 7.5); 63 65 this->loadModel("models/comet.obj", 1.0f, 3); -
branches/new_class_id/src/world_entities/npcs/space_turret.h
r9656 r9709 18 18 class SpaceTurret : public NPC 19 19 { 20 NewObjectListDeclaration(SpaceTurret); 20 21 21 22 public: -
branches/new_class_id/src/world_entities/planet.cc
r9406 r9709 32 32 33 33 34 35 CREATE_FACTORY(Planet, CL_PLANET);36 34 #include "class_id.h" 35 NewObjectListDefinitionID(Planet, CL_PLANET); 36 CREATE_FACTORY(Planet); 37 37 38 38 … … 42 42 Planet::Planet(const TiXmlElement* root) 43 43 { 44 this-> setClassID(CL_PLANET, "Planet");44 this->registerObject(this, Planet::_objectList); 45 45 this->toList(OM_GROUP_01); 46 46 -
branches/new_class_id/src/world_entities/planet.h
r7221 r9709 16 16 class Planet : public WorldEntity 17 17 { 18 NewObjectListDeclaration(Planet); 19 18 20 public: 19 21 Planet(const TiXmlElement* root); -
branches/new_class_id/src/world_entities/power_ups/laser_power_up.cc
r9406 r9709 24 24 25 25 26 27 CREATE_FACTORY(LaserPowerUp, CL_LASER_POWER_UP); 26 #include "class_id.h" 27 NewObjectListDefinitionID(LaserPowerUp, CL_LASER_POWER_UP); 28 CREATE_FACTORY(LaserPowerUp); 28 29 29 30 LaserPowerUp::LaserPowerUp () : PowerUp(0.0, 1.0, 0.0) … … 49 50 void LaserPowerUp::init() 50 51 { 51 this-> setClassID(CL_LASER_POWER_UP, "LaserPowerUp");52 this->registerObject(this, LaserPowerUp::_objectList); 52 53 this->loadModel("models/guns/test_gun.obj", 2.0); 53 54 -
branches/new_class_id/src/world_entities/power_ups/laser_power_up.h
r7954 r9709 13 13 14 14 class LaserPowerUp : public PowerUp { 15 NewObjectListDeclaration(LaserPowerUp); 15 16 16 17 public: -
branches/new_class_id/src/world_entities/power_ups/param_power_up.cc
r9705 r9709 28 28 29 29 #include "class_id.h" 30 CREATE_FACTORY(ParamPowerUp, CL_PARAM_POWER_UP);31 30 NewObjectListDefinitionID(ParamPowerUp, CL_PARAM_POWER_UP); 31 CREATE_FACTORY(ParamPowerUp); 32 32 33 33 const char* ParamPowerUp::paramTypes[] = { -
branches/new_class_id/src/world_entities/power_ups/turret_power_up.cc
r9406 r9709 24 24 25 25 26 27 CREATE_FACTORY(TurretPowerUp, CL_TURRET_POWER_UP); 26 #include "class_id.h" 27 NewObjectListDefinitionID(TurretPowerUp, CL_TURRET_POWER_UP); 28 CREATE_FACTORY(TurretPowerUp); 28 29 29 30 TurretPowerUp::TurretPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0) … … 45 46 void TurretPowerUp::init() 46 47 { 47 this-> setClassID(CL_TURRET_POWER_UP, "TurretPowerUp");48 this->registerObject(this, TurretPowerUp::_objectList); 48 49 this->loadModel("models/guns/turret1.obj", 2.0); 49 50 -
branches/new_class_id/src/world_entities/power_ups/turret_power_up.h
r7954 r9709 13 13 14 14 class TurretPowerUp : public PowerUp { 15 NewObjectListDeclaration(TurretPowerUp); 15 16 16 17 public: -
branches/new_class_id/src/world_entities/power_ups/weapon_power_up.cc
r9705 r9709 28 28 29 29 #include "class_id.h" 30 CREATE_FACTORY(WeaponPowerUp, CL_WEAPON_POWER_UP);31 30 NewObjectListDefinitionID(WeaponPowerUp, CL_WEAPON_POWER_UP); 31 CREATE_FACTORY(WeaponPowerUp); 32 32 33 33 WeaponPowerUp::WeaponPowerUp(const TiXmlElement* root) : PowerUp(1.0, 1.0, 0.0) … … 88 88 { 89 89 this->weapon = dynamic_cast<Weapon*>((weaponXML == NULL) 90 ? Factory::fabricate( static_cast<ClassID>(this->weapon->getLeafClassID()))90 ? Factory::fabricate((this->weapon->getClassID())) 91 91 : Factory::fabricate((const TiXmlElement*)this->getXmlElem()->FirstChildElement("weapon"))); 92 92 this->model = this->weapon->getModel(0); -
branches/new_class_id/src/world_entities/projectiles/bomb.cc
r8362 r9709 25 25 #include "debug.h" 26 26 27 CREATE_FAST_FACTORY_STATIC(Bomb, CL_BOMB); 27 #include "class_id.h" 28 NewObjectListDefinitionID(Bomb, CL_BOMB); 29 CREATE_FAST_FACTORY_STATIC(Bomb); 28 30 29 31 /** … … 67 69 void Bomb::init() 68 70 { 69 this-> setClassID(CL_BOMB, "Bomb");71 this->registerObject(this, Bomb::_objectList); 70 72 71 73 … … 173 175 } 174 176 177 175 178 void Bomb::deactivate() 176 179 { … … 182 185 void Bomb::detonate(float size) 183 186 { 184 ObjectManager::EntityList detonationList; 185 ObjectManager::distanceFromObject(detonationList, *this, size, CL_NPC); 187 /// FIXME 188 /* ObjectManager::EntityList detonationList; 189 ObjectManager::distanceFromObject(detonationList, *this, size, NPC::objectList()); 186 190 while( !detonationList.empty() ) 187 191 { 188 192 detonationList.front()->collidesWith(this, Vector(0,0,0)); 189 193 detonationList.pop_front(); 190 } 194 }*/ 191 195 } -
branches/new_class_id/src/world_entities/projectiles/bomb.h
r6622 r9709 17 17 class Bomb : public Projectile 18 18 { 19 19 NewObjectListDeclaration(Bomb); 20 20 public: 21 21 Bomb(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/projectiles/boomerang_projectile.cc
r9235 r9709 20 20 21 21 #include "state.h" 22 #include "class_list.h"23 22 24 23 #include "dot_emitter.h" … … 27 26 #include "debug.h" 28 27 29 CREATE_FAST_FACTORY_STATIC(BoomerangProjectile, CL_BOOMERANG_PROJECTILE); 28 #include "class_id.h" 29 NewObjectListDefinitionID(BoomerangProjectile, CL_BOOMERANG_PROJECTILE); 30 CREATE_FAST_FACTORY_STATIC(BoomerangProjectile); 30 31 31 32 /** … … 34 35 BoomerangProjectile::BoomerangProjectile () : Projectile() 35 36 { 36 this-> setClassID(CL_BOOMERANG_PROJECTILE, "BoomerangProjectile");37 this->registerObject(this, BoomerangProjectile::_objectList); 37 38 38 39 this->loadModel("models/projectiles/orx-rocket.obj", 2.0); … … 60 61 61 62 /* this is normaly done by World.cc by deleting the ParticleEngine */ 62 if (BoomerangProjectile::trailParticles != NULL && ClassList::getList(CL_BOOMERANG_PROJECTILE)->size() <= 1)63 { 64 if ( ClassList::exists(BoomerangProjectile::trailParticles, CL_PARTICLE_SYSTEM))63 if (BoomerangProjectile::trailParticles != NULL && BoomerangProjectile::objectList().size() <= 1) 64 { 65 if (ParticleSystem::objectList().exists(BoomerangProjectile::trailParticles)) 65 66 delete BoomerangProjectile::trailParticles; 66 67 BoomerangProjectile::trailParticles = NULL; 67 68 } 68 if (BoomerangProjectile::explosionParticles != NULL && ClassList::getList(CL_BOOMERANG_PROJECTILE)->size() <= 1)69 { 70 if ( ClassList::exists(BoomerangProjectile::explosionParticles, CL_PARTICLE_SYSTEM))69 if (BoomerangProjectile::explosionParticles != NULL && BoomerangProjectile::objectList().size() <= 1) 70 { 71 if (ParticleSystem::objectList().exists(BoomerangProjectile::explosionParticles)) 71 72 delete BoomerangProjectile::explosionParticles; 72 73 BoomerangProjectile::explosionParticles = NULL; -
branches/new_class_id/src/world_entities/projectiles/boomerang_projectile.h
r9235 r9709 17 17 class BoomerangProjectile : public Projectile 18 18 { 19 NewObjectListDeclaration(BoomerangProjectile); 19 20 public: 20 21 BoomerangProjectile (); -
branches/new_class_id/src/world_entities/projectiles/guided_missile.cc
r9298 r9709 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 23 22 #include "dot_emitter.h" … … 26 25 #include "debug.h" 27 26 28 CREATE_FAST_FACTORY_STATIC(GuidedMissile, CL_GUIDED_MISSILE); 27 #include "class_id.h" 28 NewObjectListDefinitionID(GuidedMissile, CL_GUIDED_MISSILE); 29 CREATE_FAST_FACTORY_STATIC(GuidedMissile); 29 30 30 31 /** … … 33 34 GuidedMissile::GuidedMissile () : Projectile() 34 35 { 35 this-> setClassID(CL_GUIDED_MISSILE, "GuidedMissile");36 this->registerObject(this, GuidedMissile::_objectList); 36 37 37 38 this->loadModel("models/projectiles/orx-rocket.obj", 2.0); … … 59 60 60 61 /* this is normaly done by World.cc by deleting the ParticleEngine */ 61 if (GuidedMissile::trailParticles != NULL && ClassList::getList(CL_GUIDED_MISSILE)->size() <= 1)62 { 63 if ( ClassList::exists(GuidedMissile::trailParticles, CL_PARTICLE_SYSTEM))62 if (GuidedMissile::trailParticles != NULL && GuidedMissile::objectList().size() <= 1) 63 { 64 if (ParticleSystem::objectList().exists(GuidedMissile::trailParticles)) 64 65 delete GuidedMissile::trailParticles; 65 66 GuidedMissile::trailParticles = NULL; 66 67 } 67 if (GuidedMissile::explosionParticles != NULL && ClassList::getList(CL_GUIDED_MISSILE)->size() <= 1)68 { 69 if ( ClassList::exists(GuidedMissile::explosionParticles, CL_PARTICLE_SYSTEM))68 if (GuidedMissile::explosionParticles != NULL && GuidedMissile::objectList().size() <= 1) 69 { 70 if (ParticleSystem::objectList().exists(GuidedMissile::explosionParticles)) 70 71 delete GuidedMissile::explosionParticles; 71 72 GuidedMissile::explosionParticles = NULL; -
branches/new_class_id/src/world_entities/projectiles/guided_missile.h
r9656 r9709 16 16 class GuidedMissile : public Projectile 17 17 { 18 NewObjectListDeclaration(GuidedMissile); 18 19 public: 19 20 GuidedMissile (); -
branches/new_class_id/src/world_entities/projectiles/hyperblast.cc
r9235 r9709 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 23 22 #include "box_emitter.h" … … 26 25 #include "debug.h" 27 26 28 CREATE_FAST_FACTORY_STATIC(Hyperblast, CL_HYPERBLAST); 27 #include "class_id.h" 28 NewObjectListDefinitionID(Hyperblast, CL_HYPERBLAST); 29 CREATE_FAST_FACTORY_STATIC(Hyperblast); 30 29 31 30 32 /** … … 33 35 Hyperblast::Hyperblast () : Projectile() 34 36 { 35 this-> setClassID(CL_HYPERBLAST, "Hyperblast");37 this->registerObject(this, Hyperblast::_objectList); 36 38 37 39 this->loadModel("models/projectiles/hyperblast.obj", 5); … … 55 57 { 56 58 /* this is normaly done by World.cc by deleting the ParticleEngine */ 57 if (Hyperblast::explosionParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1)59 if (Hyperblast::explosionParticles != NULL && Hyperblast::objectList().size() <= 1) 58 60 { 59 61 Hyperblast::explosionParticles = NULL; -
branches/new_class_id/src/world_entities/projectiles/hyperblast.h
r9235 r9709 17 17 class Hyperblast : public Projectile 18 18 { 19 NewObjectListDeclaration(Hyperblast); 19 20 public: 20 21 Hyperblast (); -
branches/new_class_id/src/world_entities/projectiles/laser.cc
r9656 r9709 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 #include "model.h" 23 22 … … 29 28 30 29 31 32 CREATE_FAST_FACTORY_STATIC(Laser, CL_LASER); 30 #include "class_id.h" 31 NewObjectListDefinition(Laser); 32 CREATE_FAST_FACTORY_STATIC(Laser); 33 33 34 34 /** … … 37 37 Laser::Laser () : Projectile() 38 38 { 39 this-> setClassID(CL_LASER, "Laser");39 this->registerObject(this, Laser::_objectList); 40 40 41 41 this->loadModel("models/projectiles/laser.obj"); … … 61 61 62 62 /* this is normaly done by World.cc by deleting the ParticleEngine */ 63 if (Laser::explosionParticles != NULL && ClassList::getList(CL_LASER)->size() <= 1)63 if (Laser::explosionParticles != NULL && Laser::objectList().size() <= 1) 64 64 { 65 65 //if (ClassList::exists(Laser::explosionParticles, CL_PARTICLE_SYSTEM)) -
branches/new_class_id/src/world_entities/projectiles/laser.h
r9235 r9709 17 17 class Laser : public Projectile 18 18 { 19 NewObjectListDeclaration(Laser); 19 20 public: 20 21 Laser (); -
branches/new_class_id/src/world_entities/projectiles/projectile.h
r9705 r9709 11 11 12 12 #include "world_entity.h" 13 #include " fast_factory.h"13 #include "loading/fast_factory.h" 14 14 15 15 #include "sound_source.h" -
branches/new_class_id/src/world_entities/projectiles/rail_projectile.cc
r9406 r9709 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 #include "model.h" 23 22 … … 29 28 30 29 31 32 CREATE_FAST_FACTORY_STATIC(RailProjectile, CL_RAIL_PROJECTILE); 30 #include "class_id.h" 31 NewObjectListDefinitionID(RailProjectile, CL_RAIL_PROJECTILE); 32 CREATE_FAST_FACTORY_STATIC(RailProjectile); 33 33 34 34 /** … … 37 37 RailProjectile::RailProjectile () : Projectile() 38 38 { 39 this-> setClassID(CL_RAIL_PROJECTILE, "RailProjectile");39 this->registerObject(this, RailProjectile::_objectList); 40 40 41 41 this->loadModel("models/projectiles/laser_projectile.obj", 100); … … 61 61 62 62 /* this is normaly done by World.cc by deleting the ParticleEngine */ 63 if (RailProjectile::explosionParticles != NULL && ClassList::getList(CL_RAIL_PROJECTILE)->size() <= 1)63 if (RailProjectile::explosionParticles != NULL && RailProjectile::objectList().size() <= 1) 64 64 { 65 65 //if (ClassList::exists(RailProjectile::explosionParticles, CL_PARTICLE_SYSTEM)) -
branches/new_class_id/src/world_entities/projectiles/rail_projectile.h
r9235 r9709 17 17 class RailProjectile : public Projectile 18 18 { 19 NewObjectListDeclaration(RailProjectile); 19 20 public: 20 21 RailProjectile (); -
branches/new_class_id/src/world_entities/projectiles/rocket.cc
r9235 r9709 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 23 22 #include "dot_emitter.h" … … 26 25 #include "debug.h" 27 26 28 CREATE_FAST_FACTORY_STATIC(Rocket, CL_ROCKET); 27 #include "class_id.h" 28 NewObjectListDefinitionID(Rocket, CL_ROCKET); 29 CREATE_FAST_FACTORY_STATIC(Rocket); 29 30 30 31 /** … … 33 34 Rocket::Rocket () : Projectile() 34 35 { 35 this-> setClassID(CL_ROCKET, "Rocket");36 this->registerObject(this, Rocket::_objectList); 36 37 37 38 this->loadModel("models/projectiles/orx-rocket.obj", .3); … … 55 56 56 57 /* this is normaly done by World.cc by deleting the ParticleEngine */ 57 if (Rocket::trailParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)58 if (Rocket::trailParticles != NULL && Rocket::objectList().size() <= 1) 58 59 { 59 60 /* if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM)) … … 61 62 Rocket::trailParticles = NULL; 62 63 } 63 if (Rocket::explosionParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)64 if (Rocket::explosionParticles != NULL && Rocket::objectList().size() <= 1) 64 65 { 65 66 /* if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM)) -
branches/new_class_id/src/world_entities/projectiles/rocket.h
r9235 r9709 9 9 #include "projectile.h" 10 10 11 class Vector;12 class Weapon;13 11 class SpriteParticles; 14 12 class ParticleEmitter; … … 17 15 class Rocket : public Projectile 18 16 { 19 public: 20 Rocket (); 21 virtual ~Rocket (); 17 NewObjectListDeclaration(Rocket); 18 19 public: 20 Rocket (); 21 virtual ~Rocket (); 22 22 23 23 24 25 24 virtual void activate(); 25 virtual void deactivate(); 26 26 27 27 virtual void collidesWith(WorldEntity* entity, const Vector& location); 28 28 29 29 virtual void destroy (WorldEntity* killer); 30 30 31 32 31 virtual void tick (float time); 32 virtual void draw () const; 33 33 34 34 35 36 37 38 35 private: 36 static FastFactory* fastFactory; 37 static SpriteParticles* trailParticles; 38 static SpriteParticles* explosionParticles; 39 39 40 40 ParticleEmitter* emitter; 41 41 42 42 43 43 WorldEntity* hitEntity; // FIXME TEMPORARY 44 44 45 45 }; -
branches/new_class_id/src/world_entities/projectiles/test_bullet.cc
r9235 r9709 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 23 22 #include "dot_emitter.h" … … 25 24 #include "debug.h" 26 25 27 CREATE_FAST_FACTORY_STATIC(TestBullet, CL_TEST_BULLET); 26 #include "class_id.h" 27 NewObjectListDefinitionID(TestBullet, CL_TEST_BULLET); 28 CREATE_FAST_FACTORY_STATIC(TestBullet); 28 29 29 30 /** … … 32 33 TestBullet::TestBullet () : Projectile() 33 34 { 34 this-> setClassID(CL_TEST_BULLET, "TestBullet");35 this->registerObject(this, TestBullet::_objectList); 35 36 36 37 this->loadModel("models/projectiles/orx-rocket.obj", .3); … … 54 55 55 56 /* this is normaly done by World.cc by deleting the ParticleEngine */ 56 if (TestBullet::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1)57 if (TestBullet::trailParticles != NULL && TestBullet::objectList().size() <= 1) 57 58 { 58 if ( ClassList::exists(TestBullet::trailParticles, CL_PARTICLE_SYSTEM))59 if (ParticleSystem::objectList().exists(TestBullet::trailParticles)) 59 60 delete TestBullet::trailParticles; 60 61 TestBullet::trailParticles = NULL; 61 62 } 62 if (TestBullet::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1)63 if (TestBullet::explosionParticles != NULL && TestBullet::objectList().size() <= 1) 63 64 { 64 if ( ClassList::exists(TestBullet::explosionParticles, CL_PARTICLE_SYSTEM))65 if (ParticleSystem::objectList().exists(TestBullet::explosionParticles)) 65 66 delete TestBullet::explosionParticles; 66 67 TestBullet::explosionParticles = NULL; -
branches/new_class_id/src/world_entities/projectiles/test_bullet.h
r9235 r9709 17 17 class TestBullet : public Projectile 18 18 { 19 NewObjectListDeclaration(TestBullet); 20 19 21 public: 20 22 TestBullet (); -
branches/new_class_id/src/world_entities/recorder.cc
r9406 r9709 22 22 23 23 24 25 CREATE_FACTORY(Recorder, CL_RECORDER); 24 #include "class_id.h" 25 NewObjectListDefinitionID(Recorder, CL_RECORDER); 26 CREATE_FACTORY(Recorder); 26 27 27 28 28 29 Recorder::Recorder (const TiXmlElement* root) 29 30 { 30 this-> setClassID(CL_RECORDER, "Recorder");31 this->registerObject(this, Recorder::_objectList); 31 32 32 33 // initialize libavcodec, and register all codecs and formats -
branches/new_class_id/src/world_entities/recorder.h
r7221 r9709 20 20 class Recorder : public WorldEntity 21 21 { 22 NewObjectListDeclaration(Recorder); 22 23 public: 23 24 Recorder (const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/satellite.cc
r9406 r9709 21 21 22 22 #include "objModel.h" 23 #include "vector.h"24 23 25 24 26 25 26 27 NewObjectListDefinition(Satellite); 27 28 28 29 /** … … 31 32 Satellite::Satellite (Vector axis, float speed) 32 33 { 33 this-> setClassID(CL_SATELLITE, "Satellite");34 this->registerObject(this, Satellite::_objectList); 34 35 35 36 this->loadModel("cube"); -
branches/new_class_id/src/world_entities/satellite.h
r7193 r9709 19 19 class Satellite : public WorldEntity 20 20 { 21 friend class World;21 NewObjectListDeclaration(Satellite); 22 22 23 23 public: -
branches/new_class_id/src/world_entities/script_trigger.cc
r9656 r9709 16 16 17 17 #include "script_trigger.h" 18 #include "class_list.h"19 18 #include "script.h" 20 19 21 20 #include "state.h" 22 21 23 24 CREATE_SCRIPTABLE_CLASS(ScriptTrigger, CL_SCRIPT_TRIGGER, 22 NewObjectListDefinition(ScriptTrigger); 23 24 CREATE_SCRIPTABLE_CLASS(ScriptTrigger, ScriptTrigger::classID(), 25 25 // Coordinates 26 26 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) … … 49 49 */ 50 50 ScriptTrigger::ScriptTrigger(const TiXmlElement* root) 51 { 52 this-> setClassID(CL_SCRIPT_TRIGGER, "ScriptTrigger");51 { 52 this->registerObject(this, ScriptTrigger::_objectList); 53 53 this->toList(OM_COMMON); 54 54 … … 139 139 void ScriptTrigger::setTarget(const std::string& target) 140 140 { 141 BaseObject* targetEntity = ClassList::getObject(target, CL_WORLD_ENTITY); 142 141 142 WorldEntity* targetEntity = WorldEntity::objectList().getObject(target); 143 143 if (targetEntity != NULL) 144 144 { 145 this->setTarget( dynamic_cast<WorldEntity*>(targetEntity));145 this->setTarget(targetEntity); 146 146 } 147 147 else … … 157 157 void ScriptTrigger::setTriggerParent(const std::string& parent) 158 158 { 159 BaseObject* parentEntity = ClassList::getObject(parent, CL_WORLD_ENTITY);159 WorldEntity* parentEntity = WorldEntity::objectList().getObject(parent); 160 160 161 161 if (parentEntity != NULL) 162 162 { 163 this->setParent( dynamic_cast<WorldEntity*>(parentEntity));163 this->setParent(parentEntity); 164 164 this->setParentMode(PNODE_MOVEMENT); 165 165 } -
branches/new_class_id/src/world_entities/script_trigger.h
r9298 r9709 18 18 class ScriptTrigger : public WorldEntity 19 19 { 20 NewObjectListDeclaration(ScriptTrigger); 20 21 public: 21 22 ScriptTrigger(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/skybox.cc
r9656 r9709 31 31 32 32 33 34 CREATE_FACTORY(SkyBox, CL_SKYBOX); 33 #include "class_id.h" 34 NewObjectListDefinitionID(SkyBox, CL_SKYBOX); 35 CREATE_FACTORY(SkyBox); 35 36 36 37 /** … … 72 73 void SkyBox::preInit() 73 74 { 74 this-> setClassID(CL_SKYBOX, "SkyBox");75 this->registerObject(this, SkyBox::_objectList); 75 76 this->toList(OM_BACKGROUND); 76 77 this->toReflectionList(); -
branches/new_class_id/src/world_entities/skybox.h
r8619 r9709 27 27 class SkyBox : public WorldEntity 28 28 { 29 public: 29 NewObjectListDeclaration(SkyBox); 30 public: 30 31 SkyBox(const std::string& fileName = ""); 31 32 SkyBox(const TiXmlElement* root); -
branches/new_class_id/src/world_entities/skydome.cc
r9406 r9709 30 30 31 31 32 NewObjectListDefinition(Skydome); 32 33 33 34 /** … … 44 45 PRINTF(0)("Skydome init\n"); 45 46 46 this-> setClassID(CL_SKYDOME, "Skydome");47 this->registerObject(this, Skydome::_objectList); 47 48 this->toList(OM_BACKGROUND); 48 49 this->toReflectionList(); … … 119 120 glEnd(); 120 121 121 WorldEntity::draw(); 122 WorldEntity::draw(); 122 123 123 124 glPopMatrix(); -
branches/new_class_id/src/world_entities/skydome.h
r9006 r9709 21 21 class Skydome : public WorldEntity 22 22 { 23 NewObjectListDeclaration(Skydome); 23 24 public: 24 25 Skydome(); … … 31 32 void generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius, 32 33 float hTile, float vTile); 33 34 34 35 void setShader(Shader* shader); 35 36 void setTexture(GLuint texture); 36 37 37 38 void activate(); 38 39 void deactivate(); 39 40 40 41 private: 41 42 42 43 typedef struct VertexInfo 43 44 { … … 48 49 49 50 bool activateDome; 50 51 51 52 VertexInfo *planeVertices; 52 53 int numPlaneVertices; … … 59 60 VertexInfo *vertices; 60 61 int numVertices; 61 62 62 63 GLuint texture; 63 64 Shader* shader; -
branches/new_class_id/src/world_entities/skysphere.cc
r9406 r9709 27 27 28 28 #include "skysphere.h" 29 #include "stdincl.h"30 29 31 30 #include "material.h" … … 33 32 34 33 35 34 NewObjectListDefinition(Skysphere); 36 35 37 36 /** … … 41 40 Skysphere::Skysphere(char* fileName) 42 41 { 43 this-> setClassID(CL_SKYSPHERE, "SkySphere");42 this->registerObject(this, Skysphere::_objectList); 44 43 this->toList(OM_BACKGROUND); 45 44 if (fileName == NULL) -
branches/new_class_id/src/world_entities/skysphere.h
r7076 r9709 24 24 class Skysphere : public WorldEntity 25 25 { 26 NewObjectListDeclaration(Skysphere); 26 27 27 28 public: -
branches/new_class_id/src/world_entities/space_ships/collision_probe.cc
r9406 r9709 24 24 25 25 26 #include "class_id.h" 27 NewObjectListDefinitionID(CollisionProbe, CL_COLLISION_PROBE); 26 28 27 28 CREATE_FACTORY(CollisionProbe, CL_COLLISION_PROBE); 29 CREATE_FACTORY(CollisionProbe); 29 30 30 31 … … 56 57 void CollisionProbe::init() 57 58 { 58 this-> setClassID(CL_COLLISION_PROBE, "CollisionProbe");59 this->registerObject(this, CollisionProbe::_objectList); 59 60 60 61 bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false; -
branches/new_class_id/src/world_entities/space_ships/collision_probe.h
r8490 r9709 13 13 class CollisionProbe : public Playable 14 14 { 15 NewObjectListDeclaration(CollisionProbe); 15 16 16 17 public: -
branches/new_class_id/src/world_entities/space_ships/cruizer.cc
r9235 r9709 34 34 #include "debug.h" 35 35 36 CREATE_FACTORY(Cruizer, CL_CRUIZER); 36 #include "class_id.h" 37 NewObjectListDefinitionID(Cruizer, CL_CRUIZER); 38 CREATE_FACTORY(Cruizer); 37 39 38 40 /** … … 89 91 { 90 92 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 91 this-> setClassID(CL_CRUIZER, "Cruizer");93 this->registerObject(this, Cruizer::_objectList); 92 94 93 95 this->setSupportedPlaymodes(Playable::Full3D); -
branches/new_class_id/src/world_entities/space_ships/cruizer.h
r9061 r9709 16 16 class Cruizer : public Playable 17 17 { 18 NewObjectListDeclaration(Cruizer); 18 19 public: 19 20 Cruizer(const std::string& fileName); -
branches/new_class_id/src/world_entities/space_ships/helicopter.cc
r9235 r9709 34 34 #include "debug.h" 35 35 36 CREATE_FACTORY(Helicopter, CL_HELICOPTER); 36 #include "class_id.h" 37 NewObjectListDefinitionID(Helicopter, CL_HELICOPTER); 38 CREATE_FACTORY(Helicopter); 37 39 #include "script_class.h" 38 CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER,40 CREATE_SCRIPTABLE_CLASS(Helicopter, Helicopter::classID(), 39 41 addMethod("moveUp", ExecutorLua1<Helicopter,bool>(&Helicopter::moveUp)) 40 42 ->addMethod("moveDown", ExecutorLua1<Helicopter,bool>(&Helicopter::moveDown)) … … 46 48 ); 47 49 50 48 51 /** 49 52 * creates the controlable Helicopter … … 100 103 Weapon* wpLeft = new TestGun(1); 101 104 wpLeft->setName("testGun Left"); 102 Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate( CL_CANNON));105 Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate("Cannon")); 103 106 104 107 cannon->setName("BFG"); … … 126 129 this->chopperBuffer = NULL; 127 130 128 this-> setClassID(CL_HELICOPTER, "Helicopter");131 this->registerObject(this, Helicopter::_objectList); 129 132 PRINTF(4)("HELICOPTER INIT\n"); 130 133 -
branches/new_class_id/src/world_entities/space_ships/helicopter.h
r9235 r9709 17 17 class Helicopter : public Playable 18 18 { 19 NewObjectListDeclaration(Helicopter); 19 20 20 21 public: -
branches/new_class_id/src/world_entities/space_ships/hover.cc
r9656 r9709 34 34 #include "debug.h" 35 35 36 CREATE_FACTORY(Hover, CL_HOVER); 36 #include "class_id.h" 37 NewObjectListDefinitionID(Hover, CL_HOVER); 38 CREATE_FACTORY(Hover); 37 39 38 40 #include "script_class.h" 39 CREATE_SCRIPTABLE_CLASS(Hover, CL_HOVER,41 CREATE_SCRIPTABLE_CLASS(Hover, Hover::classID(), 40 42 addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer)) 41 43 //Coordinates … … 98 100 Weapon* wpLeft = new TestGun(1); 99 101 wpLeft->setName("testGun Left"); 100 Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate( CL_HYPERBLASTER));102 Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate("Hyperblaster")); 101 103 102 104 cannon->setName("BFG"); … … 123 125 124 126 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 125 this-> setClassID(CL_HOVER, "Hover");127 this->registerObject(this, Hover::_objectList); 126 128 this->toReflectionList(); 127 129 -
branches/new_class_id/src/world_entities/space_ships/hover.h
r9235 r9709 15 15 class Hover : public Playable 16 16 { 17 NewObjectListDeclaration(Hover); 17 18 public: 18 19 -
branches/new_class_id/src/world_entities/space_ships/space_ship.cc
r9656 r9709 53 53 54 54 55 56 CREATE_FACTORY(SpaceShip, CL_SPACE_SHIP); 55 #include "class_id.h" 56 NewObjectListDefinitionID(SpaceShip, CL_SPACE_SHIP); 57 CREATE_FACTORY(SpaceShip); 58 57 59 #include "script_class.h" 58 CREATE_SCRIPTABLE_CLASS(SpaceShip, CL_SPACE_SHIP,60 CREATE_SCRIPTABLE_CLASS(SpaceShip, SpaceShip::classID(), 59 61 addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer)) 60 62 ->addMethod("fire", ExecutorLua1<Playable, bool>(&Playable::fire)) … … 117 119 { 118 120 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 119 this-> setClassID(CL_SPACE_SHIP, "SpaceShip");121 this->registerObject(this, SpaceShip::_objectList); 120 122 121 123 PRINTF(4)("SPACESHIP INIT\n"); -
branches/new_class_id/src/world_entities/space_ships/space_ship.h
r9235 r9709 19 19 class SpaceShip : public Playable 20 20 { 21 NewObjectListDeclaration(SpaceShip); 21 22 22 23 public: … … 36 37 virtual void postSpawn(); 37 38 virtual void leftWorld(); 38 39 39 40 virtual void destroy(WorldEntity* killer); 40 41 virtual void respawn(); -
branches/new_class_id/src/world_entities/space_ships/spacecraft_2d.cc
r9406 r9709 38 38 39 39 40 CREATE_FACTORY(Spacecraft2D, CL_SPACECRAFT_2D); 41 42 43 CREATE_SCRIPTABLE_CLASS(Spacecraft2D, CL_SPACECRAFT_2D, 40 #include "class_id.h" 41 NewObjectListDefinitionID(Spacecraft2D, CL_SPACECRAFT_2D); 42 CREATE_FACTORY(Spacecraft2D); 43 44 CREATE_SCRIPTABLE_CLASS(Spacecraft2D, Spacecraft2D::classID(), 44 45 addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer)) 45 46 //Coordinates … … 52 53 53 54 55 54 56 /** 55 57 * @brief loads a Spacecraft2D information from a specified file. … … 85 87 86 88 //weapons: 87 Weapon* wpRight = dynamic_cast<Weapon*>(Factory::fabricate( CL_LASER_CANNON));89 Weapon* wpRight = dynamic_cast<Weapon*>(Factory::fabricate("LaserCannon")); 88 90 wpRight->setName("Cannon_Right"); 89 Weapon* wpLeft = dynamic_cast<Weapon*>(Factory::fabricate( CL_LASER_CANNON));91 Weapon* wpLeft = dynamic_cast<Weapon*>(Factory::fabricate("LaserCannon")); 90 92 wpLeft->setName("Cannon_Left"); 91 93 92 Weapon* turretLeft = dynamic_cast<Weapon*>(Factory::fabricate( CL_BOOMERANG_GUN));94 Weapon* turretLeft = dynamic_cast<Weapon*>(Factory::fabricate("BoomerangGun")); 93 95 wpRight->setName("Turret_Left"); 94 Weapon* turretRight = dynamic_cast<Weapon*>(Factory::fabricate( CL_BOOMERANG_GUN));96 Weapon* turretRight = dynamic_cast<Weapon*>(Factory::fabricate("BoomerangGun")); 95 97 wpLeft->setName("Turret_Right"); 96 98 … … 125 127 { 126 128 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 127 this-> setClassID(CL_SPACECRAFT_2D, "Spacecraft2D");129 this->registerObject(this, Spacecraft2D::_objectList); 128 130 129 131 this->setSupportedPlaymodes(Playable::Full3D | Playable::Horizontal ); -
branches/new_class_id/src/world_entities/space_ships/spacecraft_2d.h
r9235 r9709 16 16 class Spacecraft2D : public Playable 17 17 { 18 NewObjectListDeclaration(Spacecraft2D); 18 19 public: 19 20 Spacecraft2D(const std::string& fileName); -
branches/new_class_id/src/world_entities/space_ships/turbine_hover.cc
r9656 r9709 34 34 #include "debug.h" 35 35 36 CREATE_FACTORY(TurbineHover, CL_TURBINE_HOVER); 36 #include "class_id.h" 37 NewObjectListDefinitionID(TurbineHover, CL_TURBINE_HOVER); 38 CREATE_FACTORY(TurbineHover); 37 39 38 40 /** … … 101 103 { 102 104 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 103 this-> setClassID(CL_TURBINE_HOVER, "TurbineHover");105 this->registerObject(this, TurbineHover::_objectList); 104 106 105 107 this->setSupportedPlaymodes(Playable::Full3D | Playable::Horizontal | Playable::Vertical); -
branches/new_class_id/src/world_entities/space_ships/turbine_hover.h
r9656 r9709 18 18 class TurbineHover : public Playable 19 19 { 20 public: 21 TurbineHover(const std::string& fileName); 22 TurbineHover(const TiXmlElement* root = NULL); 23 virtual ~TurbineHover(); 20 NewObjectListDeclaration(TurbineHover); 21 public: 22 TurbineHover(const std::string& fileName); 23 TurbineHover(const TiXmlElement* root = NULL); 24 virtual ~TurbineHover(); 24 25 25 26 void setBoostColor(const Color& color); 26 27 27 28 29 30 28 virtual void loadParams(const TiXmlElement* root); 29 virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); 30 virtual void enter(); 31 virtual void leave(); 31 32 32 33 virtual void setTeam(int teamID); 33 34 34 35 36 35 virtual void postSpawn(); 36 virtual void leftWorld(); 37 virtual void respawn(); 37 38 38 39 40 39 virtual void collidesWith(WorldEntity* entity, const Vector& location); 40 virtual void tick(float dt); 41 virtual void draw() const; 41 42 42 43 virtual void process(const Event &event); 43 44 44 45 46 45 private: 46 void init(); 47 void movement(float dt); 47 48 48 49 50 51 52 53 54 49 private: 50 bool bForward; //!< forward button pressed. 51 bool bBackward; //!< backward button pressed. 52 bool bLeft; //!< left button pressed. 53 bool bRight; //!< right button pressed. 54 bool bAscend; //!< ascend button pressed. 55 bool bDescend; //!< descend button presses. 55 56 56 57 57 int yInvert; 58 float mouseSensitivity; //!< the mouse sensitivity 58 59 59 60 61 62 60 PNode wingNodeLeft; 61 PNode wingNodeRight; 62 PNode rotorNodeLeft; 63 PNode rotorNodeRight; 63 64 64 65 66 65 PNode cameraNode; 66 float cameraLook; 67 float rotation; 67 68 68 69 70 71 72 69 // Vector velocity; //!< the velocity of the TurbineHover. 70 Quaternion direction; //!< the direction of the TurbineHover. 71 float travelSpeed; //!< the current speed of the Hove (to make soft movement) 72 float acceleration; //!< the acceleration of the TurbineHover. 73 float airFriction; //!< AirFriction. 73 74 74 75 75 float rotorSpeed; //!< the speed of the rotor. 76 float rotorCycle; //!< The Cycle the rotor is in. 76 77 77 78 float airViscosity; 78 79 79 80 80 ParticleEmitter* burstEmitter[2]; 81 ParticleSystem* burstSystem; 81 82 }; 82 83 -
branches/new_class_id/src/world_entities/spawning_point.cc
r9706 r9709 34 34 35 35 #include "class_id.h" 36 CREATE_FACTORY( SpawningPoint, CL_SPAWNING_POINT );37 36 NewObjectListDefinitionID(SpawningPoint, CL_SPAWNING_POINT); 37 CREATE_FACTORY( SpawningPoint); 38 38 /** 39 39 * constructor -
branches/new_class_id/src/world_entities/spectator.cc
r9406 r9709 22 22 #include "shared_network_data.h" 23 23 24 CREATE_FACTORY(Spectator, CL_SPECTATOR); 25 26 27 24 #include "class_id.h" 25 NewObjectListDefinitionID(Spectator, CL_SPECTATOR); 26 CREATE_FACTORY(Spectator); 28 27 29 28 … … 58 57 { 59 58 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 60 this-> setClassID(CL_SPECTATOR, "Spectator");59 this->registerObject(this, Spectator::_objectList); 61 60 62 61 this->getWeaponManager().changeWeaponConfig(1); … … 89 88 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 90 89 91 90 92 91 registerVar( new SynchronizeableBool( &bLeft, &bLeft, "bLeft", PERMISSION_OWNER ) ); 93 92 registerVar( new SynchronizeableBool( &bRight, &bRight, "bRight", PERMISSION_OWNER ) ); … … 161 160 { 162 161 Playable::tick( time ); 163 162 164 163 if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() ) 165 164 { 166 165 xMouse *= time / 10; 167 166 yMouse *= time / 10; 168 167 169 168 angleX -= xMouse; 170 169 angleY -= yMouse; 171 170 172 171 if ( angleY > 2.05 ) 173 172 angleY = 2.05; 174 173 175 174 if ( angleY < -1.15 ) 176 175 angleY = -1.15; 177 176 178 177 this->mouseDir = Quaternion( angleX, Vector( 0, 1, 0 ) ) * Quaternion( angleY, Vector( 0, 0, 1 ) ); 179 178 180 179 xMouse = yMouse = 0; 181 180 } 182 181 183 182 this->setAbsDir( this->mouseDir ); 184 183 185 184 Vector velocity; 186 185 187 186 if ( this->bForward ) 188 187 { 189 188 velocity += this->getAbsDirX(); 190 189 } 191 190 192 191 if ( this->bBackward ) 193 192 { 194 193 velocity -= this->getAbsDirX(); 195 194 } 196 195 197 196 if ( this->bRight ) 198 197 { 199 198 velocity += this->getAbsDirZ(); 200 199 } 201 200 202 201 if ( this->bLeft ) 203 202 { 204 203 velocity -= this->getAbsDirZ(); 205 204 } 206 205 207 206 velocity *= 100; 208 207 209 208 this->shiftCoor( velocity*time ); 210 209 } -
branches/new_class_id/src/world_entities/spectator.h
r8228 r9709 11 11 class Spectator : public Playable 12 12 { 13 NewObjectListDeclaration(Spectator); 13 14 14 15 public: … … 37 38 bool bForward; 38 39 bool bBackward; 39 40 40 41 float xMouse; //!< mouse moved in x-Direction 41 42 float yMouse; //!< mouse moved in y-Direction -
branches/new_class_id/src/world_entities/terrain.cc
r9406 r9709 34 34 35 35 36 37 CREATE_FACTORY(Terrain, CL_TERRAIN); 36 #include "class_id.h" 37 NewObjectListDefinitionID(Terrain, CL_TERRAIN); 38 CREATE_FACTORY(Terrain); 38 39 39 40 /** … … 89 90 { 90 91 if (objectList) 91 glDeleteLists(this-> objectList, 1);92 glDeleteLists(this->modelList, 1); 92 93 if( this->ssp) 93 94 delete ssp; … … 104 105 void Terrain::init() 105 106 { 106 this-> setClassID(CL_TERRAIN, "Terrain");107 this->registerObject(this, Terrain::_objectList); 107 108 this->toList(OM_ENVIRON_NOTICK); 108 109 this->toReflectionList(); 109 110 110 this-> objectList = 0;111 this->modelList = 0; 111 112 this->ssp = NULL; 112 113 this->vegetation = NULL; … … 207 208 208 209 if (this->objectList) 209 glCallList(this-> objectList);210 glCallList(this->modelList); 210 211 else if (this->getModel()) 211 212 this->getModel()->draw(); … … 256 257 if (debugTerrain == TERRAIN_DAVE) 257 258 { 258 objectList = glGenLists(1);259 glNewList ( objectList, GL_COMPILE);259 modelList = glGenLists(1); 260 glNewList (modelList, GL_COMPILE); 260 261 261 262 glColor3f(1.0,0,0); -
branches/new_class_id/src/world_entities/terrain.h
r7954 r9709 12 12 13 13 #include "world_entity.h" 14 #include "vector.h"15 14 16 15 // FORWARD DECLARATION … … 26 25 class Terrain : public WorldEntity 27 26 { 27 NewObjectListDeclaration(Terrain); 28 28 29 29 public: … … 52 52 private: 53 53 Model* vegetation; 54 int objectList;54 int modelList; 55 55 56 56 HeightMap* heightMap; -
branches/new_class_id/src/world_entities/test_entity.cc
r9406 r9709 35 35 36 36 37 38 CREATE_FACTORY(TestEntity, CL_TEST_ENTITY); 37 #include "class_id.h" 38 NewObjectListDefinition(TestEntity); 39 CREATE_FACTORY(TestEntity); 39 40 40 41 #include "script_class.h" 41 CREATE_SCRIPTABLE_CLASS(TestEntity, CL_TEST_ENTITY,42 CREATE_SCRIPTABLE_CLASS(TestEntity, TestEntity::classID(), 42 43 addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 43 44 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) 44 45 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 45 46 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 46 47 47 48 ); 48 49 … … 75 76 void TestEntity::init() 76 77 { 77 this-> setClassID(CL_TEST_ENTITY, "TestEntity");78 this->registerObject(this, TestEntity::_objectList); 78 79 this->toList(OM_GROUP_00); 79 80 -
branches/new_class_id/src/world_entities/test_entity.h
r9235 r9709 15 15 class TestEntity : public WorldEntity, public PhysicsInterface 16 16 { 17 NewObjectListDeclaration(TestEntity); 17 18 public: 18 19 TestEntity (); -
branches/new_class_id/src/world_entities/weapons/aim.cc
r9656 r9709 29 29 30 30 31 NewObjectListDefinition(Aim); 31 32 32 33 /** … … 59 60 void Aim::init() 60 61 { 61 this-> setClassID(CL_CROSSHAIR, "Aim");62 this->registerObject(this, Aim::_objectList); 62 63 this->setName("Aim"); 63 64 … … 107 108 ObjectManager::EntityList::iterator entity; 108 109 //printf("%d\n", this->targetGroup); 109 for (entity = State::getObjectManager()->get ObjectList(this->targetGroup).begin();110 entity != State::getObjectManager()->get ObjectList(this->targetGroup).end();110 for (entity = State::getObjectManager()->getEntityList(this->targetGroup).begin(); 111 entity != State::getObjectManager()->getEntityList(this->targetGroup).end(); 111 112 entity ++) 112 113 { -
branches/new_class_id/src/world_entities/weapons/aim.h
r9656 r9709 19 19 template<class T> class tAnimation; 20 20 21 21 22 //! An Aim for zooming in on Targets. 22 23 /** … … 28 29 class Aim : public PNode, public Element2D 29 30 { 31 NewObjectListDeclaration(Aim); 30 32 31 33 public: -
branches/new_class_id/src/world_entities/weapons/aiming_system.cc
r9406 r9709 30 30 31 31 32 NewObjectListDefinition(AimingSystem); 32 33 33 34 /** … … 55 56 void AimingSystem::init() 56 57 { 57 this-> setClassID(CL_AIMING_SYSTEM, "AimingSystem");58 this->registerObject(this, AimingSystem::_objectList); 58 59 this->setName("AimingSystem"); 59 60 … … 63 64 // registering default reactions: 64 65 this->unsubscribeReaction(CREngine::CR_OBJECT_DAMAGE); 65 this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY);66 this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, WorldEntity::classID()); 66 67 67 68 this->range = 1000.0f; -
branches/new_class_id/src/world_entities/weapons/aiming_system.h
r9235 r9709 21 21 class AimingSystem : public WorldEntity 22 22 { 23 NewObjectListDeclaration(AimingSystem); 23 24 24 25 public: -
branches/new_class_id/src/world_entities/weapons/aiming_turret.cc
r9656 r9709 27 27 #include "util/loading/factory.h" 28 28 29 CREATE_FACTORY(AimingTurret, CL_AIMING_TURRET); 30 29 #include "class_id.h" 30 NewObjectListDefinitionID(AimingTurret, CL_AIMING_TURRET); 31 CREATE_FACTORY(AimingTurret); 31 32 32 33 … … 64 65 void AimingTurret::init() 65 66 { 66 this-> setClassID(CL_AIMING_TURRET, "AimingTurret");67 this->registerObject(this, AimingTurret::_objectList); 67 68 68 69 Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this); … … 86 87 87 88 this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET); 88 this->setProjectileType (CL_GUIDED_MISSILE);89 this->setProjectileTypeC("GuidedMissile"); 89 90 90 91 -
branches/new_class_id/src/world_entities/weapons/aiming_turret.h
r9656 r9709 13 13 class AimingTurret : public Weapon 14 14 { 15 NewObjectListDeclaration(AimingTurret); 16 15 17 public: 16 18 AimingTurret (); -
branches/new_class_id/src/world_entities/weapons/boomerang_gun.cc
r9235 r9709 27 27 #include "util/loading/factory.h" 28 28 29 CREATE_FACTORY(BoomerangGun, CL_BOOMERANG_GUN); 29 #include "class_id.h" 30 NewObjectListDefinitionID(BoomerangGun, CL_BOOMERANG_GUN); 31 CREATE_FACTORY(BoomerangGun); 30 32 31 33 … … 61 63 void BoomerangGun::init() 62 64 { 63 this-> setClassID(CL_BOOMERANG_GUN, "BoomerangGun");65 this->registerObject(this, BoomerangGun::_objectList); 64 66 65 67 … … 85 87 86 88 this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET); 87 this->setProjectileType (CL_BOOMERANG_PROJECTILE);89 this->setProjectileTypeC("BoomerangProjectile"); 88 90 89 91 this->loadModel("models/guns/turret1.obj", 5.0); -
branches/new_class_id/src/world_entities/weapons/boomerang_gun.h
r9235 r9709 11 11 class BoomerangGun : public Weapon 12 12 { 13 NewObjectListDeclaration(BoomerangGun); 13 14 public: 14 15 BoomerangGun (); -
branches/new_class_id/src/world_entities/weapons/cannon.cc
r9406 r9709 32 32 #include "animation3d.h" 33 33 34 #include "fast_factory.h" 35 36 37 38 39 CREATE_FACTORY(Cannon, CL_CANNON); 34 #include "loading/fast_factory.h" 35 36 37 38 #include "class_id.h" 39 NewObjectListDefinitionID(Cannon, CL_CANNON); 40 CREATE_FACTORY(Cannon); 40 41 41 42 /** … … 69 70 void Cannon::init() 70 71 { 71 this-> setClassID(CL_CANNON, "Cannon");72 this->registerObject(this, Cannon::_objectList); 72 73 73 74 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN); … … 88 89 89 90 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY); 90 this->setProjectileType (CL_BOMB);91 this->setProjectileTypeC("Bomb"); 91 92 this->prepareProjectiles(5); 92 93 -
branches/new_class_id/src/world_entities/weapons/cannon.h
r8777 r9709 12 12 class Cannon : public Weapon 13 13 { 14 NewObjectListDeclaration(Cannon); 14 15 public: 15 16 Cannon (); -
branches/new_class_id/src/world_entities/weapons/fps_sniper_rifle.cc
r9406 r9709 29 29 30 30 31 #include " fast_factory.h"31 #include "loading/fast_factory.h" 32 32 33 33 #include "fps_sniper_rifle.h" … … 39 39 40 40 41 CREATE_FACTORY(FPSSniperRifle, CL_FPS_SNIPER_RIFLE); 41 #include "class_id.h" 42 NewObjectListDefinitionID(FPSSniperRifle, CL_FPS_SNIPER_RIFLE); 43 CREATE_FACTORY(FPSSniperRifle); 42 44 43 45 /** … … 76 78 void FPSSniperRifle::init() 77 79 { 78 this-> setClassID(CL_FPS_SNIPER_RIFLE, "FPSSniperRifle");80 this->registerObject(this, FPSSniperRifle::_objectList); 79 81 80 82 this->loadModel("models/guns/fps_sniper_rifle.obj", 0.2); … … 98 100 99 101 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 100 this->setProjectileType (CL_LASER);102 this->setProjectileTypeC("Laser"); 101 103 this->prepareProjectiles(20); 102 104 -
branches/new_class_id/src/world_entities/weapons/fps_sniper_rifle.h
r9003 r9709 39 39 class FPSSniperRifle : public Weapon 40 40 { 41 NewObjectListDeclaration(FPSSniperRifle); 42 41 43 public: 42 44 FPSSniperRifle (int leftRight); -
branches/new_class_id/src/world_entities/weapons/hyperblaster.cc
r9406 r9709 31 31 #include "animation3d.h" 32 32 33 #include " fast_factory.h"33 #include "loading/fast_factory.h" 34 34 35 35 36 36 37 38 CREATE_FACTORY(Hyperblaster, CL_HYPERBLASTER); 37 #include "class_id.h" 38 NewObjectListDefinitionID(Hyperblaster, CL_HYPERBLASTER); 39 CREATE_FACTORY(Hyperblaster); 39 40 40 41 Hyperblaster::Hyperblaster(const TiXmlElement* root) … … 56 57 void Hyperblaster::init() 57 58 { 58 this-> setClassID(CL_HYPERBLASTER, "Hyperblaster");59 this->registerObject(this, Hyperblaster::_objectList); 59 60 60 61 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN); … … 76 77 77 78 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY); 78 this->setProjectileType (CL_HYPERBLAST);79 this->setProjectileTypeC("Hyperblast"); 79 80 this->prepareProjectiles(2); 80 81 -
branches/new_class_id/src/world_entities/weapons/hyperblaster.h
r8777 r9709 12 12 class Hyperblaster : public Weapon 13 13 { 14 public: 14 NewObjectListDeclaration(Hyperblaster); 15 public: 15 16 Hyperblaster (const TiXmlElement* root = NULL); 16 17 virtual ~Hyperblaster (); -
branches/new_class_id/src/world_entities/weapons/laser_cannon.cc
r9656 r9709 29 29 #include "animation3d.h" 30 30 31 #include " fast_factory.h"31 #include "loading/fast_factory.h" 32 32 33 CREATE_FACTORY(LaserCannon, CL_LASER_CANNON); 34 33 #include "class_id.h" 34 NewObjectListDefinitionID(LaserCannon, CL_LASER_CANNON); 35 CREATE_FACTORY(LaserCannon); 35 36 36 37 LaserCannon::LaserCannon(const TiXmlElement* root) … … 52 53 void LaserCannon::init() 53 54 { 54 this-> setClassID(CL_LASER_CANNON, "LaserCannon");55 this->registerObject(this, LaserCannon::_objectList); 55 56 56 57 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/laser_cannon.obj", OBJ, RP_CAMPAIGN); … … 72 73 73 74 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 74 this->setProjectileType (CL_RAIL_PROJECTILE);75 this->setProjectileTypeC("RailProjectile"); 75 76 this->prepareProjectiles(100); 76 77 this->setEmissionPoint(Vector(2.8,0,0) * 5.0); -
branches/new_class_id/src/world_entities/weapons/laser_cannon.h
r9235 r9709 29 29 class LaserCannon : public Weapon 30 30 { 31 public: 31 NewObjectListDeclaration(LaserCannon); 32 public: 32 33 LaserCannon (const TiXmlElement* root = NULL); 33 34 virtual ~LaserCannon (); -
branches/new_class_id/src/world_entities/weapons/targeting_turret.cc
r9656 r9709 26 26 #include "util/loading/factory.h" 27 27 28 CREATE_FACTORY(TargetingTurret, CL_TARGETING_TURRET); 28 #include "class_id.h" 29 NewObjectListDefinitionID(TargetingTurret, CL_TARGETING_TURRET); 30 CREATE_FACTORY(TargetingTurret); 29 31 30 32 … … 48 50 void TargetingTurret::init() 49 51 { 50 this-> setClassID(CL_TARGETING_TURRET, "TargetingTurret");52 this->registerObject(this, TargetingTurret::_objectList); 51 53 52 54 Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this); … … 70 72 71 73 this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET); 72 this->setProjectileType (CL_GUIDED_MISSILE);74 this->setProjectileTypeC("GuidedMissile"); 73 75 74 76 -
branches/new_class_id/src/world_entities/weapons/targeting_turret.h
r9656 r9709 12 12 class TargetingTurret : public Weapon 13 13 { 14 NewObjectListDeclaration(TargetingTurret); 14 15 public: 15 16 TargetingTurret(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/weapons/test_gun.cc
r9656 r9709 31 31 #include "animation3d.h" 32 32 33 #include "fast_factory.h" 34 35 CREATE_FACTORY(TestGun, CL_TEST_GUN); 36 33 #include "loading/fast_factory.h" 34 35 #include "class_id.h" 36 NewObjectListDefinitionID(TestGun, CL_TEST_GUN); 37 CREATE_FACTORY(TestGun); 37 38 /** 38 39 * standard constructor … … 109 110 void TestGun::init() 110 111 { 111 this->setClassID(CL_TEST_GUN, "TestGun"); 112 112 this->registerObject(this, TestGun::_objectList); 113 113 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN); 114 114 … … 129 129 130 130 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 131 this->setProjectileType (CL_LASER);131 this->setProjectileTypeC("Laser"); 132 132 this->prepareProjectiles(100); 133 133 -
branches/new_class_id/src/world_entities/weapons/test_gun.h
r8777 r9709 37 37 class TestGun : public Weapon 38 38 { 39 NewObjectListDeclaration(TestGun); 39 40 public: 40 41 TestGun (int leftRight); -
branches/new_class_id/src/world_entities/weapons/turret.cc
r9406 r9709 27 27 #include "util/loading/factory.h" 28 28 29 CREATE_FACTORY(Turret, CL_TURRET); 30 31 29 #include "class_id.h" 30 NewObjectListDefinitionID(Turret, CL_TURRET); 31 CREATE_FACTORY(Turret); 32 32 33 33 /** … … 62 62 void Turret::init() 63 63 { 64 this-> setClassID(CL_TURRET, "Turret");64 this->registerObject(this, Turret::_objectList); 65 65 66 66 … … 86 86 87 87 this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET); 88 this->setProjectileType (CL_ROCKET);88 this->setProjectileTypeC("Rocket"); 89 89 90 90 this->loadModel("models/guns/turret1.obj"); -
branches/new_class_id/src/world_entities/weapons/turret.h
r8777 r9709 11 11 class Turret : public Weapon 12 12 { 13 NewObjectListDeclaration(Turret); 13 14 public: 14 15 Turret (); -
branches/new_class_id/src/world_entities/weapons/weapon.cc
r9705 r9709 21 21 #include "weapon.h" 22 22 23 #include " fast_factory.h"23 #include "loading/fast_factory.h" 24 24 #include "world_entities/projectiles/projectile.h" 25 25
Note: See TracChangeset
for help on using the changeset viewer.