Changeset 5113 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Aug 23, 2005, 11:18:39 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.cc
r5111 r5113 165 165 void PNode::setRelCoor (const Vector& relCoord) 166 166 { 167 if (this->toCoordinate!= NULL) 168 { 169 delete this->toCoordinate; 170 this->toCoordinate = NULL; 171 } 172 167 173 this->relCoordinate = relCoord; 168 174 this->bRelCoorChanged = true; … … 213 219 void PNode::setAbsCoor (const Vector& absCoord) 214 220 { 221 if (this->toCoordinate!= NULL) 222 { 223 delete this->toCoordinate; 224 this->toCoordinate = NULL; 225 } 226 215 227 if( likely(this->parentMode & PNODE_MOVEMENT)) 216 228 { … … 276 288 void PNode::setRelDir (const Quaternion& relDir) 277 289 { 290 if (this->toDirection!= NULL) 291 { 292 delete this->toDirection; 293 this->toDirection = NULL; 294 } 278 295 this->relDirection = relDir; 279 296 this->bRelCoorChanged = true; … … 327 344 void PNode::setAbsDir (const Quaternion& absDir) 328 345 { 346 if (this->toDirection!= NULL) 347 { 348 delete this->toDirection; 349 this->toDirection = NULL; 350 } 351 329 352 if (likely(this->parent != NULL)) 330 353 this->relDirection = absDir / this->parent->getAbsDir(); -
trunk/src/lib/coord/p_node.h
r5111 r5113 66 66 /** @returns the relative position */ 67 67 inline const Vector& getRelCoor () const { return this->prevRelCoordinate; }; 68 /** @returns the Relative Coordinate Destination */ 69 inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; }; 68 70 void setAbsCoor (const Vector& absCoord); 69 71 void setAbsCoor (float x, float y, float z); … … 78 80 /** @returns the relative Direction */ 79 81 inline const Quaternion& getRelDir () const { return this->prevRelDirection; }; 82 /** @returns the Relative Directional Destination */ 83 inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; }; 80 84 /** @returns a Vector pointing into the relative Direction */ 81 85 inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); }; -
trunk/src/lib/graphics/render2D/element_2d.cc
r5111 r5113 214 214 void Element2D::setRelCoor2D (const Vector& relCoord) 215 215 { 216 if (this->toCoordinate!= NULL) 217 { 218 delete this->toCoordinate; 219 this->toCoordinate = NULL; 220 } 216 221 this->relCoordinate = relCoord; 217 222 this->bRelCoorChanged = true; … … 227 232 void Element2D::setRelCoor2D (float x, float y, float z) 228 233 { 229 this->set AbsCoor2D(Vector(x,y,z));234 this->setRelCoor2D(Vector(x,y,z)); 230 235 } 231 236 … … 288 293 void Element2D::setAbsCoor2D (const Vector& absCoord) 289 294 { 295 if (this->toCoordinate!= NULL) 296 { 297 delete this->toCoordinate; 298 this->toCoordinate = NULL; 299 } 300 290 301 if( likely(this->parentMode & E2D_PARENT_MOVEMENT)) 291 302 { … … 362 373 void Element2D::setRelDir2D (float relDir) 363 374 { 375 if (this->toDirection!= NULL) 376 { 377 delete this->toDirection; 378 this->toDirection = NULL; 379 } 380 364 381 this->relDirection = relDir; 365 382 this->bRelDirChanged = true; … … 386 403 void Element2D::setAbsDir2D (float absDir) 387 404 { 405 if (this->toDirection!= NULL) 406 { 407 delete this->toDirection; 408 this->toDirection = NULL; 409 } 410 388 411 if (likely(this->parent != NULL)) 389 412 this->relDirection = absDir - this->parent->getAbsDir2D(); … … 712 735 { 713 736 tIterator<Element2D>* iterator = this->children->getIterator(); 714 //PNode* pn = this->children->enumerate ();715 737 Element2D* pn = iterator->nextElement(); 716 738 while( pn != NULL) -
trunk/src/lib/graphics/render2D/element_2d.h
r5111 r5113 108 108 /** @returns the relative position */ 109 109 inline const Vector& getRelCoor2D () const { return this->prevRelCoordinate; }; 110 /** @returns the Relative Coordinate Destination */ 111 inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; }; 110 112 const Vector& getRelCoor2Dpx() const; 111 113 void setAbsCoor2D (const Vector& absCoord); … … 123 125 /** @returns the relative Direction */ 124 126 inline float getRelDir2D () const { return this->prevRelDirection; }; 127 /** @returns the Relative Directional Destination */ 128 inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; }; 125 129 void setAbsDir2D (float absDir); 126 130 /** @returns the absolute Direction */ -
trunk/src/lib/graphics/text_engine.cc
r5111 r5113 592 592 if( glyphSurf != NULL ) 593 593 { 594 595 594 SDL_SetAlpha(glyphSurf, 0, 0); 596 595 … … 598 597 TexCoord tmpTexCoord; 599 598 tmpTexCoord.minU = (float)tmpRect.x/(float)tmpSurf->w; 600 tmpTexCoord.maxU = (float)(tmpRect.x +1 + tmpGlyph->width)/(float)tmpSurf->w;599 tmpTexCoord.maxU = (float)(tmpRect.x +1 + tmpGlyph->width)/(float)tmpSurf->w; 601 600 tmpTexCoord.minV = (float)tmpRect.y/(float)tmpSurf->w; 602 601 tmpTexCoord.maxV = (float)(tmpRect.y+tmpGlyph->height)/(float)tmpSurf->w; … … 620 619 621 620 // Outputting Glyphs to BMP-files. 622 623 char outname[ 64];621 /* 622 char outname[512]; 624 623 if (i < 10) 625 sprintf( outname, " glyph-00%d.bmp", i );624 sprintf( outname, "%s-glyph-00%d.bmp", this->getName(), i ); 626 625 else if (i <100) 627 sprintf( outname, "glyph-0%d.bmp", i );626 sprintf( outname, "%s-glyph-0%d.bmp", this->getName(), i ); 628 627 else 629 sprintf( outname, "glyph-%d.bmp", i );630 SDL_SaveBMP(tmpSurf, outname); 631 */ 628 sprintf( outname, "%s-glyph-%d.bmp", this->getName(), i ); 629 SDL_SaveBMP(tmpSurf, outname);*/ 630 632 631 } 633 632 } … … 712 711 x = 0; 713 712 y = y + maxLineHeight; 714 maxLineHeight = 0;713 //maxLineHeight = 0; 715 714 } 716 715 if (y + maxLineHeight + 1 > size) -
trunk/src/lib/lang/base_object.cc
r5111 r5113 52 52 // delete []this->className; 53 53 if (this->objectName) 54 delete []this->objectName;}54 delete[] this->objectName;} 55 55 56 56 /** … … 84 84 { 85 85 if (this->objectName) 86 delete []this->objectName;86 delete[] this->objectName; 87 87 if (objectName) 88 88 { -
trunk/src/lib/lang/base_object.h
r5111 r5113 27 27 28 28 void setName (const char* newName); 29 /** \briefreturns the Name of this Object */29 /** returns the Name of this Object */ 30 30 inline const char* getName ()const { return this->objectName; }; 31 31 -
trunk/src/lib/lang/class_list.cc
r5111 r5113 48 48 { 49 49 delete this->objectList; 50 if(ClassList::classList != NULL) 51 { 52 delete ClassList::classList; 53 ClassList::classList = NULL; 54 } 50 55 --ClassList::classCount; 51 56 } … … 56 61 //! the Count of classes 57 62 unsigned int ClassList::classCount = 0; 63 64 //! a List of all strings of all classes, that have registered so far. 65 tList<const char>* ClassList::classList = NULL; 58 66 59 67 /** … … 109 117 } 110 118 119 /** 120 * grabs the names of all Classes, and injects it into a List of const chars 121 * @return the generated List 122 * 123 * This function first looks, if the List has been changed (by the ListSize) 124 * befor it changes anything. 125 */ 126 const tList<const char>* ClassList::getClassList() 127 { 128 if (unlikely(ClassList::classList != NULL && ClassList::classList->getSize() != ClassList::classCount)) 129 { 130 delete ClassList::classList; 131 ClassList::classList = NULL; 132 } 133 if (unlikely(ClassList::classList == NULL)) 134 ClassList::classList = new tList<const char>; 135 136 if(likely(ClassList::first != NULL)) 137 { 138 ClassList* tmpCL = ClassList::first; 139 while (likely(tmpCL != NULL)) 140 { 141 ClassList::classList->add(tmpCL->className); 142 tmpCL = tmpCL->next; 143 } 144 } 145 return ClassList::classList; 146 } 147 148 /** 149 * searches for classID and returns the list of Entities 150 * @param classID the ID of the class to get the list from 151 * @return the List accessed by classID, or NULL if not found 152 */ 111 153 tList<BaseObject>* ClassList::getList(long classID) 112 154 { … … 119 161 { 120 162 if (unlikely(tmpCL->classID == classID)) 163 return tmpCL->objectList; 164 tmpCL = tmpCL->next; 165 } 166 } 167 return NULL; 168 } 169 170 /** 171 * searches for className and returns the list of Entities 172 * @param className the name of the class to get the list from 173 * @return the List accessed by classID, or NULL if not found 174 */tList<BaseObject>* ClassList::getList(const char* className) 175 { 176 if(unlikely(ClassList::first == NULL)) 177 return NULL; 178 else 179 { 180 ClassList* tmpCL = ClassList::first; 181 while (likely(tmpCL != NULL)) 182 { 183 if (unlikely(!strcmp(tmpCL->className, className))) 121 184 return tmpCL->objectList; 122 185 tmpCL = tmpCL->next; … … 205 268 } 206 269 207 208 270 /** 209 271 * prints out a string of all the types this Object matches … … 222 284 } 223 285 } 286 287 /** 288 * converts a ClassID into a string 289 * @param classID the ClassID to search for 290 * @return a String containing the name of the Class, NULL if the Class was not found 291 */ 292 const char* ClassList::IDToString(ClassID classID) 293 { 294 if(likely(ClassList::first != NULL)) 295 { 296 ClassList* tmpCL = ClassList::first; 297 while (likely(tmpCL != NULL)) 298 { 299 if (tmpCL->classID == classID) 300 return tmpCL->className; 301 tmpCL = tmpCL->next; 302 } 303 } 304 return NULL; 305 } 306 307 /** 308 * converts a String into a ClassID 309 * @param className the name of the class to search for 310 * @return the ClassID. CL_NULL, if the class was not found. 311 */ 312 long ClassList::StringToID(const char* className) 313 { 314 if(likely(ClassList::first != NULL)) 315 { 316 ClassList* tmpCL = ClassList::first; 317 while (likely(tmpCL != NULL)) 318 { 319 if (!strcasecmp(tmpCL->className, className)) 320 return tmpCL->classID; 321 tmpCL = tmpCL->next; 322 } 323 } 324 return CL_NULL; 325 } 326 327 224 328 225 329 /** -
trunk/src/lib/lang/class_list.h
r5111 r5113 35 35 36 36 // STATIC FUNCTIONS 37 static void addToClassList(BaseObject* objectPointer, const long& classID, const char* className);38 static void removeFromClassList(BaseObject* objectPointer);37 static void addToClassList(BaseObject* objectPointer, const long& classID, const char* className); 38 static void removeFromClassList(BaseObject* objectPointer); 39 39 40 static tList<BaseObject>* getList(long classID = CL_NULL); 41 static BaseObject* getObject(const char* name, long classID = CL_NULL); 42 static bool exists(const BaseObject* object, long classID = CL_NULL); 40 static tList<BaseObject>* getList(long classID = CL_NULL); 41 static tList<BaseObject>* getList(const char* className); 42 static const tList<const char>* getClassList(); 43 static BaseObject* getObject(const char* name, long classID = CL_NULL); 44 static bool exists(const BaseObject* object, long classID = CL_NULL); 43 45 44 static void whatIs(const BaseObject* object); 45 static void debug(unsigned int debugLevel = 0, long classID = CL_NULL); 46 static void whatIs(const BaseObject* object); 47 48 static const char* IDToString(ClassID classID = CL_NULL); 49 static long StringToID(const char* className); 50 static void debug(unsigned int debugLevel = 0, long classID = CL_NULL); 51 46 52 47 53 private: 48 tList<BaseObject>* objectList; //!< A list of Objects belonging to this Class54 tList<BaseObject>* objectList; //!< A list of Objects belonging to this Class 49 55 50 long classID; //!< ClassID stored in this ClassList \see ClassID51 const char* className; //!< Name of the Class Stored here56 long classID; //!< ClassID stored in this ClassList \see ClassID 57 const char* className; //!< Name of the Class Stored here 52 58 53 ClassList* next; //!< Pointer to the next class in the List59 ClassList* next; //!< Pointer to the next class in the List 54 60 55 61 // STATIC MEMBERS 56 static ClassList* first; //!< The first Class in the List 57 static unsigned int classCount; //!< The Count of classes that have been registered (should match the lower description) 62 static ClassList* first; //!< The first Class in the List 63 static tList<const char>* classList; //!< a List of all Names of all classes, that have registered so far. 64 static unsigned int classCount; //!< The Count of classes that have been registered (should match the lower description) 58 65 }; 59 66 -
trunk/src/lib/util/list.h
r5111 r5113 135 135 void removeLast(); 136 136 void flush(); 137 T* firstElement() ;138 T* lastElement() ;139 bool isEmpty() ;140 unsigned int getSize() ;137 T* firstElement() const; 138 T* lastElement() const; 139 bool isEmpty() const; 140 unsigned int getSize() const; 141 141 bool inList(T* entity); 142 tIterator<T>* getIterator() ;142 tIterator<T>* getIterator() const; 143 143 T* nextElement(T* toEntity); 144 144 T* toArray(); … … 303 303 */ 304 304 template<class T> 305 inline T* tList<T>::firstElement() 305 inline T* tList<T>::firstElement() const 306 306 { 307 307 return this->first->curr; … … 314 314 */ 315 315 template<class T> 316 inline T* tList<T>::lastElement() 316 inline T* tList<T>::lastElement() const 317 317 { 318 318 return this->last->curr; … … 325 325 */ 326 326 template<class T> 327 inline bool tList<T>::isEmpty() 327 inline bool tList<T>::isEmpty() const 328 328 { 329 329 return (this->size==0)?true:false; … … 359 359 */ 360 360 template<class T> 361 inline unsigned int tList<T>::getSize() 361 inline unsigned int tList<T>::getSize() const 362 362 { 363 363 return this->size; … … 372 372 */ 373 373 template<class T> 374 inline tIterator<T>* tList<T>::getIterator() 374 inline tIterator<T>* tList<T>::getIterator() const 375 375 { 376 376 tIterator<T>* iterator = new tIterator<T>(this->first);
Note: See TracChangeset
for help on using the changeset viewer.