Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 12, 2006, 8:54:30 AM (18 years ago)
Author:
bensch
Message:

orxonox/std:: compile and run again, with many more std::strings….

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/world_entities/world_entity.cc

    r7203 r7216  
    6161  this->bCollide = true;
    6262
    63   this->md2TextureFileName = NULL;
    64 
    6563  this->objectListNumber = OM_INIT;
    6664  this->objectListIterator = NULL;
     
    123121 * @todo fix this, so it only has one loadModel-Function.
    124122*/
    125 void WorldEntity::loadModel(const char* fileName, float scaling, unsigned int modelNumber)
     123void WorldEntity::loadModel(const std::string& fileName, float scaling, unsigned int modelNumber)
    126124{
    127125  this->modelLODName = fileName;
    128126  this->scaling = scaling;
    129   if ( fileName != NULL && strcmp(fileName, "") )
     127  if (!fileName.empty())
    130128  {
    131129    // search for the special character # in the LoadParam
    132     if (strchr(fileName, '#') != NULL)
    133     {
    134       PRINTF(4)("Found # in %s... searching for LOD's\n", fileName);
    135       char* lodFile = new char[strlen(fileName)+1];
    136       strcpy(lodFile, fileName);
    137       char* depth = strchr(lodFile, '#');
     130    if (fileName.find('#') != std::string::npos)
     131    {
     132      PRINTF(4)("Found # in %s... searching for LOD's\n", fileName.c_str());
     133      std::string lodFile = fileName;
     134      unsigned int offset = lodFile.find('#');
    138135      for (unsigned int i = 0; i < 3; i++)
    139136      {
    140         *depth = 48+(int)i;
     137        lodFile[offset] = 48+(int)i;
    141138        if (ResourceManager::isInDataDir(lodFile))
    142139          this->loadModel(lodFile, scaling, i);
     
    149146      this->scaling = 1.0;
    150147    }
    151     if(strstr(fileName, ".obj"))
    152     {
    153       PRINTF(4)("fetching OBJ file: %s\n", fileName);
     148    if(fileName.find(".obj") != std::string::npos)
     149    {
     150      PRINTF(4)("fetching OBJ file: %s\n", fileName.c_str());
    154151      BaseObject* loadedModel = ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, this->scaling);
    155152      if (loadedModel != NULL)
     
    159156        this->buildObbTree(4);
    160157    }
    161     else if(strstr(fileName, ".md2"))
    162     {
    163       PRINTF(4)("fetching MD2 file: %s\n", fileName);
     158    else if(fileName.find(".md2") != std::string::npos)
     159    {
     160      PRINTF(4)("fetching MD2 file: %s\n", fileName.c_str());
    164161      Model* m = new MD2Model(fileName, this->md2TextureFileName, this->scaling);
    165162      //this->setModel((Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN), 0);
Note: See TracChangeset for help on using the changeset viewer.