Index: trunk/src/orxonox.cc
===================================================================
--- trunk/src/orxonox.cc	(revision 9406)
+++ trunk/src/orxonox.cc	(revision 9869)
@@ -41,19 +41,14 @@
 #include "sound_engine.h"
 #include "util/loading/resource_manager.h"
+
 #include "cd_engine.h"
-#include "text_engine.h"
 #include "event_handler.h"
 
-#include "util/loading/factory.h"
-#include "fast_factory.h"
-
-#include "benchmark.h"
-
-#include "class_list.h"
+#include "loading/fast_factory.h"
+
+#include "subprojects/benchmark.h"
+
 #include "shell_command_class.h"
 #include "shell_command.h"
-#include "shell_buffer.h"
-
-#include "util/loading/load_param_description.h"
 
 #include "network_manager.h"
@@ -97,4 +92,5 @@
 REGISTER_ARG_ARG(  _, write_dict,  "compression", "writedict",    "write packets to DATA/dicts/newdict",               "numBytes" );
 
+ObjectListDefinition(Orxonox);
 
 /**
@@ -105,5 +101,5 @@
 Orxonox::Orxonox ()
 {
-  this->setClassID(CL_ORXONOX, "Orxonox");
+  this->registerObject(this, Orxonox::_objectList);
   this->setName("orxonox-main");
 
@@ -127,12 +123,9 @@
 
   // class-less services/factories
-  Factory::deleteFactories();
   FastFactory::deleteAll();
   OrxShell::ShellCommandClass::unregisterAllCommands();
 
-  LoadClassDescription::deleteAllDescriptions();
-
   // handlers
-  delete ResourceManager::getInstance(); // deletes the Resource Manager
+  Resources::ResourceManager::deleteInstance(); // deletes the Resource Manager
 
   // engines
@@ -142,9 +135,12 @@
   delete EventHandler::getInstance();
 
+  Resources::ResourceManager::deleteInstance();
   // output-buffer
-  delete OrxShell::ShellBuffer::getInstance();
+  delete DebugBuffer::getInstance();
 
   SDL_QuitSubSystem(SDL_INIT_TIMER);
-  ClassList::debug();
+
+
+  ObjectListBase::debugAll(1);
 
   Preferences::getInstance()->save();
@@ -260,5 +256,5 @@
   GraphicsEngine::getInstance()->initFromPreferences();
 
-  std::string iconName = ResourceManager::getFullName("pictures/fighter-top-32x32.bmp");
+  std::string iconName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath("pictures/fighter-top-32x32.bmp");
   if (!iconName.empty())
   {
@@ -331,5 +327,4 @@
 
 //#include "util/loading/dynamic_loader.h"
-
 /**
  * initializes and loads resource files
@@ -345,18 +340,16 @@
   if ((dataPath = Preferences::getInstance()->getString(CONFIG_SECTION_GENERAL, CONFIG_NAME_DATADIR, ""))!= "")
   {
-    if (!ResourceManager::getInstance()->setDataDir(dataPath) &&
-        !ResourceManager::getInstance()->verifyDataDir(DEFAULT_DATA_DIR_CHECKFILE))
+    Resources::ResourceManager::getInstance()->setMainGlobalPath(dataPath) ;
+    if(!Resources::ResourceManager::getInstance()->checkFileInMainPath(File(DEFAULT_DATA_DIR_CHECKFILE)))
     {
       PRINTF(1)("Data Could not be located in %s\n", dataPath.c_str());
     }
   }
-
-
-  while (!ResourceManager::getInstance()->verifyDataDir(DEFAULT_DATA_DIR_CHECKFILE))
+  while (!Resources::ResourceManager::getInstance()->checkFileInMainPath(File(DEFAULT_DATA_DIR_CHECKFILE)))
   {
 
     PRINTF(1)("The DataDirectory %s could not be verified\n\nh" \
               "!!!  Please Change in File %s Section %s Entry %s to a suitable value !!!\n",
-              ResourceManager::getInstance()->getDataDir().c_str(),
+              Resources::ResourceManager::getInstance()->mainGlobalPath().name().c_str(),
               this->configFileName.c_str(),
               CONFIG_SECTION_GENERAL,
@@ -367,16 +360,23 @@
       return(-1);
     delete gui;
-    ResourceManager::getInstance()->setDataDir(Preferences::getInstance()->getString(CONFIG_SECTION_GENERAL, CONFIG_NAME_DATADIR, ""));
-
-  }
-
+    Resources::ResourceManager::getInstance()->setMainGlobalPath(Preferences::getInstance()->getString(CONFIG_SECTION_GENERAL, CONFIG_NAME_DATADIR, ""));
+  }
 
   //! @todo this is a hack and should be loadable
-  std::string imageDir = ResourceManager::getInstance()->getFullName("maps");
-  ResourceManager::getInstance()->addImageDir(imageDir);
-  imageDir = ResourceManager::getInstance()->getFullName("pictures");
-  ResourceManager::getInstance()->addImageDir(imageDir);
-
-  //  DynamicLoader::loadDyLib("libtest.so");
+  Resources::ResourceManager::getInstance()->addResourceSubPath("Texture", "maps");
+  Resources::ResourceManager::getInstance()->addResourceSubPath("Texture", "pictures");
+
+  Resources::ResourceManager::getInstance()->addResourceSubPath("SoundBuffer", "sound");
+  Resources::ResourceManager::getInstance()->addResourceSubPath("SoundBuffer", "music");
+
+  Resources::ResourceManager::getInstance()->addResourceSubPath("Shader", "shaders");
+  Resources::ResourceManager::getInstance()->addResourceSubPath("OBJ", "models");
+
+  Resources::ResourceManager::getInstance()->addKeepLevelName("Imediately");
+  Resources::ResourceManager::getInstance()->addKeepLevelName("LevelEnd");
+  Resources::ResourceManager::getInstance()->addKeepLevelName("CampaignEnd");
+  Resources::ResourceManager::getInstance()->addKeepLevelName("GameEnd");
+  Resources::ResourceManager::getInstance()->setDefaultKeepLevel(std::string("GameEnd"));
+
   return 0;
 }
@@ -388,5 +388,5 @@
 int Orxonox::initMisc()
 {
-  OrxShell::ShellBuffer::getInstance();
+  DebugBuffer::getInstance();
 
   // start the collision detection engine
@@ -570,5 +570,5 @@
   }
 
-  printf("finished inizialisation\n");
+  PRINTF(5)("finished inizialisation\n");
   orx->start();
 
