Changeset 4508 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jun 4, 2005, 2:29:11 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/util/list.h
r4500 r4508 110 110 int getSize(); 111 111 //T* enumerate(); 112 bool inList(T* entity); 112 113 tIterator<T>* getIterator(); 113 114 T* nextElement(T* toEntity); … … 258 259 } 259 260 261 /** 262 \brief checks if an entity is in the List 263 \param entity The entity to check for in the entire List. 264 \returns true if it is, false otherwise 265 */ 266 template<class T> 267 inline bool tList<T>::inList(T* entity) 268 { 269 // pre checks 270 if(this->size == 0) return false; 271 if( entity == NULL) return false; 272 273 // search in the List 274 this->currentEl = this->first; 275 while(this->currentEl->curr != entity && this->currentEl != NULL) 276 this->currentEl = this->currentEl->next; 277 278 // post checks 279 if(this->currentEl == NULL) 280 return false; 281 else 282 return true; 283 } 260 284 261 285 /** -
orxonox/trunk/src/story_entities/world.cc
r4504 r4508 570 570 trackManager->addPointV(Vector(970, 24, 40)); 571 571 trackManager->addPointV(Vector(1000, 40, -7)); 572 572 573 trackManager->setDuration(4); 573 574 -
orxonox/trunk/src/util/track/track_manager.cc
r4502 r4508 149 149 150 150 /** 151 \brief checks if there are any BackLoops in the Track (Backloops only 152 \param trackElem the trackElement to check about 153 \param depth the depth to search in 151 \brief checks if there are any BackLoops in the Track 154 152 \returns true if NO loop was found, false Otherwise 155 153 You actually have to act on false!! 156 it simply does this by looking if the current trackElem is found again somewhere else in the Track 157 158 \todo this has to be reimplemented 159 */ 160 bool TrackElement::backLoopCheck(const TrackElement* trackElem, unsigned int depth) const 161 { 162 if(depth == 0 || this != trackElem) 163 { 164 if (this->children) 165 { 166 tIterator<TrackElement>* iterator = this->children->getIterator(); 167 TrackElement* enumElem = iterator->nextElement(); 168 while (enumElem) 169 { 170 if(!enumElem->backLoopCheck(trackElem, depth + 1)) 171 return false; 172 enumElem = iterator->nextElement(); 173 } 174 delete iterator; 175 } 176 } 177 else 178 return false; 179 154 */ 155 bool TrackElement::backLoopCheck(void) const 156 { 157 tList<const TrackElement>* trackList = new tList<const TrackElement>; 158 159 this->backLoopCheckAtomic(trackList); 160 161 delete trackList; 180 162 // only returns if everything worked out 181 163 return true; 182 164 } 165 166 /** 167 \brief checks if there are any BackLoops in the Track. 168 \param trackList A list of stored tracks, to search in. 169 \returns true if NO loop was found, false Otherwise 170 You actually have to act on false!! 171 */ 172 bool TrackElement::backLoopCheckAtomic(tList<const TrackElement>* trackList) const 173 { 174 if (trackList->inList(this)) 175 return false; 176 177 trackList->add(this); 178 179 if (this->children) 180 { 181 tIterator<TrackElement>* iterator = this->children->getIterator(); 182 TrackElement* enumElem = iterator->nextElement(); 183 while (enumElem) 184 { 185 if (!enumElem->backLoopCheckAtomic(trackList)) 186 return false; 187 } 188 delete iterator; 189 } 190 return true; 191 } 192 183 193 184 194 /** … … 264 274 PRINT(0)(" is Joined at the End\n"); 265 275 266 if(!this->backLoopCheck( this)) /* this should not happen */276 if(!this->backLoopCheck()) /* this should not happen */ 267 277 PRINT(2)(" THERE IS A BACKLOOP TO THIS ELEMENT\n"); 268 278 } … … 916 926 // checking if there is a back-loop-connection and ERROR if it is. 917 927 tmpTrackElem = this->firstTrackElem->findByID(trackIDs[0]); 918 if (!tmpTrackElem->backLoopCheck( tmpTrackElem))928 if (!tmpTrackElem->backLoopCheck()) 919 929 { 920 930 PRINTF(2)("Backloop connection detected at joining trackElements\n -> TRACK WILL NOT BE JOINED\n"); -
orxonox/trunk/src/util/track/track_manager.h
r4502 r4508 48 48 TrackElement* findByID(unsigned int trackID); 49 49 TrackElement* findByName(const char* trackName); 50 bool backLoopCheck( const TrackElement* trackElem, unsigned int depth = 0) const;50 bool backLoopCheck(void) const; 51 51 52 52 TrackElement* getChild(int childNumber) const; … … 55 55 inline const char* getName(void) const { return this->name; }; 56 56 57 57 private: 58 bool backLoopCheckAtomic(tList<const TrackElement>* trackList) const; 59 60 public: 58 61 // atributes 59 62 bool isFresh; //!< If no Points where added until now
Note: See TracChangeset
for help on using the changeset viewer.