- Timestamp:
- Aug 24, 2005, 1:30:13 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_detection/cd_engine.cc
r5111 r5115 71 71 } 72 72 73 73 #include "class_list.h" 74 #include "state.h" 74 75 /** 75 76 * this checks the collisions with the objects … … 80 81 tIterator<WorldEntity>* iterator1 = entityList->getIterator(); 81 82 tIterator<WorldEntity>* iterator2 = entityList->getIterator(); 82 WorldEntity* entity1 = iterator1->nextElement(); 83 WorldEntity* entity2 = iterator2->seekElement(entity1); 83 WorldEntity* entity1 = iterator1->firstElement(); 84 WorldEntity* entity2 = iterator2->iteratorElement(iterator1); 85 //entity2 = iterator2->nextElement(); 84 86 PRINTF(3)("checking for collisions\n"); 85 87 while( entity1 != NULL) … … 87 89 if( likely(entity1 != this->terrain)) 88 90 { 91 entity2 = iterator2->nextElement(); 92 89 93 while( entity2 != NULL) 90 94 { 91 if( likely(entity2 != this->terrain)) 95 // if (entity2 != NULL) 96 // printf("entity2::%s::%s", entity2->getClassName(), getName()); 97 98 ///////////////// FIXME 99 ///////////////// COMMENTED OUT, because some part of it generated a segfault 100 //////////////// 101 102 /* if( likely(entity2 != this->terrain)) 92 103 { 93 PRINTF( 3)("checking object %s against %s\n", entity1->getName(), entity2->getName());104 PRINTF(4)("checking object %s against %s\n", entity1->getName(), entity2->getName()); 94 105 tree = entity1->getOBBTree(); 95 if( likely(tree != NULL) ) tree->collideWith(entity1, entity2);96 } 106 if( likely(tree != NULL) && entity2->getOBBTree() != NULL) tree->collideWith(entity1, entity2); 107 }*/ 97 108 entity2 = iterator2->nextElement(); 98 109 } 110 // printf("\n"); 99 111 } 100 112 entity1 = iterator1->nextElement(); 101 entity2 = iterator2->seekElement(entity1); 102 113 entity2 = iterator2->iteratorElement(iterator1); 103 114 } 104 115 delete iterator1; … … 133 144 134 145 tIterator<WorldEntity>* iterator = entityList->getIterator(); 135 WorldEntity* entity = iterator-> nextElement();146 WorldEntity* entity = iterator->firstElement(); 136 147 while( entity != NULL) 137 148 { -
trunk/src/lib/collision_detection/obb_tree.cc
r5028 r5115 47 47 { 48 48 this->setClassID(CL_OBB_TREE, "OBBTree"); 49 50 this->rootNode = NULL; 49 51 50 52 material = new Material*[5]; -
trunk/src/lib/collision_detection/obb_tree_node.cc
r5111 r5115 574 574 575 575 iterator = partition1.getIterator(); 576 element = iterator-> nextElement();576 element = iterator->firstElement(); 577 577 index = 0; 578 578 while( element != NULL) … … 592 592 593 593 iterator = partition2.getIterator(); 594 element = iterator-> nextElement();594 element = iterator->firstElement(); 595 595 index = 0; 596 596 while( element != NULL) -
trunk/src/lib/coord/p_node.cc
r5113 r5115 78 78 PNode::~PNode () 79 79 { 80 printf("deleting %s::%s\n", this->getClassName(), this->getName()); 80 81 tIterator<PNode>* iterator = this->children->getIterator(); 81 PNode* pn = iterator-> nextElement();82 PNode* pn = iterator->firstElement(); 82 83 while( pn != NULL) 83 84 { … … 435 436 436 437 tIterator<PNode>* iterator = this->children->getIterator(); 437 PNode* pn = iterator-> nextElement();438 PNode* pn = iterator->firstElement(); 438 439 439 440 while( pn != NULL) … … 605 606 { 606 607 tIterator<PNode>* iterator = this->children->getIterator(); 607 PNode* pn = iterator-> nextElement();608 PNode* pn = iterator->firstElement(); 608 609 while( pn != NULL) 609 610 { … … 615 616 616 617 pn->update(dt); 617 //pn = this->children->nextElement();618 618 pn = iterator->nextElement(); 619 619 } … … 656 656 tIterator<PNode>* iterator = this->children->getIterator(); 657 657 //PNode* pn = this->children->enumerate (); 658 PNode* pn = iterator-> nextElement();658 PNode* pn = iterator->firstElement(); 659 659 while( pn != NULL) 660 660 { … … 722 722 if (depth >= 2 || depth == 0) 723 723 { 724 Vector childColor = Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(20,0,.0)); 725 724 726 tIterator<PNode>* iterator = this->children->getIterator(); 725 //PNode* pn = this->children->enumerate (); 726 Vector childColor = Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(20,0,.0)); 727 PNode* pn = iterator->nextElement(); 727 PNode* pn = iterator->firstElement(); 728 728 while( pn != NULL) 729 729 { -
trunk/src/lib/graphics/importer/model.cc
r5111 r5115 192 192 193 193 tIterator<Material>* tmpIt = this->materialList->getIterator(); 194 Material* material = tmpIt-> nextElement();194 Material* material = tmpIt->firstElement(); 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-> nextElement();415 Material* material = tmpIt->firstElement(); 416 416 while(material) 417 417 { -
trunk/src/lib/graphics/render2D/element_2d.cc
r5113 r5115 55 55 56 56 tIterator<Element2D>* iterator = this->children->getIterator(); 57 Element2D* pn = iterator-> nextElement();57 Element2D* pn = iterator->firstElement(); 58 58 while( pn != NULL) 59 59 { … … 479 479 { 480 480 tIterator<Element2D>* iterator = this->children->getIterator(); 481 Element2D* pn = iterator-> nextElement();481 Element2D* pn = iterator->firstElement(); 482 482 483 483 while( pn != NULL) … … 687 687 { 688 688 tIterator<Element2D>* iterator = this->children->getIterator(); 689 Element2D* pn = iterator-> nextElement();689 Element2D* pn = iterator->firstElement(); 690 690 while( pn != NULL) 691 691 { … … 697 697 698 698 pn->update2D(dt); 699 //pn = this->children->nextElement();700 699 pn = iterator->nextElement(); 701 700 } … … 735 734 { 736 735 tIterator<Element2D>* iterator = this->children->getIterator(); 737 Element2D* pn = iterator-> nextElement();736 Element2D* pn = iterator->firstElement(); 738 737 while( pn != NULL) 739 738 { -
trunk/src/lib/graphics/render2D/render_2d.cc
r5111 r5115 105 105 { 106 106 tIterator<Element2D>* iterator = this->element2DList[i]->getIterator(); 107 Element2D* elem = iterator-> nextElement();107 Element2D* elem = iterator->firstElement(); 108 108 while (elem != NULL) 109 109 { … … 131 131 { 132 132 tIterator<Element2D>* iterator = this->element2DList[i]->getIterator(); 133 Element2D* elem = iterator-> nextElement();133 Element2D* elem = iterator->firstElement(); 134 134 while (elem != NULL) 135 135 { -
trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
r5111 r5115 253 253 counter = 0; 254 254 iterator = listA->getIterator(); 255 tempTri = iterator-> nextElement();255 tempTri = iterator->firstElement(); 256 256 while( tempTri) 257 257 { … … 262 262 counter = 0; 263 263 iterator = listB->getIterator(); 264 tempTri = iterator-> nextElement();264 tempTri = iterator->firstElement(); 265 265 while( tempTri) 266 266 { … … 271 271 counter = 0; 272 272 iterator = listC->getIterator(); 273 tempTri = iterator-> nextElement();273 tempTri = iterator->firstElement(); 274 274 while( tempTri) 275 275 { … … 280 280 counter = 0; 281 281 iterator = listD->getIterator(); 282 tempTri = iterator-> nextElement();282 tempTri = iterator->firstElement(); 283 283 while( tempTri) 284 284 { -
trunk/src/lib/graphics/text_engine.cc
r5113 r5115 845 845 846 846 tIterator<BaseObject>* textIterator = ClassList::getList(CL_TEXT)->getIterator(); 847 Text* text = dynamic_cast<Text*>(textIterator-> nextElement());847 Text* text = dynamic_cast<Text*>(textIterator->firstElement()); 848 848 while( text != NULL) 849 849 { -
trunk/src/lib/lang/class_list.cc
r5113 r5115 208 208 { 209 209 tIterator<BaseObject>* iterator = tmp->objectList->getIterator(); 210 BaseObject* enumBO = iterator-> nextElement();210 BaseObject* enumBO = iterator->firstElement(); 211 211 const char* tmpName; 212 212 while (enumBO != NULL) … … 249 249 { 250 250 tIterator<BaseObject>* iterator = tmp->objectList->getIterator(); 251 BaseObject* enumBO = iterator-> nextElement();251 BaseObject* enumBO = iterator->firstElement(); 252 252 while (enumBO != NULL) 253 253 { … … 362 362 PRINT(0)("| Listing Instances:\n"); 363 363 tIterator<BaseObject>* iterator = tmp->objectList->getIterator(); 364 BaseObject* enumBO = iterator-> nextElement();364 BaseObject* enumBO = iterator->firstElement(); 365 365 while (enumBO) 366 366 { -
trunk/src/lib/particles/particle_engine.cc
r5111 r5115 51 51 ParticleEngine::~ParticleEngine () 52 52 { 53 // we must not do this, because PNoe does it for us 54 // or we do this with help from ClassList, which essentially makes much more sense 53 55 // delete all remaining systems 54 tIterator<ParticleSystem>* sysIt = this->systemList->getIterator();55 ParticleSystem* tmpSys = sysIt->nextElement();56 while(tmpSys)57 {58 delete tmpSys;59 tmpSys = sysIt->nextElement();60 }61 delete sysIt;62 delete this->systemList;63 64 // delete all remaining emitters65 tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator();66 ParticleEmitter* tmpEmit = emitIt->nextElement();67 while(tmpEmit)68 {69 delete tmpEmit;70 tmpEmit = emitIt->nextElement();71 }72 delete emitIt;73 delete this->emitterList;56 // tIterator<ParticleSystem>* sysIt = this->systemList->getIterator(); 57 // ParticleSystem* tmpSys = sysIt->firstElement(); 58 // while(tmpSys) 59 // { 60 // delete tmpSys; 61 // tmpSys = sysIt->nextElement(); 62 // } 63 // delete sysIt; 64 delete this->systemList; 65 // 66 // // delete all remaining emitters 67 // tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator(); 68 // ParticleEmitter* tmpEmit = emitIt->firstElement(); 69 // while(tmpEmit) 70 // { 71 // delete tmpEmit; 72 // tmpEmit = emitIt->nextElement(); 73 // } 74 // delete emitIt; 75 delete this->emitterList; 74 76 75 77 // there should be no more Connections … … 147 149 // look, if we have already added this connection 148 150 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 149 ParticleConnection* tmpConnection = tmpConIt-> nextElement();151 ParticleConnection* tmpConnection = tmpConIt->firstElement(); 150 152 while(tmpConnection) 151 153 { … … 178 180 // remove any connections, that have this system within 179 181 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 180 ParticleConnection* tmpConnection = tmpConIt-> nextElement();182 ParticleConnection* tmpConnection = tmpConIt->firstElement(); 181 183 while(tmpConnection) 182 184 { … … 199 201 // remove any connections, that have this emitter within 200 202 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 201 ParticleConnection* tmpConnection = tmpConIt-> nextElement();203 ParticleConnection* tmpConnection = tmpConIt->firstElement(); 202 204 while(tmpConnection) 203 205 { … … 224 226 // look, if we have already added this connection 225 227 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 226 ParticleConnection* tmpConnection = tmpConIt-> nextElement();228 ParticleConnection* tmpConnection = tmpConIt->firstElement(); 227 229 while(tmpConnection) 228 230 { … … 260 262 // ticks all the ParticleSystems 261 263 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 262 ParticleSystem* tmpSys = tmpIt-> nextElement();264 ParticleSystem* tmpSys = tmpIt->firstElement(); 263 265 while(tmpSys) 264 266 { … … 270 272 // add new Particles to each System connected to an Emitter. 271 273 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 272 ParticleConnection* tmpConnection = tmpConIt-> nextElement();274 ParticleConnection* tmpConnection = tmpConIt->firstElement(); 273 275 while(tmpConnection) 274 276 { … … 285 287 { 286 288 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 287 ParticleSystem* tmpSys = tmpIt-> nextElement();289 ParticleSystem* tmpSys = tmpIt->firstElement(); 288 290 while(tmpSys) 289 291 { … … 302 304 { 303 305 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 304 ParticleSystem* tmpSys = tmpIt-> nextElement();306 ParticleSystem* tmpSys = tmpIt->firstElement(); 305 307 while(tmpSys) 306 308 { … … 324 326 int count = 0; 325 327 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 326 ParticleSystem* tmpSys = tmpIt-> nextElement();328 ParticleSystem* tmpSys = tmpIt->firstElement(); 327 329 while(tmpSys) 328 330 { … … 346 348 { 347 349 tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator(); 348 ParticleEmitter* tmpEmit = tmpIt-> nextElement();350 ParticleEmitter* tmpEmit = tmpIt->firstElement(); 349 351 while(tmpEmit) 350 352 { … … 369 371 int count = 0; 370 372 tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator(); 371 ParticleEmitter* tmpEmit = tmpIt-> nextElement();373 ParticleEmitter* tmpEmit = tmpIt->firstElement(); 372 374 while(tmpEmit) 373 375 { … … 402 404 403 405 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 404 ParticleConnection* tmpConnection = tmpConIt-> nextElement();406 ParticleConnection* tmpConnection = tmpConIt->firstElement(); 405 407 while(tmpConnection) 406 408 { … … 414 416 { 415 417 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 416 ParticleSystem* tmpSys = tmpIt-> nextElement();418 ParticleSystem* tmpSys = tmpIt->firstElement(); 417 419 while(tmpSys) 418 420 { … … 429 431 { 430 432 tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator(); 431 ParticleEmitter* tmpEmit = tmpIt-> nextElement();433 ParticleEmitter* tmpEmit = tmpIt->firstElement(); 432 434 while(tmpEmit) 433 435 { -
trunk/src/lib/physics/physics_engine.cc
r5111 r5115 53 53 // delete all PhysicsConnections that are still in existence 54 54 tIterator<PhysicsConnection>* itPC = this->connections->getIterator(); 55 PhysicsConnection* enumPC = itPC-> nextElement();55 PhysicsConnection* enumPC = itPC->firstElement(); 56 56 while (enumPC) 57 57 { … … 60 60 } 61 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;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; 87 87 88 88 … … 163 163 { 164 164 tIterator<PhysicsInterface>* tmpIt = interfaces->getIterator(); 165 PhysicsInterface* tmpInt = tmpIt-> nextElement();165 PhysicsInterface* tmpInt = tmpIt->firstElement(); 166 166 while(tmpInt) 167 167 { … … 206 206 { 207 207 tIterator<Field>* tmpIt = fields->getIterator(); 208 Field* tmpField = tmpIt-> nextElement();208 Field* tmpField = tmpIt->firstElement(); 209 209 while(tmpField) 210 210 { … … 251 251 { 252 252 tIterator<PhysicsConnection>* tmpIt = connections->getIterator(); 253 PhysicsConnection* tmpConn = tmpIt-> nextElement();253 PhysicsConnection* tmpConn = tmpIt->firstElement(); 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-> nextElement();280 PhysicsConnection* enumPC = itPC->firstElement(); 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-> nextElement();291 PhysicsInterface* enumPI = itPI->firstElement(); 292 292 while (enumPI) 293 293 { -
trunk/src/lib/physics/physics_interface.cc
r5111 r5115 68 68 69 69 tIterator<PNode>* iterator = massCalcPNode->children->getIterator(); 70 PNode* pn = iterator-> nextElement();70 PNode* pn = iterator->firstElement(); 71 71 while( pn != NULL) 72 72 { -
trunk/src/lib/sound/sound_engine.cc
r5111 r5115 215 215 { 216 216 tIterator<BaseObject>* sourceIterator = this->sourceList->getIterator(); 217 SoundSource* enumSource = (SoundSource*)sourceIterator-> nextElement();217 SoundSource* enumSource = (SoundSource*)sourceIterator->firstElement(); 218 218 while (enumSource) 219 219 { … … 228 228 { 229 229 tIterator<BaseObject>* bufferIterator = this->bufferList->getIterator(); 230 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator-> nextElement();230 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->firstElement(); 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-> nextElement();300 SoundSource* enumSource = (SoundSource*)sourceIterator->firstElement(); 301 301 while (enumSource) 302 302 { … … 345 345 { 346 346 tIterator<BaseObject>* iterator = this->sourceList->getIterator(); 347 SoundSource* enumSource = (SoundSource*)iterator-> nextElement();347 SoundSource* enumSource = (SoundSource*)iterator->firstElement(); 348 348 while (enumSource) 349 349 { … … 373 373 { 374 374 tIterator<BaseObject>* bufferIterator = this->bufferList->getIterator(); 375 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator-> nextElement();375 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->firstElement(); 376 376 while (enumBuffer) 377 377 { 378 378 tIterator<BaseObject>* sourceIterator = this->sourceList->getIterator(); 379 SoundSource* enumSource = (SoundSource*)sourceIterator-> nextElement();379 SoundSource* enumSource = (SoundSource*)sourceIterator->firstElement(); 380 380 while (enumSource) 381 381 { … … 401 401 { 402 402 tIterator<BaseObject>* bufferIterator = this->bufferList->getIterator(); 403 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator-> nextElement();403 SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->firstElement(); 404 404 while (enumBuffer) 405 405 { … … 419 419 { 420 420 tIterator<BaseObject>* Iterator = this->sourceList->getIterator(); 421 SoundSource* enumSource = (SoundSource*)Iterator-> nextElement();421 SoundSource* enumSource = (SoundSource*)Iterator->firstElement(); 422 422 while (enumSource) 423 423 { -
trunk/src/lib/util/ini_parser.cc
r5111 r5115 58 58 { 59 59 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 60 IniSection* sectionEnum = sectionIt-> nextElement();60 IniSection* sectionEnum = sectionIt->firstElement(); 61 61 while (sectionEnum) 62 62 { 63 63 tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator(); 64 IniEntry* entryEnum = entryIt-> nextElement();64 IniEntry* entryEnum = entryIt->firstElement(); 65 65 while (entryEnum) 66 66 { … … 192 192 { 193 193 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 194 IniSection* sectionEnum = sectionIt-> nextElement();194 IniSection* sectionEnum = sectionIt->firstElement(); 195 195 while (sectionEnum) 196 196 { … … 198 198 199 199 tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator(); 200 IniEntry* entryEnum = entryIt-> nextElement();200 IniEntry* entryEnum = entryIt->firstElement(); 201 201 while (entryEnum) 202 202 { … … 246 246 { 247 247 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 248 IniSection* sectionEnum = sectionIt-> nextElement();248 IniSection* sectionEnum = sectionIt->firstElement(); 249 249 while (sectionEnum) 250 250 { … … 347 347 { 348 348 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 349 IniSection* sectionEnum = sectionIt-> nextElement();349 IniSection* sectionEnum = sectionIt->firstElement(); 350 350 while (sectionEnum) 351 351 { … … 395 395 { 396 396 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 397 IniSection* sectionEnum = sectionIt-> nextElement();397 IniSection* sectionEnum = sectionIt->firstElement(); 398 398 while (sectionEnum) 399 399 { … … 401 401 { 402 402 tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator(); 403 IniEntry* entryEnum = entryIt-> nextElement();403 IniEntry* entryEnum = entryIt->firstElement(); 404 404 while (entryEnum) 405 405 { … … 452 452 { 453 453 tIterator<IniSection>* sectionIt = this->sections->getIterator(); 454 IniSection* sectionEnum = sectionIt-> nextElement();454 IniSection* sectionEnum = sectionIt->firstElement(); 455 455 while (sectionEnum) 456 456 { … … 458 458 459 459 tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator(); 460 IniEntry* entryEnum = entryIt-> nextElement();460 IniEntry* entryEnum = entryIt->firstElement(); 461 461 while (entryEnum) 462 462 { -
trunk/src/lib/util/list.h
r5113 r5115 12 12 #endif 13 13 14 14 template<class T> class tIterator; 15 15 16 16 //! a list element of the tList, … … 23 23 24 24 /** 25 * an iterator class26 27 this enables the user to iterate through a list very easely28 */29 template<class T> class tIterator30 {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 iterator40 listElement<T>* tmpEl; //!< temp listElemnt pointer41 listElement<T>* startElement; //!< pointer to the start of the list42 };43 44 45 /**46 * iterator constructor47 * @param startElement: the first list element from the tList48 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 destructor71 */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 list81 * @returns next list element82 */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 list96 * @param element the element to seek97 * @returns next list element98 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 /**122 25 * the list template class 123 26 … … 126 29 template<class T> class tList 127 30 { 31 friend class tIterator<T>; 32 128 33 public: 129 34 tList (); … … 374 279 inline tIterator<T>* tList<T>::getIterator() const 375 280 { 376 tIterator<T>* iterator = new tIterator<T>(this->first); 377 return iterator; 281 return new tIterator<T>(this); 378 282 } 379 283 … … 414 318 } 415 319 320 321 322 323 /** 324 * an iterator class 325 326 this enables the user to iterate through a list very easely 327 */ 328 template<class T> class tIterator 329 { 330 public: 331 tIterator(const tList<T>* list); 332 ~tIterator(); 333 334 T* firstElement(); 335 T* nextElement(); 336 T* seekElement(T* element); 337 T* iteratorElement(const tIterator<T>* iterator); 338 339 private: 340 listElement<T>* currentEl; //!< pointer to the current list element in the iterator 341 listElement<T>* tmpEl; //!< temp listElemnt pointer 342 const tList<T>* list; //!< The List, that we want to iterate through 343 }; 344 345 346 /** 347 * iterator constructor 348 * @param startElement: the first list element from the tList 349 * 350 * normaly you will use it like this: 351 ********************************************************** 352 * tIterator<char>* nameIterator = nameList->getIterator(); 353 * char name* = nameIterator->firstElement(); 354 * while( name != NULL) 355 * { 356 * PRINTF(3)("found name: %s in list\n", name); 357 * name = nameIterator->nextElement(); 358 * } 359 * delete nameIterator; 360 * ******************************************************** 361 */ 362 template<class T> 363 inline tIterator<T>::tIterator (const tList<T>* list) 364 { 365 this->currentEl = list->first; 366 this->tmpEl = NULL; 367 this->list = list; 368 } 369 370 371 /** 372 * the destructor 373 */ 374 template<class T> 375 inline tIterator<T>::~tIterator () 376 { 377 this->currentEl = NULL; 378 } 379 380 template<class T> 381 inline T* tIterator<T>::firstElement () 382 { 383 this->currentEl = this->list->first; 384 if (this->currentEl == NULL) 385 return NULL; 386 else 387 return this->currentEl->curr; 388 } 389 390 391 /** 392 * use it to iterate through the list 393 * @returns next list element 394 */ 395 template<class T> 396 inline T* tIterator<T>::nextElement () 397 { 398 if( this->currentEl == NULL) 399 return NULL; 400 401 this->currentEl = this->currentEl->next; 402 if (this->currentEl != NULL) 403 return this->currentEl->curr; 404 else 405 return NULL; 406 } 407 408 /** 409 * gets the element after the selected one, sets the iterator to this point in the list 410 * @param element the element to seek 411 * @returns current list element 412 */ 413 template<class T> 414 inline T* tIterator<T>::seekElement (T* element) 415 { 416 if (element == NULL) 417 { 418 this->currentEl = NULL; 419 return NULL; 420 } 421 this->tmpEl = this->list->first; 422 while( this->tmpEl != NULL) 423 { 424 if( unlikely(this->tmpEl->curr == element)) 425 { 426 this->currentEl = this->tmpEl; 427 return this->currentEl->curr; 428 } 429 this->tmpEl = this->tmpEl->next; 430 } 431 this->currentEl = NULL; 432 return NULL; 433 } 434 435 /** 436 * grabs the iterator entity from another iterator 437 * @param iterator the iterator to grab the local currentEl from 438 * @returns the grabbed element (current). 439 */ 440 template<class T> 441 T* tIterator<T>::iteratorElement(const tIterator<T>* iterator) 442 { 443 if (iterator != NULL) 444 { 445 this->currentEl = iterator->currentEl; 446 if (this->currentEl != NULL) 447 return this->currentEl->curr; 448 else 449 return NULL; 450 } 451 else 452 { 453 this->currentEl = NULL; 454 return NULL; 455 } 456 } 457 458 416 459 #endif /* _LIST_H */ -
trunk/src/story_entities/campaign.cc
r5111 r5115 154 154 */ 155 155 tIterator<StoryEntity>* it = this->entities->getIterator(); 156 se = it-> nextElement();156 se = it->firstElement(); 157 157 while( se != NULL) 158 158 { … … 284 284 285 285 tIterator<StoryEntity>* iterator = this->entities->getIterator(); 286 StoryEntity* entity = iterator-> nextElement();286 StoryEntity* entity = iterator->firstElement(); 287 287 while( entity != NULL) 288 288 { -
trunk/src/story_entities/world.cc
r5111 r5115 118 118 PRINTF(3)("World::~World() - deleting current world\n"); 119 119 120 ParticleEngine::getInstance()->debug();121 122 120 // here everything that is alocated by the World is deleted 123 121 delete this->entities; 124 122 State::setWorldEntityList(NULL); 123 125 124 126 125 delete LightManager::getInstance(); … … 135 134 FastFactory::flushAll(true); 136 135 136 137 137 // erease everything that is left. 138 138 delete NullParent::getInstance(); … … 140 140 141 141 // unload the resources !! 142 ResourceManager::getInstance()->unload(this->music);142 // ResourceManager::getInstance()->unload(this->music); 143 143 ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL); 144 144 } … … 761 761 void World::debug() 762 762 { 763 PRINTF(0)("Printing out the List of alive WorldEntities:\n"); 764 tIterator<WorldEntity>* iterator = this->entities->getIterator(); 765 WorldEntity* entity = iterator->firstElement(); 766 while( entity != NULL) 767 { 768 PRINTF(0)("%s::%s\n", entity->getClassName(), entity->getName()); 769 entity = iterator->nextElement(); 770 } 771 delete iterator; 763 772 } 764 773 … … 864 873 865 874 tIterator<WorldEntity>* iterator = this->entities->getIterator(); 866 WorldEntity* entity = iterator-> nextElement();875 WorldEntity* entity = iterator->firstElement(); 867 876 while( entity != NULL) 868 877 { … … 951 960 glLoadIdentity(); 952 961 tIterator<WorldEntity>* iterator = this->entities->getIterator(); 953 entity = iterator-> nextElement();962 entity = iterator->firstElement(); 954 963 while( entity != NULL ) 955 964 { -
trunk/src/subprojects/benchmark.cc
r5111 r5115 352 352 /*give list out */ 353 353 tIterator<char>* iterator = list->getIterator(); 354 name = iterator-> nextElement();354 name = iterator->firstElement(); 355 355 printf(" List Elements: \t\t"); 356 356 while( name != NULL) … … 373 373 /*give list out */ 374 374 iterator = list->getIterator(); 375 name = iterator-> nextElement();375 name = iterator->firstElement(); 376 376 printf(" List Elements: \t\t"); 377 377 while( name != NULL) … … 433 433 /*give list out */ 434 434 iterator = list->getIterator(); 435 name = iterator-> nextElement();435 name = iterator->firstElement(); 436 436 printf(" List Elements: \t\t"); 437 437 while( name != NULL) -
trunk/src/subprojects/collision_detection/collision_detection.cc
r5111 r5115 235 235 236 236 tIterator<WorldEntity>* iterator = entityList->getIterator(); 237 WorldEntity* entity = iterator-> nextElement();237 WorldEntity* entity = iterator->firstElement(); 238 238 while( entity != NULL) 239 239 { … … 251 251 252 252 tIterator<WorldEntity>* iterator = entityList->getIterator(); 253 WorldEntity* entity = iterator-> nextElement();253 WorldEntity* entity = iterator->firstElement(); 254 254 while( entity != NULL) 255 255 { -
trunk/src/util/animation/animation3d.cc
r5111 r5115 58 58 // delete all the KeyFrames 59 59 tIterator<KeyFrame3D>* itKF = keyFrameList->getIterator(); 60 KeyFrame3D* enumKF = itKF-> nextElement();60 KeyFrame3D* enumKF = itKF->firstElement(); 61 61 while (enumKF) 62 62 { -
trunk/src/util/animation/animation_player.cc
r5111 r5115 86 86 // deleting the Animation List AND all the elements of the List 87 87 tIterator<Animation>* animIt = this->animationList->getIterator(); 88 Animation* anim = animIt-> nextElement();88 Animation* anim = animIt->firstElement(); 89 89 while( anim != NULL) 90 90 { … … 109 109 // iterate through all the animations and tick them. 110 110 tIterator<Animation>* animIt = this->animationList->getIterator(); 111 Animation* anim = animIt-> nextElement();111 Animation* anim = animIt->firstElement(); 112 112 while( anim != NULL) 113 113 { … … 147 147 { 148 148 tIterator<Animation>* animIt = this->animationList->getIterator(); 149 Animation* anim = animIt-> nextElement();149 Animation* anim = animIt->firstElement(); 150 150 while( anim != NULL) 151 151 { … … 176 176 // Per ANIMATION DEBUG 177 177 tIterator<Animation>* animIt = this->animationList->getIterator(); 178 Animation* anim = animIt-> nextElement();178 Animation* anim = animIt->firstElement(); 179 179 while( anim != NULL) 180 180 { -
trunk/src/util/animation/t_animation.h
r5111 r5115 108 108 // delete all the KeyFrames 109 109 tIterator<KeyFrameF>* itKF = keyFrameList->getIterator(); 110 KeyFrameF* enumKF = itKF-> nextElement();110 KeyFrameF* enumKF = itKF->firstElement(); 111 111 while (enumKF) 112 112 { -
trunk/src/util/garbage_collector.cc
r5111 r5115 156 156 // 157 157 // tIterator<WorldEntity>* iterator = list->getIterator(); 158 // WorldEntity* entity = iterator-> nextElement();158 // WorldEntity* entity = iterator->firstElement(); 159 159 // while( entity != NULL) 160 160 // { -
trunk/src/util/loading/load_param.cc
r5113 r5115 295 295 296 296 tIterator<LoadParamDescription>* iterator = this->paramList->getIterator(); 297 LoadParamDescription* enumParamDesc = iterator-> nextElement();297 LoadParamDescription* enumParamDesc = iterator->firstElement(); 298 298 while (enumParamDesc) 299 299 { … … 314 314 { 315 315 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 316 LoadClassDescription* enumClassDesc = iterator-> nextElement();316 LoadClassDescription* enumClassDesc = iterator->firstElement(); 317 317 while (enumClassDesc) 318 318 { … … 336 336 { 337 337 tIterator<LoadParamDescription>* iterator = this->paramList->getIterator(); 338 LoadParamDescription* enumParamDesc = iterator-> nextElement();338 LoadParamDescription* enumParamDesc = iterator->firstElement(); 339 339 while (enumParamDesc) 340 340 { … … 362 362 PRINT(3)(" Listing all the Loadable Options (loaded since Game started).\n\n"); 363 363 tIterator<LoadClassDescription>* classIT = LoadClassDescription::classList->getIterator(); 364 LoadClassDescription* enumClassDesc = classIT-> nextElement();364 LoadClassDescription* enumClassDesc = classIT->firstElement(); 365 365 while (enumClassDesc) 366 366 { 367 367 PRINT(3)("<%s>\n", enumClassDesc->className); 368 368 tIterator<LoadParamDescription>* paramIT = enumClassDesc->paramList->getIterator(); 369 LoadParamDescription* enumParamDesc = paramIT-> nextElement();369 LoadParamDescription* enumParamDesc = paramIT->firstElement(); 370 370 while (enumParamDesc) 371 371 { … … 394 394 395 395 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 396 LoadClassDescription* enumClassDesc = iterator-> nextElement();396 LoadClassDescription* enumClassDesc = iterator->firstElement(); 397 397 while (enumClassDesc) 398 398 { … … 412 412 // { 413 413 // tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 414 // LoadClassDescription* enumClassDesc = iterator-> nextElement();414 // LoadClassDescription* enumClassDesc = iterator->firstElement(); 415 415 // while (enumClassDesc) 416 416 // { -
trunk/src/util/resource_manager.cc
r5113 r5115 74 74 // deleting the Directorie Lists 75 75 tIterator<char>* tmpIt = imageDirs->getIterator(); 76 char* tmpDir = tmpIt-> nextElement();76 char* tmpDir = tmpIt->firstElement(); 77 77 while(tmpDir) 78 78 { … … 144 144 // check if the Directory has been added before 145 145 tIterator<char>* tmpImageDirs = imageDirs->getIterator(); 146 char* tmpDir = tmpImageDirs-> nextElement();146 char* tmpDir = tmpImageDirs->firstElement(); 147 147 while(tmpDir) 148 148 { … … 363 363 { 364 364 tIterator<char>* iterator = imageDirs->getIterator(); 365 tmpDir = iterator->nextElement(); 366 //tmpDir = imageDirs->enumerate(); 365 tmpDir = iterator->firstElement(); 367 366 while(tmpDir) 368 367 { … … 492 491 { 493 492 tIterator<Resource>* iterator = resourceList->getIterator(); 494 Resource* enumRes = iterator-> nextElement();493 Resource* enumRes = iterator->firstElement(); 495 494 while (enumRes) 496 495 { … … 521 520 // Resource* enumRes = resourceList->enumerate(); 522 521 tIterator<Resource>* iterator = resourceList->getIterator(); 523 Resource* enumRes = iterator-> nextElement();522 Resource* enumRes = iterator->firstElement(); 524 523 while (enumRes) 525 524 { … … 603 602 // Resource* enumRes = resourceList->enumerate(); 604 603 tIterator<Resource>* iterator = resourceList->getIterator(); 605 Resource* enumRes = iterator-> nextElement();604 Resource* enumRes = iterator->firstElement(); 606 605 while (enumRes) 607 606 { … … 799 798 PRINT(0)(" List of Image-Directories: "); 800 799 tIterator<char>* tmpIt = imageDirs->getIterator(); 801 char* tmpDir = tmpIt-> nextElement();800 char* tmpDir = tmpIt->firstElement(); 802 801 while(tmpDir) 803 802 { … … 810 809 PRINT(0)("List of all stored Resources:\n"); 811 810 tIterator<Resource>* iterator = resourceList->getIterator(); 812 Resource* enumRes = iterator-> nextElement();811 Resource* enumRes = iterator->firstElement(); 813 812 while (enumRes) 814 813 { -
trunk/src/util/shell.cc
r5113 r5115 91 91 // delete all the Chars in the Buffers 92 92 tIterator<char>* charIterator = this->buffer->getIterator(); 93 char* charElem = charIterator-> nextElement();93 char* charElem = charIterator->firstElement(); 94 94 while (charElem != NULL) 95 95 { … … 191 191 // delete all the Chars in the Buffers 192 192 tIterator<char>* charIterator = this->buffer->getIterator(); 193 char* charElem = charIterator-> nextElement();193 char* charElem = charIterator->firstElement(); 194 194 195 195 while (charElem != NULL) … … 289 289 { 290 290 tIterator<char>* charIterator = this->buffer->getIterator(); 291 char* charElem = charIterator-> nextElement();291 char* charElem = charIterator->firstElement(); 292 292 293 293 int i = 1; … … 606 606 addLength = strlen(addString); 607 607 tIterator<const char>* charIterator = stringList->getIterator(); 608 const char* charElem = charIterator-> nextElement();608 const char* charElem = charIterator->firstElement(); 609 609 while (charElem != NULL) 610 610 { … … 655 655 656 656 tIterator<const char>* iterator = inputList->getIterator(); 657 const char* enumString = iterator-> nextElement();657 const char* enumString = iterator->firstElement(); 658 658 while (enumString != NULL) 659 659 { … … 687 687 688 688 tIterator<BaseObject>* iterator = inputList->getIterator(); 689 BaseObject* enumBO = iterator-> nextElement();689 BaseObject* enumBO = iterator->firstElement(); 690 690 while (enumBO != NULL) 691 691 { -
trunk/src/util/track/track_manager.cc
r5111 r5115 79 79 { 80 80 tIterator<TrackElement>* iterator = this->children->getIterator(); 81 TrackElement* enumElem = iterator-> nextElement();81 TrackElement* enumElem = iterator->firstElement(); 82 82 while (enumElem) 83 83 { … … 104 104 { 105 105 tIterator<TrackElement>* iterator = this->children->getIterator(); 106 TrackElement* enumElem = iterator-> nextElement();106 TrackElement* enumElem = iterator->firstElement(); 107 107 TrackElement* tmpElem; 108 108 while (enumElem) … … 133 133 { 134 134 tIterator<TrackElement>* iterator = this->children->getIterator(); 135 TrackElement* enumElem = iterator-> nextElement();135 TrackElement* enumElem = iterator->firstElement(); 136 136 TrackElement* tmpElem; 137 137 while (enumElem) … … 179 179 { 180 180 tIterator<TrackElement>* iterator = this->children->getIterator(); 181 TrackElement* enumElem = iterator-> nextElement();181 TrackElement* enumElem = iterator->firstElement(); 182 182 while (enumElem) 183 183 { … … 206 206 207 207 tIterator<TrackElement>* iterator = this->children->getIterator(); 208 TrackElement* enumElem = iterator-> nextElement();208 TrackElement* enumElem = iterator->firstElement(); 209 209 for (int i = 0; i < childCount; i++) 210 210 enumElem = iterator->nextElement(); … … 234 234 //TrackElement* enumElem = this->children->enumerate(); 235 235 tIterator<TrackElement>* iterator = this->children->getIterator(); 236 TrackElement* enumElem = iterator-> nextElement();236 TrackElement* enumElem = iterator->firstElement(); 237 237 while (enumElem) 238 238 { … … 331 331 //TrackElement* enumElem = this->children->enumerate(); 332 332 tIterator<TrackElement>* iterator = this->children->getIterator(); 333 TrackElement* enumElem = iterator-> nextElement();333 TrackElement* enumElem = iterator->firstElement(); 334 334 while (enumElem) 335 335 { … … 975 975 //TrackElement* enumElem = firstJoint->children->enumerate(); 976 976 tIterator<TrackElement>* iterator = firstJoint->children->getIterator(); 977 TrackElement* enumElem = iterator-> nextElement();977 TrackElement* enumElem = iterator->firstElement(); 978 978 while (enumElem) 979 979 { … … 1001 1001 { 1002 1002 tIterator<TrackElement>* iterator = tmpElem->children->getIterator(); 1003 TrackElement* enumElem = iterator-> nextElement();1003 TrackElement* enumElem = iterator->firstElement(); 1004 1004 //TrackElement* enumElem = tmpElem->children->enumerate(); 1005 1005 while (enumElem) -
trunk/src/world_entities/test_entity.cc
r5087 r5115 46 46 { 47 47 delete this->md2Model; 48 this->obbTree = NULL; 48 49 } 49 50
Note: See TracChangeset
for help on using the changeset viewer.