Changeset 3654 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Mar 25, 2005, 6:47:26 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/command_node.cc
r3608 r3654 281 281 if( this->world->command(cmd)) return; 282 282 283 WorldEntity* entity = bound->enumerate(); 283 tIterator<WorldEntity>* iterator = bound->getIterator(); 284 WorldEntity* entity = iterator->nextElement(); 284 285 while( entity != NULL) 285 286 { 286 287 entity->command (cmd); /*no absorbtion of command! strange*/ 287 entity = bound->nextElement(); 288 } 288 entity = iterator->nextElement(); 289 } 290 delete iterator; 289 291 } 290 292 -
orxonox/trunk/src/lib/util/list.h
r3653 r3654 87 87 inline T* tIterator<T>::nextElement () 88 88 { 89 if( this->currentEl == NULL) 90 { 91 PRINTF(1)("Iterator has not been initialized - there is no currentEl\n"); 89 if( this->currentEl == NULL || this->currentEl->next == NULL) /* don't turn it the other way or it will give segfaults! */ 92 90 return NULL; 93 }94 91 if( this->currentEl == this->firstEl) 95 92 { 96 93 this->currentEl = this->currentEl->next; 97 return this->firstEl->curr; 98 } 99 if( this->currentEl->next == NULL) 100 return NULL; 94 return this->firstEl->curr; /* if its the first element, don't return second element*/ 95 } 101 96 this->currentEl = this->currentEl->next; 102 97 return this->currentEl->curr; … … 126 121 127 122 private: 128 129 123 Uint32 size; 130 124 listElement<T>* first; 131 125 listElement<T>* last; 132 126 listElement<T>* currentEl; 133 134 127 }; 135 128 … … 255 248 inline tIterator<T>* tList<T>::getIterator() 256 249 { 257 if( this->size == 0) return NULL;258 250 tIterator<T>* iterator = new tIterator<T>(this->first); 259 251 return iterator; -
orxonox/trunk/src/story_entities/world.cc
r3653 r3654 755 755 756 756 /* function to let all entities tick (iterate through list) */ 757 WorldEntity* entity;758 757 float seconds = this->dt / 1000.0; 759 758 this->gameTime += seconds; 760 entity = entities->enumerate(); 759 //entity = entities->enumerate(); 760 tIterator<WorldEntity>* iterator = this->entities->getIterator(); 761 WorldEntity* entity = iterator->nextElement(); 761 762 while( entity != NULL) 762 763 { 763 764 entity->tick (seconds); 764 entity = entities->nextElement();765 entity = iterator->nextElement(); 765 766 } 767 delete iterator; 766 768 //skySphere->updatePosition(localCamera->absCoordinate); 767 769 -
orxonox/trunk/src/world_entities/player.cc
r3631 r3654 207 207 PRINTF(1)("changing the weapon of the player: deactivate old, activate new\n"); 208 208 this->activeWeapon->deactivate(); 209 this->weapons->enumerate();209 //this->weapons->enumerate(); FIX: strang weapon change... 210 210 this->activeWeapon = this->weapons->nextElement(this->activeWeapon); 211 211 this->activeWeapon->activate();
Note: See TracChangeset
for help on using the changeset viewer.