Index: trunk/src/lib/Makefile.am
===================================================================
--- trunk/src/lib/Makefile.am	(revision 7192)
+++ trunk/src/lib/Makefile.am	(revision 7193)
@@ -16,4 +16,12 @@
 		util/executor/executor.cc \
 		\
+		util/loading/resource_manager.cc \
+		util/loading/resource.cc \
+		util/loading/game_loader.cc \
+		util/loading/load_param.cc \
+		util/loading/load_param_description.cc \
+		util/loading/factory.cc \
+		util/loading/dynamic_loader.cc \
+		\
 		data/data_tank.cc
 
@@ -31,6 +39,16 @@
 		util/executor/executor_specials.h \
 		util/executor/functor_list.h \
+		\
+		util/loading/resource_manager.h \
+		util/loading/resource.h \
+		util/loading/game_loader.h \
+		util/loading/load_param.h \
+		util/loading/load_param_description.h \
+		util/loading/factory.h \
+		util/loading/dynamic_loader.h \
+		\
 		util/count_pointer.h \
 		util/list.h \
+		\
 		\
 		data/data_tank.h
Index: trunk/src/lib/coord/p_node.cc
===================================================================
--- trunk/src/lib/coord/p_node.cc	(revision 7192)
+++ trunk/src/lib/coord/p_node.cc	(revision 7193)
@@ -18,5 +18,5 @@
 #include "p_node.h"
 
-#include "load_param.h"
+#include "util/loading/load_param.h"
 #include "class_list.h"
 
Index: trunk/src/lib/graphics/effects/fog_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/fog_effect.cc	(revision 7192)
+++ trunk/src/lib/graphics/effects/fog_effect.cc	(revision 7193)
@@ -19,6 +19,6 @@
 #include "fog_effect.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 
 #include "glincl.h"
Index: trunk/src/lib/graphics/effects/graphics_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/graphics_effect.cc	(revision 7192)
+++ trunk/src/lib/graphics/effects/graphics_effect.cc	(revision 7193)
@@ -20,5 +20,5 @@
 #include "graphics_effect.h"
 
-#include "load_param.h"
+#include "util/loading/load_param.h"
 
 
Index: trunk/src/lib/graphics/effects/lense_flare.cc
===================================================================
--- trunk/src/lib/graphics/effects/lense_flare.cc	(revision 7192)
+++ trunk/src/lib/graphics/effects/lense_flare.cc	(revision 7193)
@@ -19,6 +19,6 @@
 #include "lense_flare.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 
 #include "glincl.h"
Index: trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- trunk/src/lib/graphics/graphics_engine.cc	(revision 7192)
+++ trunk/src/lib/graphics/graphics_engine.cc	(revision 7193)
@@ -17,5 +17,5 @@
 
 #include "graphics_engine.h"
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 #include "event_handler.h"
 #include "state.h"
@@ -44,6 +44,6 @@
 
 #include "parser/tinyxml/tinyxml.h"
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 #include "class_list.h"
 
Index: trunk/src/lib/graphics/importer/height_map.cc
===================================================================
--- trunk/src/lib/graphics/importer/height_map.cc	(revision 7192)
+++ trunk/src/lib/graphics/importer/height_map.cc	(revision 7193)
@@ -20,5 +20,5 @@
 #include "p_node.h"
 #include "state.h"
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 #include "debug.h"
 
Index: trunk/src/lib/graphics/importer/material.cc
===================================================================
--- trunk/src/lib/graphics/importer/material.cc	(revision 7192)
+++ trunk/src/lib/graphics/importer/material.cc	(revision 7193)
@@ -21,10 +21,10 @@
 #include "texture.h"
 #include "debug.h"
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 #include <stdlib.h>
 #include <string.h>
 
 //! @todo check if we are in RESOURCE MANAGER-mode
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 
 using namespace std;
Index: trunk/src/lib/graphics/importer/md2Model.cc
===================================================================
--- trunk/src/lib/graphics/importer/md2Model.cc	(revision 7192)
+++ trunk/src/lib/graphics/importer/md2Model.cc	(revision 7193)
@@ -19,5 +19,5 @@
 
 #include "debug.h"
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 
 
Index: trunk/src/lib/graphics/importer/media_container.cc
===================================================================
--- trunk/src/lib/graphics/importer/media_container.cc	(revision 7192)
+++ trunk/src/lib/graphics/importer/media_container.cc	(revision 7193)
@@ -25,5 +25,5 @@
 #include "media_container.h"
 
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 
 /* header for debug output */
Index: trunk/src/lib/graphics/importer/model.h
===================================================================
--- trunk/src/lib/graphics/importer/model.h	(revision 7192)
+++ trunk/src/lib/graphics/importer/model.h	(revision 7193)
@@ -46,5 +46,5 @@
   unsigned int     numTexCoor;           //!< how many Texture Coordinates in the Model
 
-  const float*     pVertices;            //!< array of the Vertives
+  const float*     pVertices;            //!< array of the Vertices
   sTriangleExt*    pTriangles;           //!< array of all triangles
   const float*     pNormals;             //!< array of the Normals
@@ -55,5 +55,5 @@
 
 //! This class defines the basic components of a model
-class Model : public BaseObject {
+class Model : virtual public BaseObject {
 
   public:
Index: trunk/src/lib/graphics/importer/movie_player.cc
===================================================================
--- trunk/src/lib/graphics/importer/movie_player.cc	(revision 7192)
+++ trunk/src/lib/graphics/importer/movie_player.cc	(revision 7193)
@@ -25,5 +25,5 @@
 #include "movie_player.h"
 
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 
 // header for debug output
Index: trunk/src/lib/graphics/light.cc
===================================================================
--- trunk/src/lib/graphics/light.cc	(revision 7192)
+++ trunk/src/lib/graphics/light.cc	(revision 7193)
@@ -23,6 +23,6 @@
 #include "vector.h"
 #include "parser/tinyxml/tinyxml.h"
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 #include "debug.h"
 
Index: trunk/src/lib/graphics/render2D/billboard.cc
===================================================================
--- trunk/src/lib/graphics/render2D/billboard.cc	(revision 7192)
+++ trunk/src/lib/graphics/render2D/billboard.cc	(revision 7193)
@@ -17,6 +17,6 @@
 #include "billboard.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 
 #include "graphics_engine.h"
Index: trunk/src/lib/graphics/render2D/element_2d.cc
===================================================================
--- trunk/src/lib/graphics/render2D/element_2d.cc	(revision 7192)
+++ trunk/src/lib/graphics/render2D/element_2d.cc	(revision 7193)
@@ -24,5 +24,5 @@
 
 #include "graphics_engine.h"
-#include "load_param.h"
+#include "util/loading/load_param.h"
 #include "class_list.h"
 
Index: trunk/src/lib/graphics/shader.cc
===================================================================
--- trunk/src/lib/graphics/shader.cc	(revision 7192)
+++ trunk/src/lib/graphics/shader.cc	(revision 7193)
@@ -23,5 +23,5 @@
 #include "debug.h"
 
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 
 
Index: trunk/src/lib/graphics/text_engine/text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/text.cc	(revision 7192)
+++ trunk/src/lib/graphics/text_engine/text.cc	(revision 7193)
@@ -20,5 +20,5 @@
 
 #include "graphics_engine.h"
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 #include "class_list.h"
 #include "debug.h"
Index: trunk/src/lib/graphics/text_engine/text_engine.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/text_engine.cc	(revision 7192)
+++ trunk/src/lib/graphics/text_engine/text_engine.cc	(revision 7193)
@@ -33,5 +33,5 @@
 
 #include "graphics_engine.h"
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 #include "class_list.h"
 
Index: trunk/src/lib/gui/gl_gui/glmenu/glmenu_imagescreen.cc
===================================================================
--- trunk/src/lib/gui/gl_gui/glmenu/glmenu_imagescreen.cc	(revision 7192)
+++ trunk/src/lib/gui/gl_gui/glmenu/glmenu_imagescreen.cc	(revision 7193)
@@ -22,6 +22,6 @@
 #include "graphics_engine.h"
 #include "material.h"
-#include "factory.h"
-#include "load_param.h"
+#include "util/loading/factory.h"
+#include "util/loading/load_param.h"
 
 CREATE_FACTORY(GLMenuImageScreen, CL_GLMENU_IMAGE_SCREEN);
Index: trunk/src/lib/gui/gtk_gui/gui_exec.cc
===================================================================
--- trunk/src/lib/gui/gtk_gui/gui_exec.cc	(revision 7192)
+++ trunk/src/lib/gui/gtk_gui/gui_exec.cc	(revision 7193)
@@ -26,5 +26,5 @@
 #include "gui_exec.h"
 
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 #include "parser/ini_parser/ini_parser.h"
 
Index: trunk/src/lib/lang/base_object.cc
===================================================================
--- trunk/src/lib/lang/base_object.cc	(revision 7192)
+++ trunk/src/lib/lang/base_object.cc	(revision 7193)
@@ -19,5 +19,5 @@
 #include "base_object.h"
 
-#include "load_param.h"
+#include "util/loading/load_param.h"
 #include "compiler.h"
 #include "class_list.h"
Index: trunk/src/lib/network/network_game_manager.cc
===================================================================
--- trunk/src/lib/network/network_game_manager.cc	(revision 7192)
+++ trunk/src/lib/network/network_game_manager.cc	(revision 7193)
@@ -20,5 +20,5 @@
 #define DEBUG_MODULE_NETWORK
 
-#include "factory.h"
+#include "util/loading/factory.h"
 #include "network_stream.h"
 #include "converter.h"
Index: trunk/src/lib/particles/box_emitter.cc
===================================================================
--- trunk/src/lib/particles/box_emitter.cc	(revision 7192)
+++ trunk/src/lib/particles/box_emitter.cc	(revision 7193)
@@ -20,6 +20,6 @@
 #include "particle_system.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 #include "debug.h"
 #include "stdlibincl.h"
Index: trunk/src/lib/particles/dot_emitter.cc
===================================================================
--- trunk/src/lib/particles/dot_emitter.cc	(revision 7192)
+++ trunk/src/lib/particles/dot_emitter.cc	(revision 7193)
@@ -20,6 +20,6 @@
 #include "particle_system.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 #include "debug.h"
 #include "stdlibincl.h"
Index: trunk/src/lib/particles/dot_particles.cc
===================================================================
--- trunk/src/lib/particles/dot_particles.cc	(revision 7192)
+++ trunk/src/lib/particles/dot_particles.cc	(revision 7193)
@@ -18,6 +18,6 @@
 #include "dot_particles.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 #include "material.h"
 #include "state.h"
Index: trunk/src/lib/particles/engine/particle_engine.cc
===================================================================
--- trunk/src/lib/particles/engine/particle_engine.cc	(revision 7192)
+++ trunk/src/lib/particles/engine/particle_engine.cc	(revision 7193)
@@ -22,5 +22,5 @@
 #include "debug.h"
 #include "stdlibincl.h"
-#include "load_param.h"
+#include "util/loading/load_param.h"
 
 using namespace std;
Index: trunk/src/lib/particles/model_particles.cc
===================================================================
--- trunk/src/lib/particles/model_particles.cc	(revision 7192)
+++ trunk/src/lib/particles/model_particles.cc	(revision 7193)
@@ -18,6 +18,6 @@
 #include "model_particles.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 #include "material.h"
 #include "state.h"
Index: trunk/src/lib/particles/particle_emitter.cc
===================================================================
--- trunk/src/lib/particles/particle_emitter.cc	(revision 7192)
+++ trunk/src/lib/particles/particle_emitter.cc	(revision 7193)
@@ -20,5 +20,5 @@
 #include "particle_system.h"
 
-#include "load_param.h"
+#include "util/loading/load_param.h"
 #include "debug.h"
 #include "stdlibincl.h"
Index: trunk/src/lib/particles/particle_system.cc
===================================================================
--- trunk/src/lib/particles/particle_system.cc	(revision 7192)
+++ trunk/src/lib/particles/particle_system.cc	(revision 7193)
@@ -23,6 +23,6 @@
 #include "model.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 #include "material.h"
 #include "state.h"
Index: trunk/src/lib/particles/plane_emitter.cc
===================================================================
--- trunk/src/lib/particles/plane_emitter.cc	(revision 7192)
+++ trunk/src/lib/particles/plane_emitter.cc	(revision 7193)
@@ -20,6 +20,6 @@
 #include "particle_system.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 #include "debug.h"
 #include "stdlibincl.h"
Index: trunk/src/lib/particles/spark_particles.cc
===================================================================
--- trunk/src/lib/particles/spark_particles.cc	(revision 7192)
+++ trunk/src/lib/particles/spark_particles.cc	(revision 7193)
@@ -18,6 +18,6 @@
 #include "spark_particles.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 #include "material.h"
 #include "state.h"
Index: trunk/src/lib/particles/sprite_particles.cc
===================================================================
--- trunk/src/lib/particles/sprite_particles.cc	(revision 7192)
+++ trunk/src/lib/particles/sprite_particles.cc	(revision 7193)
@@ -18,6 +18,6 @@
 #include "sprite_particles.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 #include "material.h"
 #include "state.h"
Index: trunk/src/lib/physics/fields/field.cc
===================================================================
--- trunk/src/lib/physics/fields/field.cc	(revision 7192)
+++ trunk/src/lib/physics/fields/field.cc	(revision 7193)
@@ -20,6 +20,6 @@
 #include "physics_engine.h"
 
-#include "factory.h"
-#include "load_param.h"
+#include "util/loading/factory.h"
+#include "util/loading/load_param.h"
 using namespace std;
 
Index: trunk/src/lib/physics/fields/gravity.cc
===================================================================
--- trunk/src/lib/physics/fields/gravity.cc	(revision 7192)
+++ trunk/src/lib/physics/fields/gravity.cc	(revision 7193)
@@ -18,6 +18,6 @@
 #include "gravity.h"
 
-#include "load_param.h"
-#include "factory.h"
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
 
 using namespace std;
Index: trunk/src/lib/physics/physics_connection.cc
===================================================================
--- trunk/src/lib/physics/physics_connection.cc	(revision 7192)
+++ trunk/src/lib/physics/physics_connection.cc	(revision 7193)
@@ -24,6 +24,6 @@
 #include "physics_interface.h"
 
-#include "factory.h"
-#include "load_param.h"
+#include "util/loading/factory.h"
+#include "util/loading/load_param.h"
 
 using namespace std;
Index: trunk/src/lib/physics/physics_engine.cc
===================================================================
--- trunk/src/lib/physics/physics_engine.cc	(revision 7192)
+++ trunk/src/lib/physics/physics_engine.cc	(revision 7193)
@@ -20,6 +20,6 @@
 #include "class_list.h"
 #include "parser/tinyxml/tinyxml.h"
-#include "factory.h"
-#include "load_param.h"
+#include "util/loading/factory.h"
+#include "util/loading/load_param.h"
 
 using namespace std;
Index: trunk/src/lib/sound/sound_engine.cc
===================================================================
--- trunk/src/lib/sound/sound_engine.cc	(revision 7192)
+++ trunk/src/lib/sound/sound_engine.cc	(revision 7193)
@@ -24,5 +24,5 @@
 
 #include "p_node.h"
-#include "resource_manager.h"
+#include "util/loading/resource_manager.h"
 #include "debug.h"
 #include "parser/ini_parser/ini_parser.h"
Index: trunk/src/lib/util/loading/dynamic_loader.cc
===================================================================
--- trunk/src/lib/util/loading/dynamic_loader.cc	(revision 7193)
+++ trunk/src/lib/util/loading/dynamic_loader.cc	(revision 7193)
@@ -0,0 +1,80 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
+
+#include "dynamic_loader.h"
+
+
+#include <dlfcn.h>
+
+
+using namespace std;
+
+
+/**
+ * standard constructor
+ * @todo this constructor is not jet implemented - do it
+*/
+DynamicLoader::DynamicLoader (const std::string& libName)
+    : Factory(NULL, CL_NULL)
+{
+  this->setClassID(CL_DYNAMIC_LOADER, "DynamicLoader");
+
+  this->handle = NULL;
+
+  if (loadDynamicLib(libName));
+  this->setName(&libName[0]);
+}
+
+
+/**
+ * standard deconstructor
+*/
+DynamicLoader::~DynamicLoader ()
+{
+  // delete what has to be deleted here
+  if (this->handle != NULL)
+    dlclose(this->handle);
+}
+
+
+bool DynamicLoader::loadDynamicLib(const std::string& libName)
+{
+  this->handle = dlopen(&libName[0], RTLD_NOW);
+  if(this->handle == NULL)
+  {
+    return false;
+  }
+  void *mkr = dlsym( this->handle, "maker");
+}
+
+bool DynamicLoader::loadDyLib(const std::string& libName)
+{
+  void* handle;
+  handle = dlopen(&libName[0], RTLD_NOW);
+  if(handle == NULL)
+  {
+    PRINTF(0)("unable to load %s\n", &libName[0]);
+    return false;
+  }
+//  void *mkr = dlsym("maker");
+
+}
+
+
+BaseObject* DynamicLoader::fabricateObject(const TiXmlElement* root) const
+{
+}
Index: trunk/src/lib/util/loading/dynamic_loader.h
===================================================================
--- trunk/src/lib/util/loading/dynamic_loader.h	(revision 7193)
+++ trunk/src/lib/util/loading/dynamic_loader.h	(revision 7193)
@@ -0,0 +1,36 @@
+/*!
+ * @file dynamic_loader.h
+ * @brief Definition of The Dynamic Loader Factory.
+*/
+
+#ifndef _DYNAMIC_LOADER_H
+#define _DYNAMIC_LOADER_H
+
+#include "util/loading/factory.h"
+
+#include <string>
+
+#define DYNAMIC_LINKAGE_FACTORY(CLASS_NAME, CLASS_ID) \
+          void* DynamicCreator(const TiXmlElement* root) { return new CLASS_NAME(root); };
+
+// FORWARD DECLARATION
+
+//! A class for ...
+class DynamicLoader : public Factory
+{
+
+public:
+  DynamicLoader(const std::string& libName);
+  virtual ~DynamicLoader();
+
+  bool loadDynamicLib(const std::string& libName);
+  virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const;
+
+  static bool loadDyLib(const std::string& libName);
+
+
+private:
+  void*      handle;
+};
+
+#endif /* _DYNAMIC_LOADER_H */
Index: trunk/src/lib/util/loading/factory.cc
===================================================================
--- trunk/src/lib/util/loading/factory.cc	(revision 7193)
+++ trunk/src/lib/util/loading/factory.cc	(revision 7193)
@@ -0,0 +1,183 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Christian Meyer
+   co-programmer: Benjamin Grauer
+*/
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
+
+#include "util/loading/factory.h"
+
+//#include "shell_command.h"
+
+using namespace std;
+
+//SHELL_COMMAND(create, Factory, fabricate);
+
+
+/*  --------------------------------------------------
+ *               Factory
+ *   --------------------------------------------------
+ */
+
+/**
+ *  constructor
+
+   set everything to zero and define factoryName
+*/
+Factory::Factory (const char* factoryName, ClassID classID)
+{
+  this->setClassID(CL_FACTORY, "Factory");
+  this->setName(factoryName);
+
+  this->classID = classID;
+  this->className = factoryName;
+
+  if( Factory::factoryList == NULL)
+    Factory::factoryList = new std::list<Factory*>;
+
+  Factory::factoryList->push_back(this);
+}
+
+/** a reference to the First Factory */
+std::list<Factory*>* Factory::factoryList = NULL;
+
+/**
+ *  destructor
+ *
+ * clear the Q
+ */
+Factory::~Factory ()
+{
+  //  printf("%s\n", this->factoryName);
+  //  Factory* tmpDel = this->next;
+  //  this->next = NULL;
+}
+
+/**
+ * deletes all the Factories. (cleanup)
+ */
+void Factory::deleteFactories()
+{
+  if (Factory::factoryList != NULL)
+  {
+    while(!Factory::factoryList->empty())
+    {
+      delete Factory::factoryList->front();
+      Factory::factoryList->pop_front();
+    }
+    delete Factory::factoryList;
+    Factory::factoryList = NULL;
+  }
+}
+
+/**
+ * @param classID match a classID with this classID
+ * @returns true on match, false otherwise
+ */
+bool Factory::operator==(ClassID classID) const
+{
+  return (this->classID == classID);
+}
+
+/**
+ * Compares the Factories Name against a given ClassName
+ * @param className the Name of the Class to Query
+ * @returns true on match, false otherwise.
+ */
+bool Factory::operator==(const char* className) const
+{
+  return(className != NULL && !strcmp(className, this->className));
+}
+
+
+/**
+ * Creates a new Object of type root->Value() (name)
+ * @param root the XML-Root to match for the newly created Object
+ * @returns a new Object of Type root->Value() on match, NULL otherwise
+ */
+ BaseObject* Factory::fabricate(const TiXmlElement* root)
+{
+  if (root == NULL || Factory::factoryList == NULL)
+    return NULL;
+
+  std::list<Factory*>::const_iterator factory;
+  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
+    if (*(*factory) == root->Value())
+      break;
+
+  if (factory != Factory::factoryList->end())
+  {
+    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getName());
+    return (*factory)->fabricateObject(root);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", root->Value());
+    return NULL;
+  }
+}
+
+
+/**
+ * Creates a new Object of type className
+ * @param className the ClassName to match for the newly created Object
+ * @returns a new Object of Type className on match, NULL otherwise
+ */
+ BaseObject* Factory::fabricate(const char* className)
+{
+  if (className == NULL || Factory::factoryList == NULL)
+    return NULL;
+
+  std::list<Factory*>::const_iterator factory;
+  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
+    if (*(*factory) == className)
+      break;
+
+  if (factory != Factory::factoryList->end())
+  {
+    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getName());
+    return (*factory)->fabricateObject(NULL);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", className);
+    return NULL;
+  }
+}
+
+
+/**
+ * Creates a new Object of type classID
+ * @param classID the ClassID to match for the newly created Object
+ * @returns a new Object of Type classID on match, NULL otherwise
+ */
+BaseObject* Factory::fabricate(ClassID classID)
+{
+  if (Factory::factoryList == NULL)
+    return NULL;
+
+  std::list<Factory*>::const_iterator factory;
+  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
+    if (*(*factory) == classID)
+      break;
+
+  if (factory != Factory::factoryList->end())
+  {
+    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getName());
+    return (*factory)->fabricateObject(NULL);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of ClassID '%h'\n", classID);
+    return NULL;
+  }
+}
Index: trunk/src/lib/util/loading/factory.h
===================================================================
--- trunk/src/lib/util/loading/factory.h	(revision 7193)
+++ trunk/src/lib/util/loading/factory.h	(revision 7193)
@@ -0,0 +1,98 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Christian Meyer
+   co-programmer: Benjamin Grauer
+*/
+
+/*!
+ * @file factory.h
+ * @brief A loadable object handler
+*/
+
+
+#ifndef _FACTORY_H
+#define _FACTORY_H
+
+class BaseObject;
+
+#include "parser/tinyxml/tinyxml.h"
+#include "base_object.h"
+#include "debug.h"
+#include <vector>
+#include <list>
+
+/**
+ * Creates a factory to a Loadable Class.
+ * this should be used at the beginning of all the Classes that should be loadable (in the cc-file)
+*/
+#define CREATE_FACTORY(CLASS_NAME, CLASS_ID) \
+    tFactory<CLASS_NAME>* global_##CLASS_NAME##_Factory = new tFactory<CLASS_NAME>(#CLASS_NAME, CLASS_ID)
+
+// #define CREATE_DYNAMIC_FACTORY(CLASS_NAME, CLASS_ID) \
+//     tFactory<CLASS_NAME>* global_##CLASS_NAME##_Dynamic_Factory = new DynamicLoader<CLASS_NAME>(#CLASS_NAME, CLASS_ID)
+
+//! The Factory is a loadable object handler
+class Factory : public BaseObject {
+
+ public:
+  virtual ~Factory ();
+
+  static void deleteFactories();
+
+  static  BaseObject* fabricate(const char* className);
+  static  BaseObject* fabricate(ClassID classID);
+  static  BaseObject* fabricate(const TiXmlElement* root = NULL);
+
+
+  bool operator==(ClassID classID) const;
+  bool operator==(const char* className) const;
+
+  protected:
+    Factory (const char* factoryName, ClassID classID);
+    virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const = 0;
+
+  protected:
+    ClassID                       classID;              //!< The Class-Identifyer of the Factory.
+    const char*                   className;            //!< The name of the Class.
+    static std::list<Factory*>*   factoryList;          //!< List of Registered Factories
+};
+
+/**
+ *  a factory that is able to load any kind of Object
+ * (this is a Functor)
+ */
+template<class T> class tFactory : public Factory
+{
+ public:
+ /**
+  * creates a new type Factory to enable the loading of T
+  * @param factoryName the Name of the Factory to load.
+  * @param classID the ID of the Class to be created.
+  */
+  tFactory (const char* factoryName, ClassID classID)
+   : Factory(factoryName, classID)
+  {  }
+
+  private:
+   /**
+    * fabricates an Object of type T, with the constructor T::T(const TiXmlElemnt*)
+    * @param root the TiXmlElement T should load parameters from.
+    * @return the newly fabricated T.
+    */
+    virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const
+    {
+      return new T(root);
+    }
+};
+
+#endif /* _FACTORY_H */
+
Index: trunk/src/lib/util/loading/game_loader.cc
===================================================================
--- trunk/src/lib/util/loading/game_loader.cc	(revision 7193)
+++ trunk/src/lib/util/loading/game_loader.cc	(revision 7193)
@@ -0,0 +1,309 @@
+
+
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Patrick Boenzli
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
+
+#include "game_loader.h"
+#include "util/loading/load_param.h"
+
+#include "shell_command.h"
+#include "campaign.h"
+
+#include "util/loading/resource_manager.h"
+
+#include "event_handler.h"
+
+
+using namespace std;
+
+
+SHELL_COMMAND(quit, GameLoader, stop)
+    ->describe("quits the game")
+    ->setAlias("orxoquit");
+
+
+GameLoader* GameLoader::singletonRef = NULL;
+
+
+/**
+ *  simple constructor
+ */
+GameLoader::GameLoader ()
+{
+  this->setClassID(CL_GAME_LOADER, "GameLoader");
+  this->setName("GameLoader");
+  this->bRun = true;
+}
+
+
+/**
+ *  simple deconstructor
+ */
+GameLoader::~GameLoader ()
+{
+  if( this->currentCampaign)
+    delete this->currentCampaign;
+  this->currentCampaign = NULL;
+}
+
+
+/**
+ *  initializes the GameLoader
+ */
+ErrorMessage GameLoader::init()
+{
+  if(this->currentCampaign != NULL)
+    this->currentCampaign->init();
+
+  this->eventHandler = EventHandler::getInstance();
+  this->eventHandler->subscribe(this, ES_GAME, KeyMapper::PEV_PAUSE);
+  this->eventHandler->subscribe(this, ES_ALL, EV_MAIN_QUIT);          //< External Quit Event
+  this->eventHandler->subscribe(this, ES_GAME, KeyMapper::PEV_QUIT);
+  this->eventHandler->subscribe(this, ES_GAME, KeyMapper::PEV_NEXT_WORLD);
+  this->eventHandler->subscribe(this, ES_GAME, KeyMapper::PEV_PREVIOUS_WORLD);
+}
+
+
+/**
+ *  reads a campaign definition file into a campaign class
+ * @param fileName to be loaded
+ * @returns the loaded campaign
+ *
+ * this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
+ */
+ErrorMessage GameLoader::loadCampaign(const char* fileName)
+{
+  ErrorMessage errorCode;
+  char* campaignName = ResourceManager::getFullName(fileName);
+  if (campaignName)
+    {
+      this->currentCampaign = this->fileToCampaign(campaignName);
+      delete[] campaignName;
+    }
+}
+
+
+/**
+ *  reads a campaign definition file into a campaign class
+ * @param fileName to be loaded
+ * @returns the loaded campaign
+ *
+ * this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
+ */
+ErrorMessage GameLoader::loadNetworkCampaign(const char* fileName)
+{
+  ErrorMessage errorCode;
+  char* campaignName = ResourceManager::getFullName(fileName);
+  if (campaignName)
+  {
+    this->currentCampaign = this->fileToCampaign(campaignName);
+    delete[] campaignName;
+  }
+}
+
+
+/**
+ *  loads a debug campaign for test purposes only.
+ * @param campaignID the identifier of the campaign.
+ * @returns error message if not able to do so.
+ */
+ErrorMessage GameLoader::loadDebugCampaign(Uint32 campaignID)
+{
+  switch(campaignID)
+    {
+      /*
+         Debug Level 0: Debug level used to test the base frame work.
+         As you can see, all storyentity data is allocated before game
+         start. the storyentity will load themselfs shortly before start
+         through the StoryEntity::init() funtion.
+      */
+    case DEBUG_CAMPAIGN_0:
+      {
+/*        Campaign* debugCampaign = new Campaign();
+
+        World* world0 = new World(DEBUG_WORLD_0);
+        world0->setNextStoryID(WORLD_ID_1);
+        debugCampaign->addEntity(world0, WORLD_ID_0);
+
+        World* world1 = new World(DEBUG_WORLD_1);
+        world1->setNextStoryID(WORLD_ID_2);
+        debugCampaign->addEntity(world1, WORLD_ID_1);
+
+        World* world2 = new World(DEBUG_WORLD_2);
+        world2->setNextStoryID(WORLD_ID_GAMEEND);
+        debugCampaign->addEntity(world2, WORLD_ID_2);
+
+        this->currentCampaign = debugCampaign;
+        break;*/
+      }
+    }
+}
+
+
+/**
+ *  starts the current entity
+ * @returns error code if this action has caused a error
+ */
+ErrorMessage GameLoader::start()
+{
+  if(this->currentCampaign != NULL)
+  {
+    this->currentCampaign->start();
+  }
+}
+
+
+/**
+ *  stops the current entity
+ * @returns error code if this action has caused a error
+ *
+ *  ATTENTION: this function shouldn't call other functions, or if so, they must return
+ *  after finishing. If you ignore or forget to do so, the current entity is not able to
+ *  terminate and it will run in the background or the ressources can't be freed or even
+ *  worse: are freed and the program will end in a segmentation fault!
+ *  hehehe, have ya seen it... :)
+ */
+void GameLoader::stop()
+{
+  if(this->currentCampaign != NULL)
+    this->currentCampaign->stop();
+}
+
+
+/**
+ *  pause the current entity
+ * @returns error code if this action has caused a error
+ *
+ * this pauses the current entity or passes this call forth to the running entity.
+ */
+ErrorMessage GameLoader::pause()
+{
+  this->isPaused = true;
+  if(this->currentCampaign != NULL)
+    this->currentCampaign->pause();
+}
+
+
+/**
+ *  resumes a pause
+ * @returns error code if this action has caused a error
+ *
+ *  this resumess the current entity or passes this call forth to the running entity.
+ */
+ErrorMessage GameLoader::resume()
+{
+  this->isPaused = false;
+  if(this->currentCampaign != NULL)
+    this->currentCampaign->resume();
+}
+
+
+/**
+ *  reads a campaign definition file into a campaign class
+ * @param fileName to be loaded
+ * @returns the loaded campaign
+ *
+ * this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
+ */
+Campaign* GameLoader::fileToCampaign(const char* fileName)
+{
+  /* do not entirely load the campaign. just the current world
+     before start of each world, it has to be initialized so it
+     can load everything it needs into memory then.
+  */
+
+  if( fileName == NULL)
+    {
+      PRINTF(2)("No filename specified for loading");
+      return NULL;
+    }
+
+  TiXmlDocument* XMLDoc = new TiXmlDocument( fileName);
+  // load the campaign document
+  if( !XMLDoc->LoadFile())
+    {
+      // report an error
+      PRINTF(1)("Could not load XML File %s: %s @ %d:%d\n", fileName, XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
+      delete XMLDoc;
+      return NULL;
+    }
+
+  // check basic validity
+  TiXmlElement* root = XMLDoc->RootElement();
+  assert( root != NULL);
+
+  if( strcmp( root->Value(), "Campaign"))
+    {
+      // report an error
+      PRINTF(2)("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
+      delete XMLDoc;
+      return NULL;
+    }
+
+  // construct campaign
+  Campaign* c = new Campaign( root);
+
+  // free the XML data
+  delete XMLDoc;
+
+  return c;
+}
+
+
+
+/**
+ *  handle keyboard commands
+ * @param event the event to handle
+ */
+void GameLoader::process(const Event& event)
+{
+  if( event.type == KeyMapper::PEV_NEXT_WORLD)
+  {
+    if( likely(event.bPressed))
+    {
+      this->switchToNextLevel();
+    }
+  }
+  else if( event.type == KeyMapper::PEV_PAUSE)
+  {
+    if( likely(event.bPressed))
+    {
+      if(this->isPaused)
+        this->resume();
+      else
+        this->pause();
+    }
+  }
+  else if( event.type == KeyMapper::PEV_QUIT)
+  {
+    if( event.bPressed) this->stop();
+  }
+  else if (event.type == EV_MAIN_QUIT)
+    this->stop();
+}
+
+
+/**
+ *  this changes to the next level
+ */
+void GameLoader::switchToNextLevel()
+{
+  if(this->currentCampaign != NULL)
+    this->currentCampaign->switchToNextLevel();
+}
+
+
Index: trunk/src/lib/util/loading/game_loader.h
===================================================================
--- trunk/src/lib/util/loading/game_loader.h	(revision 7193)
+++ trunk/src/lib/util/loading/game_loader.h	(revision 7193)
@@ -0,0 +1,79 @@
+/*!
+ * @file game_loader.h
+ *  loads campaigns, worlds and all other story_entities
+*/
+
+#ifndef _GAME_LOADER_H
+#define _GAME_LOADER_H
+
+//#include "stdincl.h"
+#include "story_def.h"
+#include "comincl.h"
+#include "event_listener.h"
+
+#include "error.h"
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class Campaign;
+class World;
+class Factory;
+class TiXmlElement;
+class BaseObject;
+class Event;
+class EventHandler;
+
+//! The GameLoader
+/**
+ *  The game loader loads all game date. this is performed in the following way:
+ * 1. Read the structure of campaings and worlds
+ * 2. Create the instances of the tree: here _ALL_ StoryEntities are created
+ *    also if they are not yet used. the worlds should load their data in
+ *    the StoryEntity::load() and StoryEntity::init() functions! NOWHERE ELSE!
+ *    Elsewhere, all the data will be allocated at the beginning... mess...
+ * 3. StoryEntities are load() and init() before they start
+ * 4. once the gamloader starts the game there will be a campaing starting a
+ *    world. this is done by callaing those StoryEntity::start()
+*/
+class GameLoader : public EventListener
+{
+ public:
+  virtual ~GameLoader ();
+  /**  this class is a singleton class @returns an instance of itself  */
+  static GameLoader* getInstance() { if(singletonRef == NULL) singletonRef = new GameLoader(); return singletonRef; }
+
+  ErrorMessage loadCampaign(const char* name);
+  ErrorMessage loadDebugCampaign(Uint32 campaignID);
+  ErrorMessage loadNetworkCampaign(const char* fileName);
+
+  ErrorMessage init();
+  ErrorMessage start();
+  void stop();
+  ErrorMessage pause();
+  ErrorMessage resume();
+
+  void switchToNextLevel();
+
+  void process(const Event &event);
+
+
+ private:
+  GameLoader ();
+
+  Campaign* fileToCampaign(const char* name);
+
+
+ private:
+  static GameLoader*     singletonRef;         //!< The singleton-reference to this object
+
+  Uint32                 startTime;            //!< start time of the campaign
+  bool                   isPaused;             //!< if the game is paused
+  bool                   bRun;                 //!< true if stop
+
+  Campaign*              currentCampaign;      //!< reference to the current campaign playing
+
+  EventHandler*          eventHandler;         //!< reference to the eventHandler
+};
+
+#endif /* _GAME_LOADER_H */
Index: trunk/src/lib/util/loading/load_param.cc
===================================================================
--- trunk/src/lib/util/loading/load_param.cc	(revision 7193)
+++ trunk/src/lib/util/loading/load_param.cc	(revision 7193)
@@ -0,0 +1,275 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
+
+#include "util/loading/load_param.h"
+#include "load_param_description.h"
+
+#include <stdarg.h>
+
+/**
+ * Constructs a new LoadParameter
+ * @param root the XML-element to load this Parameter from
+ * @param paramName the Parameter to load
+ * @param object the BaseObject, to load this parameter on to (will be cast to executor's Parameter)
+ * @param executor the Executor, that executes the loading procedure.
+ */
+CLoadParam::CLoadParam(const TiXmlElement* root, const char* paramName, BaseObject* object, const Executor& executor, bool inLoadCycle)
+{
+  this->paramName = paramName;
+  this->object = object;
+  this->inLoadCycle = inLoadCycle;
+
+  // determin the LoadString.
+  if (likely(!inLoadCycle))
+    this->loadElem = grabParameterElement(root, paramName);
+  //this->loadString = grabParameter(root, paramName);
+  else if (!strcmp(root->Value(), paramName))
+    this->loadElem = (TiXmlElement*)root->FirstChild();
+  else
+    this->loadElem = NULL;
+
+  // set the Executor.
+  this->executor = executor.clone();
+}
+
+/**
+ * This is a VERY SPECIAL deconsrtuctor.
+ * It is made, so that it loads the Parameters on destruction.
+ * meaning, if an Executor a valid Object exist, and all
+ * Execution-Conditions are met, they are executed here.
+ */
+CLoadParam::~CLoadParam()
+{
+  if (likely(this->executor != NULL))
+  {
+    if (this->loadElem != NULL &&  this->loadElem->ToText())
+      this->loadString = this->loadElem->Value();
+    else
+      this->loadString = NULL;
+    if (likely(this->object != NULL) &&
+        ( this->loadString != NULL ||
+         ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString)))
+    {
+      PRINTF(4)("Loading '%s' with Parameters '%s' onto: '%s'(%s)\n", this->paramName, this->loadString, this->object->getName(), this->object->getClassName());
+      this->executor->execute(this->object, this->loadString);
+    }
+    delete this->executor;
+  }
+}
+
+/**
+ * set the default values of the executor
+ * @param count how many default values to set.
+ * @param ... the default values !! must be at least count parameters!!
+ */
+CLoadParam& CLoadParam::defaultValues(unsigned int count, ...)
+{
+  va_list values;
+  va_start(values, count);
+
+  assert(executor != NULL);
+  this->executor->defaultValues(count, values);
+
+  return *this;
+}
+
+
+
+/**
+ * @param descriptionText The text to set as a description for this Parameter
+ * @returns a pointer to itself.
+*/
+CLoadParam& CLoadParam::describe(const char* descriptionText)
+{
+  if (LoadClassDescription::parametersDescription && this->paramDesc && !this->paramDesc->getDescription())
+    {
+      this->paramDesc->setDescription(descriptionText);
+    }
+  return *this;
+}
+
+// const LoadParamDescription* LoadParamDescription::getClass(const char* className)
+// {
+//   tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
+//   LoadClassDescription* enumClassDesc = iterator->firstElement();
+//   while (enumClassDesc)
+//   {
+//     if (!strcmp(enumClassDesc->className, classNameBegin, className))
+//     {
+//       delete iterator;
+//       return enumClassDesc;
+//     }
+//     enumClassDesc = iterator->nextElement();
+//   }
+//   delete iterator;
+//
+//   return NULL;
+// }
+
+
+
+
+/*
+ * @param object The object this Parameter is loaded too.
+ * @param root: the XML-element to load this option from.
+ * @param paramName: The name of the parameter loaded.
+ * @param paramCount: how many parameters this loading-function takes
+ * @param multi: if false LoadParam assumes only one occurence of this parameter in root, if true it assumes multiple occurences.
+ * @param ...: the parameter information (1. Parameter, 2. Default Value for the Parameter, ...)
+*/
+/*LoadParam::LoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName,
+                             int paramCount, bool multi, const void* pointerToParam, ...)
+{
+  this->setClassID(CL_LOAD_PARAM, "LoadParam");
+  this->executor = NULL;
+
+  this->loadString = NULL;
+  this->pointerToParam = pointerToParam;
+
+  if (paramCount == 0 || this->pointerToParam != NULL)
+    this->loadString = "none";
+  else
+{
+      if (likely(!multi))
+        this->loadString = grabParameter(root, paramName);
+      else
+{
+          if (!strcmp(root->Value(), paramName))
+{
+              const TiXmlNode* val = root->FirstChild();
+              if( val->ToText())
+                this->loadString = val->Value();
+}
+}
+}
+
+  this->paramDesc = NULL;
+  if (LoadClassDescription::parametersDescription)
+{
+    // locating the class
+    this->classDesc = LoadClassDescription::addClass(object->getClassName());
+
+    if ((this->paramDesc = this->classDesc->addParam(paramName)) != NULL)
+{
+
+      this->paramDesc->paramCount = paramCount;
+      this->paramDesc->types = new int[paramCount];
+      this->paramDesc->defaultValues = new char*[paramCount];
+
+      va_list types;
+      va_start (types, pointerToParam);
+      char defaultVal[512];
+      for(int i = 0; i < paramCount; i++)
+{
+        defaultVal[0] = '\0';
+          // parameters parsed
+        int tmpType = va_arg (types, int);
+        this->paramDesc->types[i] = tmpType;
+        switch (tmpType)
+{
+  case MT_INT:
+            sprintf(defaultVal, "%d", va_arg(types, int));
+            break;
+//          case MT_LONG:
+//            sprintf(defaultVal, "%0.3f", va_arg(types, l_LONG_TYPE));
+//            break;
+  case MT_FLOAT:
+            sprintf(defaultVal, "%0.3f", va_arg(types, double));
+            break;
+  case MT_STRING:
+            sprintf(defaultVal, "%s", va_arg(types, l_STRING_TYPE));
+            break;
+  case MT_EXT1:
+            sprintf(defaultVal, "");
+            break;
+}
+        this->paramDesc->defaultValues[i] = new char[strlen(defaultVal)+1];
+        strcpy(this->paramDesc->defaultValues[i], defaultVal);
+}
+      va_end(types);
+
+      int argCount = 0;
+}
+}
+}*/
+
+
+
+
+
+
+
+
+
+
+//////////////////////
+// HELPER FUNCTIONS //
+//////////////////////
+/**
+ * @param root: The XML-element to grab a parameter from
+ * @param parameterName: the parameter to grab
+ * @returns the Value of the parameter if found, NULL otherwise
+*/
+const char* grabParameter(const TiXmlElement* root, const char* parameterName)
+{
+  const TiXmlElement* element;
+  const TiXmlNode* node;
+
+  if (root == NULL || parameterName == NULL)
+    return NULL;
+  assert( parameterName != NULL);
+
+  element = root->FirstChildElement( parameterName);
+  if( element == NULL) return NULL;
+
+  node = element->FirstChild();
+  while( node != NULL)
+    {
+      if( node->ToText()) return node->Value();
+      node = node->NextSibling();
+    }
+  return NULL;
+}
+
+/**
+ * @param root: The XML-element to grab a parameter from
+ * @param parameterName: the parameter to grab
+ * @returns the Element of the parameter if found, NULL otherwise
+ */
+const TiXmlElement* grabParameterElement(const TiXmlElement* root, const char* parameterName)
+{
+  const TiXmlElement* element;
+  const TiXmlNode* node;
+
+  if (root == NULL || parameterName == NULL)
+    return NULL;
+  assert( parameterName != NULL);
+
+  element = root->FirstChildElement( parameterName);
+  if( element == NULL) return NULL;
+
+  node = element->FirstChild();
+  while( node != NULL)
+  {
+    if( node->ToText()) return (TiXmlElement*)node;
+    node = node->NextSibling();
+  }
+  return NULL;
+}
+
+
+
Index: trunk/src/lib/util/loading/load_param.h
===================================================================
--- trunk/src/lib/util/loading/load_param.h	(revision 7193)
+++ trunk/src/lib/util/loading/load_param.h	(revision 7193)
@@ -0,0 +1,117 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+/*!
+ * @file load_param.h
+ * A Class and macro-functions, that makes our lives easy to load-in parameters
+ */
+
+#ifndef _LOAD_PARAM_H
+#define _LOAD_PARAM_H
+
+#include "base_object.h"
+
+#include "executor/executor.h"
+#include "executor/executor_specials.h"
+
+#include "helper_functions.h"
+
+// Forward Declaration //
+class LoadClassDescription;
+class LoadParamDescription;
+class MultiType;
+
+
+/**
+ * Loads a Parameter from ROOT named PARAMETER_NAME
+ * onto OBJECT of CLASS, trough the FUNCTION
+ * @param ROOT the TiXmlElement to load the Parameter from
+ * @param PARAMETER_NAME the Name of the Parameter to load
+ * @param OBJECT The BaseObject to load the new setting to.
+ * @param CLASS What Class the BaseObejct is of (this is for identifying the Functuon)
+ * @param FUNCTION The function of Class to Load (if you want to call &CLASS::FUNCTION write FUNCTION here).
+ */
+#define LoadParam(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
+         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, ExecutorObjective<CLASS>(&CLASS::FUNCTION), false)
+
+#define LoadParam_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
+         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, ExecutorObjective<CLASS>(&CLASS::FUNCTION), true)
+
+#define LoadParamXML(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
+         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), false)
+
+#define LoadParamXML_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
+         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), true)
+
+
+/**
+ * this Starts a Cycle in the Loading Process
+ * be aware, that in the cycle the first parameter of load_param should because
+ * called element, and that you must say true at the Fith parameter, or it will fail
+ * also you will have to close the Cycle again with LOAD_PARAM_END_CYCLE
+ *
+ * @param ROOT The root XLM-element to search element under.
+ * @param ELEMENT the element to search
+ */
+#define LOAD_PARAM_START_CYCLE(ROOT, ELEMENT) \
+  const TiXmlElement* ELEMENT; \
+  ELEMENT= ROOT->FirstChildElement(); \
+  while( ELEMENT != NULL) \
+{
+/**
+   * closes a LoadParam Loop
+   * @see LOAD_PARAM_START_CYCLE
+   * @param ELEMENT the Element to step through.
+ */
+#define LOAD_PARAM_END_CYCLE(ELEMENT) \
+  ELEMENT = ELEMENT->NextSiblingElement(); \
+}
+
+/**************************
+**** REAL DECLARATIONS ****
+**************************/
+//! abstract Base class for a Loadable parameter
+class CLoadParam : public BaseObject
+{
+  public:
+    CLoadParam(const TiXmlElement* root, const char* paramName, BaseObject* object, const Executor& executor, bool inLoadCycle = false);
+    virtual ~CLoadParam();
+
+    CLoadParam& describe(const char* descriptionText);
+    CLoadParam& defaultValues(unsigned int count, ...);
+    CLoadParam& attribute(const char* attributeName, const Executor& executor);
+
+
+  private:
+    bool                     inLoadCycle;
+    Executor*                executor;
+    BaseObject*              object;
+    const char*              paramName;
+
+    LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this CLoadParameter
+    LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
+    const TiXmlElement*      loadElem;             //!< The Element to load.
+    const char*              loadString;           //!< The string loaded by this LoadParam
+    const void*              pointerToParam;       //!< A Pointer to a Parameter.
+
+    MultiType*               defaultValue;
+};
+
+// helper function
+
+const char* grabParameter(const TiXmlElement* root, const char* parameterName);
+const TiXmlElement* grabParameterElement(const TiXmlElement* root, const char* parameterName);
+
+#endif /* _LOAD_PARAM_H */
Index: trunk/src/lib/util/loading/load_param_description.cc
===================================================================
--- trunk/src/lib/util/loading/load_param_description.cc	(revision 7193)
+++ trunk/src/lib/util/loading/load_param_description.cc	(revision 7193)
@@ -0,0 +1,285 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#include "load_param_description.h"
+
+#include "multi_type.h"
+#include <stdarg.h>
+#include "stdlibincl.h"
+/**
+ * @param paramName the name of the parameter to load
+ */
+LoadParamDescription::LoadParamDescription(const char* paramName)
+{
+  this->types = NULL;
+  this->description = NULL;
+  this->defaultValues = NULL;
+  this->paramName = new char[strlen(paramName)+1];
+  strcpy(this->paramName, paramName);
+}
+
+/**
+ *  removes all the alocated memory
+ */
+LoadParamDescription::~LoadParamDescription()
+{
+  if (this->defaultValues != NULL)
+  {
+    for(int i = 0; i < this->paramCount; i++)
+    {
+      delete[] this->defaultValues[i];
+    }
+  }
+
+  delete[] this->types;
+  delete[] this->defaultValues;
+  delete[] this->paramName;
+  delete[] this->description;
+}
+
+/**
+ * @param descriptionText The text to set as a description for this Parameter
+ */
+void LoadParamDescription::setDescription(const char* descriptionText)
+{
+  this->description = new char[strlen(descriptionText)+1];
+  strcpy(this->description, descriptionText);
+}
+
+/**
+ *  prints out this parameter, its input method and the description (if availiable)
+ */
+void LoadParamDescription::print() const
+{
+  PRINT(3)(" <%s>", this->paramName);
+  for (int i = 0; i < this->paramCount; i++)
+  {
+    if (i > 0)
+      PRINT(3)(",");
+    // FIXME
+    //     switch (this->types[i])
+//     {
+//       default:
+//         PRINTF(3)("none");
+//         break;
+//       case ParameterBool:
+//         PRINT(3)("bool");
+//         break;
+//       case ParameterChar:
+//         PRINT(3)("char");
+//         break;
+//       case ParameterString:
+//         PRINT(3)("string");
+//         break;
+//       case ParameterInt:
+//         PRINT(3)("int");
+//         break;
+//       case ParameterUInt:
+//         PRINT(3)("Uint");
+//         break;
+//       case ParameterFloat:
+//         PRINT(3)("float");
+//         break;
+//       case ParameterLong:
+//         PRINT(3)("long");
+//         break;
+//       case ParameterXML:
+//         PRINT(3)("XML");
+//         break;
+//     }
+  }
+  PRINT(3)("</%s>", this->paramName);
+  if (this->description)
+    PRINT(3)(" -- %s", this->description);
+  // default values
+  if (this->paramCount > 0)
+  {
+    PRINT(3)(" (Default: ");
+    for (int i = 0; i < this->paramCount; i++)
+    {
+      if (i > 0)
+        PRINT(3)(", ");
+      if (this->types[i] & MT_STRING)
+      { // leave brackets !!
+        PRINT(3)("\"%s\"", this->defaultValues[i]);
+      }
+      else
+      {
+        PRINT(3)("%s", this->defaultValues[i]);
+      }
+    }
+    PRINT(3)(")");
+  }
+  PRINT(3)("\n");
+}
+
+/**
+ *  A list, that holds all the classes that are loadable (classes not objects!!)
+ */
+std::list<LoadClassDescription*>* LoadClassDescription::classList = NULL;
+
+/**
+ *  if the description of Parameters should be executed
+ */
+bool LoadClassDescription::parametersDescription = false;
+
+/**
+ * @param className the name of the class to be loadable
+ */
+LoadClassDescription::LoadClassDescription(const char* className)
+{
+  this->className = new char[strlen(className)+1];
+  strcpy(this->className, className);
+
+  if (LoadClassDescription::classList == NULL)
+    LoadClassDescription::classList = new std::list<LoadClassDescription*>;
+
+  LoadClassDescription::classList->push_back(this);
+}
+
+/**
+ *  deletes a classDescription (deletes all the parameterDescriptions as well
+ */
+LoadClassDescription::~LoadClassDescription()
+{
+  std::list<LoadParamDescription*>::iterator it = this->paramList.begin();
+  while (!this->paramList.empty())
+  {
+    delete this->paramList.front();
+    this->paramList.pop_front();
+  }
+
+  delete[] this->className;
+}
+
+void LoadClassDescription::deleteAllDescriptions()
+{
+  if (LoadClassDescription::classList != NULL)
+  {
+    while (!LoadClassDescription::classList->empty())
+    {
+      delete LoadClassDescription::classList->front();
+      LoadClassDescription::classList->pop_front();
+    }
+    delete LoadClassDescription::classList;
+  }
+  LoadClassDescription::classList = NULL;
+}
+
+
+/**
+ *  adds a class to the list of loadable classes
+ * @param className The name of the class to add
+
+   this function searches for the className string, and if found just returns the appropriate Class.
+   Otherwise it returns a new classDescription
+ */
+LoadClassDescription* LoadClassDescription::addClass(const char* className)
+{
+  if (LoadClassDescription::classList != NULL)
+  {
+    std::list<LoadClassDescription*>::iterator it = LoadClassDescription::classList->begin();
+    while (it != LoadClassDescription::classList->end())
+    {
+      if (!strcmp((*it)->className, className))
+      {
+        return (*it);
+      }
+      it++;
+    }
+  }
+  return new LoadClassDescription(className);
+}
+
+/**
+ *  does the same as addClass(const char* className), but with params
+ * @param paramName the name of the parameter to add.
+ */
+LoadParamDescription* LoadClassDescription::addParam(const char* paramName)
+{
+  std::list<LoadParamDescription*>::iterator it = this->paramList.begin();
+  while (it != this->paramList.end())
+  {
+    if (!strcmp((*it)->paramName, paramName))
+    {
+      return NULL;
+    }
+    it++;
+  }
+
+  LoadParamDescription* newParam = new LoadParamDescription(paramName);
+
+  this->paramList.push_back(newParam);
+  return newParam;
+}
+
+/**
+ *  prints out all loadable Classes, and their parameters
+ * @param fileName prints the output to a File
+ * @todo implement it
+ */
+void LoadClassDescription::printAll(const char* fileName)
+{
+  PRINT(3)("===============================================================\n");
+  PRINT(3)(" Listing all the Loadable Options (loaded since Game started).\n\n");
+  if (LoadClassDescription::classList != NULL)
+  {
+    std::list<LoadClassDescription*>::iterator classDesc = LoadClassDescription::classList->begin();
+    while (classDesc != LoadClassDescription::classList->end())
+    {
+      PRINT(3)("<%s>\n", (*classDesc)->className);
+      std::list<LoadParamDescription*>::iterator param = (*classDesc)->paramList.begin();
+      while (param != (*classDesc)->paramList.end())
+      {
+        (*param)->print();
+        param++;
+      }
+      PRINT(3)("</%s>\n\n", (*classDesc)->className);
+      classDesc++;
+    }
+  }
+  else
+    PRINT(3)("no Classes defined so far\n");
+  PRINT(3)("===============================================================\n");
+}
+
+/**
+ * searches for classes, which beginn with classNameBegin
+ * @param classNameBegin the beginning string of a Class
+ * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
+ * !! The strings MUST NOT be deleted !!
+ */
+std::list<const char*> LoadClassDescription::searchClassWithShort(const char* classNameBegin)
+{
+  /// FIXME
+  // NOT USED
+/*  unsigned int searchLength = strlen(classNameBegin);
+  std::list<const char*> retVal;
+
+  tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
+  LoadClassDescription* enumClassDesc = iterator->firstElement();
+  while (enumClassDesc)
+  {
+    if (strlen(enumClassDesc->className)>searchLength+1 &&
+        !strncasecmp(enumClassDesc->className, classNameBegin, searchLength))
+    {
+      retVal->add(enumClassDesc->className);
+    }
+    enumClassDesc = iterator->nextElement();
+  }
+  delete iterator;
+
+  return retVal;*/
+}
Index: trunk/src/lib/util/loading/load_param_description.h
===================================================================
--- trunk/src/lib/util/loading/load_param_description.h	(revision 7193)
+++ trunk/src/lib/util/loading/load_param_description.h	(revision 7193)
@@ -0,0 +1,81 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+/*!
+ * @file load_param.h
+ * A Class and macro-functions, that makes our lives easy to load-in parameters
+ */
+
+#ifndef _LOAD_PARAM_DESCRIPTION_H
+#define _LOAD_PARAM_DESCRIPTION_H
+
+#include "base_object.h"
+#include <list>
+
+// Forward Declaration //
+class MultiType;
+
+/************************
+*** DESCRIPTION STUFF ***
+************************/
+//! A class that handles the description of loadable parameters
+class LoadParamDescription
+{
+  friend class LoadParam;
+  friend class LoadClassDescription;
+ public:
+  LoadParamDescription(const char* paramName);
+  ~LoadParamDescription();
+
+  void setDescription(const char* descriptionText);
+  /** @returns the descriptionString */
+  const char* getDescription() { return this->description; };
+
+  void print() const;
+
+ private:
+  char*         paramName;             //!< The name of the parameter.
+  int           paramCount;            //!< The count of parameters.
+  int*          types;                 //!< What kind of parameters does this function take ??
+  char*         description;           //!< A longer description about this function.
+  char**        defaultValues;         //!< The 'Default Values'. @TODO MAKE THIS A MULTITYPE
+};
+
+//! A class for descriptions of a loadable module
+class LoadClassDescription
+{
+  friend class CLoadParam;
+ public:
+  LoadClassDescription(const char* className);
+  ~LoadClassDescription();
+
+  static LoadClassDescription* addClass(const char* className);
+  LoadParamDescription* addParam(const char* paramName);
+
+  static void deleteAllDescriptions();
+
+  static void printAll(const char* fileName = NULL);
+  static std::list<const char*> searchClassWithShort(const char* classNameBegin);
+//  static const LoadParamDescription* getClass(const char* className);
+
+ private:
+  static bool                              parametersDescription;  //!< if parameter-description should be enabled.
+  static std::list<LoadClassDescription*>* classList;              //!< a list, that stores all the loadable classes. (after one instance has been loaded)
+  char*                                    className;              //!< name of the class
+
+  std::list<LoadParamDescription*>         paramList;              //!< List of parameters this class knows.
+};
+
+#endif /* _LOAD_PARAM_DESCRIPTION_H */
Index: trunk/src/lib/util/loading/resource.cc
===================================================================
--- trunk/src/lib/util/loading/resource.cc	(revision 7193)
+++ trunk/src/lib/util/loading/resource.cc	(revision 7193)
@@ -0,0 +1,50 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: ...
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
+
+#include "resource.h"
+
+using namespace std;
+
+
+/**
+ * standard constructor
+ * @todo this constructor is not jet implemented - do it
+*/
+Resource::Resource ()
+{
+   this->setClassID(CL_RESOURCE, "Resource");
+
+   /* If you make a new class, what is most probably the case when you write this file
+      don't forget to:
+       1. Add the new file new_class.cc to the ./src/Makefile.am
+       2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS
+
+      Advanced Topics:
+      - if you want to let your object be managed via the ObjectManager make sure to read
+        the object_manager.h header comments. You will use this most certanly only if you
+        make many objects of your class, like a weapon bullet.
+   */
+}
+
+
+/**
+ * standard deconstructor
+*/
+Resource::~Resource ()
+{
+  // delete what has to be deleted here
+}
Index: trunk/src/lib/util/loading/resource.h
===================================================================
--- trunk/src/lib/util/loading/resource.h	(revision 7193)
+++ trunk/src/lib/util/loading/resource.h	(revision 7193)
@@ -0,0 +1,32 @@
+/*!
+ * @file resource.h
+ * @brief Definition of ...
+*/
+
+#ifndef _RESOURCE_H
+#define _RESOURCE_H
+
+#include "base_object.h"
+#include "multi_type.h"
+
+
+// FORWARD DECLARATION
+
+
+
+//! A class for ...
+class Resource : virtual public BaseObject {
+
+ public:
+  Resource();
+  virtual ~Resource();
+
+  virtual bool load(const char* fileName, const MultiType& param1, const MultiType& param2);
+  virtual bool reload();
+  virtual bool unload();
+
+ private:
+
+};
+
+#endif /* _RESOURCE_H */
Index: trunk/src/lib/util/loading/resource_manager.cc
===================================================================
--- trunk/src/lib/util/loading/resource_manager.cc	(revision 7193)
+++ trunk/src/lib/util/loading/resource_manager.cc	(revision 7193)
@@ -0,0 +1,1092 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
+
+#include "util/loading/resource_manager.h"
+
+#include "substring.h"
+#include "debug.h"
+
+#include <algorithm>
+#include <assert.h>
+
+// different resource Types
+#ifndef NO_MODEL
+#include "objModel.h"
+#include "primitive_model.h"
+#include "md2Model.h"
+#endif /* NO_MODEL */
+#ifndef NO_TEXTURES
+#include "texture.h"
+#endif /* NO_TEXTURES */
+#ifndef NO_TEXT
+#include "font.h"
+#endif /* NO_TEXT */
+#ifndef NO_AUDIO
+#include "sound_buffer.h"
+#include "ogg_player.h"
+#endif /* NO_AUDIO */
+#ifndef NO_SHADERS
+#include "shader.h"
+#endif /* NO_SHADERS */
+
+// File Handling Includes
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+using namespace std;
+
+/**
+ * @brief standard constructor
+*/
+ResourceManager::ResourceManager ()
+{
+  this->setClassID(CL_RESOURCE_MANAGER, "ResourceManager");
+  this->setName("ResourceManager");
+
+  this->dataDir = new char[3];
+  strcpy(this->dataDir, "./");
+  this->tryDataDir("./data");
+}
+
+//! Singleton Reference to the ResourceManager
+ResourceManager* ResourceManager::singletonRef = NULL;
+
+/**
+ * @brief standard destructor
+*/
+ResourceManager::~ResourceManager ()
+{
+  // deleting the Resources-List
+  this->unloadAllByPriority(RP_GAME);
+
+  if (!this->resourceList.empty())
+    PRINTF(1)("Not removed all Resources, since there are still %d resources registered\n", this->resourceList.size());
+
+  // deleting the Directorie Lists
+  while (!this->imageDirs.empty())
+  {
+    delete[] this->imageDirs.back();
+    this->imageDirs.pop_back();
+  }
+
+  delete[] this->dataDir;
+
+  ResourceManager::singletonRef = NULL;
+}
+
+/**
+ * @brief sets the data main directory
+ * @param dataDir the DataDirectory.
+ */
+bool ResourceManager::setDataDir(const char* dataDir)
+{
+  char* realDir = ResourceManager::homeDirCheck(dataDir);
+  if (isDir(realDir))
+  {
+    delete[] this->dataDir;
+    if (dataDir[strlen(dataDir)-1] == '/' || dataDir[strlen(dataDir)-1] == '\\')
+    {
+      this->dataDir = new char[strlen(realDir)+1];
+      strcpy(this->dataDir, realDir);
+    }
+    else
+    {
+      this->dataDir = new char[strlen(realDir)+2];
+      strcpy(this->dataDir, realDir);
+      this->dataDir[strlen(realDir)] = '/';
+      this->dataDir[strlen(realDir)+1] = '\0';
+    }
+    delete[] realDir;
+    return true;
+  }
+  else
+  {
+    PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", realDir, this->dataDir);
+    delete[] realDir;
+    return false;
+  }
+}
+
+/**
+ * @brief sets the data main directory
+ * @param dataDir the DataDirectory.
+ *
+ * this is essentially the same as setDataDir, but it ommits the error-message
+ */
+bool ResourceManager::tryDataDir(const char* dataDir)
+{
+  char* realDir = ResourceManager::homeDirCheck(dataDir);
+  if (isDir(realDir))
+  {
+    delete[] this->dataDir;
+    if (dataDir[strlen(dataDir)-1] == '/' || dataDir[strlen(dataDir)-1] == '\\')
+    {
+      this->dataDir = new char[strlen(realDir)+1];
+      strcpy(this->dataDir, realDir);
+    }
+    else
+    {
+      this->dataDir = new char[strlen(realDir)+2];
+      strcpy(this->dataDir, realDir);
+      this->dataDir[strlen(realDir)] = '/';
+      this->dataDir[strlen(realDir)+1] = '\0';
+    }
+    delete[] realDir;
+    return true;
+  }
+  delete[] realDir;
+  return false;
+}
+
+
+/**
+ * @brief checks for the DataDirectory, by looking if
+ * @param fileInside is iniside of the given directory.
+*/
+bool ResourceManager::verifyDataDir(const char* fileInside)
+{
+  bool retVal;
+  if (!isDir(this->dataDir))
+  {
+    PRINTF(1)("%s is not a directory\n", this->dataDir);
+    return false;
+  }
+
+  char* testFile = new char[strlen(this->dataDir)+strlen(fileInside)+1];
+  sprintf(testFile, "%s%s", this->dataDir, fileInside);
+  retVal = isFile(testFile);
+  delete[] testFile;
+  return retVal;
+}
+
+#ifndef NO_TEXTURES
+/**
+ * @brief adds a new Path for Images
+ * @param imageDir The path to insert
+ * @returns true, if the Path was well and injected (or already existent within the list)
+   false otherwise
+*/
+bool ResourceManager::addImageDir(const char* imageDir)
+{
+  if (imageDir == NULL)
+    return false;
+
+  char* newDir;
+  if (imageDir[strlen(imageDir)-1] == '/' || imageDir[strlen(imageDir)-1] == '\\')
+  {
+    newDir = new char[strlen(imageDir)+1];
+    strcpy(newDir, imageDir);
+  }
+  else
+  {
+    newDir = new char[strlen(imageDir)+2];
+    strcpy(newDir, imageDir);
+    newDir[strlen(imageDir)] = '/';
+    newDir[strlen(imageDir)+1] = '\0';
+  }
+  // check if the param is a Directory
+  if (isDir(newDir))
+  {
+    // check if the Directory has been added before
+    std::vector<char*>::const_iterator imageDir;
+    for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
+    {
+      if (!strcmp(*imageDir, newDir))
+      {
+        PRINTF(3)("Path %s already loaded\n", newDir);
+        delete[] newDir;
+        return true;
+      }
+    }
+    // adding the directory to the List
+    this->imageDirs.push_back(newDir);
+    return true;
+  }
+  else
+  {
+    PRINTF(1)("%s is not a Directory, and can not be added to the Paths of Images\n", newDir);
+    delete[] newDir;
+    return false;
+  }
+}
+#endif /* NO_TEXTURES */
+
+/**
+ * @brief loads resources
+ * @param fileName: The fileName of the resource to load
+ * @param prio: The ResourcePriority of this resource (will only be increased)
+ * @param param0: an additional option to parse (see the constuctors for more help)
+ * @param param1: an additional option to parse (see the constuctors for more help)
+ * @param param2: an additional option to parse (see the constuctors for more help)
+ * @returns a pointer to a desired Resource.
+*/
+BaseObject* ResourceManager::load(const char* fileName, ResourcePriority prio,
+                                  const MultiType& param0, const MultiType& param1, const MultiType& param2)
+{
+  if (fileName == NULL)
+    return NULL;
+  ResourceType tmpType;
+#ifndef NO_MODEL
+#define __IF_OK
+  if (!strncasecmp(fileName+(strlen(fileName)-4), ".obj", 4))
+    tmpType = OBJ;
+  else if (!strncmp(fileName+(strlen(fileName)-4), ".md2", 4))
+    tmpType = MD2;
+  else if (!strcasecmp(fileName, "cube") ||
+           !strcasecmp(fileName, "sphere") ||
+           !strcasecmp(fileName, "plane") ||
+           !strcasecmp(fileName, "cylinder") ||
+           !strcasecmp(fileName, "cone"))
+    tmpType = PRIM;
+#endif /* NO_MODEL */
+#ifndef NO_AUDIO
+#ifdef __IF_OK
+  else
+#endif
+#define __IF_OK
+    if (!strncasecmp(fileName+(strlen(fileName)-4), ".wav", 4))
+      tmpType = WAV;
+    else if (!strncasecmp(fileName+(strlen(fileName)-4), ".mp3", 4))
+      tmpType = MP3;
+    else if (!strncasecmp(fileName+(strlen(fileName)-4), ".ogg", 4))
+      tmpType = OGG;
+#endif /* NO_AUDIO */
+#ifndef NO_TEXT
+#ifdef __IF_OK
+    else
+#endif
+#define __IF_OK
+      if (!strncasecmp(fileName+(strlen(fileName)-4), ".ttf", 4))
+        tmpType = TTF;
+#endif /* NO_TEXT */
+#ifndef NO_SHADERS
+#ifdef __IF_OK
+      else
+#endif
+#define __IF_OK
+        if (!strncasecmp(fileName+(strlen(fileName)-5), ".vert", 5))
+          tmpType = SHADER;
+#endif /* NO_SHADERS */
+#ifndef NO_TEXTURES
+#ifdef __IF_OK
+        else
+#else
+  if
+#endif
+          tmpType = IMAGE;
+#endif /* NO_TEXTURES */
+#undef __IF_OK
+  return this->load(fileName, tmpType, prio, param0, param1, param2);
+}
+
+/**
+ * @brief caches a Resource
+ *
+ * @see load;
+ *
+ * @brief returns true if ok, false otherwise.
+ * This function loads a Resource without applying it to an Object.
+ * This is for loading purposes, e.g, when the user is loading a Resource
+ * during the initialisation instead of at Runtime.
+ */
+bool ResourceManager::cache(const char* fileName, ResourceType type, ResourcePriority prio,
+                            const MultiType& param0, const MultiType& param1, const MultiType& param2)
+{
+  assert(fileName != NULL);
+
+  // searching if the resource was loaded before.
+  Resource* tmpResource;
+  // check if we already loaded this Resource
+  tmpResource = this->locateResourceByInfo(fileName, type, param0, param1, param2);
+  // otherwise load it
+  if (tmpResource == NULL)
+    tmpResource = this->loadResource(fileName, type, prio, param0, param1, param2);
+  // return cached pointer.
+  if (tmpResource != NULL) // if the resource was loaded before.
+  {
+    if(tmpResource->prio < prio)
+      tmpResource->prio = prio;
+    return true;
+  }
+  else
+    return false;
+}
+
+/**
+ * tells the ResourceManager to generate a Copy of the Resource.
+ * @brief resourcePointer: The Pointer to the resource to copy
+ * @returns the Resource pointed to resourcePointer.
+ */
+BaseObject* ResourceManager::copy(BaseObject* resourcePointer)
+{
+  Resource* tmp = locateResourceByPointer(resourcePointer);
+  if (tmp!=NULL)
+  {
+    tmp->count++;
+    return tmp->pointer;
+  }
+  else
+    return NULL;
+}
+
+
+/**
+ * @brief loads resources
+ * @param fileName: The fileName of the resource to load
+ * @param type: The Type of Resource to load.
+ * @param prio: The ResourcePriority of this resource (will only be increased)
+ * @param param0: an additional option to parse (see the constuctors for more help)
+ * @param param1: an additional option to parse (see the constuctors for more help)
+ * @param param2: an additional option to parse (see the constuctors for more help)
+ * @returns a pointer to a desired Resource.
+*/
+BaseObject* ResourceManager::load(const char* fileName, ResourceType type, ResourcePriority prio,
+                                  const MultiType& param0, const MultiType& param1, const MultiType& param2)
+{
+  assert(fileName != NULL);
+
+  // searching if the resource was loaded before.
+  Resource* tmpResource;
+  // check if we already loaded this Resource
+  tmpResource = this->locateResourceByInfo(fileName, type, param0, param1, param2);
+  // otherwise load it
+  if (tmpResource == NULL)
+  {
+    tmpResource = this->loadResource(fileName, type, prio, param0, param1, param2);
+  }
+  // return cached pointer.
+  if (tmpResource != NULL) // if the resource was loaded before.
+  {
+    tmpResource->count++;
+    if(tmpResource->prio < prio)
+      tmpResource->prio = prio;
+
+    return tmpResource->pointer;
+  }
+  else
+    return NULL;
+}
+
+
+/**
+ * @brief loads resources for internal purposes
+ * @param fileName: The fileName of the resource to load
+ * @param type: The Type of Resource to load.
+ * @param prio: The ResourcePriority of this resource (will only be increased)
+ * @param param0: an additional option to parse (see the constuctors for more help)
+ * @param param1: an additional option to parse (see the constuctors for more help)
+ * @param param2: an additional option to parse (see the constuctors for more help)
+ * @returns a pointer to a desired Resource.
+ */
+Resource* ResourceManager::loadResource(const char* fileName, ResourceType type, ResourcePriority prio,
+                                        const MultiType& param0, const MultiType& param1, const MultiType& param2)
+{
+  // Setting up the new Resource
+  Resource* tmpResource = new Resource;
+  tmpResource->count = 0;
+  tmpResource->type = type;
+  tmpResource->prio = prio;
+  tmpResource->pointer = NULL;
+  tmpResource->name = new char[strlen(fileName)+1];
+  strcpy(tmpResource->name, fileName);
+
+  // creating the full name. (directoryName + FileName)
+  char* fullName = ResourceManager::getFullName(fileName);
+  // Checking for the type of resource \see ResourceType
+  switch(type)
+  {
+#ifndef NO_MODEL
+    case OBJ:
+      if (param0.getType() != MT_NULL)
+        tmpResource->param[0] = param0;
+      else
+        tmpResource->param[0] = 1.0f;
+
+      if(ResourceManager::isFile(fullName))
+        tmpResource->pointer = new OBJModel(fullName, tmpResource->param[0].getFloat());
+      else
+      {
+        PRINTF(2)("File %s in %s does not exist. Loading a cube-Model instead\n", fileName, dataDir);
+        tmpResource->pointer = ResourceManager::load("cube", PRIM, prio, tmpResource->param[0].getFloat());
+      }
+      break;
+    case PRIM:
+      if (param0 != MT_NULL)
+        tmpResource->param[0] = param0;
+      else
+        tmpResource->param[0] = 1.0f;
+
+      if (!strcmp(tmpResource->name, "cube"))
+        tmpResource->pointer = new PrimitiveModel(PRIM_CUBE, tmpResource->param[0].getFloat());
+      else if (!strcmp(tmpResource->name, "sphere"))
+        tmpResource->pointer = new PrimitiveModel(PRIM_SPHERE, tmpResource->param[0].getFloat());
+      else if (!strcmp(tmpResource->name, "plane"))
+        tmpResource->pointer = new PrimitiveModel(PRIM_PLANE, tmpResource->param[0].getFloat());
+      else if (!strcmp(tmpResource->name, "cylinder"))
+        tmpResource->pointer = new PrimitiveModel(PRIM_CYLINDER, tmpResource->param[0].getFloat());
+      else if (!strcmp(tmpResource->name, "cone"))
+        tmpResource->pointer = new PrimitiveModel(PRIM_CONE, tmpResource->param[0].getFloat());
+      break;
+    case MD2:
+      if(ResourceManager::isFile(fullName))
+      {
+        tmpResource->param[0] = param0;
+        tmpResource->param[1] = param1;
+        tmpResource->pointer = new MD2Data(fullName, tmpResource->param[0].getString(), tmpResource->param[1].getFloat());
+      }
+      break;
+#endif /* NO_MODEL */
+#ifndef NO_TEXT
+    case TTF:
+      if (param0 != MT_NULL)
+      {
+        assert(param0.getInt() >= 0);
+        tmpResource->param[0] = param0;
+      }
+      else
+        tmpResource->param[0] = FONT_DEFAULT_RENDER_SIZE;
+
+      if(isFile(fullName))
+        tmpResource->pointer = new Font(fullName, (unsigned int) tmpResource->param[0].getInt());
+      else
+        PRINTF(2)("%s does not exist in %s. Not loading Font\n", fileName, this->dataDir);
+      break;
+#endif /* NO_TEXT */
+#ifndef NO_AUDIO
+    case WAV:
+      if(isFile(fullName))
+        tmpResource->pointer = new SoundBuffer(fullName);
+      break;
+    case OGG:
+      if (isFile(fullName))
+        tmpResource->pointer = new OggPlayer(fullName);
+      break;
+#endif /* NO_AUDIO */
+#ifndef NO_TEXTURES
+    case IMAGE:
+      if (param0 != MT_NULL)
+        tmpResource->param[0] = param0;
+      else
+        tmpResource->param[0] = GL_TEXTURE_2D;
+      if(isFile(fullName))
+      {
+        PRINTF(4)("Image %s resides to %s\n", fileName, fullName);
+        tmpResource->pointer = new Texture(fullName, tmpResource->param[0].getInt());
+      }
+      else
+      {
+        std::vector<char*>::iterator imageDir;
+        for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
+        {
+          char* imgName = new char[strlen(*imageDir)+strlen(fileName)+1];
+          sprintf(imgName, "%s%s", *imageDir, fileName);
+          if(isFile(imgName))
+          {
+            PRINTF(4)("Image %s resides to %s\n", fileName, imgName);
+            tmpResource->pointer = new Texture(imgName, tmpResource->param[0].getInt());
+            delete[] imgName;
+            break;
+          }
+          delete[] imgName;
+        }
+      }
+      if(!tmpResource)
+        PRINTF(2)("!!Image %s not Found!!\n", fileName);
+      break;
+#endif /* NO_TEXTURES */
+#ifndef NO_SHADERS
+    case SHADER:
+      if(ResourceManager::isFile(fullName))
+      {
+        if (param0 != MT_NULL)
+        {
+          MultiType param = param0; /// HACK
+          char* secFullName = ResourceManager::getFullName(param.getString());
+          if (ResourceManager::isFile(secFullName))
+          {
+            tmpResource->param[0] = secFullName;
+            tmpResource->pointer = new Shader(fullName, secFullName);
+          }
+          delete[] secFullName;
+        }
+        else
+        {
+          tmpResource->param[0] = param0;
+          tmpResource->pointer = new Shader(fullName, NULL);
+        }
+      }
+      break;
+#endif /* NO_SHADERS */
+    default:
+      tmpResource->pointer = NULL;
+      PRINTF(1)("No type found for %s.\n   !!This should not happen unless the Type is not supported yet. JUST DO IT!!\n", tmpResource->name);
+      break;
+  }
+  if (tmpResource->pointer != NULL)
+    this->resourceList.push_back(tmpResource);
+  delete[] fullName;
+
+
+  if (tmpResource->pointer != NULL)
+    return tmpResource;
+  else
+  {
+    PRINTF(2)("Resource %s could not be loaded\n", fileName);
+    delete[] tmpResource->name;
+    delete tmpResource;
+    return NULL;
+  }
+}
+
+/**
+ * @brief unloads a Resource
+ * @param pointer: The pointer to free
+ * @param prio: the PriorityLevel to unload this resource
+ * @returns true if successful (pointer found, and deleted), false otherwise
+*/
+bool ResourceManager::unload(BaseObject* pointer, ResourcePriority prio)
+{
+  if (pointer == NULL)
+    return false;
+  // if pointer is existent. and only one resource of this type exists.
+  Resource* tmpResource = this->locateResourceByPointer(pointer);
+  if (tmpResource != NULL)
+    return unload(tmpResource, prio);
+  else
+  {
+    PRINTF(2)("Resource not Found %p\n", pointer);
+    return false;
+  }
+}
+
+/**
+ * @brief unloads a Resource
+ * @param resource: The resource to unloade
+ * @param prio the PriorityLevel to unload this resource
+ * @returns true on success, false otherwise.
+*/
+bool ResourceManager::unload(Resource* resource, ResourcePriority prio)
+{
+  if (resource == NULL)
+    return false;
+  if (resource->count > 0)
+    resource->count--;
+
+  if (resource->prio <= prio)
+  {
+    if (resource->count == 0)
+    {
+      delete resource->pointer;
+      // deleting the List Entry:
+      PRINTF(4)("Resource %s safely removed.\n", resource->name);
+      delete[] resource->name;
+      std::vector<Resource*>::iterator resourceIT = std::find(this->resourceList.begin(), this->resourceList.end(), resource);
+      this->resourceList.erase(resourceIT);
+      delete resource;
+    }
+    else
+      PRINTF(4)("Resource %s not removed, because there are still %d References to it.\n", resource->name, resource->count);
+  }
+  else
+    PRINTF(4)("not deleting resource %s because DeleteLevel to high\n", resource->name);
+  return true;
+}
+
+
+/**
+ * @brief unloads all alocated Memory of Resources with a pririty lower than prio
+ * @param prio The priority to delete
+*/
+bool ResourceManager::unloadAllByPriority(ResourcePriority prio)
+{
+  unsigned int removeCount;
+  for (unsigned int round = 0; round < 3; round++)
+  {
+    int index = this->resourceList.size() - 1;
+    removeCount = 0;
+    while (index >= 0)
+    {
+      if (this->resourceList[index]->prio <= prio)
+      {
+        if (this->resourceList[index]->count == 0)
+          unload(this->resourceList[index], prio);
+        else
+        {
+          if (round == 3)
+            PRINTF(2)("unable to unload %s because there are still %d references to it\n",
+                      this->resourceList[index]->name, this->resourceList[index]->count);
+          removeCount++;
+        }
+      }
+      index--;
+    }
+    if (removeCount == 0) break;
+  }
+}
+
+
+/**
+ * @brief Searches for a Resource by some information
+ * @param fileName: The name to look for
+ * @param type the Type of resource to locate.
+ * @param param0: an additional option to parse (see the constuctors for more help)
+ * @param param1: an additional option to parse (see the constuctors for more help)
+ * @param param2: an additional option to parse (see the constuctors for more help)
+ * @returns a Pointer to the Resource if found, NULL otherwise.
+*/
+Resource* ResourceManager::locateResourceByInfo(const char* fileName, ResourceType type,
+    const MultiType& param0, const MultiType& param1, const MultiType& param2) const
+{
+  std::vector<Resource*>::const_iterator resource;
+  for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++)
+  {
+    if ((*resource)->type == type && !strcmp(fileName, (*resource)->name))
+    {
+      bool match = false;
+      switch (type)
+      {
+#ifndef NO_MODEL
+        case PRIM:
+        case OBJ:
+          if (param0 == MT_NULL)
+          {
+            if ((*resource)->param[0] == 1.0f)
+              match = true;
+          }
+          else if ((*resource)->param[0] == param0.getFloat())
+            match = true;
+          break;
+        case MD2:
+          if (param0 == MT_NULL && ((*resource)->param[0] == "") && param1 == MT_NULL && ((*resource)->param[0] == 1.0f))
+              match = true;
+          else if ((*resource)->param[0] == ((MultiType)param0).getString() && (*resource)->param[1] == ((MultiType)param1).getFloat())
+            match = true;
+          break;
+#endif /* NO_MODEL */
+#ifndef NO_TEXT
+        case TTF:
+          if (param0 == MT_NULL)
+          {
+            if ((*resource)->param[0] == FONT_DEFAULT_RENDER_SIZE)
+              match = true;
+          }
+          else if ((*resource)->param[0] == param0.getInt())
+            match = true;
+          break;
+#endif /* NO_TEXT */
+#ifndef NO_SHADERS
+        case SHADER:
+          if (param0 == MT_NULL)
+          {
+            if ((*resource)->param[0] == "")
+              match = true;
+          }
+          else if ((*resource)->param[0] == ((MultiType)param0).getString())
+            match = true;
+          break;
+#endif /* NO_SHADERS */
+#ifndef NO_TEXTURES
+        case IMAGE:
+          if (param0 == MT_NULL)
+          {
+            if ((*resource)->param[0] == GL_TEXTURE_2D)
+              match = true;
+          }
+          else if ((*resource)->param[0] ==  param0.getInt())
+            match = true;
+          break;
+#endif /* NO_TEXTURES */
+        default:
+          match = true;
+          break;
+      }
+      if (match)
+      {
+        return (*resource);
+      }
+    }
+  }
+  return NULL;
+}
+
+/**
+ * @brief Searches for a Resource by Pointer
+ * @param pointer the Pointer to search for
+ * @returns a Pointer to the Resource if found, NULL otherwise.
+ */
+Resource* ResourceManager::locateResourceByPointer(const void* pointer) const
+{
+  //  Resource* enumRes = resourceList->enumerate();
+  std::vector<Resource*>::const_iterator resource;
+  for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++)
+    if (pointer == (*resource)->pointer)
+      return (*resource);
+  return NULL;
+}
+
+char* ResourceManager::toResourcableString(unsigned int i)
+{
+  int len = strlen(ResourceManager::ResourceTypeToChar(this->resourceList[i]->type));
+  len += strlen(this->resourceList[i]->name);
+  if (this->resourceList[i]->param[0].getString()) len += strlen(this->resourceList[i]->param[0].getString()) +1;
+  if (this->resourceList[i]->param[1].getString()) len += strlen(this->resourceList[i]->param[1].getString()) +1;
+  if (this->resourceList[i]->param[2].getString()) len += strlen(this->resourceList[i]->param[2].getString()) +1;
+  len += 10;
+  char* tmp = new char[len];
+  tmp[0] = '\0';
+  strcat( tmp, ResourceManager::ResourceTypeToChar(this->resourceList[i]->type));
+  strcat(tmp,",");
+  strcat (tmp, this->resourceList[i]->name);
+  if (this->resourceList[i]->param[0].getString() && this->resourceList[i]->param[0].getString() != '\0')
+  {
+    strcat(tmp,",");
+    strcat( tmp, this->resourceList[i]->param[0].getString());
+  }
+  if (this->resourceList[i]->param[1].getString() && this->resourceList[i]->param[1].getString() != '\0')
+  {
+    strcat(tmp,",");
+    strcat( tmp, this->resourceList[i]->param[1].getString());
+  }
+  if (this->resourceList[i]->param[2].getString() && this->resourceList[i]->param[2].getString() != '\0')
+  {
+    strcat(tmp,",");
+    strcat( tmp, this->resourceList[i]->param[2].getString());
+  }
+  return tmp;
+}
+
+/**
+ * @brief caches a Resource from a ResourceableString created with the toResourcableString-function
+ * @param resourceableString the String to cache the resource from.
+ */
+bool ResourceManager::fromResourceableString(const char* resourceableString)
+{
+  SubString splits(resourceableString, ',');
+  splits.debug();
+  if (splits.getCount() == 2)
+    this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
+                RP_LEVEL);
+  else if (splits.getCount() == 3)
+    return this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
+                RP_LEVEL, splits[2]);
+  else if (splits.getCount() == 4)
+    return this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
+                RP_LEVEL, splits[2], splits[3]);
+  else if (splits.getCount() == 5)
+    return this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
+                RP_LEVEL, splits[2], splits[3], splits[4]);
+}
+
+
+/**
+ * @brief Checks if it is a Directory
+ * @param directoryName the Directory to check for
+ * @returns true if it is a directory/symlink false otherwise
+*/
+bool ResourceManager::isDir(const char* directoryName)
+{
+  if (directoryName == NULL)
+    return false;
+
+  char* tmpDirName = NULL;
+  struct stat status;
+
+  // checking for the termination of the string given. If there is a "/" at the end cut it away
+  if (directoryName[strlen(directoryName)-1] == '/' ||
+      directoryName[strlen(directoryName)-1] == '\\')
+  {
+    tmpDirName = new char[strlen(directoryName)];
+    strncpy(tmpDirName, directoryName, strlen(directoryName)-1);
+    tmpDirName[strlen(directoryName)-1] = '\0';
+  }
+  else
+  {
+    tmpDirName = new char[strlen(directoryName)+1];
+    strcpy(tmpDirName, directoryName);
+  }
+
+  if(!stat(tmpDirName, &status))
+  {
+    if (status.st_mode & (S_IFDIR
+#ifndef __WIN32__
+                          | S_IFLNK
+#endif
+                         ))
+    {
+      delete[] tmpDirName;
+      return true;
+    }
+    else
+    {
+      delete[] tmpDirName;
+      return false;
+    }
+  }
+  else
+  {
+    delete[] tmpDirName;
+    return false;
+  }
+}
+
+/**
+ * @brief Checks if the file is either a Regular file or a Symlink
+ * @param fileName the File to check for
+ * @returns true if it is a regular file/symlink, false otherwise
+*/
+bool ResourceManager::isFile(const char* fileName)
+{
+  if (fileName == NULL)
+    return false;
+  char* tmpFileName = ResourceManager::homeDirCheck(fileName);
+  // actually checks the File
+  struct stat status;
+  if (!stat(tmpFileName, &status))
+  {
+    if (status.st_mode & (S_IFREG
+#ifndef __WIN32__
+                          | S_IFLNK
+#endif
+                         ))
+    {
+      delete[] tmpFileName;
+      return true;
+    }
+    else
+    {
+      delete[] tmpFileName;
+      return false;
+    }
+  }
+  else
+  {
+    delete[] tmpFileName;
+    return false;
+  }
+}
+
+/**
+ * @brief touches a File on the disk (thereby creating it)
+ * @param fileName The file to touch
+*/
+bool ResourceManager::touchFile(const char* fileName)
+{
+  char* tmpName = ResourceManager::homeDirCheck(fileName);
+  if (tmpName == NULL)
+    return false;
+  FILE* stream;
+  if( (stream = fopen (tmpName, "w")) == NULL)
+  {
+    PRINTF(1)("could not open %s fro writing\n", fileName);
+    delete[] tmpName;
+    return false;
+  }
+  fclose(stream);
+
+  delete[] tmpName;
+}
+
+/**
+ * @brief deletes a File from disk
+ * @param fileName the File to delete
+*/
+bool ResourceManager::deleteFile(const char* fileName)
+{
+  if (fileName == NULL)
+    return false;
+  char* tmpName = ResourceManager::homeDirCheck(fileName);
+  unlink(tmpName);
+  delete[] tmpName;
+}
+
+/**
+ * @param name the Name of the file to check
+ * @returns The name of the file, including the HomeDir
+ * IMPORTANT: this has to be deleted from the outside
+ */
+char* ResourceManager::homeDirCheck(const char* name)
+{
+  if (name == NULL)
+    return NULL;
+  char* retName;
+  if (!strncmp(name, "~/", 2))
+  {
+    char tmpFileName[500];
+#ifdef __WIN32__
+    strcpy(tmpFileName, getenv("USERPROFILE"));
+#else
+    strcpy(tmpFileName, getenv("HOME"));
+#endif
+    retName = new char[strlen(tmpFileName)+strlen(name)];
+    sprintf(retName, "%s%s", tmpFileName, name+1);
+  }
+  else
+  {
+    retName = new char[strlen(name)+1];
+    strcpy(retName, name);
+  }
+  return retName;
+}
+
+/**
+ * @param fileName the Name of the File to check
+ * @returns The full name of the file, including the DataDir, and NULL if the file does not exist
+ * !!IMPORTANT: this has to be deleted from the outside!!
+*/
+char* ResourceManager::getFullName(const char* fileName)
+{
+  if (fileName == NULL || ResourceManager::getInstance()->getDataDir() == NULL)
+    return NULL;
+
+  char* retName = new char[strlen(ResourceManager::getInstance()->getDataDir())
+                           + strlen(fileName) + 1];
+  sprintf(retName, "%s%s", ResourceManager::getInstance()->getDataDir(), fileName);
+  if (ResourceManager::isFile(retName) || ResourceManager::isDir(retName))
+    return retName;
+  else
+  {
+    delete[] retName;
+    return NULL;
+  }
+}
+
+
+/**
+ * @brief checks wether a file is in the DataDir.
+ * @param fileName the File to check if it is in the Data-Dir structure.
+ * @returns true if the file exists, false otherwise
+ */
+bool ResourceManager::isInDataDir(const char* fileName)
+{
+  if (fileName == NULL || ResourceManager::getInstance()->getDataDir() == NULL)
+    return false;
+
+  bool retVal = false;
+  char* checkFile = new char[strlen(ResourceManager::getInstance()->getDataDir())
+                             + strlen(fileName) + 1];
+  sprintf(checkFile, "%s%s", ResourceManager::getInstance()->getDataDir(), fileName);
+
+  if (ResourceManager::isFile(checkFile) || ResourceManager::isDir(checkFile))
+    retVal = true;
+  else
+    retVal = false;
+  delete[] checkFile;
+  return retVal;
+}
+
+
+/**
+ * @brief outputs debug information about the ResourceManager
+ */
+void ResourceManager::debug() const
+{
+  PRINT(0)("=RM===================================\n");
+  PRINT(0)("= RESOURCE-MANAGER DEBUG INFORMATION =\n");
+  PRINT(0)("======================================\n");
+  // if it is not initialized
+  PRINT(0)(" Reference is: %p\n", ResourceManager::singletonRef);
+  PRINT(0)(" Data-Directory is: %s\n", this->dataDir);
+  PRINT(0)(" List of Image-Directories: ");
+  std::vector<char*>::const_iterator imageDir;
+  for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
+    PRINT(0)("%s ", (*imageDir));
+  PRINT(0)("\n");
+
+  PRINT(0)("List of all stored Resources:\n");
+  std::vector<Resource*>::const_iterator resource;
+  for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++)
+
+  {
+    PRINT(0)("-----------------------------------------\n");
+    PRINT(0)("Name: %s; References: %d; Type: %s ", (*resource)->name, (*resource)->count, ResourceManager::ResourceTypeToChar((*resource)->type));
+
+    PRINT(0)("gets deleted at ");
+    switch((*resource)->prio)
+    {
+      default:
+      case RP_NO:
+        PRINT(0)("first posibility (0)\n");
+        break;
+      case RP_LEVEL:
+        PRINT(0)("the end of the Level (1)\n");
+        break;
+      case RP_CAMPAIGN:
+        PRINT(0)("the end of the campaign (2)\n");
+        break;
+      case RP_GAME:
+        PRINT(0)("when leaving the game (3)\n");
+        break;
+    }
+  }
+
+
+
+  PRINT(0)("==================================RM==\n");
+}
+
+
+/**
+ * @brief converts a ResourceType into the corresponding String
+ * @param type the ResourceType to translate
+ * @returns the converted String.
+ */
+const char* ResourceManager::ResourceTypeToChar(ResourceType type)
+{
+  return ResourceManager::resourceNames[type];
+}
+
+/**
+ * @brief converts a String into a ResourceType (good for loading)
+ * @param resourceType the name of the Type
+ * @returns the Number of the Type, or 0 (defautl) if not found.
+ */
+ResourceType ResourceManager::stringToResourceType(const char* resourceType)
+{
+  assert(resourceType != NULL);
+  for (unsigned int i = 0; i < RESOURCE_TYPE_SIZE; i++)
+    if (!strcmp(resourceType, ResourceManager::resourceNames[i]))
+      return (ResourceType)i;
+  return (ResourceType)0;
+}
+
+/**
+ * The Names of the ResourceTypes
+ */
+const char* ResourceManager::resourceNames[] =
+  {
+#ifndef NO_MODEL
+    "ObjectModel",
+    "PrimitiveModel",
+    "MD2-Data",
+#endif
+#ifndef NO_TEXT
+    "Font",
+#endif
+#ifndef NO_AUDIO
+    "Wav",
+    "mp3",
+    "ogg",
+#endif
+#ifndef NO_TEXTURES
+    "Texture",
+#endif
+#ifndef NO_SHADERS
+    "Shader",
+#endif
+
+  };
Index: trunk/src/lib/util/loading/resource_manager.h
===================================================================
--- trunk/src/lib/util/loading/resource_manager.h	(revision 7193)
+++ trunk/src/lib/util/loading/resource_manager.h	(revision 7193)
@@ -0,0 +1,159 @@
+/*!
+ * @file resource_manager.h
+  *  The Resource Manager checks if a file/resource is loaded.
+
+    If a file/resource was already loaded the resourceManager will
+    return a void pointer to the desired resource.
+    Otherwise it will instruct the coresponding resource-loader to load,
+    and receive a pointer to it.
+
+    it is possible to compile the resource Manager without some modules by
+    just adding the compile flag -D....
+    (NO_MODEL)
+    (NO_AUDIO)
+    (NO_TEXT)
+    (NO_TEXTURES)
+    (NO_SHADERS)
+*/
+
+#ifndef _RESOURCE_MANAGER_H
+#define _RESOURCE_MANAGER_H
+
+#include "base_object.h"
+#include "multi_type.h"
+
+#include <vector>
+
+//! An eumerator for different fileTypes the resourceManager supports
+typedef enum ResourceType
+{
+#ifndef NO_MODEL
+  OBJ,                  //!< loading .obj file
+  PRIM,                 //!< loading primitive model
+  MD2,                  //!< loading md2-file
+#endif /* NO_MODEL */
+#ifndef NO_TEXT
+  TTF,                  //!< loading a TrueTypeFont
+#endif /* NO_TEXT */
+#ifndef NO_AUDIO
+  WAV,                  //!< loading wav
+  MP3,                  //!< loading mp3
+  OGG,                  //!< loading ogg
+#endif /* NO_AUDIO */
+#ifndef NO_TEXTURES
+  IMAGE,                //!< loading an image
+#endif /* NO_TEXTURES */
+#ifndef NO_SHADERS
+  SHADER,               //!< openGL-shader program
+#endif /* NO_SHADERS */
+  RESOURCE_TYPE_SIZE
+};
+
+//! An enumerator for different UNLOAD-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      =   4
+};
+
+//! A Struct that keeps track about a resource its name its Type, and so on
+struct Resource
+{
+  BaseObject*       pointer;           //!< Pointer to the Resource.
+  unsigned int      count;             //!< How many times this Resource has been loaded.
+
+  char*             name;              //!< Name of the Resource.
+  ResourceType      type;              //!< ResourceType of this Resource.
+  ResourcePriority  prio;              //!< The Priority of this resource. (This will only be increased)
+
+  MultiType         param[3];          //!< The Parameters given to this Resource.
+};
+
+
+//! The ResourceManager is a class, that decides if a file/resource should be loaded
+/**
+ * If a file/resource was already loaded the resourceManager will
+ * return a pointer to the desired resource.
+ * Otherwise it will instruct the corresponding resource-loader to load,
+ * and receive the pointer to it.
+ *
+ * It does it by looking, if a desired file has already been loaded.
+ * There is also the possibility to check for some variables
+ */
+class ResourceManager : public BaseObject
+{
+ public:
+  virtual ~ResourceManager();
+  /** @returns a Pointer to the only object of this Class */
+  inline static ResourceManager* getInstance() { if (!singletonRef) singletonRef = new ResourceManager();  return singletonRef; };
+
+  bool setDataDir(const char* dataDir);
+  /** @returns the Name of the data directory */
+  inline const char* getDataDir() const { return this->dataDir; };
+
+
+  bool tryDataDir(const char* dataDir);
+  bool verifyDataDir(const char* fileInside);
+  bool addImageDir(const char* imageDir);
+
+  bool cache(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO,
+             const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
+  BaseObject* copy(BaseObject* resourcePointer);
+
+  BaseObject* load(const char* fileName, ResourcePriority prio = RP_NO,
+                   const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
+  BaseObject* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO,
+                   const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
+  bool unload(BaseObject* pointer, ResourcePriority prio = RP_NO);
+  bool unload(Resource* resource, ResourcePriority = RP_NO);
+  bool unloadAllByPriority(ResourcePriority prio);
+
+  Resource* locateResourceByInfo(const char* fileName, ResourceType type,
+                                 const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType()) const;
+  Resource* locateResourceByPointer(const void* pointer) const;
+
+  char* toResourcableString(unsigned int i);
+  bool fromResourceableString(const char* resourceableString);
+  /** @returns the Count of Resources the ResourceManager handles */
+  unsigned int resourceCount() const { return this->resourceList.size(); }
+
+  void debug() const;
+
+
+  // utility functions for handling files in and around the data-directory
+  static bool isDir(const char* directory);
+  static bool isFile(const char* fileName);
+  static bool touchFile(const char* fileName);
+  static bool deleteFile(const char* fileName);
+  static char* homeDirCheck(const char* fileName);
+  static char* getFullName(const char* fileName);
+  static bool isInDataDir(const char* fileName);
+
+  static const char* ResourceTypeToChar(ResourceType type);
+  static ResourceType stringToResourceType(const char* resourceType);
+
+ private:
+  ResourceManager();
+  Resource* loadResource(const char* fileName, ResourceType type, ResourcePriority prio,
+                         const MultiType& param0, const MultiType& param1, const MultiType& param2);
+
+ private:
+  static ResourceManager*  singletonRef;       //!< singleton Reference
+
+  char*                    dataDir;            //!< The Data Directory, where all relevant Data is stored.
+  std::vector<char*>       imageDirs;          //!< A list of directories in which images are stored.
+
+  std::vector<Resource*>   resourceList;       //!< The List of Resources, that has already been loaded.
+
+  static const char*       resourceNames[RESOURCE_TYPE_SIZE];
+};
+
+#endif /* _RESOURCE_MANAGER_H */
