Index: branches/resources/src/lib/graphics/graphics_engine.cc
===================================================================
--- branches/resources/src/lib/graphics/graphics_engine.cc	(revision 7227)
+++ branches/resources/src/lib/graphics/graphics_engine.cc	(revision 7229)
@@ -357,4 +357,7 @@
 
 #ifdef __WIN32__
+  // renewing GL-settings
+  glEnable(GL_DEPTH_TEST);
+
   // REBUILDING TEXTURES (ON WINDOWS CONTEXT SWITCH)
   const std::list<BaseObject*>* texList = ClassList::getList(CL_TEXTURE);
Index: branches/resources/src/lib/graphics/importer/material.cc
===================================================================
--- branches/resources/src/lib/graphics/importer/material.cc	(revision 7227)
+++ branches/resources/src/lib/graphics/importer/material.cc	(revision 7229)
@@ -83,5 +83,5 @@
     ResourceManager::getInstance()->unload(this->diffuseTexture);
   if (m.diffuseTexture != NULL)
-    this->diffuseTexture = (Texture*)ResourceManager::getInstance()->copy(m.diffuseTexture);
+    this->diffuseTexture = dynamic_cast<Texture*>(ResourceManager::getInstance()->copy(m.diffuseTexture));
   this->ambientTexture = NULL; /// FIXME
   this->specularTexture = NULL; /// FIXME
@@ -298,5 +298,5 @@
   //! @todo Textures from .mtl-file need special care.
   if (!dMap.empty())
-    this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target);
+    this->diffuseTexture = dynamic_cast<Texture*>(ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target));
   else
     this->diffuseTexture = NULL;
Index: branches/resources/src/lib/graphics/importer/texture.h
===================================================================
--- branches/resources/src/lib/graphics/importer/texture.h	(revision 7227)
+++ branches/resources/src/lib/graphics/importer/texture.h	(revision 7229)
@@ -8,4 +8,5 @@
 
 #include "base_object.h"
+#include "lib/util/loading/resource.h"
 
 #include "glincl.h"
@@ -15,5 +16,5 @@
 
 //! A Class, that reads in Textures from different fileformats.
-  class Texture : public BaseObject
+  class Texture : public Loading::Resource
   {
     public:
@@ -43,5 +44,4 @@
 
     protected:
-
       bool setSurface(SDL_Surface* newSurface);
       bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; };
Index: branches/resources/src/lib/graphics/text_engine/text.cc
===================================================================
--- branches/resources/src/lib/graphics/text_engine/text.cc	(revision 7227)
+++ branches/resources/src/lib/graphics/text_engine/text.cc	(revision 7229)
@@ -88,5 +88,5 @@
   if (!fontFile.empty())
   {
-    tmpFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, (int)fontSize);
+    tmpFont = dynamic_cast<Font*>(ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, (int)fontSize));
     if (tmpFont != NULL)
       this->font = tmpFont;
Index: branches/resources/src/lib/shell/shell_command.cc
===================================================================
--- branches/resources/src/lib/shell/shell_command.cc	(revision 7227)
+++ branches/resources/src/lib/shell/shell_command.cc	(revision 7229)
@@ -349,5 +349,5 @@
  * @returns the Name of the Parameter at Hand
  */
-const char* ShellCommand::paramToString(long parameter)
+const std::string& ShellCommand::paramToString(long parameter)
 {
   return MultiType::MultiTypeToString((MT_Type)parameter);
Index: branches/resources/src/lib/shell/shell_command.h
===================================================================
--- branches/resources/src/lib/shell/shell_command.h	(revision 7227)
+++ branches/resources/src/lib/shell/shell_command.h	(revision 7229)
@@ -80,5 +80,5 @@
 
     static bool isRegistered(const std::string& commandName, const std::string& className);
-    static const char* paramToString(long parameter);
+    static const std::string& paramToString(long parameter);
 
   protected:
Index: branches/resources/src/lib/sound/sound_buffer.cc
===================================================================
--- branches/resources/src/lib/sound/sound_buffer.cc	(revision 7227)
+++ branches/resources/src/lib/sound/sound_buffer.cc	(revision 7229)
@@ -96,5 +96,5 @@
   else if (stereo && !is16Bit)
     return AL_FORMAT_STEREO8;
-  else if (stereo && is16Bit)
+  else /* if (stereo && is16Bit) */
     return AL_FORMAT_STEREO16;
 }
Index: branches/resources/src/lib/util/loading/resource.cc
===================================================================
--- branches/resources/src/lib/util/loading/resource.cc	(revision 7227)
+++ branches/resources/src/lib/util/loading/resource.cc	(revision 7229)
@@ -18,21 +18,31 @@
 #include "resource.h"
 
-using namespace std;
 
+namespace Loading
+{
 
-/**
- * standard constructor
-*/
-Resource::Resource (const std::string& fileName)
-{
-   this->setClassID(CL_RESOURCE, "Resource");
+  /**
+   * standard constructor
+  */
+  Resource::Resource (const std::string& fileName, ResourcePriority prio)
+  {
+    this->setClassID(CL_RESOURCE, "Resource");
+    this->resource = NULL;
 
+  }
+
+  /**
+   * standard deconstructor
+   */
+  Resource::~Resource ()
+  {
+    // delete what has to be deleted here
+  }
+
+  Resource::SharedResource::SharedResource()
+  {
+    this->referenceCount = 1;
+    this->type = CL_NULL;
+    this->prio = RP_NO;
+  }
 }
-
-/**
- * standard deconstructor
- */
-Resource::~Resource ()
-{
-  // delete what has to be deleted here
-}
Index: branches/resources/src/lib/util/loading/resource.h
===================================================================
--- branches/resources/src/lib/util/loading/resource.h	(revision 7227)
+++ branches/resources/src/lib/util/loading/resource.h	(revision 7229)
@@ -10,49 +10,95 @@
 #include "multi_type.h"
 #include <string>
-
-// FORWARD DECLARATION
+#include <map>
+#include <vector>
 
 
+namespace Loading
+{
+  // FORWARD DECLARATION
 
-//! An enumerator for different (UN)LOAD-types.
-/**
- * RP_NO:        will be unloaded on request
- * RP_LEVEL:     will be unloaded at the end of a Level
- * RP_CAMPAIGN:  will be unloaded at the end of a Campaign
- * RP_GAME:      will be unloaded at the end of the whole Game (when closing orxonox)
- */
-typedef enum ResourcePriority
-{
-  RP_NO        =   0,
-  RP_LEVEL     =   1,
-  RP_CAMPAIGN  =   2,
-  RP_GAME      =   3
-};
+  //! An enumerator for different (UN)LOAD-types.
+  /**
+   * RP_NO:        will be unloaded on request
+   * RP_LEVEL:     will be unloaded at the end of a Level
+   * RP_CAMPAIGN:  will be unloaded at the end of a Campaign
+   * RP_GAME:      will be unloaded at the end of the whole Game (when closing orxonox)
+   */
+  typedef enum ResourcePriority
+  {
+    RP_NO        =   0,
+    RP_LEVEL     =   1,
+    RP_CAMPAIGN  =   2,
+    RP_GAME      =   3
+  };
 
 
+  //! A Resource is an Object, that can be loaded from Disk
+  /**
+   * A Resource can cahnge the internal type, meaning it is a
+   * SmartPointer, that keeps track of the InternalCount of the
+   * Resource (SharedResource).
+   */
+  class Resource : virtual public BaseObject
+  {
+  protected:
+    /**
+     * This is a Class for the internal handling of the Resource.
+     * Any Resource keeps exactly one of these Classes, so it can
+     * reference and move it around, and keep track of how many
+     * references of it are stored.
+     */
+    class SharedResource
+    {
+    public:
+      SharedResource();
+      std::string       fileName;
 
-//! A Resource is an Object, that can be loaded from Disk
-/**
- *
- */
-class Resource : virtual public BaseObject {
+      unsigned int      referenceCount;    //!< How many times this Resource has been loaded.
+      ClassID           type;              //!< ResourceType of this Resource.
+      ResourcePriority  prio;              //!< The Priority of this resource. (can only be increased, so noone else will delete this)
 
- public:
-   Resource(const std::string& fileName);
-  virtual ~Resource();
+      MultiType         param[3];          //!< The Parameters given to this Resource.
+    };
 
-  virtual bool load(std::string& fileName, const MultiType& param1, const MultiType& param2);
-  virtual bool reload();
-  virtual bool unload();
 
- private:
-   std::string       fileName;
+  public:
+    Resource(const std::string& fileName = "", ResourcePriority prio = RP_LEVEL);
+    virtual ~Resource();
 
-   unsigned int      referenceCount;    //!< How many times this Resource has been loaded.
-/// TODO REMOVE THIS:   ResourceType      type;              //!< ResourceType of this Resource.
-   ResourcePriority  prio;              //!< The Priority of this resource. (can only be increased, so noone else will delete this)
+    // looks if the resource was already loaded and (if not) loads it.
+    virtual bool load(std::string& fileName = "",
+                      ResourcePriority prio = RP_LEVEL,
+                      const MultiType& param0 = MT_NULL,
+                      const MultiType& param1 = MT_NULL,
+                      const MultiType& param2 = MT_NULL);
+    // reloads the resource.
+    virtual bool reload() { };
+    // unloads the sharedResource (from this Resource)
+    virtual bool unload();
 
-   MultiType         param[3];          //!< The Parameters given to this Resource.
-};
+    // checks if a resource was already loaded.
+    bool isLoaded(std::string& fileName,
+                  const MultiType& param0 = MT_NULL,
+                  const MultiType& param1 = MT_NULL,
+                  const MultiType& param2 = MT_NULL);
 
+    // raises the priority can only be raised
+    void raisePriority(ResourcePriority prio);
+    /** @returns the referenceCount of the shared resource behind this resource or 0 if no internal Resource is stored */
+  unsigned int referenceCount() const { return (this->resource)? this->resource->referenceCount : 0; };
+
+  protected:
+    const SharedResource* findResource(std::string& fileName,
+                                       const MultiType& param0 = MT_NULL,
+                                       const MultiType& param1 = MT_NULL,
+                                       const MultiType& param2 = MT_NULL);
+
+  protected:
+    SharedResource*     resource;          //!< The internal Resource, this Resource is keeping (at the moment).
+
+    static std::map<ClassID, std::vector<SharedResource> > storedResources;
+  };
+
+}
 #endif /* _RESOURCE_H */
Index: branches/resources/src/lib/util/multi_type.cc
===================================================================
--- branches/resources/src/lib/util/multi_type.cc	(revision 7227)
+++ branches/resources/src/lib/util/multi_type.cc	(revision 7229)
@@ -408,5 +408,5 @@
 #endif
   ("MultiType of Type '%s' :: Values: BOOL: '%d', INT: '%d', FLOAT: '%f', CHAR: '%c', STRING '%s'\n",
-   MultiType::MultiTypeToString(this->type),
+   MultiType::MultiTypeToString(this->type).c_str(),
    this->getBool(),
    this->getInt(),
@@ -453,20 +453,20 @@
  * @returns: the Type as a constant String (do not delete)
  */
-const char* MultiType::MultiTypeToString(MT_Type type)
+const std::string& MultiType::MultiTypeToString(MT_Type type)
 {
   switch ( type )
   {
     case MT_BOOL:
-      return "bool";
+      return MultiType::multiTypeNames[1];
     case MT_INT:
-      return "int";
+      return MultiType::multiTypeNames[2];
     case MT_FLOAT:
-      return "float";
+      return MultiType::multiTypeNames[3];
     case MT_CHAR:
-      return "char";
+      return MultiType::multiTypeNames[4];
     case MT_STRING:
-      return "string";
-  }
-  return "NONE";
+      return MultiType::multiTypeNames[5];
+  }
+  return MultiType::multiTypeNames[0];
 }
 
@@ -478,15 +478,26 @@
 MT_Type MultiType::StringToMultiType(const std::string& type)
 {
-  if (type == "bool")
+  if (type == MultiType::multiTypeNames[1])
     return MT_BOOL;
-  if (type == "int")
+  if (type == MultiType::multiTypeNames[2])
     return MT_INT;
-  if (type, "float")
+  if (type == MultiType::multiTypeNames[3])
     return MT_FLOAT;
-  if (type == "char")
+  if (type == MultiType::multiTypeNames[4])
     return MT_CHAR;
-  if (type == "string")
+  if (type == MultiType::multiTypeNames[5])
     return MT_STRING;
 
   return MT_NULL;
 }
+
+
+const std::string MultiType::multiTypeNames[] =
+{
+  "none",
+  "bool",
+  "int",
+  "float",
+  "char",
+  "string"
+};
Index: branches/resources/src/lib/util/multi_type.h
===================================================================
--- branches/resources/src/lib/util/multi_type.h	(revision 7227)
+++ branches/resources/src/lib/util/multi_type.h	(revision 7229)
@@ -92,18 +92,24 @@
     void debug() const;
 
-    static const char* MultiTypeToString(MT_Type type);
+    static const std::string& MultiTypeToString(MT_Type type);
     static MT_Type StringToMultiType(const std::string& type);
 
   private:
+    /**
+     * The stored internal Value of the MultiType is handled in this union
+     * plus the string down below
+     */
     union MultiTypeValue
     {
-      bool              Bool;
-      int               Int;
-      float             Float;
-      char              Char;
+      bool              Bool;            //!< If Type == MT_BOOL this is the MultiType's value
+      int               Int;             //!< If Type == MT_INT this is the MultiType's value
+      float             Float;           //!< If Type == MT_FLOAT this is the MultiType's value
+      char              Char;            //!< If Type == MT_CHAR this is the MultiType's value
 //      std::string*      String;
-    }                   value;
-    std::string         storedString;
-    MT_Type             type;
+    }                   value;           //!< The stored internal value.
+    std::string         storedString;    //!< The String if either MT_TYPE == MT_STRING or if temporary requested
+    MT_Type             type;            //!< The Type of the MultiString.
+
+    static const std::string multiTypeNames[]; //!< An array to convert from String to MT_TYPE and backwords.
 };
 
