Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5125 in orxonox.OLD


Ignore:
Timestamp:
Aug 25, 2005, 3:04:49 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: a first command can be executed 'clear'
also improved the seg-fault-protection of the TextEngine

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine.cc

    r5124 r5125  
    120120    }
    121121    else
    122     {
    123       this->text = new char[1];
    124       *this->text = '\0';
    125     }
     122      this->text = NULL;
    126123  }
    127124
     
    135132      if (this->externText == NULL)
    136133        tmpText = this->text;
    137       while (*tmpText != '\0')
     134      if (tmpText != NULL)
     135      {
     136        while (*tmpText != '\0')
    138137        {
    139138          if(glyphArray[*tmpText])
    140             {
    141               width += glyphArray[*tmpText]->width;
    142             }
     139          {
     140            width += glyphArray[*tmpText]->width;
     141          }
    143142          tmpText++;
    144143        }
    145       this->width = width;
     144        this->width = width;
     145      }
    146146    }
    147147}
     
    205205      if (this->externText == NULL)
    206206        tmpText = this->text;
    207       while (*tmpText != '\0')
     207      if (likely(tmpText != NULL))
    208208      {
    209         if(glyphArray[*tmpText])
     209        while (*tmpText != '\0')
    210210        {
    211           glCallList(glyphArray[*tmpText]->displayList);
    212           glTranslatef(glyphArray[*tmpText]->width, 0, 0);
     211          if(glyphArray[*tmpText])
     212          {
     213            glCallList(glyphArray[*tmpText]->displayList);
     214            glTranslatef(glyphArray[*tmpText]->width, 0, 0);
     215          }
     216          tmpText++;
    213217        }
    214         tmpText++;
    215       }    }
     218      }
     219    }
    216220  else //(if type & TEXT_RENDER_STATIC)
    217221    {
  • trunk/src/util/shell.cc

    r5124 r5125  
    203203  // remove all chars from the BufferTexts.
    204204  if (this->bufferText)
    205     for (int i; i < this->bufferDisplaySize; i++)
    206     {
    207       this->bufferText[i]->setText(NULL);
    208     }
    209 
     205    for (int i = 0; i < this->bufferDisplaySize; i++)
     206    {
     207      this->bufferText[i]->setText(NULL, true);
     208    }
    210209
    211210  // delete all the Chars in the Buffers
    212211  tIterator<char>* charIterator = this->buffer->getIterator();
    213212  char* charElem = charIterator->firstElement();
    214 
    215213  while (charElem != NULL)
    216214  {
     
    220218  }
    221219  delete charIterator;
     220  delete this->buffer;
     221  this->buffer = new tList<char>;
    222222}
    223223
     
    343343  if (likely(this->inputLine != NULL))
    344344  {
    345     delete [] this->inputLine;
     345    delete[] this->inputLine;
    346346  }
    347347  this->inputLine = new char[1];
    348348  *this->inputLine = '\0';
     349  this->inputLineText->setText(this->inputLine, true);
    349350}
    350351
     
    405406{
    406407  this->addBufferLineStatic("Execute Command: %s\n", this->inputLine);
    407   delete this->inputLine;
    408   this->inputLine = new char[1];
    409   this->inputLine[0]='\0';
    410   this->inputLineText->setText(this->inputLine);
     408
     409  if (!strcmp(this->inputLine, "clear"))
     410  {
     411    this->flushBuffers();
     412  }
     413
     414  this->flushInputLine();
     415
    411416  return false;
    412417}
Note: See TracChangeset for help on using the changeset viewer.