Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5211 in orxonox.OLD


Ignore:
Timestamp:
Sep 21, 2005, 2:21:41 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: valgrind mem-leak-recovered

Location:
trunk/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/coord/p_node.cc

    r5209 r5211  
    104104{
    105105  this->setClassID(CL_PARENT_NODE, "PNode");
     106
    106107  this->children = new tList<PNode>();
    107108  this->bRelCoorChanged = true;
  • trunk/src/lib/graphics/importer/model.cc

    r5115 r5211  
    350350    delete this->normals;
    351351  if (this->triangles)
    352     delete this->triangles;
     352    delete[] this->triangles;
    353353
    354354  this->vertices = NULL;
    355355  this->vTexture = NULL;
    356356  this->normals = NULL;
    357   this->triangles = NULL; this->triangleCount = 0;
     357  this->triangles = NULL;
     358  this->triangleCount = 0;
    358359}
    359360
  • trunk/src/lib/graphics/importer/texture.cc

    r4836 r5211  
    4545Texture::~Texture()
    4646{
    47   if (this->texture)
     47  if (this->texture != 0)
    4848    glDeleteTextures(1, &this->texture);
    4949}
  • trunk/src/lib/graphics/light.cc

    r5156 r5211  
    244244    if (this->lights[i])
    245245      delete lights[i];
    246   delete lights;
     246  delete[] lights;
    247247  LightManager::singletonRef = NULL;
    248248}
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r5118 r5211  
    9090  this->parent = NULL;
    9191  this->children = new tList<Element2D>;
     92  this->absDirection = 0.0;
    9293  this->relDirection = 0.0;
    9394  this->bRelCoorChanged = true;
     
    844845NullElement2D::~NullElement2D ()
    845846{
    846   //delete singletonRef;
    847847  NullElement2D::singletonRef = NULL;
    848848}
  • trunk/src/lib/graphics/render2D/element_2d.h

    r5113 r5211  
    193193    Vector                  absCoordinate;      //!< absolute coordinates in the world ( from (0,0,0) )
    194194    float                   relDirection;       //!< direction relative to the parent
    195     float                   absDirection;       //!< absolute direvtion in the world ( from (0,0,1) )
     195    float                   absDirection;       //!< absolute diretion in the world ( from (0,0,1) )
    196196
    197197    Vector                  prevRelCoordinate;  //!< The last Relative Coordinate from the last update-Cycle.
  • trunk/src/lib/math/curve.cc

    r4836 r5211  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    1313   co-programmer: Patrick Boenzli
    1414
    15    ADD: Patrick Boenzli           B-Spline 
    16 
    17 
    18    TODO: 
     15   ADD: Patrick Boenzli           B-Spline
     16
     17
     18   TODO:
    1919     local-Time implementation
    2020     NURBS
    2121     tList implementation
    22      
     22
    2323*/
    2424
     
    3333
    3434
    35 /** 
     35/**
    3636  *  default constructor for a Curve
    3737*/
     
    7171void Curve::addNode(const Vector& newNode, unsigned int insertPosition)
    7272{
    73 
    7473  if (this->nodeCount == 0 || insertPosition > this->nodeCount)
    7574    return addNode(newNode);
     
    8584    {
    8685      while (tmpNode->next->number != insertPosition)
    87         tmpNode= tmpNode->next;
     86        tmpNode= tmpNode->next;
    8887      insNode->next = tmpNode->next;
    8988      tmpNode->next = insNode;
     
    199198      tmpNode->factor = binCoef;
    200199      if (tmpNode =tmpNode->next)
    201         {
    202           binCoef *=(n-k)/(k+1);
    203           ++k;
    204         }
     200        {
     201          binCoef *=(n-k)/(k+1);
     202          ++k;
     203        }
    205204    }
    206205
     
    212211      dirCurve = new BezierCurve(1);
    213212      while(tmpNode->next)
    214         {
    215           Vector tmpVector = (tmpNode->next->position)- (tmpNode->position);
    216           tmpVector.x*=(float)nodeCount;
    217           tmpVector.y*=(float)nodeCount;
    218           tmpVector.z*=(float)nodeCount;
    219           tmpVector.normalize();
    220           this->dirCurve->addNode(tmpVector);
    221           tmpNode = tmpNode->next;
    222         }
     213        {
     214          Vector tmpVector = (tmpNode->next->position)- (tmpNode->position);
     215          tmpVector.x*=(float)nodeCount;
     216          tmpVector.y*=(float)nodeCount;
     217          tmpVector.z*=(float)nodeCount;
     218          tmpVector.normalize();
     219          this->dirCurve->addNode(tmpVector);
     220          tmpNode = tmpNode->next;
     221        }
    223222    }
    224223}
     
    229228 * @return the Position on the Path
    230229*/
    231 Vector BezierCurve::calcPos(float t) 
     230Vector BezierCurve::calcPos(float t)
    232231{
    233232  Vector ret = Vector(0.0,0.0,0.0);
     
    237236      double factor = pow(1.0-t,nodeCount-1);
    238237      while(tmpNode)
    239         {
    240           ret.x += tmpNode->factor * factor * tmpNode->position.x;
    241           ret.y += tmpNode->factor * factor * tmpNode->position.y;
    242           ret.z += tmpNode->factor * factor * tmpNode->position.z;
    243           factor *= t/(1.0-t); // same as pow but much faster.
    244          
    245           tmpNode = tmpNode->next;
    246         }
     238        {
     239          ret.x += tmpNode->factor * factor * tmpNode->position.x;
     240          ret.y += tmpNode->factor * factor * tmpNode->position.y;
     241          ret.z += tmpNode->factor * factor * tmpNode->position.z;
     242          factor *= t/(1.0-t); // same as pow but much faster.
     243
     244          tmpNode = tmpNode->next;
     245        }
    247246    }
    248247  else if (nodeCount == 2)
  • trunk/src/lib/physics/physics_engine.cc

    r5129 r5211  
    5858  }
    5959  delete itPC;
    60    delete this->connections;
     60  delete this->connections;
    6161//
    6262//   // delete all PhysicsInterfaces, still in existence (this could be dangerous)
  • trunk/src/lib/util/list.h

    r5209 r5211  
    8282    {
    8383      listElement<T>* le = this->currentEl->next;
    84       //delete this->currentEl->curr;
     84      //delete this->currentEl->curr;  //! THIS IS EXTREMELY UNSAFE (the list only stores pointers not instances) //
    8585      delete this->currentEl;
    8686      this->currentEl = le;
  • trunk/src/story_entities/campaign.cc

    r5115 r5211  
    161161    }
    162162    delete this->entities;
     163    delete it;
    163164}
    164165
  • trunk/src/story_entities/world.cc

    r5209 r5211  
    165165  this->setName(name);
    166166  this->debugWorldNr = worldID;
    167 
     167  this->gameTime = 0.0f;
    168168  this->setSpeed(1.0);
    169169  this->music = NULL;
     170  this->shell = NULL;
     171  this->entities = NULL;
    170172}
    171173
     
    259261  // load the parameters
    260262  // name
    261   char* temp;
    262263  const char* string = grabParameter( root, "name");
    263264  if( string == NULL)
    264265    {
    265266      PRINTF(2)("World is missing a proper 'name'\n");
    266       string = "Unknown";
    267       temp = new char[strlen(string)+1];
    268       strcpy( temp, string);
    269       this->setName(temp);
     267      this->setName("Unknown");
    270268    }
    271269  else
    272270    {
    273       temp = new char[strlen(string )+1];
    274       strcpy( temp, string);
    275       this->setName(temp);
     271      this->setName(string);
    276272    }
    277273
     
    478474  ClassList::debug();
    479475
    480   this->music = (OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
    481   music->playback();
     476  this->music = NULL;//(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
     477  //music->playback();
    482478}
    483479
  • trunk/src/util/loading/load_param.cc

    r5141 r5211  
    133133  this->types = NULL;
    134134  this->description = NULL;
     135  this->defaultValues = NULL;
    135136  this->paramName = new char[strlen(paramName)+1];
    136137  strcpy(this->paramName, paramName);
    137   this->defaultValues = NULL;
    138138}
    139139
     
    158158  }
    159159
    160   delete []this->types;
    161   delete []this->defaultValues;
    162   delete []this->paramName;
    163   delete []this->description;
     160  delete[] this->types;
     161  delete[] this->defaultValues;
     162  delete[] this->paramName;
     163  delete[] this->description;
    164164}
    165165
  • trunk/src/util/resource_manager.cc

    r5208 r5211  
    8181    }
    8282  delete tmpIt;
    83 
    8483  delete this->imageDirs;
     84
     85  delete[] this->dataDir;
    8586
    8687  ResourceManager::singletonRef = NULL;
     
    356357                      PRINTF(4)("Image %s resides to %s\n", fileName, imgName);
    357358                      tmpResource->pointer = new Texture(imgName);
    358                       delete []imgName;
     359                      delete[] imgName;
    359360                      break;
    360361                    }
    361                   delete []imgName;
     362                  delete[] imgName;
    362363                  tmpDir = iterator->nextElement();
    363364                }
     
    375376      if (tmpResource->pointer)
    376377        this->resourceList->add(tmpResource);
    377       delete []fullName;
     378      delete[] fullName;
    378379    }
    379380  if (tmpResource->pointer)
     
    631632    }
    632633  else
     634  {
     635    delete[] tmpDirName;
    633636    return false;
     637  }
    634638}
    635639
Note: See TracChangeset for help on using the changeset viewer.