Index: /orxonox/trunk/src/defs/debug.h
===================================================================
--- /orxonox/trunk/src/defs/debug.h	(revision 3671)
+++ /orxonox/trunk/src/defs/debug.h	(revision 3672)
@@ -58,10 +58,10 @@
 // DEFINE MODULES \\
 #define DEBUG_MODULE_ORXONOX            0
-#define DEBUG_MODULE_WORLD              3
+#define DEBUG_MODULE_WORLD              2
 #define DEBUG_MODULE_PNODE              0
 #define DEBUG_MODULE_WORLD_ENTITY       0
 #define DEBUG_MODULE_COMMAND_NODE       0
 #define DEBUG_MODULE_GRAPHICS           0
-#define DEBUG_MODULE_LOAD               0
+#define DEBUG_MODULE_LOAD               4
 
 #define DEBUG_MODULE_IMPORTER           0
Index: /orxonox/trunk/src/lib/graphics/importer/material.cc
===================================================================
--- /orxonox/trunk/src/lib/graphics/importer/material.cc	(revision 3671)
+++ /orxonox/trunk/src/lib/graphics/importer/material.cc	(revision 3672)
@@ -62,5 +62,5 @@
     delete []this->name;
   if (this->diffuseTexture)
-    ResourceManager::unload(this->diffuseTexture);
+    ResourceManager::getInstance()->unload(this->diffuseTexture);
   if (this->nextMat)
     delete this->nextMat;
@@ -339,5 +339,5 @@
   //! \todo check if RESOURCE MANAGER is availiable
   //! \todo Textures from .mtl-file need special care.
-  this->diffuseTextureSet = this->diffuseTexture = (Texture*)ResourceManager::load(dMap, IMAGE);
+  this->diffuseTextureSet = this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE);
 }
 
Index: /orxonox/trunk/src/lib/util/resource_manager.cc
===================================================================
--- /orxonox/trunk/src/lib/util/resource_manager.cc	(revision 3671)
+++ /orxonox/trunk/src/lib/util/resource_manager.cc	(revision 3672)
@@ -11,5 +11,5 @@
    ### File Specific:
    main-programmer: Benjamin Grauer
-   co-programmer: ...
+   co-programmer: Patrick Boenzli
 */
 
@@ -38,7 +38,7 @@
 {
    this->setClassName ("ResourceManager");
-   dataDir = NULL;
-   imageDirs = new tList<char>();
-   resourceList = new tList<Resource>();
+   this->dataDir = "./";
+   this->imageDirs = new tList<char>();
+   this->resourceList = new tList<Resource>();
 }
 
@@ -55,10 +55,4 @@
 //! Singleton Reference to the ResourceManager
 ResourceManager* ResourceManager::singletonRef = NULL;
-//! The List of Resources, that has already been loaded.
-tList<Resource>* ResourceManager::resourceList = NULL;
-//! The Data Directory, where all relevant Data is stored.
-char* ResourceManager::dataDir = NULL;
-//! A list of directories in which images are stored.
-tList<char>* ResourceManager::imageDirs = NULL;
 
 /**
@@ -68,17 +62,18 @@
 {
   // deleting the Resources-List
-  unloadAllByPriority(RP_GAME);
-  delete resourceList;
-  resourceList = NULL;
+  this->unloadAllByPriority(RP_GAME);
+  delete this->resourceList;
   // deleting the Directorie Lists
-  char* tmpDir = imageDirs->enumerate();
+  tIterator<char>* tmpIt = imageDirs->getIterator();
+  char* tmpDir = tmpIt->nextElement();
   while(tmpDir)
     {
       delete []tmpDir;
-      tmpDir = imageDirs->nextElement();
-    }
-
-  delete imageDirs;
-  imageDirs = NULL;
+      tmpDir = tmpIt->nextElement();
+    }
+  delete tmpIt;
+
+  delete this->imageDirs;
+
   ResourceManager::singletonRef = NULL;
 }
@@ -92,6 +87,6 @@
   if (isDir(dataDir))
     {
-      ResourceManager::dataDir = new char[strlen(dataDir)+1];
-      strcpy(ResourceManager::dataDir, dataDir);
+      this->dataDir = new char[strlen(dataDir)+1];
+      strcpy(this->dataDir, dataDir);
     }
   else
@@ -113,5 +108,6 @@
     {
       // check if the Directory has been added before
-      char* tmpDir = imageDirs->enumerate();
+      tIterator<char>* tmpImageDirs = imageDirs->getIterator();
+      char* tmpDir = tmpImageDirs->nextElement();
       while(tmpDir)
 	{
@@ -119,12 +115,15 @@
 	    {
 	      PRINTF(4)("Path %s already loaded\n", imageDir);
+	      delete tmpImageDirs;
 	      return true;
 	    }
-	  tmpDir = imageDirs->nextElement();
-	}
+	  tmpDir = tmpImageDirs->nextElement();
+	}
+      delete tmpImageDirs;
+
       // adding the directory to the List
       tmpDir  = new char[strlen(imageDir)+1];
       strcpy(tmpDir, imageDir);
-      imageDirs->add(tmpDir);
+      this->imageDirs->add(tmpDir);
       return true;
     }
@@ -162,5 +161,5 @@
     tmpType = IMAGE;
 
-  return ResourceManager::load(fileName, tmpType, prio);
+  return this->load(fileName, tmpType, prio);
 }
 
@@ -175,5 +174,5 @@
 {
   // searching if the resource was loaded before.
-  Resource* tmpResource = ResourceManager::locateResourceByName(fileName);
+  Resource* tmpResource = this->locateResourceByName(fileName);
   if (!tmpResource) // if the resource was not loaded before.
     {
@@ -189,5 +188,5 @@
       // creating the full name. (directoryName + FileName)
       char* fullName = new char[strlen(dataDir)+strlen(fileName)+1];
-      sprintf(fullName, "%s%s", dataDir, fileName);
+      sprintf(fullName, "%s%s", this->dataDir, fileName);
       
       // Checking for the type of resource \see ResourceType
@@ -251,5 +250,5 @@
 	  tmpResource->pointer = NULL;
 	}
-      resourceList->add(tmpResource);
+      this->resourceList->add(tmpResource);
       delete []fullName;
     }
@@ -274,5 +273,5 @@
 {
   // if pointer is existent. and only one resource of this type exists.
-  Resource* tmpResource =ResourceManager::locateResourceByPointer(pointer);
+  Resource* tmpResource = this->locateResourceByPointer(pointer);
   if (!tmpResource)
     {
@@ -310,5 +309,5 @@
 	  PRINTF(4)("Resource %s safely removed.\n", resource->name);
 	  delete []resource->name;
-	  resourceList->remove(resource);
+	  this->resourceList->remove(resource);
 	}
       else
@@ -327,5 +326,4 @@
 bool ResourceManager::unloadAllByPriority(ResourcePriority prio)
 {
-
   tIterator<Resource>* iterator = resourceList->getIterator();
   Resource* enumRes = iterator->nextElement();
Index: /orxonox/trunk/src/lib/util/resource_manager.h
===================================================================
--- /orxonox/trunk/src/lib/util/resource_manager.h	(revision 3671)
+++ /orxonox/trunk/src/lib/util/resource_manager.h	(revision 3672)
@@ -56,11 +56,11 @@
   virtual ~ResourceManager();
 
-  static bool setDataDir(char* dataDir);
-  static bool addImageDir(char* imageDir);
-  static void* load(const char* fileName, ResourcePriority prio = RP_NO);
-  static void* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO);
-  static bool unload(void* pointer, ResourcePriority prio = RP_NO);
-  static bool unload(Resource* resource, ResourcePriority = RP_NO);
-  static bool unloadAllByPriority(ResourcePriority prio);
+  bool setDataDir(char* dataDir);
+  bool addImageDir(char* imageDir);
+  void* load(const char* fileName, ResourcePriority prio = RP_NO);
+  void* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO);
+  bool unload(void* pointer, ResourcePriority prio = RP_NO);
+  bool unload(Resource* resource, ResourcePriority = RP_NO);
+  bool unloadAllByPriority(ResourcePriority prio);
 
  private:
@@ -68,13 +68,14 @@
   static ResourceManager* singletonRef;
 
-  static tList<Resource>* resourceList;
-  static char* dataDir;
-  static tList<char>* imageDirs;
+  tList<Resource>* resourceList;       //!< The List of Resources, that has already been loaded.
+  char* dataDir;                       //!< The Data Directory, where all relevant Data is stored.
+  tList<char>* imageDirs;              //!< A list of directories in which images are stored.
 
-  static Resource* locateResourceByName(const char* fileName);
-  static Resource* locateResourceByPointer(const void* pointer);
+
+  Resource* locateResourceByName(const char* fileName);
+  Resource* locateResourceByPointer(const void* pointer);
   
-  static bool isDir(const char* directory);
-  static bool isFile(const char* directory);  
+  bool isDir(const char* directory);
+  bool isFile(const char* directory);  
 };
 
Index: /orxonox/trunk/src/story_entities/world.cc
===================================================================
--- /orxonox/trunk/src/story_entities/world.cc	(revision 3671)
+++ /orxonox/trunk/src/story_entities/world.cc	(revision 3672)
@@ -146,5 +146,5 @@
   cn->reset();
 
-  ResourceManager::unloadAllByPriority(RP_LEVEL);
+  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
 
   delete WorldInterface::getInstance();
Index: /orxonox/trunk/src/world_entities/environment.cc
===================================================================
--- /orxonox/trunk/src/world_entities/environment.cc	(revision 3671)
+++ /orxonox/trunk/src/world_entities/environment.cc	(revision 3672)
@@ -29,5 +29,5 @@
 Environment::Environment () : WorldEntity()
 {
-  this->model = (Model*) ResourceManager::load("models/reaplow.obj", OBJ);
+  this->model = (Model*) ResourceManager::getInstance()->load("models/reaplow.obj", OBJ);
   //  this->model = new OBJModel("../data/models/fighter.obj");
 }
Index: /orxonox/trunk/src/world_entities/player.cc
===================================================================
--- /orxonox/trunk/src/world_entities/player.cc	(revision 3671)
+++ /orxonox/trunk/src/world_entities/player.cc	(revision 3672)
@@ -45,5 +45,5 @@
      the player.cc for debug also
   */
-  this->model = (Model*)ResourceManager::load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
+  this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
   travelSpeed = 15.0;
   velocity = new Vector();
Index: /orxonox/trunk/src/world_entities/projectile.cc
===================================================================
--- /orxonox/trunk/src/world_entities/projectile.cc	(revision 3671)
+++ /orxonox/trunk/src/world_entities/projectile.cc	(revision 3672)
@@ -33,6 +33,6 @@
 Projectile::Projectile () : WorldEntity()
 {
-  //this->model = new OBJModel("");
-  this->projectileModel = new Primitive(P_SPHERE);
+  this->model = (Model*)ResourceManager::getInstance()->load("cube", PRIM, RP_LEVEL);
+  //  this->projectileModel = new Primitive(P_SPHERE);
   this->flightDirection = NULL;
   this->currentLifeTime = 0.0f;
@@ -137,6 +137,6 @@
   this->getAbsDir().matrix (matrix);
   glMultMatrixf((float*)matrix);  
-  //this->model->draw();
-  this->projectileModel->draw();
+  this->model->draw();
+  //this->projectileModel->draw();
 
   glPopMatrix();
Index: /orxonox/trunk/src/world_entities/world_entity.cc
===================================================================
--- /orxonox/trunk/src/world_entities/world_entity.cc	(revision 3671)
+++ /orxonox/trunk/src/world_entities/world_entity.cc	(revision 3672)
@@ -51,5 +51,6 @@
 {
   // if( collisioncluster != NULL) delete collisioncluster;
-  ResourceManager::unload(this->model);
+  if (this->model)
+    ResourceManager::getInstance()->unload(this->model);
 }
 
