- Timestamp:
- Oct 18, 2005, 9:32:34 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/render_2d.cc
r5399 r5400 101 101 { 102 102 if (element2D->getLayer() != E2D_LAYER_EXTERN) 103 this->element2DList[element2D->getLayer()]->remove (element2D);103 this->element2DList[element2D->getLayer()]->removeFromLast(element2D); 104 104 if (to != E2D_LAYER_EXTERN) 105 105 this->element2DList[to]->add(element2D); -
trunk/src/lib/util/list.h
r5285 r5400 38 38 void addAtBeginning(T* entity); //!< @todo This should be made with an ENUM 39 39 void remove(const T* entity); 40 void removeFromLast(const T* entity); 40 41 void removeLast(); 41 42 void flush(); … … 159 160 } 160 161 this->currentEl = this->currentEl->next; 162 } 163 } 164 165 /** 166 * remove an entity from the list 167 * @param entity: the entity to be removed 168 * 169 * this algorithm starts at the end of the List, working its way to the front 170 * for finding the right entity. 171 */ 172 template<class T> 173 inline void tList<T>::removeFromLast(const T* entity) 174 { 175 this->currentEl = this->last; 176 while( this->currentEl != NULL) 177 { 178 if( unlikely(this->currentEl->curr == entity)) 179 { 180 // erstes element? 181 if( unlikely(this->currentEl->prev == NULL)) this->first = this->currentEl->next; 182 else this->currentEl->prev->next = this->currentEl->next; 183 184 // letztes element? 185 if( unlikely(this->currentEl->next == NULL)) this->last = this->currentEl->prev; 186 else this->currentEl->next->prev = this->currentEl->prev; 187 188 delete this->currentEl; 189 this->size--; 190 return; 191 } 192 this->currentEl = this->currentEl->prev; 161 193 } 162 194 }
Note: See TracChangeset
for help on using the changeset viewer.