Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9836 in orxonox.OLD for branches/new_class_id/src/lib/util


Ignore:
Timestamp:
Sep 26, 2006, 5:16:10 PM (18 years ago)
Author:
bensch
Message:

orxonox/new_class_id: Taken out the old ResourceManager.
On the way, i had to desintegrate the old MD3-model loading process (via ResourceManager) MD3 is untouched, but also not loaded anymore neither from ResourceMangers nor from the WorldEntity

@patrick: MD3-ModelLoading class must be implemented… this should be quite easy, with the way MD3 is, and the new Resource-paradigm
cheers

Location:
branches/new_class_id/src/lib/util
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/util/Makefile.am

    r9794 r9836  
    1515                multi_type.cc \
    1616                \
    17                 loading/new_resource_manager.cc \
     17                loading/resource_manager.cc \
    1818                loading/resource.cc \
    1919                loading/game_loader.cc \
     
    6666                \
    6767                loading/resource_manager.h \
    68                 loading/new_resource_manager.h \
    6968                loading/resource.h \
    7069                loading/game_loader.h \
  • branches/new_class_id/src/lib/util/loading/game_loader.cc

    r9833 r9836  
    2020#include "game_loader.h"
    2121#include "util/loading/load_param.h"
    22 #include "util/loading/new_resource_manager.h"
     22#include "util/loading/resource_manager.h"
    2323#include "debug.h"
    2424#include "campaign.h"
     
    8383{
    8484  ErrorMessage errorCode;
    85   std::string campaignName = Resources::NewResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
     85  std::string campaignName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
    8686  if (!campaignName.empty())
    8787  {
     
    103103{
    104104  ErrorMessage errorCode;
    105   std::string campaignName = Resources::NewResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
     105  std::string campaignName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
    106106  if (!campaignName.empty())
    107107  {
  • branches/new_class_id/src/lib/util/loading/old_resource_manager.cc

    r9834 r9836  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
    1717
    18 #include "util/loading/resource_manager.h"
     18#include "old_resource_manager.h"
    1919#include "substring.h"
    2020#include "debug.h"
     
    411411        tmpResource->param[0] = param0;
    412412        tmpResource->param[1] = param1;
    413         tmpResource->pointer = new md3::MD3Data(fullName, tmpResource->param[0].getCString(), tmpResource->param[1].getFloat());
     413//        tmpResource->pointer = new md3::MD3Data(fullName, tmpResource->param[0].getCString(), tmpResource->param[1].getFloat());
    414414      }
    415415      break;
     
    419419        tmpResource->param[0] = param0;
    420420        tmpResource->param[1] = param1;
    421         tmpResource->pointer = new md3::MD3AnimationCfg(fullName);
     421//        tmpResource->pointer = new md3::MD3AnimationCfg(fullName);
    422422      }
    423423      break;
  • branches/new_class_id/src/lib/util/loading/old_resource_manager.h

    r9834 r9836  
    1717*/
    1818
    19 #ifndef _RESOURCE_MANAGER_H
    20 #define _RESOURCE_MANAGER_H
     19#ifndef _OLD_RESOURCE_MANAGER_H
     20#define _OLD_RESOURCE_MANAGER_H
    2121
    2222#include "base_object.h"
  • branches/new_class_id/src/lib/util/loading/resource.cc

    r9800 r9836  
    1717
    1818#include "resource.h"
    19 #include "new_resource_manager.h"
     19#include "resource_manager.h"
    2020
    2121#include "debug.h"
     
    4747  std::string NewResource::locateFile(const std::string& fileName) const
    4848  {
    49     if ((NewResourceManager::getInstance()->mainGlobalPath() + File(fileName)).exists() )
    50       return (NewResourceManager::getInstance()->mainGlobalPath() + File(fileName)).name();
     49    if ((ResourceManager::getInstance()->mainGlobalPath() + File(fileName)).exists() )
     50      return (ResourceManager::getInstance()->mainGlobalPath() + File(fileName)).name();
    5151
    5252    std::string locatedFile;
    53     locatedFile = locateFileInSubDir(NewResourceManager::getInstance()->mainGlobalPath(), fileName);
     53    locatedFile = locateFileInSubDir(ResourceManager::getInstance()->mainGlobalPath(), fileName);
    5454    if (!locatedFile.empty())
    5555    {
     
    6161      return fileName;
    6262
    63     return (NewResourceManager::getInstance()->mainGlobalPath() + File(fileName)).name();
     63    return (ResourceManager::getInstance()->mainGlobalPath() + File(fileName)).name();
    6464  }
    6565
     
    115115  KeepLevel::KeepLevel(const std::string& keepLevelName)
    116116  {
    117     this->_keepLevel = NewResourceManager::getInstance()->getKeepLevelID(keepLevelName);
     117    this->_keepLevel = ResourceManager::getInstance()->getKeepLevelID(keepLevelName);
    118118  }
    119119
    120120  const std::string& KeepLevel::name() const
    121121  {
    122     return NewResourceManager::getInstance()->getKeepLevelName(this->_keepLevel);
     122    return ResourceManager::getInstance()->getKeepLevelName(this->_keepLevel);
    123123  }
    124124
     
    141141      : _id(-1), _typeName(typeName)
    142142  {
    143     NewResourceManager::getInstance()->registerType(this);
     143    ResourceManager::getInstance()->registerType(this);
    144144    PRINTF(4)("Created ResourceType '%s'\n", typeName.c_str());
    145145  }
     
    147147  Type::~Type()
    148148  {
    149     NewResourceManager::getInstance()->unregisterType(this);
     149    ResourceManager::getInstance()->unregisterType(this);
    150150  }
    151151
  • branches/new_class_id/src/lib/util/loading/resource_manager.cc

    r9835 r9836  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
    1717
    18 #include "new_resource_manager.h"
     18#include "resource_manager.h"
    1919#include "debug.h"
    2020
     
    2525namespace Resources
    2626{
    27   ObjectListDefinition(NewResourceManager);
    28   //! Singleton Reference to the NewResourceManager
    29   NewResourceManager* NewResourceManager::_singletonRef = NULL;
     27  ObjectListDefinition(ResourceManager);
     28  //! Singleton Reference to the ResourceManager
     29  ResourceManager* ResourceManager::_singletonRef = NULL;
    3030
    3131
     
    3333   * @brief standard constructor
    3434  */
    35   NewResourceManager::NewResourceManager ()
     35  ResourceManager::ResourceManager ()
    3636  {
    37     this->registerObject(this, NewResourceManager::_objectList);
    38     this->setName("NewResourceManager");
     37    this->registerObject(this, ResourceManager::_objectList);
     38    this->setName("ResourceManager");
    3939    this->_mainGlobalPath = Directory("./");
    4040  }
     
    4444   * @brief standard destructor
    4545  */
    46   NewResourceManager::~NewResourceManager ()
     46  ResourceManager::~ResourceManager ()
    4747  {
    4848    // deleting the Resources-List
     
    5252    //     PRINTF(1)("Not removed all Resources, since there are still %d resources registered\n", this->resourceList.size());
    5353
    54     NewResourceManager::_singletonRef = NULL;
     54    ResourceManager::_singletonRef = NULL;
    5555  }
    5656
     
    5858
    5959
    60   void NewResourceManager::registerType(Resources::Type* type)
     60  void ResourceManager::registerType(Resources::Type* type)
    6161  {
    6262    if(type->id() == -1)
     
    6868  }
    6969
    70   void NewResourceManager::unregisterType(Resources::Type* type)
     70  void ResourceManager::unregisterType(Resources::Type* type)
    7171  {
    7272    std::vector<Resources::Type*>::iterator it = std::find (this->_resourceTypes.begin(), this->_resourceTypes.end(), type);
     
    7979
    8080
    81   void NewResourceManager::setMainGlobalPath(const Directory& directory)
     81  void ResourceManager::setMainGlobalPath(const Directory& directory)
    8282  {
    8383    this->_mainGlobalPath = directory;
     
    8585  }
    8686
    87   void NewResourceManager::addGlobalPath(const Directory& directory)
     87  void ResourceManager::addGlobalPath(const Directory& directory)
    8888  {
    8989    std::vector<Directory>::const_iterator it = std::find(this->_globalPaths.begin(), this->_globalPaths.end(), directory);
     
    9393
    9494
    95   bool NewResourceManager::addResourcePath(const std::string& resourceName, const std::string& pathName)
     95  bool ResourceManager::addResourcePath(const std::string& resourceName, const std::string& pathName)
    9696  {
    9797    std::vector<Resources::Type*>::iterator it;
     
    103103  }
    104104
    105   bool NewResourceManager::addResourceSubPath(const std::string& resourceName, const std::string& pathName)
     105  bool ResourceManager::addResourceSubPath(const std::string& resourceName, const std::string& pathName)
    106106  {
    107107    std::vector<Resources::Type*>::iterator it;
     
    115115
    116116
    117   bool NewResourceManager::checkFileInMainPath(const File& fileInside)
     117  bool ResourceManager::checkFileInMainPath(const File& fileInside)
    118118  {
    119119    return (this->_mainGlobalPath + fileInside).exists();
    120120  }
    121121
    122   std::string NewResourceManager::prependAbsoluteMainPath(const std::string& fileName)
     122  std::string ResourceManager::prependAbsoluteMainPath(const std::string& fileName)
    123123  {
    124124    return (this->_mainGlobalPath + File(fileName)).name();
     
    126126
    127127
    128   unsigned int NewResourceManager::addKeepLevelName(const std::string& keepLevelName)
     128  unsigned int ResourceManager::addKeepLevelName(const std::string& keepLevelName)
    129129  {
    130130    this->_keepLevelNames.push_back(keepLevelName);
     
    132132  }
    133133
    134   unsigned int NewResourceManager::getKeepLevelID(const std::string& keepLevelName) const
     134  unsigned int ResourceManager::getKeepLevelID(const std::string& keepLevelName) const
    135135  {
    136136    for (unsigned int i = 0; i < this->_keepLevelNames.size(); ++i)
     
    142142  }
    143143
    144   const std::string& NewResourceManager::getKeepLevelName(unsigned int keepLevelID) const
     144  const std::string& ResourceManager::getKeepLevelName(unsigned int keepLevelID) const
    145145  {
    146146    assert(keepLevelID < this->_keepLevelNames.size());
     
    150150
    151151  /**
    152    * @brief outputs debug information about the NewResourceManager
     152   * @brief outputs debug information about the ResourceManager
    153153   */
    154   void NewResourceManager::debug() const
     154  void ResourceManager::debug() const
    155155  {
    156156    PRINT(0)("=RM===================================\n");
  • branches/new_class_id/src/lib/util/loading/resource_manager.h

    r9835 r9836  
    11/*!
    2  * @file new_resource_manager.h
     2 * @file resource_manager.h
    33 */
    44
    5 #ifndef _NEW_RESOURCE_MANAGER_H
    6 #define _NEW_RESOURCE_MANAGER_H
     5#ifndef _RESOURCE_MANAGER_H
     6#define _RESOURCE_MANAGER_H
    77
    88#include "resource.h"
     
    1313{
    1414
    15   class NewResourceManager : public BaseObject
     15  class ResourceManager : public BaseObject
    1616  {
    17     ObjectListDeclaration(NewResourceManager);
     17    ObjectListDeclaration(ResourceManager);
    1818  public:
    1919    /** @returns a Pointer to the only object of this Class */
    20     inline static NewResourceManager* getInstance() { if (!_singletonRef) _singletonRef = new NewResourceManager();  return _singletonRef; };
     20    inline static ResourceManager* getInstance() { if (!_singletonRef) _singletonRef = new ResourceManager();  return _singletonRef; };
    2121    /** @brief deletes the Instance if it exists. */
    2222    inline static void deleteInstance() { if (_singletonRef) delete _singletonRef; };
     
    5454    static bool isInDataDir(const std::string& fileName);
    5555  private:
    56     NewResourceManager();
    57     virtual ~NewResourceManager();
     56    ResourceManager();
     57    virtual ~ResourceManager();
    5858
    5959  private:
    60     static NewResourceManager*         _singletonRef;       //!< singleton Reference
     60    static ResourceManager*         _singletonRef;       //!< singleton Reference
    6161
    6262    Directory                          _mainGlobalPath;     //!< The main include directory (default at "./")
Note: See TracChangeset for help on using the changeset viewer.