Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5208 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Sep 19, 2005, 8:36:45 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: first fruits of valgrind…. delete[] are fine now :)

Location:
trunk/src
Files:
9 edited

Legend:

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

    r5179 r5208  
    104104
    105105  tmpFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, &fontSize);
    106   if (!tmpFont)
     106  if (tmpFont == NULL)
    107107  {
    108108    PRINTF(2)("Font %s could not be loaded, probably file not found\n", fontFile);
  • trunk/src/lib/shell/shell.cc

    r5206 r5208  
    4141    ->describe("Deactivates the Shell. (moves it into background)")
    4242    ->setAlias("hide");
     43SHELL_COMMAND(textsize, Shell, setTextSize)
     44    ->describe("Sets the size of the Text (size, linespacing)");
    4345
    4446/**
     
    5759  this->setAbsCoor2D(3, -400);
    5860  this->textSize = 15;
    59   this->lineSpacing = 5;
     61  this->lineSpacing = 0;
    6062  this->bActive = false;
    6163
     
    7274  // EVENT-Handler subscription of '`' to all States.
    7375  EventHandler::getInstance()->subscribe(this, ES_ALL, SDLK_BACKQUOTE);
    74 
    7576}
    7677
     
    139140  this->textSize = textSize;
    140141  this->lineSpacing = lineSpacing;
    141 
    142   this->rebuildText();
     142  this->shellInput->setFont("fonts/dpquake_.ttf", this->textSize);
     143
     144//  this->rebuildText();
    143145}
    144146
     
    150152void Shell::rebuildText()
    151153{
    152   this->shellInput->setFont("fonts/Aniron_Bold.ttf", this->textSize);
     154  this->shellInput->setFont("fonts/dpquake_.ttf", this->textSize);
    153155  this->shellInput->setColor(1, 0, 0);
    154156  this->shellInput->setAlignment(TEXT_ALIGN_LEFT);
    155   this->shellInput->setText(NULL);
    156157  this->shellInput->setParent2D(this);
    157158  this->shellInput->setRelCoor2D(5, (this->textSize + this->lineSpacing)*this->bufferDisplaySize + this->textSize);
     
    176177  for (unsigned int i = 0; i < bufferDisplaySize; i++)
    177178  {
    178     this->bufferText[i] = TextEngine::getInstance()->createText("fonts/Aniron_Bold.ttf", this->textSize, TEXT_RENDER_DYNAMIC);
     179    this->bufferText[i] = TextEngine::getInstance()->createText("fonts/dpquake_.ttf", this->textSize, TEXT_RENDER_DYNAMIC);
    179180    this->bufferText[i]->setColor(1, 0, 0);
    180181    this->bufferText[i]->setAlignment(TEXT_ALIGN_LEFT);
  • trunk/src/lib/shell/shell.h

    r5206 r5208  
    44 *
    55 * @todo check for smooth deletion process
     6 * @todo Buffer Display in different Colors for different debug mode.
    67 */
    78
     
    7879    unsigned int             lineSpacing;            //!< The Spacing between lines.
    7980    unsigned int             textSize;               //!< The size of the text.
     81    char*                    textFont;               //!< The file containing the font.
    8082
    8183    // HANDLING TEXT INPUT
  • trunk/src/lib/shell/shell_input.h

    r5204 r5208  
    22 * @file shell_input.h
    33 * @brief Definition of ...
     4 * @todo AutoCompletion should print nice output
     5 * @todo move up and down in Buffer
     6 * @todo display old shell Commands
    47*/
    58
  • trunk/src/orxonox.cc

    r5207 r5208  
    196196  char* icon = ResourceManager::getFullName("pictures/fighter-top-32x32.bmp");
    197197  GraphicsEngine::getInstance()->setWindowName(PACKAGE_NAME " " PACKAGE_VERSION, icon);
    198   delete icon;
     198  delete[] icon;
    199199  return 0;
    200200}
  • trunk/src/util/loading/game_loader.cc

    r5195 r5208  
    107107    {
    108108      this->currentCampaign = this->fileToCampaign(campaignName);
    109       delete campaignName;
     109      delete[] campaignName;
    110110    }
    111111//   World* world0 = new World(DEBUG_WORLD_0);
  • trunk/src/util/resource_manager.cc

    r5121 r5208  
    9696  if (isDir(realDir))
    9797    {
    98       delete this->dataDir;
     98      delete[] this->dataDir;
    9999      this->dataDir = new char[strlen(realDir)+1];
    100100      strcpy(this->dataDir, realDir);
     
    126126  sprintf(testFile, "%s%s", this->dataDir, fileInside);
    127127  retVal = isFile(testFile);
    128   delete testFile;
     128  delete[] testFile;
    129129  return retVal;
    130130}
     
    382382    {
    383383      PRINTF(2)("Resource %s could not be loaded\n", fileName);
     384      delete[] tmpResource->name;
    384385      delete tmpResource;
    385386      return NULL;
     
    456457          // deleting the List Entry:
    457458          PRINTF(4)("Resource %s safely removed.\n", resource->name);
    458           delete []resource->name;
     459          delete[] resource->name;
    459460          this->resourceList->remove(resource);
    460461        }
     
    625626      else
    626627        {
    627           delete tmpDirName;
     628          delete[] tmpDirName;
    628629          return false;
    629630        }
     
    653654                            ))
    654655        {
    655           delete tmpFileName;
     656          delete[] tmpFileName;
    656657          return true;
    657658        }
    658659      else
    659660        {
    660           delete tmpFileName;
     661          delete[] tmpFileName;
    661662          return false;
    662663        }
     
    664665  else
    665666    {
    666       delete tmpFileName;
     667      delete[] tmpFileName;
    667668      return false;
    668669    }
     
    682683    {
    683684      PRINTF(1)("could not open %s fro writing\n", fileName);
     685      delete[] tmpName;
    684686      return false;
    685687    }
    686688  fclose(stream);
    687689
    688   delete tmpName;
     690  delete[] tmpName;
    689691}
    690692
     
    699701  char* tmpName = ResourceManager::homeDirCheck(fileName);
    700702  unlink(tmpName);
    701   delete tmpName;
     703  delete[] tmpName;
    702704}
    703705
     
    748750  else
    749751    {
    750       delete retName;
     752      delete[] retName;
    751753      return NULL;
    752754    }
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r4992 r5208  
    9090    }
    9191    this->currentSlotConfig[i].position.setName(tmpName);
    92     delete tmpName;
     92    delete[] tmpName;
    9393  }
    9494
  • trunk/src/world_entities/world_entity.cc

    r5143 r5208  
    1919
    2020#include "world_entity.h"
     21#include "shell_command.h"
    2122
    2223#include "resource_manager.h"
     
    2728
    2829using namespace std;
     30
     31SHELL_COMMAND(model, WorldEntity, loadModel)
     32    ->describe("sets the Model of the WorldEntity")
     33    ->defaultValues(1, "models/ships/reaplow.obj");
     34
    2935
    3036/**
Note: See TracChangeset for help on using the changeset viewer.