Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3676 in orxonox.OLD


Ignore:
Timestamp:
Mar 30, 2005, 5:42:02 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: debug-information for ResourceManager

Location:
orxonox/trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/util/resource_manager.cc

    r3672 r3676  
    217217          if(isFile(fullName))
    218218            {
     219              PRINTF(4)("Image %s resides to %s\n", fileName, fullName);
    219220              tmpResource->pointer = new Texture(fullName);
    220221            }
     
    229230                  sprintf(imgName, "%s%s", tmpDir, fileName);
    230231                  if(isFile(imgName))
    231                     tmpResource->pointer = new Texture(imgName);
     232                    {
     233                      PRINTF(4)("Image %s resides to %s\n", fileName, imgName);
     234                      tmpResource->pointer = new Texture(imgName);
     235                      delete []imgName;
     236                      break;
     237                    }
    232238                  delete []imgName;
    233239                  tmpDir = iterator->nextElement();
     
    242248          PRINTF(1)("No type found for %s.\n   !!This should not happen unless the Type is not supported yet.!!\n", tmpResource->name);
    243249          break;
    244         }
    245      
    246       // checking if the File really exists.
    247       if(!isFile(fullName))
    248         {
    249           PRINTF(2)("Sorry, %s is not a regular file.\n", fullName);
    250           tmpResource->pointer = NULL;
    251250        }
    252251      this->resourceList->add(tmpResource);
     
    413412    return false;
    414413}
     414
     415/**
     416   \brief outputs debug information about the ResourceManager
     417*/
     418void ResourceManager::debug(void)
     419{
     420  PRINT(0)("=RM===================================\n");
     421  PRINT(0)("= RESOURCE-MANAGER DEBUG INFORMATION =\n");
     422  PRINT(0)("======================================\n");
     423  // if it is not initialized
     424  PRINT(0)(" Reference is: %p\n", ResourceManager::singletonRef);
     425  PRINT(0)(" Data-Directory is: %s\n", this->dataDir);
     426  PRINT(0)(" List of Image-Directories: ");
     427  tIterator<char>* tmpIt = imageDirs->getIterator();
     428  char* tmpDir = tmpIt->nextElement();
     429  while(tmpDir)
     430    {
     431      PRINT(0)("%s ",tmpDir);
     432      tmpDir = tmpIt->nextElement();
     433    }
     434  delete tmpIt;
     435  PRINT(0)("\n");
     436
     437  PRINT(0)("List of all stored Resources:\n");
     438  tIterator<Resource>* iterator = resourceList->getIterator();
     439  Resource* enumRes = iterator->nextElement();
     440  while (enumRes)
     441    {
     442      PRINT(0)("-----------------------------------------\n");
     443      PRINT(0)("Name: %s; References: %d; Type:", enumRes->name, enumRes->count);
     444      switch (enumRes->type)
     445        {
     446        case OBJ:
     447          PRINT(0)("ObjectModel\n");
     448          break;
     449        case PRIM:
     450          PRINT(0)("PrimitiveModel\n");
     451          break;
     452        case IMAGE:
     453          PRINT(0)("ImageFile (Texture)\n");
     454          break;
     455        default:
     456          PRINT(0)("SoundFile\n");
     457          break;
     458        }
     459      PRINT(0)("gets deleted at ");
     460      switch(enumRes->prio)
     461        {
     462        default:
     463        case RP_NO:
     464          PRINT(0)("first posibility (0)\n");
     465          break;
     466        case RP_LEVEL:
     467          PRINT(0)("the end of the Level (1)\n");
     468          break;
     469        case RP_CAMPAIGN:
     470          PRINT(0)("the end of the campaign (2)\n");
     471          break;
     472        case RP_GAME:
     473          PRINT(0)("when leaving the game (3)\n");
     474          break;
     475        }
     476      enumRes = iterator->nextElement();
     477    }
     478  delete iterator;
     479
     480
     481
     482  PRINT(0)("==================================RM==\n");
     483}
  • orxonox/trunk/src/lib/util/resource_manager.h

    r3672 r3676  
    6363  bool unload(Resource* resource, ResourcePriority = RP_NO);
    6464  bool unloadAllByPriority(ResourcePriority prio);
     65  void debug(void);
    6566
    6667 private:
     
    7778 
    7879  bool isDir(const char* directory);
    79   bool isFile(const char* directory); 
     80  bool isFile(const char* directory);
     81
    8082};
    8183
  • orxonox/trunk/src/orxonox.cc

    r3671 r3676  
    331331  orx->start();
    332332 
    333   //  delete orx;
     333  delete orx;
    334334 
    335335}
  • orxonox/trunk/src/story_entities/world.cc

    r3675 r3676  
    145145  cn->unbind(this->localPlayer);
    146146  cn->reset();
     147  ResourceManager::getInstance()->debug();
    147148
    148149  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
  • orxonox/trunk/src/world_entities/projectile.cc

    r3675 r3676  
    3333Projectile::Projectile () : WorldEntity()
    3434{
    35   this->model = (Model*)ResourceManager::getInstance()->load("cube", PRIM, RP_LEVEL);
    36   //  this->projectileModel = new Primitive(P_SPHERE);
     35  this->model = (Model*)ResourceManager::getInstance()->load("sphere", PRIM, RP_LEVEL);
    3736  this->flightDirection = NULL;
    3837  this->currentLifeTime = 0.0f;
     
    138137  glMultMatrixf((float*)matrix); 
    139138  this->model->draw();
    140   //this->projectileModel->draw();
    141139
    142140  glPopMatrix();
  • orxonox/trunk/src/world_entities/projectile.h

    r3646 r3676  
    99#include "world_entity.h"
    1010
    11 class Primitive;
    1211class Vector;
    1312
     
    3231 private:
    3332  //physical attriutes like: force, speed, acceleration etc.
    34   Primitive* projectileModel;          //!< this serves temporary as a plasma bullet
    3533  float speed;                         //!< this is the speed of the projectile
    3634  float currentLifeTime;               //!< this is the time, the projectile exists in this world (incremented by tick)
Note: See TracChangeset for help on using the changeset viewer.