Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 18, 2005, 11:52:15 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: merged trunk back to levelloader
merged with command:
svn merge -r 3499:HEAD trunk branches/levelloader

Conflicts in
C track_manager.h
C world_entities/player.cc
C world_entities/player.h
C world_entities/environment.h
C lib/coord/p_node.cc
C defs/debug.h
C track_manager.cc
C story_entities/campaign.h

solved in merge-favouring. It was quite easy because Chris only worked on the headers, and he didi it quite clean. Thats the spirit :)

Conflits in world.cc are a MESS: fix it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelloader/src/lib/util/list.h

    r3499 r3605  
    8686  T* enumerate();
    8787  T* nextElement();
     88  T* nextElement(T* toEntity);
    8889  T* toArray();
    8990  void debug();
     
    101102template<class T>
    102103tList<T>::~tList ()
    103 {}
     104{
     105  this->currentEl = this->first;
     106  while(this->currentEl != NULL)
     107    {
     108      listElement* le = this->currentEl->next;
     109      //delete this->currentEl->curr;
     110      delete this->currentEl;
     111      this->currentEl = le;
     112    }
     113  this->first = NULL;
     114  this->last = NULL;
     115  this->size = 0;
     116}
     117
    104118
    105119template<class T>
    106120void tList<T>::add(T* entity)
    107121{
     122  if( entity == NULL) return;
    108123  listElement* el = new listElement;
    109124  el->prev = this->last;
     
    113128  this->last = el;
    114129
    115   if(this->size == 0) this->first = el;
     130  if(el->prev == NULL) this->first = el; /* if first element */
    116131  else el->prev->next = el;
    117132  this->size++;
     
    122137void tList<T>::remove(T* entity)
    123138{
     139  if( entity == NULL) return;
    124140  this->currentEl = this->first;
    125141  listElement* te;
     
    134150          else this->currentEl->next->prev = this->currentEl->prev;
    135151
    136           te = this->currentEl->next;
     152          te = this->currentEl->next;  // for what am i doing this?
    137153          delete this->currentEl;
    138154          this->currentEl = te;
     155          this->size--;
    139156          return;
    140157        }
     
    151168    {
    152169      listElement* le = this->currentEl->next;
    153       delete this->currentEl->curr;
     170      //delete this->currentEl->curr;
    154171      delete this->currentEl;
    155172      this->currentEl = le;
     
    185202T* tList<T>::enumerate()
    186203{
     204  //if( this->last == this->first == NULL) return NULL;
    187205  if(this->size == 0) return NULL;
    188206  this->currentEl = this->first;
     
    194212T* tList<T>::nextElement()
    195213{
     214  // if( this->last == this->first == NULL) return NULL;
    196215  if(this->size == 0) return NULL;
    197216  this->currentEl = this->currentEl->next;
     
    201220
    202221
     222/**
     223   \brief this returns the next element after toEntity or the first if toEntity is last
     224*/
     225template<class T>
     226T* tList<T>::nextElement(T* toEntity)
     227{
     228  //if( this->last == this->first == NULL) return NULL;
     229  if(this->size == 0) return NULL;
     230  if( toEntity == NULL) return this->first->curr;
     231  if( toEntity == this->last->curr ) return this->first->curr;
     232  this->currentEl = this->first;
     233  while(this->currentEl->curr != toEntity && this->currentEl->next != NULL)
     234    {
     235      this->currentEl = this->currentEl->next;
     236    }
     237  if(this->currentEl == NULL) return NULL;
     238  return this->currentEl->next->curr;
     239}
     240
     241
    203242template<class T>
    204243T* tList<T>::toArray()
Note: See TracChangeset for help on using the changeset viewer.