Changeset 5111 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Aug 23, 2005, 11:13:56 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_detection/cd_engine.cc
r5110 r5111 80 80 tIterator<WorldEntity>* iterator1 = entityList->getIterator(); 81 81 tIterator<WorldEntity>* iterator2 = entityList->getIterator(); 82 WorldEntity* entity1 = iterator1-> firstElement();82 WorldEntity* entity1 = iterator1->nextElement(); 83 83 WorldEntity* entity2 = iterator2->seekElement(entity1); 84 84 PRINTF(3)("checking for collisions\n"); 85 /*while( entity1 != NULL)85 while( entity1 != NULL) 86 86 { 87 87 if( likely(entity1 != this->terrain)) … … 101 101 entity2 = iterator2->seekElement(entity1); 102 102 103 } */103 } 104 104 delete iterator1; 105 105 delete iterator2; … … 133 133 134 134 tIterator<WorldEntity>* iterator = entityList->getIterator(); 135 WorldEntity* entity = iterator-> firstElement();135 WorldEntity* entity = iterator->nextElement(); 136 136 while( entity != NULL) 137 137 { -
trunk/src/lib/collision_detection/obb_tree_node.cc
r5110 r5111 574 574 575 575 iterator = partition1.getIterator(); 576 element = iterator-> firstElement();576 element = iterator->nextElement(); 577 577 index = 0; 578 578 while( element != NULL) … … 592 592 593 593 iterator = partition2.getIterator(); 594 element = iterator-> firstElement();594 element = iterator->nextElement(); 595 595 index = 0; 596 596 while( element != NULL) -
trunk/src/lib/coord/p_node.cc
r5110 r5111 79 79 { 80 80 tIterator<PNode>* iterator = this->children->getIterator(); 81 PNode* pn = iterator-> firstElement();81 PNode* pn = iterator->nextElement(); 82 82 while( pn != NULL) 83 83 { … … 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 173 167 this->relCoordinate = relCoord; 174 168 this->bRelCoorChanged = true; … … 219 213 void PNode::setAbsCoor (const Vector& absCoord) 220 214 { 221 if (this->toCoordinate!= NULL)222 {223 delete this->toCoordinate;224 this->toCoordinate = NULL;225 }226 227 215 if( likely(this->parentMode & PNODE_MOVEMENT)) 228 216 { … … 288 276 void PNode::setRelDir (const Quaternion& relDir) 289 277 { 290 if (this->toDirection!= NULL)291 {292 delete this->toDirection;293 this->toDirection = NULL;294 }295 278 this->relDirection = relDir; 296 279 this->bRelCoorChanged = true; … … 344 327 void PNode::setAbsDir (const Quaternion& absDir) 345 328 { 346 if (this->toDirection!= NULL)347 {348 delete this->toDirection;349 this->toDirection = NULL;350 }351 352 329 if (likely(this->parent != NULL)) 353 330 this->relDirection = absDir / this->parent->getAbsDir(); … … 435 412 436 413 tIterator<PNode>* iterator = this->children->getIterator(); 437 PNode* pn = iterator-> firstElement();414 PNode* pn = iterator->nextElement(); 438 415 439 416 while( pn != NULL) … … 605 582 { 606 583 tIterator<PNode>* iterator = this->children->getIterator(); 607 PNode* pn = iterator-> firstElement();584 PNode* pn = iterator->nextElement(); 608 585 while( pn != NULL) 609 586 { … … 615 592 616 593 pn->update(dt); 594 //pn = this->children->nextElement(); 617 595 pn = iterator->nextElement(); 618 596 } … … 655 633 tIterator<PNode>* iterator = this->children->getIterator(); 656 634 //PNode* pn = this->children->enumerate (); 657 PNode* pn = iterator-> firstElement();635 PNode* pn = iterator->nextElement(); 658 636 while( pn != NULL) 659 637 { … … 721 699 if (depth >= 2 || depth == 0) 722 700 { 701 tIterator<PNode>* iterator = this->children->getIterator(); 702 //PNode* pn = this->children->enumerate (); 723 703 Vector childColor = Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(20,0,.0)); 724 725 tIterator<PNode>* iterator = this->children->getIterator(); 726 PNode* pn = iterator->firstElement(); 704 PNode* pn = iterator->nextElement(); 727 705 while( pn != NULL) 728 706 { -
trunk/src/lib/coord/p_node.h
r5109 r5111 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; };70 68 void setAbsCoor (const Vector& absCoord); 71 69 void setAbsCoor (float x, float y, float z); … … 80 78 /** @returns the relative Direction */ 81 79 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; };84 80 /** @returns a Vector pointing into the relative Direction */ 85 81 inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); }; -
trunk/src/lib/graphics/importer/model.cc
r5110 r5111 192 192 193 193 tIterator<Material>* tmpIt = this->materialList->getIterator(); 194 Material* material = tmpIt-> firstElement();194 Material* material = tmpIt->nextElement(); 195 195 //! @todo do we really have to delete this material?? 196 196 while(material) … … 413 413 { 414 414 tIterator<Material>* tmpIt = this->materialList->getIterator(); 415 Material* material = tmpIt-> firstElement();415 Material* material = tmpIt->nextElement(); 416 416 while(material) 417 417 { -
trunk/src/lib/graphics/render2D/element_2d.cc
r5110 r5111 55 55 56 56 tIterator<Element2D>* iterator = this->children->getIterator(); 57 Element2D* pn = iterator-> firstElement();57 Element2D* pn = iterator->nextElement(); 58 58 while( pn != NULL) 59 59 { … … 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 }221 216 this->relCoordinate = relCoord; 222 217 this->bRelCoorChanged = true; … … 232 227 void Element2D::setRelCoor2D (float x, float y, float z) 233 228 { 234 this->set RelCoor2D(Vector(x,y,z));229 this->setAbsCoor2D(Vector(x,y,z)); 235 230 } 236 231 … … 293 288 void Element2D::setAbsCoor2D (const Vector& absCoord) 294 289 { 295 if (this->toCoordinate!= NULL)296 {297 delete this->toCoordinate;298 this->toCoordinate = NULL;299 }300 301 290 if( likely(this->parentMode & E2D_PARENT_MOVEMENT)) 302 291 { … … 373 362 void Element2D::setRelDir2D (float relDir) 374 363 { 375 if (this->toDirection!= NULL)376 {377 delete this->toDirection;378 this->toDirection = NULL;379 }380 381 364 this->relDirection = relDir; 382 365 this->bRelDirChanged = true; … … 403 386 void Element2D::setAbsDir2D (float absDir) 404 387 { 405 if (this->toDirection!= NULL)406 {407 delete this->toDirection;408 this->toDirection = NULL;409 }410 411 388 if (likely(this->parent != NULL)) 412 389 this->relDirection = absDir - this->parent->getAbsDir2D(); … … 479 456 { 480 457 tIterator<Element2D>* iterator = this->children->getIterator(); 481 Element2D* pn = iterator-> firstElement();458 Element2D* pn = iterator->nextElement(); 482 459 483 460 while( pn != NULL) … … 687 664 { 688 665 tIterator<Element2D>* iterator = this->children->getIterator(); 689 Element2D* pn = iterator-> firstElement();666 Element2D* pn = iterator->nextElement(); 690 667 while( pn != NULL) 691 668 { … … 697 674 698 675 pn->update2D(dt); 676 //pn = this->children->nextElement(); 699 677 pn = iterator->nextElement(); 700 678 } … … 734 712 { 735 713 tIterator<Element2D>* iterator = this->children->getIterator(); 736 Element2D* pn = iterator->firstElement(); 714 //PNode* pn = this->children->enumerate (); 715 Element2D* pn = iterator->nextElement(); 737 716 while( pn != NULL) 738 717 { -
trunk/src/lib/graphics/render2D/element_2d.h
r5109 r5111 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; };112 110 const Vector& getRelCoor2Dpx() const; 113 111 void setAbsCoor2D (const Vector& absCoord); … … 125 123 /** @returns the relative Direction */ 126 124 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; };129 125 void setAbsDir2D (float absDir); 130 126 /** @returns the absolute Direction */ -
trunk/src/lib/graphics/render2D/render_2d.cc
r5110 r5111 105 105 { 106 106 tIterator<Element2D>* iterator = this->element2DList[i]->getIterator(); 107 Element2D* elem = iterator-> firstElement();107 Element2D* elem = iterator->nextElement(); 108 108 while (elem != NULL) 109 109 { … … 131 131 { 132 132 tIterator<Element2D>* iterator = this->element2DList[i]->getIterator(); 133 Element2D* elem = iterator-> firstElement();133 Element2D* elem = iterator->nextElement(); 134 134 while (elem != NULL) 135 135 { -
trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
r5110 r5111 253 253 counter = 0; 254 254 iterator = listA->getIterator(); 255 tempTri = iterator-> firstElement();255 tempTri = iterator->nextElement(); 256 256 while( tempTri) 257 257 { … … 262 262 counter = 0; 263 263 iterator = listB->getIterator(); 264 tempTri = iterator-> firstElement();264 tempTri = iterator->nextElement(); 265 265 while( tempTri) 266 266 { … … 271 271 counter = 0; 272 272 iterator = listC->getIterator(); 273 tempTri = iterator-> firstElement();273 tempTri = iterator->nextElement(); 274 274 while( tempTri) 275 275 { … … 280 280 counter = 0; 281 281 iterator = listD->getIterator(); 282 tempTri = iterator-> firstElement();282 tempTri = iterator->nextElement(); 283 283 while( tempTri) 284 284 { -
trunk/src/lib/graphics/text_engine.cc
r5110 r5111 592 592 if( glyphSurf != NULL ) 593 593 { 594 594 595 SDL_SetAlpha(glyphSurf, 0, 0); 595 596 … … 597 598 TexCoord tmpTexCoord; 598 599 tmpTexCoord.minU = (float)tmpRect.x/(float)tmpSurf->w; 599 tmpTexCoord.maxU = (float)(tmpRect.x +1 + 600 tmpTexCoord.maxU = (float)(tmpRect.x +1 +tmpGlyph->width)/(float)tmpSurf->w; 600 601 tmpTexCoord.minV = (float)tmpRect.y/(float)tmpSurf->w; 601 602 tmpTexCoord.maxV = (float)(tmpRect.y+tmpGlyph->height)/(float)tmpSurf->w; … … 619 620 620 621 // Outputting Glyphs to BMP-files. 621 /*622 char outname[ 512];622 /* 623 char outname[64]; 623 624 if (i < 10) 624 sprintf( outname, " %s-glyph-00%d.bmp", this->getName(), i );625 sprintf( outname, "glyph-00%d.bmp", i ); 625 626 else if (i <100) 626 sprintf( outname, "%s-glyph-0%d.bmp", this->getName(), i );627 sprintf( outname, "glyph-0%d.bmp", i ); 627 628 else 628 sprintf( outname, "%s-glyph-%d.bmp", this->getName(), i );629 SDL_SaveBMP(tmpSurf, outname); */630 629 sprintf( outname, "glyph-%d.bmp", i ); 630 SDL_SaveBMP(tmpSurf, outname); 631 */ 631 632 } 632 633 } … … 711 712 x = 0; 712 713 y = y + maxLineHeight; 713 //maxLineHeight = 0;714 maxLineHeight = 0; 714 715 } 715 716 if (y + maxLineHeight + 1 > size) … … 845 846 846 847 tIterator<BaseObject>* textIterator = ClassList::getList(CL_TEXT)->getIterator(); 847 Text* text = dynamic_cast<Text*>(textIterator-> firstElement());848 Text* text = dynamic_cast<Text*>(textIterator->nextElement()); 848 849 while( text != NULL) 849 850 { -
trunk/src/lib/lang/base_object.cc
r5102 r5111 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
r5102 r5111 27 27 28 28 void setName (const char* newName); 29 /** returns the Name of this Object */29 /** \brief 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
r5110 r5111 48 48 { 49 49 delete this->objectList; 50 if(ClassList::classList != NULL)51 {52 delete ClassList::classList;53 ClassList::classList = NULL;54 }55 50 --ClassList::classCount; 56 51 } … … 61 56 //! the Count of classes 62 57 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;66 58 67 59 /** … … 117 109 } 118 110 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)) 111 tList<BaseObject>* ClassList::getList(long classID) 112 { 113 if(unlikely(ClassList::first == NULL)) 114 return NULL; 115 else 137 116 { 138 117 ClassList* tmpCL = ClassList::first; 139 118 while (likely(tmpCL != NULL)) 140 119 { 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 Entities150 * @param classID the ID of the class to get the list from151 * @return the List accessed by classID, or NULL if not found152 */153 tList<BaseObject>* ClassList::getList(long classID)154 {155 if(unlikely(ClassList::first == NULL))156 return NULL;157 else158 {159 ClassList* tmpCL = ClassList::first;160 while (likely(tmpCL != NULL))161 {162 120 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 Entities172 * @param className the name of the class to get the list from173 * @return the List accessed by classID, or NULL if not found174 */tList<BaseObject>* ClassList::getList(const char* className)175 {176 if(unlikely(ClassList::first == NULL))177 return NULL;178 else179 {180 ClassList* tmpCL = ClassList::first;181 while (likely(tmpCL != NULL))182 {183 if (unlikely(!strcmp(tmpCL->className, className)))184 121 return tmpCL->objectList; 185 122 tmpCL = tmpCL->next; … … 208 145 { 209 146 tIterator<BaseObject>* iterator = tmp->objectList->getIterator(); 210 BaseObject* enumBO = iterator-> firstElement();147 BaseObject* enumBO = iterator->nextElement(); 211 148 const char* tmpName; 212 149 while (enumBO != NULL) … … 249 186 { 250 187 tIterator<BaseObject>* iterator = tmp->objectList->getIterator(); 251 BaseObject* enumBO = iterator-> firstElement();188 BaseObject* enumBO = iterator->nextElement(); 252 189 while (enumBO != NULL) 253 190 { … … 268 205 } 269 206 207 270 208 /** 271 209 * prints out a string of all the types this Object matches … … 284 222 } 285 223 } 286 287 /**288 * converts a ClassID into a string289 * @param classID the ClassID to search for290 * @return a String containing the name of the Class, NULL if the Class was not found291 */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 ClassID309 * @param className the name of the class to search for310 * @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 328 224 329 225 /** … … 362 258 PRINT(0)("| Listing Instances:\n"); 363 259 tIterator<BaseObject>* iterator = tmp->objectList->getIterator(); 364 BaseObject* enumBO = iterator-> firstElement();260 BaseObject* enumBO = iterator->nextElement(); 365 261 while (enumBO) 366 262 { -
trunk/src/lib/lang/class_list.h
r5105 r5111 35 35 36 36 // STATIC FUNCTIONS 37 static void 38 static void 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 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); 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); 45 43 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 44 static void whatIs(const BaseObject* object); 45 static void debug(unsigned int debugLevel = 0, long classID = CL_NULL); 52 46 53 47 private: 54 tList<BaseObject>* 48 tList<BaseObject>* objectList; //!< A list of Objects belonging to this Class 55 49 56 long 57 const char* 50 long classID; //!< ClassID stored in this ClassList \see ClassID 51 const char* className; //!< Name of the Class Stored here 58 52 59 ClassList* 53 ClassList* next; //!< Pointer to the next class in the List 60 54 61 55 // STATIC MEMBERS 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) 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) 65 58 }; 66 59 -
trunk/src/lib/particles/particle_engine.cc
r5110 r5111 53 53 // delete all remaining systems 54 54 tIterator<ParticleSystem>* sysIt = this->systemList->getIterator(); 55 ParticleSystem* tmpSys = sysIt-> firstElement();55 ParticleSystem* tmpSys = sysIt->nextElement(); 56 56 while(tmpSys) 57 57 { … … 64 64 // delete all remaining emitters 65 65 tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator(); 66 ParticleEmitter* tmpEmit = emitIt-> firstElement();66 ParticleEmitter* tmpEmit = emitIt->nextElement(); 67 67 while(tmpEmit) 68 68 { … … 147 147 // look, if we have already added this connection 148 148 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 149 ParticleConnection* tmpConnection = tmpConIt-> firstElement();149 ParticleConnection* tmpConnection = tmpConIt->nextElement(); 150 150 while(tmpConnection) 151 151 { … … 178 178 // remove any connections, that have this system within 179 179 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 180 ParticleConnection* tmpConnection = tmpConIt-> firstElement();180 ParticleConnection* tmpConnection = tmpConIt->nextElement(); 181 181 while(tmpConnection) 182 182 { … … 199 199 // remove any connections, that have this emitter within 200 200 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 201 ParticleConnection* tmpConnection = tmpConIt-> firstElement();201 ParticleConnection* tmpConnection = tmpConIt->nextElement(); 202 202 while(tmpConnection) 203 203 { … … 224 224 // look, if we have already added this connection 225 225 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 226 ParticleConnection* tmpConnection = tmpConIt-> firstElement();226 ParticleConnection* tmpConnection = tmpConIt->nextElement(); 227 227 while(tmpConnection) 228 228 { … … 260 260 // ticks all the ParticleSystems 261 261 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 262 ParticleSystem* tmpSys = tmpIt-> firstElement();262 ParticleSystem* tmpSys = tmpIt->nextElement(); 263 263 while(tmpSys) 264 264 { … … 270 270 // add new Particles to each System connected to an Emitter. 271 271 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 272 ParticleConnection* tmpConnection = tmpConIt-> firstElement();272 ParticleConnection* tmpConnection = tmpConIt->nextElement(); 273 273 while(tmpConnection) 274 274 { … … 285 285 { 286 286 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 287 ParticleSystem* tmpSys = tmpIt-> firstElement();287 ParticleSystem* tmpSys = tmpIt->nextElement(); 288 288 while(tmpSys) 289 289 { … … 302 302 { 303 303 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 304 ParticleSystem* tmpSys = tmpIt-> firstElement();304 ParticleSystem* tmpSys = tmpIt->nextElement(); 305 305 while(tmpSys) 306 306 { … … 324 324 int count = 0; 325 325 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 326 ParticleSystem* tmpSys = tmpIt-> firstElement();326 ParticleSystem* tmpSys = tmpIt->nextElement(); 327 327 while(tmpSys) 328 328 { … … 346 346 { 347 347 tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator(); 348 ParticleEmitter* tmpEmit = tmpIt-> firstElement();348 ParticleEmitter* tmpEmit = tmpIt->nextElement(); 349 349 while(tmpEmit) 350 350 { … … 369 369 int count = 0; 370 370 tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator(); 371 ParticleEmitter* tmpEmit = tmpIt-> firstElement();371 ParticleEmitter* tmpEmit = tmpIt->nextElement(); 372 372 while(tmpEmit) 373 373 { … … 402 402 403 403 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 404 ParticleConnection* tmpConnection = tmpConIt-> firstElement();404 ParticleConnection* tmpConnection = tmpConIt->nextElement(); 405 405 while(tmpConnection) 406 406 { … … 414 414 { 415 415 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 416 ParticleSystem* tmpSys = tmpIt-> firstElement();416 ParticleSystem* tmpSys = tmpIt->nextElement(); 417 417 while(tmpSys) 418 418 { … … 429 429 { 430 430 tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator(); 431 ParticleEmitter* tmpEmit = tmpIt-> firstElement();431 ParticleEmitter* tmpEmit = tmpIt->nextElement(); 432 432 while(tmpEmit) 433 433 { -
trunk/src/lib/physics/physics_engine.cc
r5110 r5111 52 52 { 53 53 // delete all PhysicsConnections that are still in existence 54 //tIterator<PhysicsConnection>* itPC = this->connections->getIterator();55 // PhysicsConnection* enumPC = itPC->firstElement();56 //while (enumPC)57 //{58 //delete enumPC;59 //enumPC = itPC->nextElement();60 //}61 //delete itPC;62 //delete this->connections;63 // 64 //// delete all PhysicsInterfaces, still in existence (this could be dangerous)65 //tIterator<PhysicsInterface>* itPI = this->interfaces->getIterator();66 // PhysicsInterface* enumPI = itPI->firstElement();67 //while (enumPI)68 //{69 //delete enumPI;70 // 71 //enumPI = itPI->nextElement();72 //}73 //delete itPI;74 //delete this->interfaces;75 // 76 //// delete all PhysicsFields, still in existence (this could be dangerous)77 //tIterator<Field>* itF = this->fields->getIterator();78 // Field* enumF = itF->firstElement();79 //while (enumF)80 //{81 //delete enumF;82 // 83 //enumF = itF->nextElement();84 //}85 //delete itF;86 //delete this->fields;54 tIterator<PhysicsConnection>* itPC = this->connections->getIterator(); 55 PhysicsConnection* enumPC = itPC->nextElement(); 56 while (enumPC) 57 { 58 delete enumPC; 59 enumPC = itPC->nextElement(); 60 } 61 delete itPC; 62 delete this->connections; 63 64 // delete all PhysicsInterfaces, still in existence (this could be dangerous) 65 tIterator<PhysicsInterface>* itPI = this->interfaces->getIterator(); 66 PhysicsInterface* enumPI = itPI->nextElement(); 67 while (enumPI) 68 { 69 delete enumPI; 70 71 enumPI = itPI->nextElement(); 72 } 73 delete itPI; 74 delete this->interfaces; 75 76 // delete all PhysicsFields, still in existence (this could be dangerous) 77 tIterator<Field>* itF = this->fields->getIterator(); 78 Field* enumF = itF->nextElement(); 79 while (enumF) 80 { 81 delete enumF; 82 83 enumF = itF->nextElement(); 84 } 85 delete itF; 86 delete this->fields; 87 87 88 88 … … 163 163 { 164 164 tIterator<PhysicsInterface>* tmpIt = interfaces->getIterator(); 165 PhysicsInterface* tmpInt = tmpIt-> firstElement();165 PhysicsInterface* tmpInt = tmpIt->nextElement(); 166 166 while(tmpInt) 167 167 { … … 206 206 { 207 207 tIterator<Field>* tmpIt = fields->getIterator(); 208 Field* tmpField = tmpIt-> firstElement();208 Field* tmpField = tmpIt->nextElement(); 209 209 while(tmpField) 210 210 { … … 251 251 { 252 252 tIterator<PhysicsConnection>* tmpIt = connections->getIterator(); 253 PhysicsConnection* tmpConn = tmpIt-> firstElement();253 PhysicsConnection* tmpConn = tmpIt->nextElement(); 254 254 while(tmpConn) 255 255 { … … 278 278 meaning let the fields work */ 279 279 tIterator<PhysicsConnection>* itPC = this->connections->getIterator(); 280 PhysicsConnection* enumPC = itPC-> firstElement();280 PhysicsConnection* enumPC = itPC->nextElement(); 281 281 while (enumPC) 282 282 { … … 289 289 /* actually tick all the PhysicsInterfaces. Move the objects around */ 290 290 tIterator<PhysicsInterface>* itPI = this->interfaces->getIterator(); 291 PhysicsInterface* enumPI = itPI-> firstElement();291 PhysicsInterface* enumPI = itPI->nextElement(); 292 292 while (enumPI) 293 293 { -
trunk/src/lib/physics/physics_interface.cc
r5110 r5111 68 68 69 69 tIterator<PNode>* iterator = massCalcPNode->children->getIterator(); 70 PNode* pn = iterator-> firstElement();70 PNode* pn = iterator->nextElement(); 71 71 while( pn != NULL) 72 72 { -
trunk/src/lib/sound/sound_engine.cc
r5110 r5111 215 215 { 216 216 tIterator<BaseObject>* sourceIterator = this->sourceList->getIterator(); 217 SoundSource* enumSource = (SoundSource*)sourceIterator-> firstElement();217 SoundSource* enumSource = (SoundSource*)sourceIterator->nextElement(); 218 218 while (enumSource) 219 219 { … … 228 228 { 229 229 tIterator<BaseObject>* bufferIterator = this->bufferList->getIterator(); 230 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator-> firstElement();230 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->nextElement(); 231 231 while (enumBuffer) 232 232 { … … 298 298 // look if there are any sources that have the buffer still loaded 299 299 tIterator<BaseObject>* sourceIterator = this->sourceList->getIterator(); 300 SoundSource* enumSource = (SoundSource*)sourceIterator-> firstElement();300 SoundSource* enumSource = (SoundSource*)sourceIterator->nextElement(); 301 301 while (enumSource) 302 302 { … … 345 345 { 346 346 tIterator<BaseObject>* iterator = this->sourceList->getIterator(); 347 SoundSource* enumSource = (SoundSource*)iterator-> firstElement();347 SoundSource* enumSource = (SoundSource*)iterator->nextElement(); 348 348 while (enumSource) 349 349 { … … 373 373 { 374 374 tIterator<BaseObject>* bufferIterator = this->bufferList->getIterator(); 375 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator-> firstElement();375 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->nextElement(); 376 376 while (enumBuffer) 377 377 { 378 378 tIterator<BaseObject>* sourceIterator = this->sourceList->getIterator(); 379 SoundSource* enumSource = (SoundSource*)sourceIterator-> firstElement();379 SoundSource* enumSource = (SoundSource*)sourceIterator->nextElement(); 380 380 while (enumSource) 381 381 { … … 401 401 { 402 402 tIterator<BaseObject>* bufferIterator = this->bufferList->getIterator(); 403 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator-> firstElement();403 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->nextElement(); 404 404 while (enumBuffer) 405 405 { … … 419 419 { 420 420 tIterator<BaseObject>* Iterator = this->sourceList->getIterator(); 421 SoundSource* enumSource = (SoundSource*)Iterator-> firstElement();421 SoundSource* enumSource = (SoundSource*)Iterator->nextElement(); 422 422 while (enumSource) 423 423 { -
trunk/src/lib/util/ini_parser.cc
r5110 r5111 58 58 { 59 59 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 60 IniSection* sectionEnum = sectionIt-> firstElement();60 IniSection* sectionEnum = sectionIt->nextElement(); 61 61 while (sectionEnum) 62 62 { 63 63 tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator(); 64 IniEntry* entryEnum = entryIt-> firstElement();64 IniEntry* entryEnum = entryIt->nextElement(); 65 65 while (entryEnum) 66 66 { … … 192 192 { 193 193 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 194 IniSection* sectionEnum = sectionIt-> firstElement();194 IniSection* sectionEnum = sectionIt->nextElement(); 195 195 while (sectionEnum) 196 196 { … … 198 198 199 199 tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator(); 200 IniEntry* entryEnum = entryIt-> firstElement();200 IniEntry* entryEnum = entryIt->nextElement(); 201 201 while (entryEnum) 202 202 { … … 246 246 { 247 247 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 248 IniSection* sectionEnum = sectionIt-> firstElement();248 IniSection* sectionEnum = sectionIt->nextElement(); 249 249 while (sectionEnum) 250 250 { … … 347 347 { 348 348 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 349 IniSection* sectionEnum = sectionIt-> firstElement();349 IniSection* sectionEnum = sectionIt->nextElement(); 350 350 while (sectionEnum) 351 351 { … … 395 395 { 396 396 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 397 IniSection* sectionEnum = sectionIt-> firstElement();397 IniSection* sectionEnum = sectionIt->nextElement(); 398 398 while (sectionEnum) 399 399 { … … 401 401 { 402 402 tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator(); 403 IniEntry* entryEnum = entryIt-> firstElement();403 IniEntry* entryEnum = entryIt->nextElement(); 404 404 while (entryEnum) 405 405 { … … 452 452 { 453 453 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 454 IniSection* sectionEnum = sectionIt-> firstElement();454 IniSection* sectionEnum = sectionIt->nextElement(); 455 455 while (sectionEnum) 456 456 { … … 458 458 459 459 tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator(); 460 IniEntry* entryEnum = entryIt-> firstElement();460 IniEntry* entryEnum = entryIt->nextElement(); 461 461 while (entryEnum) 462 462 { -
trunk/src/lib/util/list.h
r5110 r5111 12 12 #endif 13 13 14 template<class T> class tIterator; 14 15 15 16 16 //! a list element of the tList, … … 23 23 24 24 /** 25 * an iterator class 26 27 this enables the user to iterate through a list very easely 28 */ 29 template<class T> class tIterator 30 { 31 public: 32 tIterator(listElement<T>* startElement); 33 ~tIterator(); 34 35 T* nextElement(); 36 T* seekElement(T* element); 37 38 private: 39 listElement<T>* currentEl; //!< pointer to the current list element in the iterator 40 listElement<T>* tmpEl; //!< temp listElemnt pointer 41 listElement<T>* startElement; //!< pointer to the start of the list 42 }; 43 44 45 /** 46 * iterator constructor 47 * @param startElement: the first list element from the tList 48 49 normaly you will use it like this: 50 51 tIterator<char>* nameIterator = nameList->getIterator(); 52 char name* = nameIterator->nextElement(); 53 while( name != NULL) 54 { 55 PRINTF(3)("found name: %s in list\n", name); 56 name = nameIterator->nextElement(); 57 } 58 delete nameIterator; 59 */ 60 template<class T> 61 inline tIterator<T>::tIterator (listElement<T>* startElement) 62 { 63 this->currentEl = startElement; 64 this->tmpEl = NULL; 65 this->startElement = startElement; 66 } 67 68 69 /** 70 * the destructor 71 */ 72 template<class T> 73 inline tIterator<T>::~tIterator () 74 { 75 this->currentEl = NULL; 76 } 77 78 79 /** 80 * use it to iterate through the list 81 * @returns next list element 82 */ 83 template<class T> 84 inline T* tIterator<T>::nextElement () 85 { 86 if( this->currentEl == NULL) 87 return NULL; 88 89 this->tmpEl = this->currentEl; 90 this->currentEl = this->currentEl->next; 91 return this->tmpEl->curr; 92 } 93 94 /** 95 * gets the element after the selected one, sets the iterator to this point in the list 96 * @param element the element to seek 97 * @returns next list element 98 99 Attention: if you seek an element, the iterator pointer will point to the NEXT listelement after the argument! 100 */ 101 template<class T> 102 inline T* tIterator<T>::seekElement (T* element) 103 { 104 for(this->tmpEl = this->startElement; this->tmpEl != NULL; this->tmpEl = this->tmpEl->next) 105 { 106 if( unlikely(this->tmpEl->curr == element)) 107 { 108 if( this->tmpEl->next != NULL) 109 { 110 this->currentEl = this->tmpEl->next->next; 111 return this->tmpEl->next->curr; 112 } 113 return NULL; 114 } 115 } 116 return NULL; 117 } 118 119 120 121 /** 25 122 * the list template class 26 123 … … 29 126 template<class T> class tList 30 127 { 31 friend class tIterator<T>;32 33 128 public: 34 129 tList (); … … 40 135 void removeLast(); 41 136 void flush(); 42 T* firstElement() const;43 T* lastElement() const;44 bool isEmpty() const;45 unsigned int getSize() const;137 T* firstElement(); 138 T* lastElement(); 139 bool isEmpty(); 140 unsigned int getSize(); 46 141 bool inList(T* entity); 47 tIterator<T>* getIterator() const;142 tIterator<T>* getIterator(); 48 143 T* nextElement(T* toEntity); 49 144 T* toArray(); … … 208 303 */ 209 304 template<class T> 210 inline T* tList<T>::firstElement() const305 inline T* tList<T>::firstElement() 211 306 { 212 307 return this->first->curr; … … 219 314 */ 220 315 template<class T> 221 inline T* tList<T>::lastElement() const316 inline T* tList<T>::lastElement() 222 317 { 223 318 return this->last->curr; … … 230 325 */ 231 326 template<class T> 232 inline bool tList<T>::isEmpty() const327 inline bool tList<T>::isEmpty() 233 328 { 234 329 return (this->size==0)?true:false; … … 264 359 */ 265 360 template<class T> 266 inline unsigned int tList<T>::getSize() const361 inline unsigned int tList<T>::getSize() 267 362 { 268 363 return this->size; … … 277 372 */ 278 373 template<class T> 279 inline tIterator<T>* tList<T>::getIterator() const 280 { 281 return new tIterator<T>(this); 374 inline tIterator<T>* tList<T>::getIterator() 375 { 376 tIterator<T>* iterator = new tIterator<T>(this->first); 377 return iterator; 282 378 } 283 379 … … 318 414 } 319 415 320 321 322 323 /**324 * an iterator class325 326 this enables the user to iterate through a list very easely327 */328 template<class T> class tIterator329 {330 public:331 tIterator(const tList<T>* list);332 ~tIterator();333 334 T* firstElement();335 T* nextElement();336 T* seekElement(T* element);337 338 private:339 listElement<T>* currentEl; //!< pointer to the current list element in the iterator340 listElement<T>* tmpEl; //!< temp listElemnt pointer341 const tList<T>* list; //!< The List, that we want to iterate through342 };343 344 345 /**346 * iterator constructor347 * @param startElement: the first list element from the tList348 349 normaly you will use it like this:350 351 tIterator<char>* nameIterator = nameList->getIterator();352 char name* = nameIterator->nextElement();353 while( name != NULL)354 {355 PRINTF(3)("found name: %s in list\n", name);356 name = nameIterator->nextElement();357 }358 delete nameIterator;359 */360 template<class T>361 inline tIterator<T>::tIterator (const tList<T>* list)362 {363 this->currentEl = list->first;364 this->tmpEl = NULL;365 this->list = list;366 }367 368 369 /**370 * the destructor371 */372 template<class T>373 inline tIterator<T>::~tIterator ()374 {375 this->currentEl = NULL;376 }377 378 template<class T>379 inline T* tIterator<T>::firstElement ()380 {381 this->currentEl = this->list->first;382 if (this->currentEl == NULL)383 return NULL;384 else385 return this->currentEl->curr;386 }387 388 389 /**390 * use it to iterate through the list391 * @returns next list element392 */393 template<class T>394 inline T* tIterator<T>::nextElement ()395 {396 if( this->currentEl == NULL || this->currentEl->next == NULL)397 {398 this->currentEl = NULL;399 return NULL;400 }401 402 this->currentEl = this->currentEl->next;403 return this->currentEl->curr;404 }405 406 /**407 * gets the element after the selected one, sets the iterator to this point in the list408 * @param element the element to seek409 * @returns next list element410 411 Attention: if you seek an element, the iterator pointer will point to the NEXT listelement after the argument!412 */413 template<class T>414 inline T* tIterator<T>::seekElement (T* element)415 {416 for(this->tmpEl = this->list->first; this->tmpEl != NULL; this->tmpEl = this->tmpEl->next)417 {418 if( unlikely(this->tmpEl->curr == element))419 {420 if( this->tmpEl->next != NULL)421 {422 this->currentEl = this->tmpEl;423 return this->tmpEl->next->curr;424 }425 return NULL;426 }427 }428 return NULL;429 }430 431 416 #endif /* _LIST_H */
Note: See TracChangeset
for help on using the changeset viewer.