Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 9, 2006, 5:28:10 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: compiles again, BUT well…. i do not expect it to run anymore

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/lib/graphics/importer/md2Model.cc

    r7193 r7203  
    7575  \brief simple constructor initializing all variables
    7676*/
    77 MD2Model::MD2Model(const char* modelFileName, const char* skinFileName, float scale)
     77MD2Model::MD2Model(const std::string& modelFileName, const std::string& skinFileName, float scale)
    7878{
    7979  this->setClassID(CL_MD2_MODEL, "MD2Model");
     
    352352{
    353353  PRINT(0)("\n==========================| MD2Model::debug() |===\n");
    354   PRINT(0)("=  Model FileName:\t%s\n", this->data->fileName);
    355   PRINT(0)("=  Skin FileName:\t%s\n", this->data->skinFileName);
     354  PRINT(0)("=  Model FileName:\t%s\n", this->data->fileName.c_str());
     355  PRINT(0)("=  Skin FileName:\t%s\n", this->data->skinFileName.c_str());
    356356  PRINT(0)("=  Size in Memory:\t%i Bytes\n", this->data->header->frameSize * this->data->header->numFrames + 64); // 64bytes is the header size
    357357  PRINT(0)("=  Number of Vertices:\t%i\n", this->data->header->numVertices);
     
    370370  \brief simple constructor
    371371*/
    372 MD2Data::MD2Data(const char* modelFileName, const char* skinFileName, float scale)
     372MD2Data::MD2Data(const std::string& modelFileName, const std::string& skinFileName, float scale)
    373373{
    374374  scale *= 0.1f;
     
    387387  this->scaleFactor = scale;
    388388
    389   this->fileName = NULL;
    390   this->skinFileName = NULL;
     389  this->fileName = "";
     390  this->skinFileName = "";
    391391  this->loadModel(modelFileName);
    392392  this->loadSkin(skinFileName);
     
    401401MD2Data::~MD2Data()
    402402{
    403   delete [] this->fileName;
    404   delete [] this->skinFileName;
    405403  delete this->header;
    406404
     
    419417  \return true if success
    420418*/
    421 bool MD2Data::loadModel(const char* fileName)
     419bool MD2Data::loadModel(const std::string& fileName)
    422420{
    423421  FILE *pFile;                            //file stream
     
    428426
    429427  //! @todo this chek should include deleting a loaded model (eventually)
    430   if (fileName == NULL)
     428  if (fileName.empty())
    431429    return false;
    432430
    433   pFile = fopen(fileName, "rb");
     431  pFile = fopen(fileName.c_str(), "rb");
    434432  if( unlikely(!pFile))
    435433    {
     
    442440  if( unlikely(this->header->version != MD2_VERSION) && unlikely(this->header->ident != MD2_IDENT))
    443441    {
    444       PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName);
     442      PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str());
    445443      return false;
    446444    }
    447445
    448   this->fileName = new char[strlen(fileName)+1];
    449   strcpy(this->fileName, fileName);
     446  this->fileName =fileName;
    450447  /* got the data: map it to locals */
    451448  this->numFrames = this->header->numFrames;
     
    507504  \return true if success
    508505*/
    509 bool MD2Data::loadSkin(const char* fileName)
    510 {
    511   if( fileName == NULL)
    512     {
    513       this->skinFileName = NULL;
     506bool MD2Data::loadSkin(const std::string& fileName)
     507{
     508  if( fileName.empty())
     509    {
     510      this->skinFileName = "";
    514511      return false;
    515512    }
    516513
    517   this->skinFileName = new char[strlen(fileName)+1];
    518   strcpy(this->skinFileName, fileName);
     514  this->skinFileName =fileName;
    519515
    520516  this->material.setName("md2ModelMaterial");
Note: See TracChangeset for help on using the changeset viewer.