Changeset 4747 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jul 1, 2005, 4:10:44 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/graphics_engine.cc
r4746 r4747 92 92 */ 93 93 // setting up the Resolution 94 this->setResolution( 800, 450, 16);94 this->setResolution(1000, 1000, 16); 95 95 96 96 // TO DO: Create a cool icon and use it here -
orxonox/trunk/src/lib/lang/base_object.cc
r4746 r4747 18 18 19 19 #include "base_object.h" 20 20 21 #include "load_param.h" 21 22 #include "compiler.h" 23 #include "class_list.h" 22 24 23 25 using namespace std; … … 38 40 if (root) 39 41 this->loadParams(root); 42 43 ClassList::addToClassList(this, this->classID, "BaseObject"); 40 44 } 41 45 … … 45 49 BaseObject::~BaseObject () 46 50 { 51 ClassList::removeFromClassList(this); 52 47 53 // delete []this->className; 48 54 if (this->objectName) 49 delete []this->objectName; 50 } 55 delete []this->objectName;} 51 56 52 57 /** … … 70 75 this->classID |= classID; 71 76 this->className = className; 77 78 ClassList::addToClassList(this, classID, className); 72 79 } 73 80 … … 94 101 \returns true if it is, false otherwise 95 102 */ 96 bool BaseObject::isA ( ClassIDclassID) const103 bool BaseObject::isA (long classID) const 97 104 { 98 105 // if classID is a derivable object -
orxonox/trunk/src/lib/lang/base_object.h
r4746 r4747 35 35 inline int getClassID() const { return this->classID; } 36 36 37 bool isA ( ClassIDclassID) const;37 bool isA (long classID) const; 38 38 void whatIs() const; 39 39 -
orxonox/trunk/src/lib/lang/class_list.cc
r4744 r4747 17 17 18 18 #include "class_list.h" 19 #include "base_object.h" 20 21 #include "compiler.h" 22 #include "debug.h" 19 23 20 24 using namespace std; … … 25 29 \todo this constructor is not jet implemented - do it 26 30 */ 27 ClassList::ClassList ()31 ClassList::ClassList(const long& classID, const char* className) 28 32 { 29 /* If you make a new class, what is most probably the case when you write this file 30 don't forget to: 31 1. Add the new file new_class.cc to the ./src/Makefile.am 32 2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS 33 34 Advanced Topics: 35 - if you want to let your object be managed via the ObjectManager make sure to read 36 the object_manager.h header comments. You will use this most certanly only if you 37 make many objects of your class, like a weapon bullet. 38 */ 33 this->objectCount = 0; 34 this->next = NULL; 35 this->className = className; 36 this->classID = classID; 39 37 } 40 38 … … 48 46 // delete what has to be deleted here 49 47 } 48 49 ClassList* ClassList::first = NULL; 50 unsigned int ClassList::classCount = 0; 51 52 53 54 void ClassList::addToClassList(BaseObject* objectPointer, const long& classID, const char* className) 55 { 56 ClassList* regClass; 57 58 if(ClassList::first == NULL) 59 ClassList::first = regClass = new ClassList(classID, className); 60 else 61 { 62 ClassList* tmp = ClassList::first; 63 while (likely(tmp != NULL)) 64 { 65 if (tmp->classID == classID) 66 { 67 regClass = tmp; 68 break; 69 } 70 71 if (tmp->next == NULL) 72 tmp->next = regClass = new ClassList(classID, className); 73 tmp = tmp->next; 74 } 75 } 76 77 ++regClass->objectCount; 78 } 79 80 void ClassList::removeFromClassList(BaseObject* objectPointer) 81 { 82 ClassList* tmp = ClassList::first; 83 while (likely(tmp != NULL)) 84 { 85 if (objectPointer->isA(tmp->classID)) 86 { 87 --tmp->objectCount; 88 } 89 90 tmp = tmp->next; 91 } 92 } 93 94 95 void ClassList::debug() 96 { 97 PRINT(0)("=================\n"); 98 PRINT(0)("= CLASS_LIST =\n"); 99 PRINT(0)("=================\n"); 100 ClassList* tmp = ClassList::first; 101 while (likely(tmp != NULL)) 102 { 103 PRINT(0)("CLASS %s has %d instances\n", tmp->className, tmp->objectCount); 104 105 tmp = tmp->next; 106 } 107 PRINT(0)("==============CL=\n"); 108 109 } -
orxonox/trunk/src/lib/lang/class_list.h
r4744 r4747 3 3 \brief Definition of the Class List, that handles a Class-Specific-Control structure 4 4 5 */5 */ 6 6 7 7 #ifndef _CLASS_LIST_H … … 15 15 16 16 17 //! A class for 17 //! A class that handles Pointers to Objects of all type. 18 /** 19 here all the Pointers to all the Object of orxonox are stored, that implement BaseObject 20 for now, this is only for debugging reasons, and we should be able to detect undeleted 21 Objects. 22 */ 18 23 class ClassList { 19 24 20 public: 21 ClassList(); 22 virtual ~ClassList(); 25 public: 26 ClassList(const long& classID, const char* className); 27 virtual ~ClassList(); 28 29 static void addToClassList(BaseObject* objectPointer, const long& classID, const char* className); 30 static void removeFromClassList(BaseObject* objectPointer); 31 32 static void debug(); 33 34 private: 35 //! a Struct for Lists of Objects 36 struct ObjectList 37 { 38 BaseObject* pointerToObject; 39 ObjectList* next; 40 }; 41 42 long classID; 43 const char* className; 44 45 ClassList* next; 46 47 unsigned int objectCount; 23 48 24 49 25 void addToClassList(BaseObject* objectPointer, ClassID classID, const char* className); 26 private: 27 static ClassList* first; 28 static ClassList* last; 29 30 int classCount; 31 50 static ClassList* first; 51 static unsigned int classCount; 32 52 33 53 }; -
orxonox/trunk/src/story_entities/world.cc
r4736 r4747 67 67 #include "sound_engine.h" 68 68 69 #include "class_list.h" 70 69 71 using namespace std; 70 72 … … 555 557 PhysicsEngine::getInstance()->debug(); 556 558 559 560 ClassList::debug(); 557 561 } 558 562
Note: See TracChangeset
for help on using the changeset viewer.