Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5111 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Aug 23, 2005, 11:13:56 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: reverted the last steps, because they created a huge pack of seg-faults

Location:
trunk/src
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_detection/cd_engine.cc

    r5110 r5111  
    8080  tIterator<WorldEntity>* iterator1 = entityList->getIterator();
    8181  tIterator<WorldEntity>* iterator2 = entityList->getIterator();
    82   WorldEntity* entity1 = iterator1->firstElement();
     82  WorldEntity* entity1 = iterator1->nextElement();
    8383  WorldEntity* entity2 = iterator2->seekElement(entity1);
    8484  PRINTF(3)("checking for collisions\n");
    85 /*  while( entity1 != NULL)
     85  while( entity1 != NULL)
    8686  {
    8787    if( likely(entity1 != this->terrain))
     
    101101    entity2 = iterator2->seekElement(entity1);
    102102
    103   }*/
     103  }
    104104  delete iterator1;
    105105  delete iterator2;
     
    133133
    134134  tIterator<WorldEntity>* iterator = entityList->getIterator();
    135   WorldEntity* entity = iterator->firstElement();
     135  WorldEntity* entity = iterator->nextElement();
    136136  while( entity != NULL)
    137137  {
  • trunk/src/lib/collision_detection/obb_tree_node.cc

    r5110 r5111  
    574574
    575575  iterator = partition1.getIterator();
    576   element = iterator->firstElement();
     576  element = iterator->nextElement();
    577577  index = 0;
    578578  while( element != NULL)
     
    592592
    593593  iterator = partition2.getIterator();
    594   element = iterator->firstElement();
     594  element = iterator->nextElement();
    595595  index = 0;
    596596  while( element != NULL)
  • trunk/src/lib/coord/p_node.cc

    r5110 r5111  
    7979{
    8080  tIterator<PNode>* iterator = this->children->getIterator();
    81   PNode* pn = iterator->firstElement();
     81  PNode* pn = iterator->nextElement();
    8282  while( pn != NULL)
    8383    {
     
    165165void PNode::setRelCoor (const Vector& relCoord)
    166166{
    167   if (this->toCoordinate!= NULL)
    168   {
    169     delete this->toCoordinate;
    170     this->toCoordinate = NULL;
    171   }
    172 
    173167  this->relCoordinate = relCoord;
    174168  this->bRelCoorChanged = true;
     
    219213void PNode::setAbsCoor (const Vector& absCoord)
    220214{
    221   if (this->toCoordinate!= NULL)
    222   {
    223     delete this->toCoordinate;
    224     this->toCoordinate = NULL;
    225   }
    226 
    227215  if( likely(this->parentMode & PNODE_MOVEMENT))
    228216  {
     
    288276void PNode::setRelDir (const Quaternion& relDir)
    289277{
    290   if (this->toDirection!= NULL)
    291   {
    292     delete this->toDirection;
    293     this->toDirection = NULL;
    294   }
    295278  this->relDirection = relDir;
    296279  this->bRelCoorChanged = true;
     
    344327void PNode::setAbsDir (const Quaternion& absDir)
    345328{
    346   if (this->toDirection!= NULL)
    347   {
    348     delete this->toDirection;
    349     this->toDirection = NULL;
    350   }
    351 
    352329  if (likely(this->parent != NULL))
    353330    this->relDirection = absDir / this->parent->getAbsDir();
     
    435412
    436413  tIterator<PNode>* iterator = this->children->getIterator();
    437   PNode* pn = iterator->firstElement();
     414  PNode* pn = iterator->nextElement();
    438415
    439416  while( pn != NULL)
     
    605582    {
    606583      tIterator<PNode>* iterator = this->children->getIterator();
    607       PNode* pn = iterator->firstElement();
     584      PNode* pn = iterator->nextElement();
    608585      while( pn != NULL)
    609586      {
     
    615592
    616593        pn->update(dt);
     594          //pn = this->children->nextElement();
    617595        pn = iterator->nextElement();
    618596      }
     
    655633    tIterator<PNode>* iterator = this->children->getIterator();
    656634      //PNode* pn = this->children->enumerate ();
    657     PNode* pn = iterator->firstElement();
     635    PNode* pn = iterator->nextElement();
    658636    while( pn != NULL)
    659637    {
     
    721699  if (depth >= 2 || depth == 0)
    722700  {
     701    tIterator<PNode>* iterator = this->children->getIterator();
     702      //PNode* pn = this->children->enumerate ();
    723703    Vector childColor =  Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(20,0,.0));
    724 
    725     tIterator<PNode>* iterator = this->children->getIterator();
    726     PNode* pn = iterator->firstElement();
     704    PNode* pn = iterator->nextElement();
    727705    while( pn != NULL)
    728706    {
  • trunk/src/lib/coord/p_node.h

    r5109 r5111  
    6666  /** @returns the relative position */
    6767  inline const Vector& getRelCoor () const { return this->prevRelCoordinate; };
    68   /** @returns the Relative Coordinate Destination */
    69   inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; };
    7068  void setAbsCoor (const Vector& absCoord);
    7169  void setAbsCoor (float x, float y, float z);
     
    8078  /** @returns the relative Direction */
    8179  inline const Quaternion& getRelDir () const { return this->prevRelDirection; };
    82   /** @returns the Relative Directional Destination */
    83   inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; };
    8480  /** @returns a Vector pointing into the relative Direction */
    8581  inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); };
  • trunk/src/lib/graphics/importer/model.cc

    r5110 r5111  
    192192
    193193    tIterator<Material>* tmpIt = this->materialList->getIterator();
    194     Material* material = tmpIt->firstElement();
     194    Material* material = tmpIt->nextElement();
    195195  //! @todo do we really have to delete this material??
    196196    while(material)
     
    413413{
    414414  tIterator<Material>* tmpIt = this->materialList->getIterator();
    415   Material* material = tmpIt->firstElement();
     415  Material* material = tmpIt->nextElement();
    416416  while(material)
    417417    {
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r5110 r5111  
    5555
    5656  tIterator<Element2D>* iterator = this->children->getIterator();
    57   Element2D* pn = iterator->firstElement();
     57  Element2D* pn = iterator->nextElement();
    5858  while( pn != NULL)
    5959  {
     
    214214void Element2D::setRelCoor2D (const Vector& relCoord)
    215215{
    216   if (this->toCoordinate!= NULL)
    217   {
    218     delete this->toCoordinate;
    219     this->toCoordinate = NULL;
    220   }
    221216  this->relCoordinate = relCoord;
    222217  this->bRelCoorChanged = true;
     
    232227void Element2D::setRelCoor2D (float x, float y, float z)
    233228{
    234   this->setRelCoor2D(Vector(x,y,z));
     229  this->setAbsCoor2D(Vector(x,y,z));
    235230}
    236231
     
    293288void Element2D::setAbsCoor2D (const Vector& absCoord)
    294289{
    295   if (this->toCoordinate!= NULL)
    296   {
    297     delete this->toCoordinate;
    298     this->toCoordinate = NULL;
    299   }
    300 
    301290  if( likely(this->parentMode & E2D_PARENT_MOVEMENT))
    302291  {
     
    373362void Element2D::setRelDir2D (float relDir)
    374363{
    375   if (this->toDirection!= NULL)
    376   {
    377     delete this->toDirection;
    378     this->toDirection = NULL;
    379   }
    380 
    381364  this->relDirection = relDir;
    382365  this->bRelDirChanged = true;
     
    403386void Element2D::setAbsDir2D (float absDir)
    404387{
    405   if (this->toDirection!= NULL)
    406   {
    407     delete this->toDirection;
    408     this->toDirection = NULL;
    409   }
    410 
    411388  if (likely(this->parent != NULL))
    412389    this->relDirection = absDir - this->parent->getAbsDir2D();
     
    479456{
    480457  tIterator<Element2D>* iterator = this->children->getIterator();
    481   Element2D* pn = iterator->firstElement();
     458  Element2D* pn = iterator->nextElement();
    482459
    483460  while( pn != NULL)
     
    687664  {
    688665    tIterator<Element2D>* iterator = this->children->getIterator();
    689     Element2D* pn = iterator->firstElement();
     666    Element2D* pn = iterator->nextElement();
    690667    while( pn != NULL)
    691668    {
     
    697674
    698675      pn->update2D(dt);
     676          //pn = this->children->nextElement();
    699677      pn = iterator->nextElement();
    700678    }
     
    734712  {
    735713    tIterator<Element2D>* iterator = this->children->getIterator();
    736     Element2D* pn = iterator->firstElement();
     714      //PNode* pn = this->children->enumerate ();
     715    Element2D* pn = iterator->nextElement();
    737716    while( pn != NULL)
    738717    {
  • trunk/src/lib/graphics/render2D/element_2d.h

    r5109 r5111  
    108108    /** @returns the relative position */
    109109    inline const Vector& getRelCoor2D () const { return this->prevRelCoordinate; };
    110     /** @returns the Relative Coordinate Destination */
    111     inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; };
    112110    const Vector& getRelCoor2Dpx() const;
    113111    void setAbsCoor2D (const Vector& absCoord);
     
    125123    /** @returns the relative Direction */
    126124    inline float getRelDir2D () const { return this->prevRelDirection; };
    127     /** @returns the Relative Directional Destination */
    128     inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; };
    129125    void setAbsDir2D (float absDir);
    130126    /** @returns the absolute Direction */
  • trunk/src/lib/graphics/render2D/render_2d.cc

    r5110 r5111  
    105105  {
    106106    tIterator<Element2D>* iterator = this->element2DList[i]->getIterator();
    107     Element2D* elem = iterator->firstElement();
     107    Element2D* elem = iterator->nextElement();
    108108    while (elem != NULL)
    109109    {
     
    131131    {
    132132      tIterator<Element2D>* iterator = this->element2DList[i]->getIterator();
    133       Element2D* elem = iterator->firstElement();
     133      Element2D* elem = iterator->nextElement();
    134134      while (elem != NULL)
    135135      {
  • trunk/src/lib/graphics/spatial_separation/quadtree_node.cc

    r5110 r5111  
    253253  counter = 0;
    254254  iterator = listA->getIterator();
    255   tempTri = iterator->firstElement();
     255  tempTri = iterator->nextElement();
    256256  while( tempTri)
    257257  {
     
    262262  counter = 0;
    263263  iterator = listB->getIterator();
    264   tempTri = iterator->firstElement();
     264  tempTri = iterator->nextElement();
    265265  while( tempTri)
    266266  {
     
    271271  counter = 0;
    272272  iterator = listC->getIterator();
    273   tempTri = iterator->firstElement();
     273  tempTri = iterator->nextElement();
    274274  while( tempTri)
    275275  {
     
    280280  counter = 0;
    281281  iterator = listD->getIterator();
    282   tempTri = iterator->firstElement();
     282  tempTri = iterator->nextElement();
    283283  while( tempTri)
    284284  {
  • trunk/src/lib/graphics/text_engine.cc

    r5110 r5111  
    592592          if( glyphSurf != NULL )
    593593            {
     594
    594595              SDL_SetAlpha(glyphSurf, 0, 0);
    595596
     
    597598              TexCoord tmpTexCoord;
    598599              tmpTexCoord.minU = (float)tmpRect.x/(float)tmpSurf->w;
    599               tmpTexCoord.maxU = (float)(tmpRect.x +1 + tmpGlyph->width)/(float)tmpSurf->w;
     600              tmpTexCoord.maxU = (float)(tmpRect.x +1 +tmpGlyph->width)/(float)tmpSurf->w;
    600601              tmpTexCoord.minV = (float)tmpRect.y/(float)tmpSurf->w;
    601602              tmpTexCoord.maxV = (float)(tmpRect.y+tmpGlyph->height)/(float)tmpSurf->w;
     
    619620
    620621              // Outputting Glyphs to BMP-files.
    621 /*
    622                 char outname[512];
     622              /*
     623                char outname[64];
    623624                if (i < 10)
    624                 sprintf( outname, "%s-glyph-00%d.bmp", this->getName(), i );
     625                sprintf( outname, "glyph-00%d.bmp", i );
    625626                else if (i <100)
    626                   sprintf( outname, "%s-glyph-0%d.bmp", this->getName(), i );
     627                sprintf( outname, "glyph-0%d.bmp", i );
    627628                else
    628                   sprintf( outname, "%s-glyph-%d.bmp", this->getName(), i );
    629                 SDL_SaveBMP(tmpSurf, outname);*/
    630 
     629                sprintf( outname, "glyph-%d.bmp", i );
     630                SDL_SaveBMP(tmpSurf, outname);
     631              */
    631632            }
    632633        }
     
    711712                  x = 0;
    712713                  y = y + maxLineHeight;
    713                   //maxLineHeight = 0;
     714                  maxLineHeight = 0;
    714715                }
    715716              if (y + maxLineHeight + 1 > size)
     
    845846
    846847  tIterator<BaseObject>* textIterator = ClassList::getList(CL_TEXT)->getIterator();
    847   Text* text = dynamic_cast<Text*>(textIterator->firstElement());
     848  Text* text = dynamic_cast<Text*>(textIterator->nextElement());
    848849  while( text != NULL)
    849850    {
  • trunk/src/lib/lang/base_object.cc

    r5102 r5111  
    5252  //  delete []this->className;
    5353  if (this->objectName)
    54     delete[] this->objectName;}
     54    delete []this->objectName;}
    5555
    5656/**
     
    8484{
    8585  if (this->objectName)
    86     delete[] this->objectName;
     86    delete []this->objectName;
    8787  if (objectName)
    8888  {
  • trunk/src/lib/lang/base_object.h

    r5102 r5111  
    2727
    2828  void setName (const char* newName);
    29   /** returns the Name of this Object */
     29  /** \brief returns the Name of this Object */
    3030  inline const char* getName ()const { return this->objectName; };
    3131
  • trunk/src/lib/lang/class_list.cc

    r5110 r5111  
    4848{
    4949  delete this->objectList;
    50   if(ClassList::classList != NULL)
    51   {
    52     delete ClassList::classList;
    53     ClassList::classList = NULL;
    54   }
    5550  --ClassList::classCount;
    5651}
     
    6156//! the Count of classes
    6257unsigned int ClassList::classCount = 0;
    63 
    64 //! a List of all strings of all classes, that have registered so far.
    65 tList<const char>* ClassList::classList = NULL;
    6658
    6759/**
     
    117109}
    118110
    119 /**
    120  * grabs the names of all Classes, and injects it into a List of const chars
    121  * @return the generated List
    122  *
    123  * This function first looks, if the List has been changed (by the ListSize)
    124  * befor it changes anything.
    125  */
    126 const tList<const char>* ClassList::getClassList()
    127 {
    128   if (unlikely(ClassList::classList != NULL && ClassList::classList->getSize() != ClassList::classCount))
    129   {
    130     delete ClassList::classList;
    131     ClassList::classList = NULL;
    132   }
    133   if (unlikely(ClassList::classList == NULL))
    134     ClassList::classList = new tList<const char>;
    135 
    136   if(likely(ClassList::first != NULL))
     111tList<BaseObject>* ClassList::getList(long classID)
     112{
     113  if(unlikely(ClassList::first == NULL))
     114    return NULL;
     115  else
    137116  {
    138117    ClassList* tmpCL = ClassList::first;
    139118    while (likely(tmpCL != NULL))
    140119    {
    141       ClassList::classList->add(tmpCL->className);
    142       tmpCL = tmpCL->next;
    143     }
    144   }
    145   return ClassList::classList;
    146 }
    147 
    148 /**
    149  * searches for classID and returns the list of Entities
    150  * @param classID the ID of the class to get the list from
    151  * @return the List accessed by classID, or NULL if not found
    152  */
    153 tList<BaseObject>* ClassList::getList(long classID)
    154 {
    155   if(unlikely(ClassList::first == NULL))
    156     return NULL;
    157   else
    158   {
    159     ClassList* tmpCL = ClassList::first;
    160     while (likely(tmpCL != NULL))
    161     {
    162120      if (unlikely(tmpCL->classID == classID))
    163         return tmpCL->objectList;
    164       tmpCL = tmpCL->next;
    165     }
    166   }
    167   return NULL;
    168 }
    169 
    170 /**
    171  * searches for className and returns the list of Entities
    172  * @param className the name of the class to get the list from
    173  * @return the List accessed by classID, or NULL if not found
    174  */tList<BaseObject>* ClassList::getList(const char* className)
    175 {
    176   if(unlikely(ClassList::first == NULL))
    177     return NULL;
    178   else
    179   {
    180     ClassList* tmpCL = ClassList::first;
    181     while (likely(tmpCL != NULL))
    182     {
    183       if (unlikely(!strcmp(tmpCL->className, className)))
    184121        return tmpCL->objectList;
    185122      tmpCL = tmpCL->next;
     
    208145      {
    209146        tIterator<BaseObject>* iterator = tmp->objectList->getIterator();
    210         BaseObject* enumBO = iterator->firstElement();
     147        BaseObject* enumBO = iterator->nextElement();
    211148        const char* tmpName;
    212149        while (enumBO != NULL)
     
    249186      {
    250187        tIterator<BaseObject>* iterator = tmp->objectList->getIterator();
    251         BaseObject* enumBO = iterator->firstElement();
     188        BaseObject* enumBO = iterator->nextElement();
    252189        while (enumBO != NULL)
    253190        {
     
    268205}
    269206
     207
    270208/**
    271209 * prints out a string of all the types this Object matches
     
    284222  }
    285223}
    286 
    287 /**
    288  * converts a ClassID into a string
    289  * @param classID the ClassID to search for
    290  * @return a String containing the name of the Class, NULL if the Class was not found
    291  */
    292 const char* ClassList::IDToString(ClassID classID)
    293 {
    294   if(likely(ClassList::first != NULL))
    295   {
    296     ClassList* tmpCL = ClassList::first;
    297     while (likely(tmpCL != NULL))
    298     {
    299       if (tmpCL->classID == classID)
    300         return tmpCL->className;
    301       tmpCL = tmpCL->next;
    302     }
    303   }
    304   return NULL;
    305 }
    306 
    307 /**
    308  * converts a String into a ClassID
    309  * @param className the name of the class to search for
    310  * @return the ClassID. CL_NULL, if the class was not found.
    311  */
    312 long ClassList::StringToID(const char* className)
    313 {
    314   if(likely(ClassList::first != NULL))
    315   {
    316     ClassList* tmpCL = ClassList::first;
    317     while (likely(tmpCL != NULL))
    318     {
    319       if (!strcasecmp(tmpCL->className, className))
    320         return tmpCL->classID;
    321       tmpCL = tmpCL->next;
    322     }
    323   }
    324   return CL_NULL;
    325 }
    326 
    327 
    328224
    329225/**
     
    362258        PRINT(0)("|  Listing Instances:\n");
    363259        tIterator<BaseObject>* iterator = tmp->objectList->getIterator();
    364         BaseObject* enumBO = iterator->firstElement();
     260        BaseObject* enumBO = iterator->nextElement();
    365261        while (enumBO)
    366262        {
  • trunk/src/lib/lang/class_list.h

    r5105 r5111  
    3535
    3636    // STATIC FUNCTIONS
    37     static void                     addToClassList(BaseObject* objectPointer, const long& classID, const char* className);
    38     static void                     removeFromClassList(BaseObject* objectPointer);
     37    static void               addToClassList(BaseObject* objectPointer, const long& classID, const char* className);
     38    static void               removeFromClassList(BaseObject* objectPointer);
    3939
    40     static tList<BaseObject>*       getList(long classID = CL_NULL);
    41     static tList<BaseObject>*       getList(const char* className);
    42     static const tList<const char>* getClassList();
    43     static BaseObject*              getObject(const char* name, long classID = CL_NULL);
    44     static bool                     exists(const BaseObject* object, long classID = CL_NULL);
     40    static tList<BaseObject>* getList(long classID = CL_NULL);
     41    static BaseObject*        getObject(const char* name, long classID = CL_NULL);
     42    static bool               exists(const BaseObject* object, long classID = CL_NULL);
    4543
    46     static void                     whatIs(const BaseObject* object);
    47 
    48     static const char*              IDToString(ClassID classID = CL_NULL);
    49     static long                     StringToID(const char* className);
    50     static void                     debug(unsigned int debugLevel = 0, long classID = CL_NULL);
    51 
     44    static void               whatIs(const BaseObject* object);
     45    static void debug(unsigned int debugLevel = 0, long classID = CL_NULL);
    5246
    5347  private:
    54     tList<BaseObject>*              objectList;             //!< A list of Objects belonging to this Class
     48    tList<BaseObject>*       objectList;             //!< A list of Objects belonging to this Class
    5549
    56     long                            classID;                //!< ClassID stored in this ClassList \see ClassID
    57     const char*                     className;              //!< Name of the Class Stored here
     50    long                     classID;                //!< ClassID stored in this ClassList \see ClassID
     51    const char*              className;              //!< Name of the Class Stored here
    5852
    59     ClassList*                      next;                   //!< Pointer to the next class in the List
     53    ClassList*               next;                   //!< Pointer to the next class in the List
    6054
    6155    // STATIC MEMBERS
    62     static ClassList*               first;                  //!< The first Class in the List
    63     static tList<const char>*       classList;              //!< a List of all Names of all classes, that have registered so far.
    64     static unsigned int             classCount;             //!< The Count of classes that have been registered (should match the lower description)
     56    static ClassList*        first;                  //!< The first Class in the List
     57    static unsigned int      classCount;             //!< The Count of classes that have been registered (should match the lower description)
    6558};
    6659
  • trunk/src/lib/particles/particle_engine.cc

    r5110 r5111  
    5353  // delete all remaining systems
    5454  tIterator<ParticleSystem>* sysIt = this->systemList->getIterator();
    55   ParticleSystem* tmpSys = sysIt->firstElement();
     55  ParticleSystem* tmpSys = sysIt->nextElement();
    5656  while(tmpSys)
    5757    {
     
    6464  // delete all remaining emitters
    6565  tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator();
    66   ParticleEmitter* tmpEmit = emitIt->firstElement();
     66  ParticleEmitter* tmpEmit = emitIt->nextElement();
    6767  while(tmpEmit)
    6868    {
     
    147147  // look, if we have already added this connection
    148148  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
    149   ParticleConnection* tmpConnection = tmpConIt->firstElement();
     149  ParticleConnection* tmpConnection = tmpConIt->nextElement();
    150150  while(tmpConnection)
    151151    {
     
    178178  // remove any connections, that have this system within
    179179  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
    180   ParticleConnection* tmpConnection = tmpConIt->firstElement();
     180  ParticleConnection* tmpConnection = tmpConIt->nextElement();
    181181  while(tmpConnection)
    182182    {
     
    199199  // remove any connections, that have this emitter within
    200200  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
    201   ParticleConnection* tmpConnection = tmpConIt->firstElement();
     201  ParticleConnection* tmpConnection = tmpConIt->nextElement();
    202202  while(tmpConnection)
    203203    {
     
    224224  // look, if we have already added this connection
    225225  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
    226   ParticleConnection* tmpConnection = tmpConIt->firstElement();
     226  ParticleConnection* tmpConnection = tmpConIt->nextElement();
    227227  while(tmpConnection)
    228228    {
     
    260260  // ticks all the ParticleSystems
    261261  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
    262   ParticleSystem* tmpSys = tmpIt->firstElement();
     262  ParticleSystem* tmpSys = tmpIt->nextElement();
    263263  while(tmpSys)
    264264    {
     
    270270  // add new Particles to each System connected to an Emitter.
    271271  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
    272   ParticleConnection* tmpConnection = tmpConIt->firstElement();
     272  ParticleConnection* tmpConnection = tmpConIt->nextElement();
    273273  while(tmpConnection)
    274274    {
     
    285285{
    286286  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
    287   ParticleSystem* tmpSys = tmpIt->firstElement();
     287  ParticleSystem* tmpSys = tmpIt->nextElement();
    288288  while(tmpSys)
    289289    {
     
    302302{
    303303  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
    304   ParticleSystem* tmpSys = tmpIt->firstElement();
     304  ParticleSystem* tmpSys = tmpIt->nextElement();
    305305  while(tmpSys)
    306306    {
     
    324324  int count = 0;
    325325  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
    326   ParticleSystem* tmpSys = tmpIt->firstElement();
     326  ParticleSystem* tmpSys = tmpIt->nextElement();
    327327  while(tmpSys)
    328328    {
     
    346346{
    347347  tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
    348   ParticleEmitter* tmpEmit = tmpIt->firstElement();
     348  ParticleEmitter* tmpEmit = tmpIt->nextElement();
    349349  while(tmpEmit)
    350350    {
     
    369369  int count = 0;
    370370  tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
    371   ParticleEmitter* tmpEmit = tmpIt->firstElement();
     371  ParticleEmitter* tmpEmit = tmpIt->nextElement();
    372372  while(tmpEmit)
    373373    {
     
    402402
    403403    tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
    404     ParticleConnection* tmpConnection = tmpConIt->firstElement();
     404    ParticleConnection* tmpConnection = tmpConIt->nextElement();
    405405    while(tmpConnection)
    406406    {
     
    414414  {
    415415    tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
    416     ParticleSystem* tmpSys = tmpIt->firstElement();
     416    ParticleSystem* tmpSys = tmpIt->nextElement();
    417417    while(tmpSys)
    418418    {
     
    429429  {
    430430    tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
    431     ParticleEmitter* tmpEmit = tmpIt->firstElement();
     431    ParticleEmitter* tmpEmit = tmpIt->nextElement();
    432432    while(tmpEmit)
    433433    {
  • trunk/src/lib/physics/physics_engine.cc

    r5110 r5111  
    5252{
    5353  // delete all PhysicsConnections that are still in existence
    54 //   tIterator<PhysicsConnection>* itPC = this->connections->getIterator();
    55 //   PhysicsConnection* enumPC = itPC->firstElement();
    56 //   while (enumPC)
    57 //   {
    58 //     delete enumPC;
    59 //     enumPC = itPC->nextElement();
    60 //   }
    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->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;
     54  tIterator<PhysicsConnection>* itPC = this->connections->getIterator();
     55  PhysicsConnection* enumPC = itPC->nextElement();
     56  while (enumPC)
     57  {
     58    delete enumPC;
     59    enumPC = itPC->nextElement();
     60  }
     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;
    8787
    8888
     
    163163{
    164164  tIterator<PhysicsInterface>* tmpIt = interfaces->getIterator();
    165   PhysicsInterface* tmpInt = tmpIt->firstElement();
     165  PhysicsInterface* tmpInt = tmpIt->nextElement();
    166166  while(tmpInt)
    167167  {
     
    206206{
    207207  tIterator<Field>* tmpIt = fields->getIterator();
    208   Field* tmpField = tmpIt->firstElement();
     208  Field* tmpField = tmpIt->nextElement();
    209209  while(tmpField)
    210210  {
     
    251251{
    252252  tIterator<PhysicsConnection>* tmpIt = connections->getIterator();
    253   PhysicsConnection* tmpConn = tmpIt->firstElement();
     253  PhysicsConnection* tmpConn = tmpIt->nextElement();
    254254  while(tmpConn)
    255255  {
     
    278278  meaning let the fields work */
    279279  tIterator<PhysicsConnection>* itPC = this->connections->getIterator();
    280   PhysicsConnection* enumPC = itPC->firstElement();
     280  PhysicsConnection* enumPC = itPC->nextElement();
    281281  while (enumPC)
    282282    {
     
    289289  /* actually tick all the PhysicsInterfaces. Move the objects around */
    290290  tIterator<PhysicsInterface>* itPI = this->interfaces->getIterator();
    291   PhysicsInterface* enumPI = itPI->firstElement();
     291  PhysicsInterface* enumPI = itPI->nextElement();
    292292  while (enumPI)
    293293    {
  • trunk/src/lib/physics/physics_interface.cc

    r5110 r5111  
    6868
    6969    tIterator<PNode>* iterator = massCalcPNode->children->getIterator();
    70     PNode* pn = iterator->firstElement();
     70    PNode* pn = iterator->nextElement();
    7171    while( pn != NULL)
    7272    {
  • trunk/src/lib/sound/sound_engine.cc

    r5110 r5111  
    215215  {
    216216    tIterator<BaseObject>* sourceIterator = this->sourceList->getIterator();
    217     SoundSource* enumSource = (SoundSource*)sourceIterator->firstElement();
     217    SoundSource* enumSource = (SoundSource*)sourceIterator->nextElement();
    218218    while (enumSource)
    219219    {
     
    228228  {
    229229    tIterator<BaseObject>* bufferIterator = this->bufferList->getIterator();
    230     SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->firstElement();
     230    SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->nextElement();
    231231    while (enumBuffer)
    232232    {
     
    298298  // look if there are any sources that have the buffer still loaded
    299299  tIterator<BaseObject>* sourceIterator = this->sourceList->getIterator();
    300   SoundSource* enumSource = (SoundSource*)sourceIterator->firstElement();
     300  SoundSource* enumSource = (SoundSource*)sourceIterator->nextElement();
    301301  while (enumSource)
    302302    {
     
    345345  {
    346346    tIterator<BaseObject>* iterator = this->sourceList->getIterator();
    347     SoundSource* enumSource = (SoundSource*)iterator->firstElement();
     347    SoundSource* enumSource = (SoundSource*)iterator->nextElement();
    348348    while (enumSource)
    349349    {
     
    373373  {
    374374    tIterator<BaseObject>* bufferIterator = this->bufferList->getIterator();
    375     SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->firstElement();
     375    SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->nextElement();
    376376    while (enumBuffer)
    377377    {
    378378      tIterator<BaseObject>* sourceIterator = this->sourceList->getIterator();
    379       SoundSource* enumSource = (SoundSource*)sourceIterator->firstElement();
     379      SoundSource* enumSource = (SoundSource*)sourceIterator->nextElement();
    380380      while (enumSource)
    381381      {
     
    401401  {
    402402    tIterator<BaseObject>* bufferIterator = this->bufferList->getIterator();
    403     SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->firstElement();
     403    SoundBuffer* enumBuffer = (SoundBuffer*)bufferIterator->nextElement();
    404404    while (enumBuffer)
    405405    {
     
    419419  {
    420420    tIterator<BaseObject>* Iterator = this->sourceList->getIterator();
    421     SoundSource* enumSource = (SoundSource*)Iterator->firstElement();
     421    SoundSource* enumSource = (SoundSource*)Iterator->nextElement();
    422422    while (enumSource)
    423423    {
  • trunk/src/lib/util/ini_parser.cc

    r5110 r5111  
    5858  {
    5959    tIterator<IniSection>* sectionIt = this->sections->getIterator();
    60     IniSection* sectionEnum = sectionIt->firstElement();
     60    IniSection* sectionEnum = sectionIt->nextElement();
    6161    while (sectionEnum)
    6262    {
    6363      tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator();
    64       IniEntry* entryEnum = entryIt->firstElement();
     64      IniEntry* entryEnum = entryIt->nextElement();
    6565      while (entryEnum)
    6666      {
     
    192192    {
    193193      tIterator<IniSection>* sectionIt = this->sections->getIterator();
    194       IniSection* sectionEnum = sectionIt->firstElement();
     194      IniSection* sectionEnum = sectionIt->nextElement();
    195195      while (sectionEnum)
    196196      {
     
    198198
    199199        tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator();
    200         IniEntry* entryEnum = entryIt->firstElement();
     200        IniEntry* entryEnum = entryIt->nextElement();
    201201        while (entryEnum)
    202202        {
     
    246246{
    247247  tIterator<IniSection>* sectionIt = this->sections->getIterator();
    248   IniSection* sectionEnum = sectionIt->firstElement();
     248  IniSection* sectionEnum = sectionIt->nextElement();
    249249  while (sectionEnum)
    250250  {
     
    347347  {
    348348    tIterator<IniSection>* sectionIt = this->sections->getIterator();
    349     IniSection* sectionEnum = sectionIt->firstElement();
     349    IniSection* sectionEnum = sectionIt->nextElement();
    350350    while (sectionEnum)
    351351    {
     
    395395  {
    396396    tIterator<IniSection>* sectionIt = this->sections->getIterator();
    397     IniSection* sectionEnum = sectionIt->firstElement();
     397    IniSection* sectionEnum = sectionIt->nextElement();
    398398    while (sectionEnum)
    399399    {
     
    401401      {
    402402        tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator();
    403         IniEntry* entryEnum = entryIt->firstElement();
     403        IniEntry* entryEnum = entryIt->nextElement();
    404404        while (entryEnum)
    405405        {
     
    452452  {
    453453    tIterator<IniSection>* sectionIt = this->sections->getIterator();
    454     IniSection* sectionEnum = sectionIt->firstElement();
     454    IniSection* sectionEnum = sectionIt->nextElement();
    455455    while (sectionEnum)
    456456    {
     
    458458
    459459      tIterator<IniEntry>* entryIt = sectionEnum->entries->getIterator();
    460       IniEntry* entryEnum = entryIt->firstElement();
     460      IniEntry* entryEnum = entryIt->nextElement();
    461461      while (entryEnum)
    462462      {
  • trunk/src/lib/util/list.h

    r5110 r5111  
    1212#endif
    1313
    14 template<class T> class tIterator;
     14
    1515
    1616//! a list element of the tList,
     
    2323
    2424/**
     25 *  an iterator class
     26
     27   this enables the user to iterate through a list very easely
     28*/
     29template<class T> class tIterator
     30{
     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 iterator
     40  listElement<T>*    tmpEl;                          //!< temp listElemnt pointer
     41  listElement<T>*    startElement;                   //!< pointer to the start of the list
     42};
     43
     44
     45/**
     46 *  iterator constructor
     47 * @param startElement:  the first list element from the tList
     48
     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*/
     60template<class T>
     61inline 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 destructor
     71*/
     72template<class T>
     73inline tIterator<T>::~tIterator ()
     74{
     75  this->currentEl = NULL;
     76}
     77
     78
     79/**
     80 *  use it to iterate through the list
     81 * @returns next list element
     82*/
     83template<class T>
     84inline 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 list
     96 * @param element the element to seek
     97 * @returns next list element
     98
     99  Attention: if you seek an element, the iterator pointer will point to the NEXT listelement after the argument!
     100 */
     101template<class T>
     102inline 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/**
    25122 *  the list template class
    26123
     
    29126template<class T> class tList
    30127{
    31   friend class tIterator<T>;
    32 
    33128 public:
    34129  tList ();
     
    40135  void removeLast();
    41136  void flush();
    42   T* firstElement() const;
    43   T* lastElement() const;
    44   bool isEmpty() const;
    45   unsigned int getSize() const;
     137  T* firstElement();
     138  T* lastElement();
     139  bool isEmpty();
     140  unsigned int getSize();
    46141  bool inList(T* entity);
    47   tIterator<T>* getIterator() const;
     142  tIterator<T>* getIterator();
    48143  T* nextElement(T* toEntity);
    49144  T* toArray();
     
    208303*/
    209304template<class T>
    210 inline T* tList<T>::firstElement() const
     305inline T* tList<T>::firstElement()
    211306{
    212307  return this->first->curr;
     
    219314*/
    220315template<class T>
    221 inline T* tList<T>::lastElement() const
     316inline T* tList<T>::lastElement()
    222317{
    223318  return this->last->curr;
     
    230325*/
    231326template<class T>
    232 inline bool tList<T>::isEmpty() const
     327inline bool tList<T>::isEmpty()
    233328{
    234329  return (this->size==0)?true:false;
     
    264359*/
    265360template<class T>
    266 inline unsigned int tList<T>::getSize() const
     361inline unsigned int tList<T>::getSize()
    267362{
    268363  return this->size;
     
    277372*/
    278373template<class T>
    279 inline tIterator<T>* tList<T>::getIterator() const
    280 {
    281   return new tIterator<T>(this);
     374inline tIterator<T>* tList<T>::getIterator()
     375{
     376  tIterator<T>* iterator = new tIterator<T>(this->first);
     377  return iterator;
    282378}
    283379
     
    318414}
    319415
    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 
    338   private:
    339     listElement<T>*    currentEl;                      //!< pointer to the current list element in the iterator
    340     listElement<T>*    tmpEl;                          //!< temp listElemnt pointer
    341     const tList<T>*    list;                           //!< The List, that we want to iterate through
    342 };
    343 
    344 
    345 /**
    346  *  iterator constructor
    347  * @param startElement:  the first list element from the tList
    348 
    349    normaly you will use it like this:
    350 
    351    tIterator<char>* nameIterator = nameList->getIterator();
    352                 char name* = nameIterator->nextElement();
    353                 while( name != NULL)
    354 {
    355                 PRINTF(3)("found name: %s in list\n", name);
    356                 name = nameIterator->nextElement();
    357 }
    358                 delete nameIterator;
    359  */
    360                 template<class T>
    361                 inline tIterator<T>::tIterator (const tList<T>* list)
    362 {
    363   this->currentEl = list->first;
    364   this->tmpEl = NULL;
    365   this->list = list;
    366 }
    367 
    368 
    369 /**
    370  *  the destructor
    371  */
    372 template<class T>
    373     inline tIterator<T>::~tIterator ()
    374 {
    375   this->currentEl = NULL;
    376 }
    377 
    378 template<class T>
    379     inline T* tIterator<T>::firstElement ()
    380 {
    381   this->currentEl = this->list->first;
    382   if (this->currentEl == NULL)
    383     return NULL;
    384   else
    385     return this->currentEl->curr;
    386 }
    387 
    388 
    389 /**
    390  *  use it to iterate through the list
    391  * @returns next list element
    392  */
    393 template<class T>
    394     inline T* tIterator<T>::nextElement ()
    395 {
    396   if( this->currentEl == NULL || this->currentEl->next == NULL)
    397   {
    398     this->currentEl = NULL;
    399     return NULL;
    400   }
    401 
    402   this->currentEl = this->currentEl->next;
    403   return this->currentEl->curr;
    404 }
    405 
    406 /**
    407  *  gets the element after the selected one, sets the iterator to this point in the list
    408  * @param element the element to seek
    409  * @returns next list element
    410 
    411   Attention: if you seek an element, the iterator pointer will point to the NEXT listelement after the argument!
    412  */
    413 template<class T>
    414     inline T* tIterator<T>::seekElement (T* element)
    415 {
    416   for(this->tmpEl = this->list->first; this->tmpEl != NULL; this->tmpEl = this->tmpEl->next)
    417   {
    418     if( unlikely(this->tmpEl->curr == element))
    419     {
    420       if( this->tmpEl->next != NULL)
    421       {
    422         this->currentEl = this->tmpEl;
    423         return this->tmpEl->next->curr;
    424       }
    425       return NULL;
    426     }
    427   }
    428   return NULL;
    429 }
    430 
    431416#endif /* _LIST_H */
  • trunk/src/story_entities/campaign.cc

    r5110 r5111  
    154154    */
    155155    tIterator<StoryEntity>* it = this->entities->getIterator();
    156     se = it->firstElement();
     156    se = it->nextElement();
    157157    while( se != NULL)
    158158    {
     
    284284
    285285  tIterator<StoryEntity>* iterator = this->entities->getIterator();
    286   StoryEntity* entity = iterator->firstElement();
     286  StoryEntity* entity = iterator->nextElement();
    287287  while( entity != NULL)
    288288    {
  • trunk/src/story_entities/world.cc

    r5110 r5111  
    864864
    865865      tIterator<WorldEntity>* iterator = this->entities->getIterator();
    866       WorldEntity* entity = iterator->firstElement();
     866      WorldEntity* entity = iterator->nextElement();
    867867      while( entity != NULL)
    868868        {
     
    951951  glLoadIdentity();
    952952  tIterator<WorldEntity>* iterator = this->entities->getIterator();
    953   entity = iterator->firstElement();
     953  entity = iterator->nextElement();
    954954  while( entity != NULL )
    955955  {
  • trunk/src/subprojects/benchmark.cc

    r5110 r5111  
    352352      /*give list out */
    353353      tIterator<char>* iterator = list->getIterator();
    354       name = iterator->firstElement();
     354      name = iterator->nextElement();
    355355      printf("  List Elements: \t\t");
    356356      while( name != NULL)
     
    373373      /*give list out */
    374374      iterator = list->getIterator();
    375       name = iterator->firstElement();
     375      name = iterator->nextElement();
    376376      printf("  List Elements: \t\t");
    377377      while( name != NULL)
     
    433433      /*give list out */
    434434      iterator = list->getIterator();
    435       name = iterator->firstElement();
     435      name = iterator->nextElement();
    436436      printf("  List Elements: \t\t");
    437437      while( name != NULL)
  • trunk/src/subprojects/collision_detection/collision_detection.cc

    r5110 r5111  
    235235
    236236  tIterator<WorldEntity>* iterator = entityList->getIterator();
    237   WorldEntity* entity = iterator->firstElement();
     237  WorldEntity* entity = iterator->nextElement();
    238238  while( entity != NULL)
    239239  {
     
    251251
    252252  tIterator<WorldEntity>* iterator = entityList->getIterator();
    253   WorldEntity* entity = iterator->firstElement();
     253  WorldEntity* entity = iterator->nextElement();
    254254  while( entity != NULL)
    255255  {
  • trunk/src/util/animation/animation3d.cc

    r5110 r5111  
    5858  // delete all the KeyFrames
    5959  tIterator<KeyFrame3D>* itKF = keyFrameList->getIterator();
    60   KeyFrame3D*  enumKF = itKF->firstElement();
     60  KeyFrame3D*  enumKF = itKF->nextElement();
    6161  while (enumKF)
    6262    {
  • trunk/src/util/animation/animation_player.cc

    r5110 r5111  
    8686  // deleting the Animation List AND all the elements of the List
    8787  tIterator<Animation>* animIt = this->animationList->getIterator();
    88   Animation* anim = animIt->firstElement();
     88  Animation* anim = animIt->nextElement();
    8989  while( anim != NULL)
    9090    {
     
    109109      // iterate through all the animations and tick them.
    110110      tIterator<Animation>* animIt = this->animationList->getIterator();
    111       Animation* anim = animIt->firstElement();
     111      Animation* anim = animIt->nextElement();
    112112      while( anim != NULL)
    113113        {
     
    147147{
    148148  tIterator<Animation>* animIt = this->animationList->getIterator();
    149   Animation* anim = animIt->firstElement();
     149  Animation* anim = animIt->nextElement();
    150150  while( anim != NULL)
    151151    {
     
    176176  // Per ANIMATION DEBUG
    177177  tIterator<Animation>* animIt = this->animationList->getIterator();
    178   Animation* anim = animIt->firstElement();
     178  Animation* anim = animIt->nextElement();
    179179  while( anim != NULL)
    180180    {
  • trunk/src/util/animation/t_animation.h

    r5110 r5111  
    108108  // delete all the KeyFrames
    109109  tIterator<KeyFrameF>* itKF = keyFrameList->getIterator();
    110   KeyFrameF*  enumKF = itKF->firstElement();
     110  KeyFrameF*  enumKF = itKF->nextElement();
    111111  while (enumKF)
    112112    {
  • trunk/src/util/garbage_collector.cc

    r5110 r5111  
    156156//
    157157//   tIterator<WorldEntity>* iterator = list->getIterator();
    158 //   WorldEntity* entity = iterator->firstElement();
     158//   WorldEntity* entity = iterator->nextElement();
    159159//   while( entity != NULL)
    160160//     {
  • trunk/src/util/loading/load_param.cc

    r5110 r5111  
    1717
    1818#include "list.h"
     19#include "array.h"
    1920#include "base_object.h"
    2021
     
    295296
    296297  tIterator<LoadParamDescription>* iterator = this->paramList->getIterator();
    297   LoadParamDescription* enumParamDesc = iterator->firstElement();
     298  LoadParamDescription* enumParamDesc = iterator->nextElement();
    298299  while (enumParamDesc)
    299300    {
     
    314315{
    315316  tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
    316   LoadClassDescription* enumClassDesc = iterator->firstElement();
     317  LoadClassDescription* enumClassDesc = iterator->nextElement();
    317318  while (enumClassDesc)
    318319    {
     
    336337{
    337338  tIterator<LoadParamDescription>* iterator = this->paramList->getIterator();
    338   LoadParamDescription* enumParamDesc = iterator->firstElement();
     339  LoadParamDescription* enumParamDesc = iterator->nextElement();
    339340  while (enumParamDesc)
    340341    {
     
    362363  PRINT(3)(" Listing all the Loadable Options (loaded since Game started).\n\n");
    363364  tIterator<LoadClassDescription>* classIT = LoadClassDescription::classList->getIterator();
    364   LoadClassDescription* enumClassDesc = classIT->firstElement();
     365  LoadClassDescription* enumClassDesc = classIT->nextElement();
    365366  while (enumClassDesc)
    366367    {
    367368      PRINT(3)("<%s>\n", enumClassDesc->className);
    368369      tIterator<LoadParamDescription>* paramIT = enumClassDesc->paramList->getIterator();
    369       LoadParamDescription* enumParamDesc = paramIT->firstElement();
     370      LoadParamDescription* enumParamDesc = paramIT->nextElement();
    370371      while (enumParamDesc)
    371372        {
     
    385386 * searches for classes, which beginn with classNameBegin
    386387 * @param classNameBegin the beginning string of a Class
    387  * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
     388 * @return a NEW char-array with ClassNames. The ARRAY should be deleted afterwards,
    388389 * !! The strings MUST NOT be deleted !!
    389390 */
    390 tList<const char>* LoadClassDescription::searchClassWithShort(const char* classNameBegin)
     391Array<char*>* LoadClassDescription::searchClassWithShort(const char* classNameBegin)
    391392{
    392393  unsigned int searchLength = strlen(classNameBegin);
    393   tList<const char>* retVal = new tList<const char>;
     394  Array<char*>* retVal = new Array<char*>;
    394395
    395396  tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
    396   LoadClassDescription* enumClassDesc = iterator->firstElement();
     397  LoadClassDescription* enumClassDesc = iterator->nextElement();
    397398  while (enumClassDesc)
    398399  {
     
    400401        !strncasecmp(enumClassDesc->className, classNameBegin, searchLength))
    401402    {
    402       retVal->add(enumClassDesc->className);
     403      retVal->addEntry(enumClassDesc->className);
    403404    }
    404405    enumClassDesc = iterator->nextElement();
     
    406407  delete iterator;
    407408
     409  retVal->finalizeArray();
    408410  return retVal;
    409411}
     
    412414// {
    413415//   tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
    414 //   LoadClassDescription* enumClassDesc = iterator->firstElement();
     416//   LoadClassDescription* enumClassDesc = iterator->nextElement();
    415417//   while (enumClassDesc)
    416418//   {
  • trunk/src/util/loading/load_param.h

    r5102 r5111  
    3131// Forward Declaration //
    3232template<class T> class tList;
     33template<class T> class Array;
    3334
    3435//! macro that makes it even more easy to load a Parameter
     
    311312
    312313  static void printAll(const char* fileName = NULL);
    313   static tList<const char>* searchClassWithShort(const char* classNameBegin);
     314  static Array<char*>* searchClassWithShort(const char* classNameBegin);
    314315//  static const LoadParamDescription* getClass(const char* className);
    315316
  • trunk/src/util/resource_manager.cc

    r5110 r5111  
    7474  // deleting the Directorie Lists
    7575  tIterator<char>* tmpIt = imageDirs->getIterator();
    76   char* tmpDir = tmpIt->firstElement();
     76  char* tmpDir = tmpIt->nextElement();
    7777  while(tmpDir)
    7878    {
     
    9999      this->dataDir = new char[strlen(realDir)+1];
    100100      strcpy(this->dataDir, realDir);
    101       delete[] realDir;
     101      delete realDir;
    102102      return true;
    103103    }
    104104  else
    105105    {
    106       PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", realDir, this->dataDir);
    107       delete[] realDir;
     106      PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", dataDir, this->dataDir);
     107      delete realDir;
    108108      return false;
    109109    }
     
    144144      // check if the Directory has been added before
    145145      tIterator<char>* tmpImageDirs = imageDirs->getIterator();
    146       char* tmpDir = tmpImageDirs->firstElement();
     146      char* tmpDir = tmpImageDirs->nextElement();
    147147      while(tmpDir)
    148148        {
     
    363363            {
    364364              tIterator<char>* iterator = imageDirs->getIterator();
    365               tmpDir = iterator->firstElement();
     365              tmpDir = iterator->nextElement();
     366              //tmpDir = imageDirs->enumerate();
    366367              while(tmpDir)
    367368                {
     
    491492{
    492493  tIterator<Resource>* iterator = resourceList->getIterator();
    493   Resource* enumRes = iterator->firstElement();
     494  Resource* enumRes = iterator->nextElement();
    494495  while (enumRes)
    495496    {
     
    520521  //  Resource* enumRes = resourceList->enumerate();
    521522  tIterator<Resource>* iterator = resourceList->getIterator();
    522   Resource* enumRes = iterator->firstElement();
     523  Resource* enumRes = iterator->nextElement();
    523524  while (enumRes)
    524525    {
     
    602603  //  Resource* enumRes = resourceList->enumerate();
    603604  tIterator<Resource>* iterator = resourceList->getIterator();
    604   Resource* enumRes = iterator->firstElement();
     605  Resource* enumRes = iterator->nextElement();
    605606  while (enumRes)
    606607    {
     
    630631
    631632  // checking for the termination of the string given. If there is a "/" at the end cut it away
    632   if (directoryName[strlen(directoryName)-1] == '/' ||
    633       directoryName[strlen(directoryName)-1] == '\\')
     633  if (directoryName[strlen(directoryName)-1] == '/')
    634634    {
    635635      tmpDirName = new char[strlen(directoryName)+1];
     
    651651                            ))
    652652        {
    653           delete[] tmpDirName;
     653          delete tmpDirName;
    654654          return true;
    655655        }
     
    798798  PRINT(0)(" List of Image-Directories: ");
    799799  tIterator<char>* tmpIt = imageDirs->getIterator();
    800   char* tmpDir = tmpIt->firstElement();
     800  char* tmpDir = tmpIt->nextElement();
    801801  while(tmpDir)
    802802    {
     
    809809  PRINT(0)("List of all stored Resources:\n");
    810810  tIterator<Resource>* iterator = resourceList->getIterator();
    811   Resource* enumRes = iterator->firstElement();
     811  Resource* enumRes = iterator->nextElement();
    812812  while (enumRes)
    813813    {
  • trunk/src/util/shell.cc

    r5110 r5111  
    2020#include "text_engine.h"
    2121#include "list.h"
     22#include "array.h"
    2223#include "graphics_engine.h"
    2324#include "event_handler.h"
    2425
    2526#include "load_param.h"
    26 #include "class_list.h"
    27 
    28 #include "key_names.h"
    2927#include "debug.h"
    3028#include <stdarg.h>
     
    4240  this->setName("Shell");
    4341
    44   this->shellHeight = 400;
    45   this->bActive = false;
    4642  this->buffer = new tList<char>;
    4743
    48   this->textSize = 15;
    49   this->lineSpacing = 5;
     44  this->textSize = 10;
    5045
    5146  //this->bufferSize = 0;
    5247  this->bufferText = NULL;
    5348  this->setBufferSize(100);
    54   this->bufferDisplaySize = 10;
    5549  this->setBufferDisplaySize(10);
    56   this->setAbsCoor2D(3, -400);
     50  this->setAbsCoor2D(3, GraphicsEngine::getInstance()->getResolutionY());
    5751  this->delayed = 0;
    5852  this->setRepeatDelay(.3, .05);
    5953  this->pressedKey = SDLK_FIRST;
    6054
    61   this->inputLineText = NULL;
     55  this->inputLineText = TextEngine::getInstance()->createText("fonts/earth.ttf", 10, TEXT_DYNAMIC, 255, 0, 0);
     56  this->inputLineText->setAlignment(TEXT_ALIGN_LEFT);
     57  this->inputLineText->setText(NULL);
    6258  this->inputLine = new char[1];
    6359  this->inputLine[0] = '\0';
    64 
    65   this->rebuildText();
    66   this->completionList = NULL;
    67 
    68   // EVENT-Handler subscription of '`' to all States, and all other keyboard commands to ES_SEHLL
     60  this->inputLineText->setParent2D(this);
     61
     62
    6963  EventHandler* evh = EventHandler::getInstance();
    7064  evh->subscribe(this, ES_ALL, SDLK_BACKQUOTE);
     
    8377  for (int i = 0; i < this->bufferDisplaySize; i++)
    8478    delete this->bufferText[i];
    85   delete[] this->bufferText;
     79  delete this->bufferText;
    8680
    8781  // delete the inputLine
     
    9185  // delete all the Chars in the Buffers
    9286  tIterator<char>* charIterator = this->buffer->getIterator();
    93   char* charElem = charIterator->firstElement();
     87  char* charElem = charIterator->nextElement();
    9488  while (charElem != NULL)
    9589  {
     
    9993  delete charIterator;
    10094
    101 //  if (this->completionList != NULL)
    102     //delete this->completionList;
    103 
    10495  Shell::singletonRef = NULL;
    10596}
    106 
    107 
    108 void Shell::activate()
    109 {
    110   if (this->bActive == true)
    111     PRINTF(3)("The shell is already active\n");
    112   this->bActive = true;
    113 
    114   EventHandler::getInstance()->setState(ES_SHELL);
    115   this->setRelCoorSoft2D(0, 0, 1, 5);
    116 }
    117 
    118 void Shell::deactivate()
    119 {
    120   if (this->bActive == false)
    121     PRINTF(3)("The shell is already inactive\n");
    122   this->bActive = false;
    123 
    124   EventHandler::getInstance()->setState(ES_GAME);
    125   this->setRelCoorSoft2D(0, -400, 1, 5);
    126 }
    127 
    128 void Shell::setTextSize(unsigned int textSize, unsigned int lineSpacing)
    129 {
    130   this->textSize = textSize;
    131   this->lineSpacing = lineSpacing;
    132 
    133   this->rebuildText();
    134 }
    135 
    136 void Shell::rebuildText()
    137 {
    138   if (this->inputLineText == NULL)
    139     delete this->inputLineText;
    140   this->inputLineText = TextEngine::getInstance()->createText("fonts/Aniron_Bold.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
    141   this->inputLineText->setAlignment(TEXT_ALIGN_LEFT);
    142   this->inputLineText->setText(NULL);
    143   this->inputLineText->setParent2D(this);
    144   this->inputLineText->setRelCoor2D(5, (this->textSize + this->lineSpacing)*this->bufferDisplaySize);
    145 
    146   this->setBufferDisplaySize(this->bufferDisplaySize);
    147 }
    148 
    149 
    15097
    15198/**
     
    159106    for (unsigned int i = 0; i < this->bufferDisplaySize; i++)
    160107      delete this->bufferText[i];
    161     delete[] this->bufferText;
     108    delete this->bufferText;
    162109  }
    163110
     
    165112  for (unsigned int i = 0; i < bufferDisplaySize; i++)
    166113  {
    167     this->bufferText[i] = TextEngine::getInstance()->createText("fonts/Aniron_Bold.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
     114    this->bufferText[i] = TextEngine::getInstance()->createText("fonts/earth.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);
    168115    this->bufferText[i]->setAlignment(TEXT_ALIGN_LEFT);
    169     this->bufferText[i]->setRelCoor2D(5, (this->textSize + this->lineSpacing)*(bufferDisplaySize - i -1));
     116    this->bufferText[i]->setRelCoor2D(5, 12+12*i);
    170117    this->bufferText[i]->setText(NULL);
    171118    this->bufferText[i]->setParent2D(this);
    172119  }
     120
     121
    173122  this->bufferDisplaySize = bufferDisplaySize;
    174 
    175   this->shellHeight = (this->textSize + this->lineSpacing) * (bufferDisplaySize+1);
    176123}
    177124
     
    191138  // delete all the Chars in the Buffers
    192139  tIterator<char>* charIterator = this->buffer->getIterator();
    193   char* charElem = charIterator->firstElement();
     140  char* charElem = charIterator->nextElement();
    194141
    195142  while (charElem != NULL)
     
    206153 * @param line the Line as in the first argument in printf
    207154 * @param args the arguments as a va_list
     155 *
     156 * @todo optimize
    208157 */
    209158bool Shell::addBufferLineStatic(const char* line, ...)
     
    225174  return true;
    226175}
     176int curr = 0;
    227177
    228178/**
     
    249199   }
    250200
    251    if (this->bActive && likely(bufferText != NULL))
     201   if (likely(bufferText != NULL))
    252202   {
    253      Text* lastText = this->bufferText[this->bufferDisplaySize-1];
    254      Vector firstCoord = this->bufferText[0]->getRelCoorSoft2D();
    255 
    256      Text* swapText;
    257      Text* moveText = this->bufferText[0];
    258      this->bufferText[0]->setRelCoorSoft2D(this->bufferText[1]->getRelCoorSoft2D(), 5);
    259      for (unsigned int i = 1; i < this->bufferDisplaySize; i++)
     203     Text* moveText = this->bufferText[this->bufferDisplaySize-1];
     204     for (int i = this->bufferDisplaySize-1; i > 0; i--)
    260205     {
    261        if ( i < this->bufferDisplaySize-1)
    262          this->bufferText[i]->setRelCoorSoft2D(this->bufferText[i+1]->getRelCoorSoft2D(),5);
    263        swapText = this->bufferText[i];
    264        this->bufferText[i] = moveText;
    265        moveText = swapText;
     206       this->bufferText[i] = this->bufferText[i-1];
    266207     }
    267      lastText->setRelCoor2D(firstCoord);
    268      this->bufferText[0] = lastText;
    269 
    270      this->bufferText[0]->setText(newLine);
     208     this->bufferText[0] = moveText;
    271209   }
     210   this->bufferText[0]->setText(newLine);
     211   // this->bufferText->
     212//  this->inputLineText->setText(newLine);
    272213}
    273214
     
    289230{
    290231  tIterator<char>* charIterator = this->buffer->getIterator();
    291   char* charElem = charIterator->firstElement();
     232  char* charElem = charIterator->nextElement();
    292233
    293234  int i = 1;
     
    305246}
    306247
     248
    307249/**
    308250 * deletes the InputLine
     
    316258  this->inputLine = new char[1];
    317259  *this->inputLine = '\0';
     260
    318261}
    319262
     
    373316bool Shell::executeCommand()
    374317{
     318
    375319  this->addBufferLineStatic("Execute Command: %s\n", this->inputLine);
    376320  delete this->inputLine;
     
    393337}
    394338
     339
     340#include "key_names.h"
    395341/**
    396342 * listens for some event
     
    406352      if (EventHandler::getInstance()->getState() == ES_GAME)
    407353      {
    408         this->activate();
     354        EventHandler::getInstance()->setState(ES_SHELL);
     355        this->setRelCoorSoft2D(0, GraphicsEngine::getInstance()->getResolutionY()-150, 1, 5);
    409356      }
    410357
    411358      else
    412359      {
    413         this->deactivate();
     360        EventHandler::getInstance()->setState(ES_GAME);
     361        this->setRelCoorSoft2D(0, GraphicsEngine::getInstance()->getResolutionY()+10, 1, 5);
    414362      }
    415363    }
     
    434382  {
    435383    if (this->pressedKey == event.type)
    436     {
    437384      this->pressedKey = SDLK_FIRST;
    438       this->delayed = 0.0;
    439     }
     385    this->delayed = 0.0;
    440386  }
    441387}
     
    480426
    481427//  glTexCoord2f(this->texCoord.maxU, this->texCoord.minV);
    482   glVertex2f(GraphicsEngine::getInstance()->getResolutionX() - this->getAbsCoor2D().x, this->getAbsCoor2D().y  );
     428  glVertex2f(this->getAbsCoor2D().x + 800, this->getAbsCoor2D().y  );
    483429
    484430//  glTexCoord2f(this->texCoord.maxU, this->texCoord.maxV);
    485   glVertex2f(GraphicsEngine::getInstance()->getResolutionX() - this->getAbsCoor2D().x, this->getAbsCoor2D().y + this->shellHeight);
     431  glVertex2f(this->getAbsCoor2D().x + 800, this->getAbsCoor2D().y + 150);
    486432
    487433//  glTexCoord2f(this->texCoord.minU, this->texCoord.maxV);
    488   glVertex2f(this->getAbsCoor2D().x, this->getAbsCoor2D().y + this->shellHeight);
     434  glVertex2f(this->getAbsCoor2D().x, this->getAbsCoor2D().y + 150);
    489435
    490436  glEnd();
     
    505451  strcpy(completionLine, this->inputLine);
    506452
    507   char* commandBegin = strrchr(completionLine, ' ');
     453   char* commandBegin = strrchr(completionLine, ' ');
    508454  if (commandBegin == NULL)
    509455    commandBegin = completionLine;
     
    516462  }
    517463
    518   char* objectStart;
    519   if (objectStart = strstr(commandBegin, "::"))
    520   {
    521     char* classIdentity = new char[objectStart - commandBegin +1];
    522     strncpy(classIdentity, commandBegin, objectStart - commandBegin);
    523     classIdentity[objectStart - commandBegin] = '\0';
    524     this->objectComplete(objectStart+2, ClassList::StringToID(classIdentity));
    525     delete[] classIdentity;
    526   }
    527   else
    528     this->classComplete(commandBegin);
    529 
    530   delete[] completionLine;
    531 }
    532 
    533 /**
    534  * autocompletes a className
    535  * @param classBegin the Beginning of a String to autoComplete
    536  * @return true on success, false otherwise
    537  */
    538 bool Shell::classComplete(const char* classBegin)
    539 {
    540   if (unlikely(classBegin == NULL))
    541     return false;
    542   const tList<const char>* clList = ClassList::getClassList();
    543   if (clList != NULL)
    544   {
    545     const tList<const char>* classList = this->createCompleteList(clList, classBegin);
    546     if (classList != NULL)
    547       this->generalComplete(classList, classBegin, "%s::", "::");
    548     else
    549       return false;
    550   }
    551   else
    552     return false;
    553   return true;
    554 }
    555 
    556 /**
    557  * autocompletes an ObjectName
    558  * @param objectBegin the beginning string of a Object
    559  * @param classID the ID of the Class to search for.
    560  * @return true on success, false otherwise
    561  */
    562 bool Shell::objectComplete(const char* objectBegin, long classID)
    563 {
    564   printf("%s\n", objectBegin);
    565 
    566   if (unlikely(objectBegin == NULL))
    567     return false;
    568   tList<BaseObject>* boList = ClassList::getList(classID);
    569   if (boList != NULL)
    570   {
    571     printf("\n", boList->firstElement()->getName());
    572     const tList<const char>* objectList = this->createCompleteList(boList, objectBegin);
    573     if (objectList != NULL)
    574       this->generalComplete(objectList, objectBegin, "%s");
    575     else
    576       return false;
    577   }
    578   else
    579     return false;
    580   return true;
    581 }
    582 
    583 bool Shell::functionComplete(const char* functionBegin)
    584 {
    585 }
    586 
    587 /**
    588  * completes the inputline on grounds of an inputList
    589  * @param stringList the List to parse through
    590  * @param begin the String to search in the inputList, and to extend with it.
    591  * @param displayAs how to display the found value to the user, printf-style, !!with only one %s!! ex.: "::%s::"
    592  * @param addBack what should be added at the end of the completion
    593  * @param addFront what should be added to the front of one finished completion
    594  * @return true if ok, false otherwise
    595  */
    596 bool Shell::generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs, const char* addBack, const char* addFront)
    597 {
    598   if (stringList->getSize() == 0)
    599     return false;
    600 
    601   const char* addString = stringList->firstElement();
    602   unsigned int addLength = 0;
    603   unsigned int inputLenght = strlen(begin);
    604 
    605   if (addString != NULL)
    606     addLength = strlen(addString);
    607   tIterator<const char>* charIterator = stringList->getIterator();
    608   const char* charElem = charIterator->firstElement();
    609   while (charElem != NULL)
    610   {
    611     PRINTF(0)(displayAs, charElem);
    612     for (unsigned int i = inputLenght; i < addLength; i++)
    613       if (addString[i] != charElem[i])
    614     {
    615       addLength = i;
    616       break;
    617     }
    618     charElem = charIterator->nextElement();
    619   }
    620   delete charIterator;
    621 
    622   if (addLength >= inputLenght)
    623   {
    624     char* adder = new char[addLength+1];
    625     strncpy(adder, addString, addLength);
    626     adder[addLength] = '\0';
    627     this->removeCharacters(inputLenght);
    628     this->addCharacters(adder);
    629     if (addBack != NULL && stringList->getSize() == 1)
    630       this->addCharacters("::");
    631     delete[] adder;
    632   }
    633   return true;
    634 }
    635 
    636 
    637 
    638 /**
    639  * searches for classes, which beginn with classNameBegin
    640  * @param inputList the List to parse through
    641  * @param classNameBegin the beginning string
    642  * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
    643  * !! The strings MUST NOT be deleted !!
    644  */
    645 const tList<const char>* Shell::createCompleteList(const tList<const char>* inputList, const char* classNameBegin)
    646 {
    647   if (inputList == NULL || classNameBegin == NULL)
    648     return NULL;
    649   unsigned int searchLength = strlen(classNameBegin);
    650   if (this->completionList != NULL)
    651     delete this->completionList;
    652   this->completionList = new tList<const char>;
    653 
    654 //  tList<const char>* classList = ClassList::getClassList();
    655 
    656   tIterator<const char>* iterator = inputList->getIterator();
    657   const char* enumString = iterator->firstElement();
    658   while (enumString != NULL)
    659   {
    660     if (strlen(enumString)>searchLength+1 &&
    661         !strncasecmp(enumString, classNameBegin, searchLength))
    662     {
    663       this->completionList->add(enumString);
    664     }
    665     enumString = iterator->nextElement();
    666   }
    667   delete iterator;
    668 
    669   return this->completionList;
    670 }
    671 
    672 /**
    673  * searches for classes, which beginn with classNameBegin
    674  * @param inputList the List to parse through
    675  * @param classNameBegin the beginning string
    676  * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
    677  * !! The strings MUST NOT be deleted !!
    678  */
    679 const tList<const char>* Shell::createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin)
    680 {
    681   if (inputList == NULL || classNameBegin == NULL)
    682     return NULL;
    683   unsigned int searchLength = strlen(classNameBegin);
    684   if (this->completionList != NULL)
    685     delete this->completionList;
    686   this->completionList = new tList<const char>;
    687 
    688   tIterator<BaseObject>* iterator = inputList->getIterator();
    689   BaseObject* enumBO = iterator->firstElement();
    690   while (enumBO != NULL)
    691   {
    692     if (enumBO->getName() != NULL &&
    693         strlen(enumBO->getName())>searchLength+1 &&
    694         !strncasecmp(enumBO->getName(), classNameBegin, searchLength))
    695     {
    696       this->completionList->add(enumBO->getName());
    697     }
    698     enumBO = iterator->nextElement();
    699   }
    700   delete iterator;
    701 
    702   return this->completionList;
     464  printf("%s\n",commandBegin);
     465   Array<char*>* classArray = LoadClassDescription::searchClassWithShort(commandBegin);
     466   if (classArray->getCount() == 0)
     467   {
     468     delete[] completionLine;
     469     delete classArray;
     470     //PRINTF(0)("no completion found for %s\n", commandBegin);
     471     return false;
     472   }
     473
     474   for (unsigned int i = 0; i < classArray->getCount(); i++)
     475   {
     476     PRINTF(0)("%s\n", classArray->getEntry(i));
     477   }
     478   if (classArray->getCount() == 1)
     479   {
     480     this->removeCharacters(strlen(commandBegin));
     481     this->addCharacters(classArray->getEntry(0));
     482     this->addCharacter(' ');
     483   }
     484
     485   delete[] completionLine;
     486   delete classArray;
    703487}
    704488
     
    710494  if (this->pressedKey != SDLK_FIRST)
    711495    printf("%s::%f %f\n", SDLKToKeyname(this->pressedKey), this->delayed, this->repeatDelay);
    712 }
     496
     497}
  • trunk/src/util/shell.h

    r5107 r5111  
    3636
    3737
    38     void activate();
    39     void deactivate();
     38    void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; };
    4039
    41     void setTextSize(unsigned int textSize, unsigned int lineSpacing = 1);
    42     void rebuildText();
     40    void setBufferDisplaySize(unsigned int bufferDisplaySize);
    4341
    4442    // BUFFER //
    45     void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; };
    46     void setBufferDisplaySize(unsigned int bufferDisplaySize);
    4743    void flushBuffers();
    4844    static bool addBufferLineStatic(const char* line, ...);
     
    7167  private:
    7268    bool autoComplete();
    73     bool classComplete(const char* classBegin);
    74     bool objectComplete(const char* objectBegin, long classID);
    75     bool functionComplete(const char* functionBegin);
    76 
    77     bool generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL);
    78 
    79     const tList<const char>* Shell::createCompleteList(const tList<const char>* inputList, const char* classNameBegin);
    80     const tList<const char>* Shell::createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin);
    8169
    8270
     
    10088    unsigned int           textSize;               //!< The size of the text.
    10189    unsigned int           lineSpacing;            //!< The Spacing between lines.
    102     unsigned int           shellHeight;            //!< The hight of the Shell in Pixels
    103     bool                   bActive;                //!< if the shell is active;
    10490
    10591    char                   bufferArray[10000];     //!< a BUFFER for fast writing
    106 
    107     // completion
    108     tList<const char>*    completionList;          //!< A list of completions, that are io.
    10992};
    11093
  • trunk/src/util/track/track_manager.cc

    r5110 r5111  
    7979    {
    8080      tIterator<TrackElement>* iterator = this->children->getIterator();
    81       TrackElement* enumElem = iterator->firstElement();
     81      TrackElement* enumElem = iterator->nextElement();
    8282      while (enumElem)
    8383        {
     
    104104    {
    105105      tIterator<TrackElement>* iterator = this->children->getIterator();
    106       TrackElement* enumElem = iterator->firstElement();
     106      TrackElement* enumElem = iterator->nextElement();
    107107      TrackElement* tmpElem;
    108108      while (enumElem)
     
    133133    {
    134134      tIterator<TrackElement>* iterator = this->children->getIterator();
    135       TrackElement* enumElem = iterator->firstElement();
     135      TrackElement* enumElem = iterator->nextElement();
    136136      TrackElement* tmpElem;
    137137      while (enumElem)
     
    179179    {
    180180      tIterator<TrackElement>* iterator = this->children->getIterator();
    181       TrackElement* enumElem = iterator->firstElement();
     181      TrackElement* enumElem = iterator->nextElement();
    182182      while (enumElem)
    183183        {
     
    206206
    207207  tIterator<TrackElement>* iterator = this->children->getIterator();
    208   TrackElement* enumElem = iterator->firstElement();
     208  TrackElement* enumElem = iterator->nextElement();
    209209  for (int i = 0; i < childCount; i++)
    210210    enumElem = iterator->nextElement();
     
    234234      //TrackElement* enumElem = this->children->enumerate();
    235235      tIterator<TrackElement>* iterator = this->children->getIterator();
    236       TrackElement* enumElem = iterator->firstElement();
     236      TrackElement* enumElem = iterator->nextElement();
    237237      while (enumElem)
    238238        {
     
    331331  //TrackElement* enumElem = this->children->enumerate();
    332332  tIterator<TrackElement>* iterator = this->children->getIterator();
    333   TrackElement* enumElem = iterator->firstElement();
     333  TrackElement* enumElem = iterator->nextElement();
    334334  while (enumElem)
    335335    {
     
    975975      //TrackElement* enumElem = firstJoint->children->enumerate();
    976976      tIterator<TrackElement>* iterator = firstJoint->children->getIterator();
    977       TrackElement* enumElem = iterator->firstElement();
     977      TrackElement* enumElem = iterator->nextElement();
    978978      while (enumElem)
    979979        {
     
    10011001        {
    10021002          tIterator<TrackElement>* iterator = tmpElem->children->getIterator();
    1003           TrackElement* enumElem = iterator->firstElement();
     1003          TrackElement* enumElem = iterator->nextElement();
    10041004          //TrackElement* enumElem = tmpElem->children->enumerate();
    10051005          while (enumElem)
Note: See TracChangeset for help on using the changeset viewer.