Index: trunk/src/lib/BuildLibs.am
===================================================================
--- trunk/src/lib/BuildLibs.am	(revision 9682)
+++ trunk/src/lib/BuildLibs.am	(revision 9869)
@@ -1,16 +1,9 @@
 
 libORXlibs_a_LIBRARIES_ = \
-                $(LIB_PREFIX)/util/libORXlibutil.a \
-                $(LIB_PREFIX)/shell/libORXshell.a \
                 $(LIB_PREFIX)/event/libORXevent.a \
                 $(LIB_PREFIX)/gui/qt/libORXqtgui.a \
                 $(LIB_PREFIX)/gui/gl/libORXglgui.a \
                 $(LIB_PREFIX)/gui/libORXbasegui.a \
-                $(LIB_PREFIX)/script_engine/libORXscript.a \
-                $(LIB_PREFIX)/graphics/importer/libORXimporter.a \
                 $(LIB_PREFIX)/graphics/libORXgraphics.a \
-                $(LIB_PREFIX)/graphics/importer/libtc.a \
-                $(LIB_PREFIX)/sound/libORXsound.a \
-                $(LIB_PREFIX)/particles/libORXparticles.a \
                 $(LIB_PREFIX)/collision_detection/libORXcd.a \
                 $(LIB_PREFIX)/collision_reaction/libORXcr.a \
@@ -23,7 +16,13 @@
                 $(LIB_PREFIX)/physics/libORXphysics.a \
                 $(LIB_PREFIX)/gui/gl/libORXglgui.a \
+                \
+                $(LIB_PREFIX)/graphics/importer/libORXimporter.a \
+                $(LIB_PREFIX)/graphics/importer/libtc.a \
+                $(LIB_PREFIX)/sound/libORXsound.a \
                 $(LIB_PREFIX)/shell/libORXshell.a \
-                $(LIB_PREFIX)/math/libORXmath.a \
+                $(LIB_PREFIX)/script_engine/libORXscript.a \
+                $(LIB_PREFIX)/util/libORXexecutor.a \
                 $(LIB_PREFIX)/util/libORXlibutil.a \
                 $(LIB_PREFIX)/lang/libORXlang.a \
-                $(LIB_PREFIX)/libORXlibs.a
+                $(LIB_PREFIX)/libORXlibs.a \
+                $(LIB_PREFIX)/math/libORXmath.a
Index: trunk/src/lib/Makefile.am
===================================================================
--- trunk/src/lib/Makefile.am	(revision 9682)
+++ trunk/src/lib/Makefile.am	(revision 9869)
@@ -25,10 +25,9 @@
 	event \
 	physics \
-	particles \
 	collision_detection \
 	collision_reaction \
 	gui \
 	network \
+	shell \
 	parser \
-	shell \
 	script_engine
Index: trunk/src/lib/collision_detection/aabb.cc
===================================================================
--- trunk/src/lib/collision_detection/aabb.cc	(revision 9682)
+++ trunk/src/lib/collision_detection/aabb.cc	(revision 9869)
@@ -21,5 +21,5 @@
 
 
-
+ObjectListDefinition(AABB);
 /**
  *  standard constructor
@@ -27,5 +27,5 @@
 AABB::AABB ()
 {
-   this->setClassID(CL_OBB, "AABB");
+  this->registerObject(this, AABB::_objectList);
    this->halfLength[0] = this->halfLength[1] = this->halfLength[2] = 0.0f;
    this->bCollided = false;
Index: trunk/src/lib/collision_detection/aabb.h
===================================================================
--- trunk/src/lib/collision_detection/aabb.h	(revision 9682)
+++ trunk/src/lib/collision_detection/aabb.h	(revision 9869)
@@ -11,8 +11,7 @@
 #include "bounding_volume.h"
 
-template<class T> class tList;
-
 //! A class representing an extended bounding volume tree: an obb tree
 class AABB : public BoundingVolume {
+  ObjectListDeclaration(AABB);
 
  public:
Index: trunk/src/lib/collision_detection/aabb_tree_node.cc
===================================================================
--- trunk/src/lib/collision_detection/aabb_tree_node.cc	(revision 9682)
+++ trunk/src/lib/collision_detection/aabb_tree_node.cc	(revision 9869)
@@ -32,12 +32,7 @@
 #include "debug.h"
 
-
-
-
-
-
 GLUquadricObj* AABBTreeNode_sphereObj = NULL;
 
-
+ObjectListDefinition(AABBTreeNode);
 /**
  *  standard constructor
@@ -48,5 +43,5 @@
     : BVTreeNode()
 {
-  this->setClassID(CL_OBB_TREE_NODE, "AABBTreeNode");
+  this->registerObject(this, AABBTreeNode::_objectList);
 
   this->obbTree = &tree;
Index: trunk/src/lib/collision_detection/aabb_tree_node.h
===================================================================
--- trunk/src/lib/collision_detection/aabb_tree_node.h	(revision 9682)
+++ trunk/src/lib/collision_detection/aabb_tree_node.h	(revision 9869)
@@ -21,4 +21,5 @@
 class AABBTreeNode : public BVTreeNode
 {
+  ObjectListDeclaration(AABBTreeNode);
 
 
Index: trunk/src/lib/collision_detection/bounding_sphere.cc
===================================================================
--- trunk/src/lib/collision_detection/bounding_sphere.cc	(revision 9682)
+++ trunk/src/lib/collision_detection/bounding_sphere.cc	(revision 9869)
@@ -20,5 +20,5 @@
 
 
-
+ObjectListDefinition(BoundingSphere);
 /**
  *  standard constructor
@@ -26,5 +26,5 @@
 BoundingSphere::BoundingSphere ()
 {
-   this->setClassID(CL_BOUNDING_SPHERE, "BoundingSphere");
+  this->registerObject(this, BoundingSphere::_objectList);
 }
 
Index: trunk/src/lib/collision_detection/bounding_sphere.h
===================================================================
--- trunk/src/lib/collision_detection/bounding_sphere.h	(revision 9682)
+++ trunk/src/lib/collision_detection/bounding_sphere.h	(revision 9869)
@@ -1,3 +1,3 @@
-/*! 
+/*!
  * @file bounding_sphere.h
   *  Definition of a bounding sphere
@@ -14,4 +14,5 @@
 //! A class representing an extended bounding volume tree: an sphere
 class BoundingSphere : public BoundingVolume {
+  ObjectListDeclaration(BoundingSphere);
 
  public:
Index: trunk/src/lib/collision_detection/bounding_volume.cc
===================================================================
--- trunk/src/lib/collision_detection/bounding_volume.cc	(revision 9682)
+++ trunk/src/lib/collision_detection/bounding_volume.cc	(revision 9869)
@@ -20,5 +20,5 @@
 
 
-
+ObjectListDefinition(BoundingVolume);
 /**
  *  standard constructor
@@ -26,5 +26,5 @@
 BoundingVolume::BoundingVolume ()
 {
-  this->setClassID(CL_BOUNDING_VOLUME, "BoundingVolume");
+  this->registerObject(this, BoundingVolume::_objectList);
   this->modelInf = NULL;
   this->triangleIndexes = NULL;
Index: trunk/src/lib/collision_detection/bounding_volume.h
===================================================================
--- trunk/src/lib/collision_detection/bounding_volume.h	(revision 9682)
+++ trunk/src/lib/collision_detection/bounding_volume.h	(revision 9869)
@@ -17,4 +17,5 @@
 //! An abstract class representing a bounding volume
 class BoundingVolume : public BaseObject {
+  ObjectListDeclaration(BoundingVolume);
 
   public:
Index: trunk/src/lib/collision_detection/bv_tree.cc
===================================================================
--- trunk/src/lib/collision_detection/bv_tree.cc	(revision 9682)
+++ trunk/src/lib/collision_detection/bv_tree.cc	(revision 9869)
@@ -21,5 +21,5 @@
 
 
-
+ObjectListDefinition(BVTree);
 /**
  *  standard constructor
@@ -27,5 +27,5 @@
 BVTree::BVTree ()
 {
-   this->setClassID(CL_BV_TREE, "BVTree");
+  this->registerObject(this, BVTree::_objectList);
 
 }
Index: trunk/src/lib/collision_detection/bv_tree.h
===================================================================
--- trunk/src/lib/collision_detection/bv_tree.h	(revision 9682)
+++ trunk/src/lib/collision_detection/bv_tree.h	(revision 9869)
@@ -36,4 +36,5 @@
 class BVTree : public BaseObject
 {
+  ObjectListDeclaration(BVTree);
 
   public:
Index: trunk/src/lib/collision_detection/bv_tree_node.cc
===================================================================
--- trunk/src/lib/collision_detection/bv_tree_node.cc	(revision 9682)
+++ trunk/src/lib/collision_detection/bv_tree_node.cc	(revision 9869)
@@ -20,5 +20,5 @@
 
 
-
+ObjectListDefinition(BVTreeNode);
 /**
  *  standard constructor
@@ -26,5 +26,5 @@
 BVTreeNode::BVTreeNode ()
 {
-   this->setClassID(CL_BV_TREE_NODE, "BVTreeNode");
+  this->registerObject(this, BVTreeNode::_objectList);
 
 }
Index: trunk/src/lib/collision_detection/bv_tree_node.h
===================================================================
--- trunk/src/lib/collision_detection/bv_tree_node.h	(revision 9682)
+++ trunk/src/lib/collision_detection/bv_tree_node.h	(revision 9869)
@@ -24,4 +24,5 @@
 //! A class that represents a bounding volume tree
 class BVTreeNode : public BaseObject {
+  ObjectListDeclaration(BVTreeNode);
 
 
Index: trunk/src/lib/collision_detection/cd_engine.cc
===================================================================
--- trunk/src/lib/collision_detection/cd_engine.cc	(revision 9682)
+++ trunk/src/lib/collision_detection/cd_engine.cc	(revision 9869)
@@ -20,6 +20,4 @@
 #include "debug.h"
 
-#include "class_list.h"
-
 #include "model.h"
 #include "world_entity.h"
@@ -36,11 +34,11 @@
 
 
-
+ObjectListDefinition(CDEngine);
 /**
- *  standard constructor
+ * @brief standard constructor
  */
 CDEngine::CDEngine ()
 {
-  this->setClassID(CL_CD_ENGINE, "CDEngine");
+  this->registerObject(this, CDEngine::_objectList);
 
   this->bAbordOnFirstCollision = false;
@@ -103,13 +101,9 @@
 void CDEngine::checkCollisionGround(std::list<WorldEntity*>& list1)
 {
-
-  std::list<BaseObject*>::const_iterator bspIterator;
   std::list<WorldEntity*>::iterator entityIterator;
-  const std::list<BaseObject*>* bspList = ClassList::getList(CL_BSP_ENTITY);
-  if( bspList == NULL)
-    return;
-
   // for all bsp managers check all entities
-  for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++) {
+  for( ObjectList<BspEntity>::const_iterator bspIterator = BspEntity::objectList().begin();
+       bspIterator != BspEntity::objectList().end();
+       bspIterator++) {
       for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++)
       {
Index: trunk/src/lib/collision_detection/cd_engine.h
===================================================================
--- trunk/src/lib/collision_detection/cd_engine.h	(revision 9682)
+++ trunk/src/lib/collision_detection/cd_engine.h	(revision 9869)
@@ -36,4 +36,5 @@
 //! The class representing the collision detection system of orxonox
 class CDEngine : public BaseObject {
+  ObjectListDeclaration(CDEngine);
 
   friend class WorldEntity;
Index: trunk/src/lib/collision_detection/obb.cc
===================================================================
--- trunk/src/lib/collision_detection/obb.cc	(revision 9682)
+++ trunk/src/lib/collision_detection/obb.cc	(revision 9869)
@@ -21,5 +21,5 @@
 
 
-
+ObjectListDefinition(OBB);
 /**
  *  standard constructor
@@ -27,5 +27,5 @@
 OBB::OBB ()
 {
-   this->setClassID(CL_OBB, "OBB");
+  this->registerObject(this, OBB::_objectList);
    this->halfLength[0] = this->halfLength[1] = this->halfLength[2] = 0.0f;
    this->bCollided = false;
Index: trunk/src/lib/collision_detection/obb.h
===================================================================
--- trunk/src/lib/collision_detection/obb.h	(revision 9682)
+++ trunk/src/lib/collision_detection/obb.h	(revision 9869)
@@ -15,4 +15,5 @@
 //! A class representing an extended bounding volume tree: an obb tree
 class OBB : public BoundingVolume {
+  ObjectListDeclaration(OBB);
 
  public:
Index: trunk/src/lib/collision_detection/obb_tree.cc
===================================================================
--- trunk/src/lib/collision_detection/obb_tree.cc	(revision 9682)
+++ trunk/src/lib/collision_detection/obb_tree.cc	(revision 9869)
@@ -27,5 +27,5 @@
 
 
-
+ObjectListDefinition(OBBTree);
 /**
  *  standard constructor
@@ -51,5 +51,5 @@
 void OBBTree::init()
 {
-  this->setClassID(CL_OBB_TREE, "OBBTree");
+  this->registerObject(this, OBBTree::_objectList);
   this->rootNode = NULL;
   this->id = 0;
Index: trunk/src/lib/collision_detection/obb_tree.h
===================================================================
--- trunk/src/lib/collision_detection/obb_tree.h	(revision 9682)
+++ trunk/src/lib/collision_detection/obb_tree.h	(revision 9869)
@@ -20,4 +20,5 @@
 class OBBTree : public BVTree
 {
+  ObjectListDeclaration(OBBTree);
 
   public:
Index: trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 9682)
+++ trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 9869)
@@ -38,5 +38,5 @@
 GLUquadricObj* OBBTreeNode_sphereObj = NULL;
 
-
+ObjectListDefinition(OBBTreeNode);
 /**
  *  standard constructor
@@ -47,5 +47,5 @@
     : BVTreeNode()
 {
-  this->setClassID(CL_OBB_TREE_NODE, "OBBTreeNode");
+  this->registerObject(this, OBBTreeNode::_objectList);
 
   this->obbTree = &tree;
@@ -284,5 +284,5 @@
 
 /**
- *  calculate the eigenvectors for the object oriented box
+ * @brief calculate the eigenvectors for the object oriented box
  * @param box: reference to the box
  * @param modelInf: the model info structure of the model
@@ -361,5 +361,5 @@
 
 /**
- *  this separates an ob-box in the middle
+ * @brief this separates an ob-box in the middle
  * @param box: the box to separate
  *
Index: trunk/src/lib/collision_detection/obb_tree_node.h
===================================================================
--- trunk/src/lib/collision_detection/obb_tree_node.h	(revision 9682)
+++ trunk/src/lib/collision_detection/obb_tree_node.h	(revision 9869)
@@ -17,10 +17,8 @@
 class PNode;
 
-
 //! A class that represents a bounding volume tree
 class OBBTreeNode : public BVTreeNode
 {
-
-
+  ObjectListDeclaration(OBBTreeNode);
   public:
     OBBTreeNode(const OBBTree& tree, OBBTreeNode* prev, int depth);
Index: trunk/src/lib/collision_reaction/collision.cc
===================================================================
--- trunk/src/lib/collision_reaction/collision.cc	(revision 9682)
+++ trunk/src/lib/collision_reaction/collision.cc	(revision 9869)
@@ -18,7 +18,4 @@
 #include "collision.h"
 #include "debug.h"
-
-
-
 
 /**
Index: trunk/src/lib/collision_reaction/collision.h
===================================================================
--- trunk/src/lib/collision_reaction/collision.h	(revision 9682)
+++ trunk/src/lib/collision_reaction/collision.h	(revision 9869)
@@ -21,5 +21,4 @@
 class Collision
 {
-
   public:
     Collision();
Index: trunk/src/lib/collision_reaction/collision_event.cc
===================================================================
--- trunk/src/lib/collision_reaction/collision_event.cc	(revision 9682)
+++ trunk/src/lib/collision_reaction/collision_event.cc	(revision 9869)
@@ -18,7 +18,4 @@
 #include "collision_event.h"
 #include "debug.h"
-
-
-
 
 /**
Index: trunk/src/lib/collision_reaction/collision_event.h
===================================================================
--- trunk/src/lib/collision_reaction/collision_event.h	(revision 9682)
+++ trunk/src/lib/collision_reaction/collision_event.h	(revision 9869)
@@ -20,5 +20,4 @@
 //! A class representing a simple collision
 class CollisionEvent {
-
  public:
    CollisionEvent();
Index: trunk/src/lib/collision_reaction/collision_handle.cc
===================================================================
--- trunk/src/lib/collision_reaction/collision_handle.cc	(revision 9682)
+++ trunk/src/lib/collision_reaction/collision_handle.cc	(revision 9869)
@@ -30,5 +30,5 @@
 
 
-
+ObjectListDefinition(CollisionHandle);
 
 /**
@@ -38,5 +38,5 @@
 CollisionHandle::CollisionHandle (WorldEntity* owner, CREngine::CRType type)
 {
-  this->setClassID(CL_COLLISION_HANDLE, "CollisionHandle");
+  this->registerObject(this, CollisionHandle::_objectList);
 
   this->owner = owner;
@@ -94,16 +94,16 @@
  *  @param classID the classid to look for
  */
-void CollisionHandle::addTarget(long target)
+void CollisionHandle::addTarget(const ClassID& target)
 {
   // make sure there is no dublicate
-  std::vector<long>::iterator it = this->targetList.begin();
+  std::vector<ClassID>::iterator it = this->targetList.begin();
   for( ; it < this->targetList.end(); it++)
     if( (*it) == target)
       return;
 
+
   // add element
-   PRINTF(5)("addTarget: %i \n", target);
-
-   this->targetList.push_back(target);
+  this->targetList.push_back(target);
+   PRINTF(5)("addTarget: %i \n", target.id());
 }
 
@@ -227,5 +227,5 @@
 bool CollisionHandle::filterCollisionEvent(CollisionEvent* collisionEvent)
 {
-  std::vector<long>::iterator it = this->targetList.begin();
+  std::vector<ClassID>::iterator it = this->targetList.begin();
   for(; it < this->targetList.end(); it++)
   {
@@ -253,13 +253,13 @@
 
     if( collisionEvent->getEntityA() == this->owner) {
-      if( collisionEvent->getEntityB()->isA((ClassID)(*it))) {
+      if( collisionEvent->getEntityB()->isA((*it))) {
         PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
-                  collisionEvent->getEntityB()->getClassCName(), *it);
+	collisionEvent->getEntityB()->getClassCName(), (*it).id());
         return true; }
     }
     else {
-      if( collisionEvent->getEntityA()->isA((ClassID)(*it))) {
+      if( collisionEvent->getEntityA()->isA((*it))) {
         PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
-                  collisionEvent->getEntityA()->getClassCName(), *it);
+	collisionEvent->getEntityA()->getClassCName(), (*it).id());
       return true; }
     }
@@ -276,5 +276,5 @@
 bool CollisionHandle::filterCollision(Collision* collision)
 {
-  std::vector<long>::iterator it = this->targetList.begin();
+  std::vector<ClassID>::iterator it = this->targetList.begin();
   for(; it < this->targetList.end(); it++)
   {
@@ -302,8 +302,8 @@
 
     if( collision->getEntityA() == this->owner) {
-      if( collision->getEntityA()->isA((ClassID)(*it)))
+      if( collision->getEntityA()->isA(*it))
         return true; }
       else {
-        if( collision->getEntityB()->isA((ClassID)(*it)))
+        if( collision->getEntityB()->isA(*it))
           return true; }
   }
Index: trunk/src/lib/collision_reaction/collision_handle.h
===================================================================
--- trunk/src/lib/collision_reaction/collision_handle.h	(revision 9682)
+++ trunk/src/lib/collision_reaction/collision_handle.h	(revision 9869)
@@ -23,5 +23,5 @@
 class CollisionHandle : public BaseObject
 {
-
+  ObjectListDeclaration(CollisionHandle);
   public:
     CollisionHandle(WorldEntity* owner, CREngine::CRType type);
@@ -30,5 +30,5 @@
     void reset();
 
-    void addTarget(long target);
+    void addTarget(const ClassID& target);
     Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB);
     void registerSharedCollision(Collision* collision);
@@ -64,5 +64,6 @@
 
     std::vector<Collision*>       collisionList;           //!< a list full of collisions
-    std::vector<long>             targetList;              //!< a list of target classes for filtering
+    /// TODO Take a std::set here!
+    std::vector<ClassID>          targetList;              //!< a list of target classes for filtering @TODO TAKE SET INSTEAD OF VECTOR HERE
 
     CollisionReaction*            collisionReaction;       //!< reference to the collision reaction object
Index: trunk/src/lib/collision_reaction/collision_reaction.cc
===================================================================
--- trunk/src/lib/collision_reaction/collision_reaction.cc	(revision 9682)
+++ trunk/src/lib/collision_reaction/collision_reaction.cc	(revision 9869)
@@ -20,5 +20,5 @@
 
 
-
+ObjectListDefinition(CollisionReaction);
 
 /**
@@ -28,5 +28,5 @@
   : BaseObject()
 {
-  this->setClassID(CL_COLLISION_REACTION, "CollisionReaction");
+  this->registerObject(this, CollisionReaction::_objectList);
 }
 
Index: trunk/src/lib/collision_reaction/collision_reaction.h
===================================================================
--- trunk/src/lib/collision_reaction/collision_reaction.h	(revision 9682)
+++ trunk/src/lib/collision_reaction/collision_reaction.h	(revision 9869)
@@ -18,5 +18,5 @@
 class CollisionReaction : public BaseObject
 {
-
+  ObjectListDeclaration(CollisionReaction);
   public:
     CollisionReaction();
Index: trunk/src/lib/collision_reaction/cr_engine.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_engine.cc	(revision 9682)
+++ trunk/src/lib/collision_reaction/cr_engine.cc	(revision 9869)
@@ -29,5 +29,5 @@
 
 
-
+ObjectListDefinition(CREngine);
 /**
  * standard constructor
@@ -36,5 +36,5 @@
   : BaseObject()
 {
-   this->setClassID(CL_CR_ENGINE, "CREngine");
+  this->registerObject(this, CREngine::_objectList);
    this->setName("CREngine");
 
Index: trunk/src/lib/collision_reaction/cr_engine.h
===================================================================
--- trunk/src/lib/collision_reaction/cr_engine.h	(revision 9682)
+++ trunk/src/lib/collision_reaction/cr_engine.h	(revision 9869)
@@ -25,4 +25,5 @@
 class CREngine : public BaseObject
 {
+  ObjectListDeclaration(CREngine);
 
   public:
Index: trunk/src/lib/collision_reaction/cr_object_damage.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_object_damage.cc	(revision 9682)
+++ trunk/src/lib/collision_reaction/cr_object_damage.cc	(revision 9869)
@@ -28,5 +28,5 @@
 
 
-
+ObjectListDefinition(CRObjectDamage);
 /**
  *  standard constructor
@@ -35,6 +35,5 @@
   : CollisionReaction()
 {
-  this->setClassID(CL_CR_OBJECT_DAMAGE, "CRObjectDamage");
-
+  this->registerObject(this, CRObjectDamage::_objectList);
 }
 
Index: trunk/src/lib/collision_reaction/cr_object_damage.h
===================================================================
--- trunk/src/lib/collision_reaction/cr_object_damage.h	(revision 9682)
+++ trunk/src/lib/collision_reaction/cr_object_damage.h	(revision 9869)
@@ -15,4 +15,5 @@
 class CRObjectDamage : public CollisionReaction
 {
+  ObjectListDeclaration(CRObjectDamage);
   public:
     CRObjectDamage();
Index: trunk/src/lib/collision_reaction/cr_physics_full_walk.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_physics_full_walk.cc	(revision 9682)
+++ trunk/src/lib/collision_reaction/cr_physics_full_walk.cc	(revision 9869)
@@ -35,5 +35,5 @@
 
 
-
+ObjectListDefinition(CRPhysicsFullWalk);
 /**
  *  standard constructor
@@ -42,5 +42,5 @@
     : CollisionReaction()
 {
-  this->setClassID(CL_CR_PHYSICS_FULL_WALK, "CRPhysicsFullWalk");
+  this->registerObject(this, CRPhysicsFullWalk::_objectList);
 }
 
Index: trunk/src/lib/collision_reaction/cr_physics_full_walk.h
===================================================================
--- trunk/src/lib/collision_reaction/cr_physics_full_walk.h	(revision 9682)
+++ trunk/src/lib/collision_reaction/cr_physics_full_walk.h	(revision 9869)
@@ -15,4 +15,5 @@
 class CRPhysicsFullWalk : public CollisionReaction
 {
+  ObjectListDeclaration(CRPhysicsFullWalk);
   public:
     CRPhysicsFullWalk();
Index: trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc	(revision 9682)
+++ trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc	(revision 9869)
@@ -35,5 +35,5 @@
 
 
-
+ObjectListDefinition(CRPhysicsGroundWalk);
 /**
  *  standard constructor
@@ -42,5 +42,5 @@
     : CollisionReaction()
 {
-  this->setClassID(CL_CR_PHYSICS_GROUND_WALK, "CRPhysicsGroundWalk");
+  this->registerObject(this, CRPhysicsGroundWalk::_objectList);
 }
 
Index: trunk/src/lib/collision_reaction/cr_physics_ground_walk.h
===================================================================
--- trunk/src/lib/collision_reaction/cr_physics_ground_walk.h	(revision 9682)
+++ trunk/src/lib/collision_reaction/cr_physics_ground_walk.h	(revision 9869)
@@ -15,4 +15,5 @@
 class CRPhysicsGroundWalk : public CollisionReaction
 {
+  ObjectListDeclaration(CRPhysicsGroundWalk);
   public:
     CRPhysicsGroundWalk();
Index: trunk/src/lib/coord/p_node.cc
===================================================================
--- trunk/src/lib/coord/p_node.cc	(revision 9682)
+++ trunk/src/lib/coord/p_node.cc	(revision 9869)
@@ -19,5 +19,4 @@
 
 #include "util/loading/load_param.h"
-#include "class_list.h"
 
 #include "netdefs.h"
@@ -30,4 +29,6 @@
 #include "color.h"
 
+
+ObjectListDefinition(PNode);
 /**
  * @brief standard constructor
@@ -38,5 +39,5 @@
   : BaseObject(), Synchronizeable()
 {
-  this->setClassID(CL_PARENT_NODE, "PNode");
+  this->registerObject(this, PNode::_objectList);
 
   this->bRelCoorChanged = true;
@@ -79,19 +80,25 @@
   PRINTF(4)("delete %s::%s\n", this->getClassCName(), this->getCName());
   // remove the Node, delete it's children (if required).
-  std::list<PNode*>::iterator deleteNode;
-  unsigned int size;
+  PNode* last = NULL;
+  //this->debugNode(0);
+
   while(!this->children.empty())
   {
-    deleteNode = this->children.begin();
-    size = this->children.size();
+    PNode* deleteNode = this->children.front();
+    if (deleteNode == last)
+    {
+      PRINTF(1)("Node same as last that was tried to be deleted. FORCE reparent to NULL of %p\n", deleteNode);
+      (deleteNode->setParent( NULL));
+      continue;
+    }
     if ((this->parentMode & PNODE_PROHIBIT_CHILD_DELETE) ||
-        ((*deleteNode)->parentMode & PNODE_PROHIBIT_DELETE_WITH_PARENT))
+        (deleteNode->parentMode & PNODE_PROHIBIT_DELETE_WITH_PARENT))
     {
-      if (this == PNode::nullParent && (*deleteNode)->parentMode & PNODE_REPARENT_TO_NULL)
+      if (this == PNode::nullParent && deleteNode->parentMode & PNODE_REPARENT_TO_NULL)
       {
         PRINTF(4)("%s::%s deletes %s::%s\n",
                   this->getClassCName(), this->getCName(),
-                  (*deleteNode)->getClassCName(), (*deleteNode)->getCName());
-        delete (*deleteNode);
+                  deleteNode->getClassCName(), deleteNode->getCName());
+        delete deleteNode;
       }
       else
@@ -99,6 +106,6 @@
         PRINTF(4)("%s::%s reparents %s::%s\n",
                   this->getClassCName(), this->getCName(),
-                  (*deleteNode)->getClassCName(), (*deleteNode)->getCName());
-        (*deleteNode)->reparent();
+                  deleteNode->getClassCName(), deleteNode->getCName());
+        deleteNode->reparent();
       }
     }
@@ -107,7 +114,8 @@
       PRINTF(4)("%s::%s deletes PNode: %s::%s\n",
                 this->getClassCName(), this->getCName(),
-                (*deleteNode)->getClassCName(), (*deleteNode)->getCName());
-      delete (*deleteNode);
+                deleteNode->getClassCName(), deleteNode->getCName());
+      delete deleteNode;
     }
+    last = deleteNode;
   }
 
@@ -541,5 +549,5 @@
 void PNode::addChild (const std::string& childName)
 {
-  PNode* childNode = dynamic_cast<PNode*>(ClassList::getObject(childName, CL_PARENT_NODE));
+  PNode* childNode = PNode::objectList().getObject(childName);
   //  PRINTF(0)("Adding the Child: %s to: %s\n", childName, this->getName());
   //  assert( childNode != NULL );
@@ -625,5 +633,5 @@
 void PNode::setParent (const std::string& parentName)
 {
-  PNode* parentNode = dynamic_cast<PNode*>(ClassList::getObject(parentName, CL_PARENT_NODE));
+  PNode* parentNode = PNode::objectList().getObject(parentName);
   if (parentNode != NULL)
     parentNode->addChild(this);
@@ -681,5 +689,5 @@
 void PNode::setParentSoft(const std::string& parentName, float bias)
 {
-  PNode* parentNode = dynamic_cast<PNode*>(ClassList::getObject(parentName, CL_PARENT_NODE));
+  PNode* parentNode = PNode::objectList().getObject(parentName);
   if (parentNode != NULL)
     this->setParentSoft(parentNode, bias);
@@ -730,6 +738,6 @@
   if (likely(PNode::nullParent == NULL))
   {
-    PNode::nullParent = new PNode(NULL, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_TO_NULL);
-    PNode::nullParent->setClassID(CL_NULL_PARENT, "NullParent");
+    PNode::nullParent = new NullParent();
+    //PNode::nullParent->registerObject(, CL_NULL_PARENT);
     PNode::nullParent->setName("NullParent");
     PNode::nullParent->setSynchronized(true);
@@ -915,5 +923,5 @@
   int childNodeCount = 0;
   this->countChildNodes(childNodeCount);
-
+  printf("%p:", this);
   PRINT(0)("PNode(%s::%s) - absCoord: (%0.2f, %0.2f, %0.2f), relCoord(%0.2f, %0.2f, %0.2f), direction(%0.2f, %0.2f, %0.2f) - %s - %d childs\n",
            this->getClassCName(),
@@ -1106,3 +1114,9 @@
 }
 
-
+ObjectListDefinition(NullParent);
+
+NullParent::NullParent()
+  : PNode(NULL, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_TO_NULL)
+{
+  this->registerObject(this, NullParent::_objectList);
+}
Index: trunk/src/lib/coord/p_node.h
===================================================================
--- trunk/src/lib/coord/p_node.h	(revision 9682)
+++ trunk/src/lib/coord/p_node.h	(revision 9869)
@@ -50,5 +50,5 @@
   PNODE_REPARENT_DELETE_CHILDREN       = 0x0040,    //!< Deletes the Children of the node when This Node is Removed. (Use with care).
   /// FIXME
-   PNODE_REPARENT_KEEP_POSITION         = 0x0080,    //!< Tries to keep the Position if the Node is reparented.
+  PNODE_REPARENT_KEEP_POSITION         = 0x0080,    //!< Tries to keep the Position if the Node is reparented.
 
 
@@ -73,6 +73,9 @@
 
 //! Patent Node is a Engine to calculate the position of an Object in respect to the position of its parent.
-class PNode : virtual public BaseObject, virtual public Synchronizeable {
- public:
+class PNode : virtual public BaseObject, virtual public Synchronizeable
+{
+  ObjectListDeclaration(PNode);
+
+public:
   PNode (PNode* parent = PNode::getNullParent(), long nodeFlags = PNODE_PARENT_MODE_DEFAULT);
   virtual ~PNode ();
@@ -95,5 +98,5 @@
   inline const Vector& getRelCoor () const { return this->prevRelCoordinate; };
   /** @returns the Relative Coordinate Destination */
-  inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; };
+inline const Vector& getRelCoorSoft2D() const { return (this->toCoordinate)? *this->toCoordinate : this->relCoordinate; };
   void setAbsCoor (const Vector& absCoord);
   void setAbsCoor (float x, float y, float z);
@@ -130,5 +133,5 @@
   inline const Quaternion& getRelDir () const { return this->prevRelDirection; };
   /** @returns the Relative Directional Destination */
-  inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; };
+inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; };
   /** @returns a Vector pointing into the relative Direction */
   inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); };
@@ -178,7 +181,6 @@
   void removeNodeFlags(unsigned short nodeFlags);
 
-  // NULL_PARENT //
   /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */
-  static PNode* getNullParent()  { return (PNode::nullParent != NULL)? PNode::nullParent : PNode::createNullParent(); };
+static PNode* getNullParent()  { return (PNode::nullParent != NULL) ? PNode::nullParent : PNode::createNullParent(); };
 
   // UPDATING //
@@ -195,13 +197,13 @@
   float distance(const PNode* node) const { return (this->getAbsCoor() - node->getAbsCoor()).len(); };
 
- private:
+private:
   /** tells the child that the parent's Coordinate has changed */
   inline void parentCoorChanged () { this->bRelCoorChanged = true; }
   /** tells the child that the parent's Direction has changed */
   inline void parentDirChanged () { this->bRelDirChanged = true; }
- public:
+public:
   /** @returns the last calculated coordinate */
   inline Vector getLastAbsCoor() { return this->lastAbsCoordinate; }
- private:
+private:
   static PNode* createNullParent();
   void reparent();
@@ -209,5 +211,5 @@
   void eraseChild(PNode* child);
 
- private:
+private:
   bool               bRelCoorChanged;    //!< If Relative Coordinate has changed since last time we checked
   bool               bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
@@ -221,5 +223,5 @@
   Vector             lastAbsCoordinate;  //!< this is used for speedcalculation, it stores the last coordinate
   Quaternion         prevRelDirection;   //!< The last Relative Direciton from the last update-Cycle.
-//  Quaternion         lastAbsDirection;
+  //  Quaternion         lastAbsDirection;
 
   Vector             velocity;           //!< Saves the velocity.
@@ -238,23 +240,32 @@
   static PNode*      nullParent;         //!< The ROOT of the main PNode Tree.
 
-  private:
-    float coorx;
-    float coory;
-    float coorz;
-
-    float rotw;
-    float rotx;
-    float roty;
-    float rotz;
-
-  private:
-    int relCoordinate_handle;
-    int relDirection_handle;
-    Vector relCoordinate_write;
-    Quaternion relDirection_write;
-
-  public:
-    virtual void varChangeHandler( std::list<int> & id );
+private:
+  float coorx;
+  float coory;
+  float coorz;
+
+  float rotw;
+  float rotx;
+  float roty;
+  float rotz;
+
+private:
+  int relCoordinate_handle;
+  int relDirection_handle;
+  Vector relCoordinate_write;
+  Quaternion relDirection_write;
+
+public:
+  virtual void varChangeHandler( std::list<int> & id );
 };
 
+// NULL_PARENT //
+class NullParent : public PNode
+{
+  ObjectListDeclaration(NullParent);
+  friend class PNode;
+  NullParent();
+};
+
+
 #endif /* _P_NODE_H */
Index: trunk/src/lib/event/event_handler.cc
===================================================================
--- trunk/src/lib/event/event_handler.cc	(revision 9682)
+++ trunk/src/lib/event/event_handler.cc	(revision 9869)
@@ -28,4 +28,6 @@
 #include <algorithm>
 
+
+ObjectListDefinition(EventHandler);
 /**
  * @brief standard constructor
@@ -33,5 +35,5 @@
 EventHandler::EventHandler ()
 {
-  this->setClassID(CL_EVENT_HANDLER, "EventHandler");
+  this->registerObject(this, EventHandler::_objectList);
   this->setName("EventHandler");
 
Index: trunk/src/lib/event/event_handler.h
===================================================================
--- trunk/src/lib/event/event_handler.h	(revision 9682)
+++ trunk/src/lib/event/event_handler.h	(revision 9869)
@@ -21,5 +21,5 @@
 class EventHandler : public BaseObject
 {
-
+  ObjectListDeclaration(EventHandler);
 public:
   virtual ~EventHandler();
Index: trunk/src/lib/event/event_listener.cc
===================================================================
--- trunk/src/lib/event/event_listener.cc	(revision 9682)
+++ trunk/src/lib/event/event_listener.cc	(revision 9869)
@@ -19,4 +19,5 @@
 #include "event_handler.h"
 
+ObjectListDefinition(EventListener);
 /**
  * @brief standard constructor
@@ -24,5 +25,5 @@
 EventListener::EventListener ()
 {
-  this->setClassID(CL_EVENT_LISTENER, "EventListener");
+  this->registerObject(this, EventListener::_objectList);
 }
 
Index: trunk/src/lib/event/event_listener.h
===================================================================
--- trunk/src/lib/event/event_listener.h	(revision 9682)
+++ trunk/src/lib/event/event_listener.h	(revision 9869)
@@ -12,7 +12,8 @@
 
 //! A class for event listener
-class EventListener : virtual public BaseObject {
-
- public:
+class EventListener : virtual public BaseObject
+{
+  ObjectListDeclaration(EventListener);
+public:
   EventListener();
   virtual ~EventListener();
Index: trunk/src/lib/event/key_mapper.cc
===================================================================
--- trunk/src/lib/event/key_mapper.cc	(revision 9682)
+++ trunk/src/lib/event/key_mapper.cc	(revision 9869)
@@ -25,5 +25,5 @@
 #include "globals.h"
 #include "parser/ini_parser/ini_parser.h"
-#include "util/preferences.h"
+#include "parser/preferences/preferences.h"
 #include "key_names.h"
 #include "event_def.h"
@@ -32,5 +32,5 @@
 
 
-
+ObjectListDefinition(KeyMapper);
 
 /* initialize all variables to a reasonable value*/
@@ -116,5 +116,5 @@
 KeyMapper::KeyMapper ()
 {
-   this->setClassID(CL_KEY_MAPPER, "KeyMapper");
+  this->registerObject(this, KeyMapper::_objectList);
 }
 
Index: trunk/src/lib/event/key_mapper.h
===================================================================
--- trunk/src/lib/event/key_mapper.h	(revision 9682)
+++ trunk/src/lib/event/key_mapper.h	(revision 9869)
@@ -16,4 +16,5 @@
 class KeyMapper : public BaseObject
 {
+  ObjectListDeclaration(KeyMapper);
 public:
   //! A mapping from key-name to key-id
Index: trunk/src/lib/graphics/Makefile.am
===================================================================
--- trunk/src/lib/graphics/Makefile.am	(revision 9682)
+++ trunk/src/lib/graphics/Makefile.am	(revision 9869)
@@ -6,6 +6,9 @@
 libORXgraphics_a_SOURCES = \
 		graphics_engine.cc \
+		graphics_effect.cc \
 		light.cc \
 		shader.cc \
+		shader_data.cc \
+		resource_shader.cc \
 		\
 		render2D/render_2d.cc \
@@ -19,21 +22,13 @@
 		text_engine/font.cc \
 		text_engine/font_data.cc \
-		\
-		effects/graphics_effect.cc \
-		effects/atmospheric_engine.cc \
-		effects/weather_effect.cc \
-		effects/sun_effect.cc \
-		effects/fog_effect.cc \
-		effects/volfog_effect.cc \
-		effects/rain_effect.cc \
-		effects/snow_effect.cc \
-		effects/cloud_effect.cc \
-		effects/lightning_effect.cc \
-		effects/lense_flare.cc
+		text_engine/resource_font.cc
 
 noinst_HEADERS =\
  		graphics_engine.h \
+ 		graphics_effect.h \
 		light.h \
 		shader.h \
+		shader_data.h \
+		resource_shader.h \
 		\
 		render2D/render_2d.h \
@@ -47,17 +42,6 @@
 		text_engine/font.h \
 		text_engine/font_data.h \
-		text_engine/default_font.xpm \
-		\
-		effects/graphics_effect.h \
-		effects/atmospheric_engine.h \
-		effects/weather_effect.h \
-		effects/sun_effect.h \
-		effects/fog_effect.h \
-		effects/volfog_effect.h \
-		effects/rain_effect.h \
-		effects/snow_effect.h \
-		effects/cloud_effect.h \
-		effects/lightning_effect.h \
-		effects/lense_flare.h
+		text_engine/resource_font.h \
+		text_engine/default_font.xpm
 
 
Index: trunk/src/lib/graphics/graphics_effect.cc
===================================================================
--- trunk/src/lib/graphics/graphics_effect.cc	(revision 9869)
+++ trunk/src/lib/graphics/graphics_effect.cc	(revision 9869)
@@ -0,0 +1,69 @@
+
+
+/*
+   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
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+
+#include "graphics_effect.h"
+
+#include "util/loading/load_param.h"
+
+ObjectListDefinition(GraphicsEffect);
+
+/**
+ * @param root The XML-element to load the GraphicsEffect from
+
+  @todo what to do, if no GraphicsEffect-Slots are open anymore ???
+ */
+GraphicsEffect::GraphicsEffect(const TiXmlElement* root) {
+  this->registerObject(this, GraphicsEffect::_objectList);
+    this->bActivated = false;
+}
+
+
+/**
+ *  destroys a GraphicsEffect
+ */
+GraphicsEffect::~GraphicsEffect() {
+}
+
+
+/**
+ * @param root The XML-element to load the GraphicsEffect from
+ */
+void GraphicsEffect::loadParams(const TiXmlElement* root) {
+    BaseObject::loadParams(root);
+}
+
+
+/**
+ *  initializes the graphics effect
+ */
+void GraphicsEffect::init() {}
+
+
+
+/**
+ * draws the effect, if needed
+ */
+void GraphicsEffect::draw() const {}
+
+
+
+/**
+ * ticks the effect if there is any time dependancy
+ */
+void GraphicsEffect::tick(float dt) {}
Index: trunk/src/lib/graphics/graphics_effect.h
===================================================================
--- trunk/src/lib/graphics/graphics_effect.h	(revision 9869)
+++ trunk/src/lib/graphics/graphics_effect.h	(revision 9869)
@@ -0,0 +1,40 @@
+/**
+ * @file graphics_effect.h
+ *  abstract type of graphical effects
+ */
+
+#ifndef _GRAPHICS_EFFECT
+#define _GRAPHICS_EFFECT
+
+#include "base_object.h"
+
+class TiXmlElement;
+
+//! A class that handles GraphicsEffects. The GraphicsEffectManager operates on this.
+class GraphicsEffect : public BaseObject {
+  ObjectListDeclaration(GraphicsEffect);
+  public:
+    GraphicsEffect(const TiXmlElement* root = NULL);
+    virtual ~GraphicsEffect();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void init();
+
+    virtual void activate() = 0;
+    virtual void deactivate() = 0;
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    inline bool isActivated() const {
+        return this->bActivated;
+    }
+
+
+protected:
+    bool              bActivated;
+};
+
+
+#endif /* _GRAPHICS_EFFECT */
Index: trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- trunk/src/lib/graphics/graphics_engine.cc	(revision 9682)
+++ trunk/src/lib/graphics/graphics_engine.cc	(revision 9869)
@@ -17,5 +17,4 @@
 
 #include "graphics_engine.h"
-#include "util/loading/resource_manager.h"
 #include "state.h"
 
@@ -28,5 +27,5 @@
 #include "debug.h"
 
-#include "util/preferences.h"
+#include "parser/preferences/preferences.h"
 #include "substring.h"
 #include "text.h"
@@ -35,15 +34,12 @@
 #include "texture.h"
 
-#include "effects/graphics_effect.h"
-#include "effects/fog_effect.h"
-#include "effects/lense_flare.h"
+#include "graphics_effect.h"
 
 #include "shell_command.h"
-
+#include "loading/load_param_xml.h"
 
 #include "parser/tinyxml/tinyxml.h"
 #include "util/loading/load_param.h"
 #include "util/loading/factory.h"
-#include "class_list.h"
 
 #ifdef __WIN32__
@@ -54,4 +50,6 @@
 SHELL_COMMAND(fps, GraphicsEngine, toggleFPSdisplay);
 
+ObjectListDefinition(GraphicsEngine);
+
 /**
  * @brief standard constructor
@@ -59,5 +57,5 @@
 GraphicsEngine::GraphicsEngine ()
 {
-  this->setClassID(CL_GRAPHICS_ENGINE, "GraphicsEngine");
+  this->registerObject(this, GraphicsEngine::_objectList);
   this->setName("GraphicsEngine");
 
@@ -117,5 +115,5 @@
 {
   LoadParamXML(root, "GraphicsEffect", this, GraphicsEngine, loadGraphicsEffects)
-  .describe("loads a graphics effect");
+   .describe("loads a graphics effect");
 }
 
@@ -590,10 +588,8 @@
 
   // tick the graphics effects
-  if (this->graphicsEffects != NULL || (this->graphicsEffects = ClassList::getList(CL_GRAPHICS_EFFECT)) != NULL)
-  {
-    std::list<BaseObject*>::const_iterator it;
-    for (it = this->graphicsEffects->begin(); it != this->graphicsEffects->end(); it++)
-      dynamic_cast<GraphicsEffect*>(*it)->tick(dt);
-  }
+  for (ObjectList<GraphicsEffect>::const_iterator it = GraphicsEffect::objectList().begin();
+       it != GraphicsEffect::objectList().end();
+       ++it)
+    (*it)->tick(dt);
 }
 
@@ -688,6 +684,6 @@
   {
     case EV_VIDEO_RESIZE:
-      this->resolutionChanged(event.resize);
-      break;
-  }
-}
+    this->resolutionChanged(event.resize);
+    break;
+  }
+}
Index: trunk/src/lib/graphics/graphics_engine.h
===================================================================
--- trunk/src/lib/graphics/graphics_engine.h	(revision 9682)
+++ trunk/src/lib/graphics/graphics_engine.h	(revision 9869)
@@ -30,4 +30,5 @@
 class GraphicsEngine : public EventListener
 {
+  ObjectListDeclaration(GraphicsEngine);
   public:
     virtual ~GraphicsEngine();
Index: trunk/src/lib/graphics/importer/Makefile.am
===================================================================
--- trunk/src/lib/graphics/importer/Makefile.am	(revision 9682)
+++ trunk/src/lib/graphics/importer/Makefile.am	(revision 9869)
@@ -4,39 +4,44 @@
 noinst_LIBRARIES = libORXimporter.a libtc.a
 
-libORXimporter_a_SOURCES = model.cc \
-			   interactive_model.cc \
-			   md_model_structure.cc \
-                           vertex_array_model.cc \
-                           grid.cc \
-                           static_model.cc \
-                           objModel.cc \
-                           primitive_model.cc \
-                           height_map.cc \
-                           bsp_manager.cc \
-                           bsp_file.cc \
-                           bsp_tree_node.cc \
-                           bsp_tree_leaf.cc \
-                           \
-                           material.cc \
-                           texture.cc \
-                           texture_data.cc \
-                           texture_sequence.cc \
-                           media_container.cc \
-                           movie_player.cc \
-                           \
-                           bsp_manager.cc \
-                           bsp_file.cc \
-                           bsp_tree_node.cc \
-                           bsp_tree_leaf.cc \
-                           \
-                           md2/md2Model.cc \
-                           \
-                           md3/md3_model.cc \
-                           md3/md3_animation.cc \
-                           md3/md3_animation_cfg.cc \
-                           md3/md3_bone_frame.cc \
-                           md3/md3_mesh.cc \
-                           md3/md3_data.cc \
-                           md3/md3_tag.cc
+libORXimporter_a_SOURCES = \
+		model.cc \
+		interactive_model.cc \
+		md_model_structure.cc \
+		vertex_array_model.cc \
+		grid.cc \
+		static_model.cc \
+		static_model_data.cc \
+		objModel.cc \
+		resource_obj.cc \
+		primitive_model.cc \
+		height_map.cc \
+		bsp_manager.cc \
+		bsp_file.cc \
+		bsp_tree_node.cc \
+		bsp_tree_leaf.cc \
+		\
+		material.cc \
+		texture.cc \
+		texture_data.cc \
+		resource_texture.cc \
+		texture_sequence.cc \
+		media_container.cc \
+		movie_player.cc \
+		\
+		bsp_manager.cc \
+		bsp_file.cc \
+		bsp_tree_node.cc \
+		bsp_tree_leaf.cc \
+		\
+		md2/md2Model.cc \
+		md2/resource_md2.cc
+#		\
+		md3/md3_model.cc \
+		md3/md3_animation.cc \
+		md3/md3_animation_cfg.cc \
+		md3/md3_bone_frame.cc \
+		md3/md3_mesh.cc \
+		md3/md3_data.cc \
+		md3/md3_tag.cc
 
 
@@ -54,5 +59,7 @@
 		grid.h \
 		static_model.h \
+		static_model_data.h \
 		objModel.h \
+		resource_obj.h \
 		primitive_model.h \
 		anorms.h \
@@ -63,4 +70,5 @@
 		texture.h \
 		texture_data.h \
+		resource_texture.h \
 		texture_sequence.h \
 		\
@@ -74,4 +82,5 @@
 		\
                 md2/md2Model.h \
+		md2/resource_md2.h \
                 \
                 md3/md3_model.h \
Index: trunk/src/lib/graphics/importer/bsp_file.cc
===================================================================
--- trunk/src/lib/graphics/importer/bsp_file.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/bsp_file.cc	(revision 9869)
@@ -466,5 +466,5 @@
     PRINTF(4)("BSP FILE: Name %s . \n", fileName);
 
-    absFileName = ResourceManager::getFullName(fileName);
+    absFileName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
 
     if(File(absFileName).exists()) {
@@ -481,5 +481,5 @@
     strncat (fileName, ext, strlen(fileName));
 
-    absFileName = ResourceManager::getFullName(fileName);
+    absFileName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
 
     if(File(absFileName).exists()) {
@@ -496,5 +496,5 @@
     strncat (fileName, ext, strlen(fileName));
 
-    absFileName = ResourceManager::getFullName(fileName);
+    absFileName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
 
     if(File(absFileName).exists()) {
@@ -511,5 +511,5 @@
     strncat (fileName, ext, strlen(fileName));
 
-    absFileName = ResourceManager::getFullName(fileName);
+    absFileName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
 
     if(File(absFileName).exists()) {
@@ -524,5 +524,5 @@
     strcpy(ext, ".TGA");
     strncat (fileName, ext, strlen(fileName));
-    absFileName = ResourceManager::getFullName(fileName);
+    absFileName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
 
     if(File(absFileName).exists()/*stat( absFileName.c_str() , &results) == 0*/) {
@@ -537,5 +537,5 @@
     strcpy(ext, ".jpg");
     strncat (fileName, ext, strlen(fileName));
-    absFileName = ResourceManager::getFullName(fileName);
+    absFileName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
     if(File(absFileName).exists()) {
       PRINTF(4)("BSP FILE: gefunden . \n");
@@ -551,5 +551,5 @@
     strcpy(ext, ".JPG");
     strncat (fileName, ext, strlen(fileName));
-    absFileName = ResourceManager::getFullName(fileName);
+    absFileName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
     if(File(absFileName).exists()) {
       PRINTF(4)("BSP FILE: gefunden . \n");
@@ -566,5 +566,5 @@
     strcpy(ext, ".bmp");
     strncat (fileName, ext, strlen(fileName));
-    absFileName = ResourceManager::getFullName(fileName);
+    absFileName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
 
     if(File(absFileName).exists()) {
@@ -580,5 +580,5 @@
     strcpy(ext, ".BMP");
     strncat (fileName, ext, strlen(fileName));
-    absFileName = ResourceManager::getFullName(fileName);
+    absFileName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
 
     if(File(absFileName).exists()) {
@@ -611,5 +611,5 @@
   this->testSurf = NULL;
 
-  this->testSurf = IMG_Load(ResourceManager::getFullName(mat).c_str());
+  this->testSurf = IMG_Load(Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(mat).c_str());
   if(this->testSurf != NULL) {
     if(this->testSurf->format->Amask != 0 ) tmpAMat.alpha = true;
Index: trunk/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- trunk/src/lib/graphics/importer/bsp_manager.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/bsp_manager.cc	(revision 9869)
@@ -33,5 +33,5 @@
 #include "world_entities/player.h"
 #include "world_entities/playable.h"
-#include "util/loading/resource_manager.h"
+
 // STL Containers
 #include <vector>
@@ -41,4 +41,5 @@
 #include "world_entity.h"
 
+#include "util/loading/resource_manager.h"
 #include "util/loading/load_param.h"
 #include "util/loading/factory.h"
@@ -91,5 +92,5 @@
   this->bspFile = new BspFile();
   this->bspFile->scale =  scale;
-  if(this->bspFile->read(ResourceManager::getFullName(fileName).c_str()) == -1)
+  if(this->bspFile->read(Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName).c_str()) == -1)
     return -1;
 
@@ -1376,5 +1377,5 @@
     if( this->outputFraction == 1.0f) // No collision Detected
     {
-      if( this->outputAllSolid ) 
+      if( this->outputAllSolid )
       {
         this->collPlane = new plane;
Index: trunk/src/lib/graphics/importer/height_map.cc
===================================================================
--- trunk/src/lib/graphics/importer/height_map.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/height_map.cc	(revision 9869)
@@ -22,5 +22,4 @@
 #include "p_node.h"
 #include "state.h"
-#include "util/loading/resource_manager.h"
 #include "debug.h"
 
@@ -327,4 +326,5 @@
 
 
+ObjectListDefinition(HeightMap);
 
 
@@ -413,5 +413,5 @@
 void HeightMap::init(const std::string& heightMapName)
 {
-  this->setClassID(CL_HEIGHT_MAP, "HeightMap");
+  this->registerObject(this, HeightMap::_objectList);
 
   this->shiftX = 0;
Index: trunk/src/lib/graphics/importer/height_map.h
===================================================================
--- trunk/src/lib/graphics/importer/height_map.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/height_map.h	(revision 9869)
@@ -29,7 +29,5 @@
 
 class SDL_Surface;
-class Vector;
 class Material;
-class PNode;
 class Texture;
 class HeightMap;
@@ -70,7 +68,9 @@
 
 
+
 //!< the height map representation itself
 class HeightMap : public VertexArrayModel
 {
+  ObjectListDeclaration(HeightMap);
   friend class Tile;
 
Index: trunk/src/lib/graphics/importer/interactive_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/interactive_model.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/interactive_model.cc	(revision 9869)
@@ -22,4 +22,6 @@
 
 
+ObjectListDefinition(InteractiveModel);
+
 /**
  * standard constructor
@@ -28,5 +30,5 @@
 InteractiveModel::InteractiveModel()
 {
-  this->setClassID(CL_INTERACTIVE_MODEL, "InteractiveModel");
+  this->registerObject(this, InteractiveModel::_objectList);
 }
 
Index: trunk/src/lib/graphics/importer/interactive_model.h
===================================================================
--- trunk/src/lib/graphics/importer/interactive_model.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/interactive_model.h	(revision 9869)
@@ -30,4 +30,5 @@
 class InteractiveModel : public Model
 {
+  ObjectListDeclaration(InteractiveModel);
   public:
     InteractiveModel();
@@ -38,5 +39,5 @@
     virtual void setAnimation(int animNum, int playbackMode = 0) = 0;
     virtual void setAnimation(int firstFrame, int lastFrame, int fps, int bStoppable, int animPlayback) {}
-    virtual int getAnimation() = 0;
+    virtual int getAnimation() const = 0;
 
     virtual bool isAnimationFinished() { return false; }
Index: trunk/src/lib/graphics/importer/material.cc
===================================================================
--- trunk/src/lib/graphics/importer/material.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/material.cc	(revision 9869)
@@ -25,5 +25,7 @@
 #include "loading/load_param.h"
 
-#include "util/loading/resource_manager.h"
+#include "resource_texture.h"
+
+ObjectListDefinition(Material);
 
 /**
@@ -33,5 +35,5 @@
 Material::Material (const std::string& mtlName)
 {
-  this->setClassID(CL_MATERIAL, "Material");
+  this->registerObject(this, Material::_objectList);
 
   this->setIllum(3);
@@ -90,9 +92,4 @@
   PRINTF(5)("delete Material %s.\n", this->getCName());
 
-  if (this->ambientTexture != NULL)
-    ResourceManager::getInstance()->unload(this->ambientTexture);
-  if (this->specularTexture != NULL)
-    ResourceManager::getInstance()->unload(this->specularTexture);
-
   if (this == Material::selectedMaterial)
     Material::selectedMaterial = NULL;
@@ -101,27 +98,4 @@
 
 const Material* Material::selectedMaterial = NULL;
-
-
-/// TODO FIX THIS
-// Material& Material::operator=(const Material& m)
-// {
-//   this->setIllum(m.illumModel);
-//   this->setDiffuse(m.diffuse[0],m.diffuse[1],m.diffuse[2]);
-//   this->setAmbient(m.ambient[0],m.ambient[1],m.ambient[2]);
-//   this->setSpecular(m.specular[0],m.specular[1],m.specular[2]);
-//   this->setShininess(m.shininess);
-//   this->setTransparency(m.transparency);
-//
-//   if (this->diffuseTexture != NULL)
-//     ResourceManager::getInstance()->unload(this->diffuseTexture);
-//   if (m.diffuseTexture != NULL)
-//     this->diffuseTexture = (Texture*)ResourceManager::getInstance()->copy(m.diffuseTexture);
-//   this->ambientTexture = NULL; /// FIXME
-//   this->specularTexture = NULL; /// FIXME
-//
-//   this->setName(m.getName());
-// }
-
-
 
 /**
@@ -288,17 +262,4 @@
 
 
-
-/**
- * @brief Adds a Texture Path to the List of already existing Paths
- * @param pathName The Path to add.
-*/
-void Material::addTexturePath(const std::string& pathName)
-{
-  ResourceManager::getInstance()->addImageDir(pathName);
-}
-
-// MAPPING //
-
-
 /**
  * @brief Sets the Diffuse map of this Texture.
@@ -322,5 +283,5 @@
  * @param textureNumber The Texture-Number from 0 to GL_MAX_TEXTURE_UNITS
  */
-void Material::setDiffuseMap(const TextureDataPointer& textureDataPointer, unsigned int textureNumber)
+void Material::setDiffuseMap(const TextureData::Pointer& textureDataPointer, unsigned int textureNumber)
 {
   assert(textureNumber < Material::getMaxTextureUnits());
@@ -349,9 +310,10 @@
   if (!dMap.empty())
   {
-    Texture* tex = dynamic_cast<Texture*>(ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target));
-    if (tex != NULL)
-      this->textures[textureNumber] = *tex;
+    this->textures[textureNumber] = ResourceTexture(dMap);
+	//dynamic_cast<Texture*>(ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target));
+/*    if (tex != NULL)
+      this->textures[textureNumber] = tex;
     else
-      this->textures[textureNumber] = Texture();
+      this->textures[textureNumber] = Texture();*/
   }
   else
Index: trunk/src/lib/graphics/importer/material.h
===================================================================
--- trunk/src/lib/graphics/importer/material.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/material.h	(revision 9869)
@@ -24,11 +24,12 @@
 class Material : public BaseObject
 {
+  ObjectListDeclaration(Material);
 public:
   Material (const std::string& mtlName = "");
   virtual ~Material ();
 
+  Material& operator=(const Material& material);
+
   void loadParams(const TiXmlElement* root);
-
-  Material& operator=(const Material& material);
 
   bool select () const;
@@ -53,5 +54,5 @@
   // MAPPING //
   void setDiffuseMap(const Texture& texture, unsigned int textureNumber = 0);
-  void setDiffuseMap(const TextureDataPointer& texturePointer, unsigned int textureNumber = 0);
+  void setDiffuseMap(const TextureData::Pointer& texturePointer, unsigned int textureNumber = 0);
   void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
   void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
@@ -65,6 +66,4 @@
 
   const Texture& diffuseTexture(unsigned int i = 0) const { return this->textures[i]; };
-
-  static void addTexturePath(const std::string& pathName);
 
   static const std::string& blendFuncToString(GLenum blendFunc);
Index: trunk/src/lib/graphics/importer/md2/md2Model.cc
===================================================================
--- trunk/src/lib/graphics/importer/md2/md2Model.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/md2/md2Model.cc	(revision 9869)
@@ -19,18 +19,18 @@
 
 #include "debug.h"
-#include "util/loading/resource_manager.h"
-
-
-
+#include "resource_md2.h"
+
+
+ObjectListDefinition(MD2Model);
 
 //! the model anorms
 sVec3D MD2Model::anorms[NUM_VERTEX_NORMALS] = {
- #include "anorms.h"
-};
+#include "anorms.h"
+    };
 
 //! anormal dots, no idea of how this shall work, but it does
 float MD2Model::anormsDots[SHADEDOT_QUANT][256] = {
-  #include "anormtab.h"
-};
+#include "anormtab.h"
+    };
 
 
@@ -42,5 +42,5 @@
 sAnim MD2Model::animationList[22] =
   {
- // begin, end, fps, interruptable
+    // begin, end, fps, interruptable
     {   0,  39,  9, 1 },   //!< STAND
     {  40,  45, 10, 1 },   //!< RUN
@@ -73,28 +73,43 @@
  ********************************************************************************/
 
+MD2Model::MD2Model()
+  : data(new MD2Data())
+{
+  this->init();
+}
+
+#include "resource_md2.h"
 /**
   \brief simple constructor initializing all variables
 */
 MD2Model::MD2Model(const std::string& modelFileName, const std::string& skinFileName, float scale)
-{
-  this->setClassID(CL_MD2_MODEL, "MD2Model");
-  /* this creates the data container via ressource manager */
-  if (!modelFileName.empty())
-    this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, skinFileName, scale);
-  if( unlikely(this->data == NULL))
-    PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n");
-
+    : data(new MD2Data())
+{
+  this->init();
   this->scaleFactor = scale;
-  this->animationSpeed = 1.0f;
-
-  shadeDots = MD2Model::anormsDots[0];
-  /* set the animation stat mannualy */
-  this->animationState.type = STAND;
-  this->animationState.numPlays = 1;
-  this->setAnimation(STAND);
-
-  this->debug();
-
-    //write the modelinfo information
+
+  this->data = ResourceMD2(modelFileName, skinFileName, scale).data;
+  rebuildInfo();
+
+  //this->debug();
+}
+
+MD2Model::MD2Model(const MD2Model& model)
+  : data(model.data)
+{
+  this->init();
+  this->rebuildInfo();
+}
+
+MD2Model& MD2Model::operator=(const MD2Model& md2model)
+{
+  this->data = md2model.data;
+  this->rebuildInfo();
+  return *this;
+}
+
+void MD2Model::rebuildInfo()
+{
+  //write the modelinfo information
   this->pModelInfo.numVertices = this->data->numVertices;
   this->pModelInfo.numTriangles = this->data->numTriangles;
@@ -107,4 +122,6 @@
 
   // triangle conversion
+  if (this->pModelInfo.pTriangles != NULL)
+    delete[] this->pModelInfo.pTriangles;
   this->pModelInfo.pTriangles = new sTriangleExt[this->data->numTriangles];
   for( int i = 0; i < this->data->numTriangles; i++)
@@ -118,4 +135,10 @@
     this->pModelInfo.pTriangles[i].indexToTexCoor[2] = this->data->pTriangles[i].indexToTexCoor[2];
   }
+}
+
+bool MD2Model::load(const std::string& modelFileName, const std::string& skinFileName, float scale)
+{
+  this->data = MD2Data::Pointer(new MD2Data(modelFileName, skinFileName, scale));
+  this->rebuildInfo();
 }
 
@@ -132,8 +155,23 @@
   this->pModelInfo.pTexCoor = NULL;
   this->pModelInfo.pTriangles = NULL;
-
-  ResourceManager::getInstance()->unload(this->data);
-}
-
+}
+
+
+void MD2Model::init()
+{
+  this->registerObject(this, MD2Model::_objectList);
+  /* this creates the data container via ressource manager */
+  if( unlikely(this->data.isNull()))
+    PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n");
+
+  this->scaleFactor = 1.0f;
+  this->animationSpeed = 1.0f;
+
+  shadeDots = MD2Model::anormsDots[0];
+  /* set the animation stat mannualy */
+  this->animationState.type = STAND;
+  this->animationState.numPlays = 1;
+  this->setAnimation(STAND);
+}
 
 /**
@@ -153,9 +191,9 @@
 
   for( int i = 0; i < this->data->numVertices; ++i)
-    {
-      this->verticesList[i][0] = currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0]);
-      this->verticesList[i][1] = currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1]);
-      this->verticesList[i][2] = currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2]);
-    }
+  {
+    this->verticesList[i][0] = currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0]);
+    this->verticesList[i][1] = currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1]);
+    this->verticesList[i][2] = currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2]);
+  }
 }
 
@@ -259,24 +297,24 @@
   /* draw the triangles */
   while( int i = *(pCommands++)) /* strange looking while loop for maximum performance */
+  {
+    if( i < 0)
     {
-      if( i < 0)
-        {
-          glBegin(GL_TRIANGLE_FAN);
-          i = -i;
-        }
-      else
-        {
-          glBegin(GL_TRIANGLE_STRIP);
-        }
-
-      for(; i > 0; i--, pCommands += 3) /* down counting for loop, next 3 gl commands */
-        {
-          glTexCoord2f( ((float *)pCommands)[0], ((float *)pCommands)[1] );
-          glNormal3fv(anorms[this->data->pLightNormals[pCommands[2]]]);
-          glVertex3fv(this->verticesList[pCommands[2]]);
-        }
-      glEnd();
-
+      glBegin(GL_TRIANGLE_FAN);
+      i = -i;
     }
+    else
+    {
+      glBegin(GL_TRIANGLE_STRIP);
+    }
+
+    for(; i > 0; i--, pCommands += 3) /* down counting for loop, next 3 gl commands */
+    {
+      glTexCoord2f( ((float *)pCommands)[0], ((float *)pCommands)[1] );
+      glNormal3fv(anorms[this->data->pLightNormals[pCommands[2]]]);
+      glVertex3fv(this->verticesList[pCommands[2]]);
+    }
+    glEnd();
+
+  }
   glDisable(GL_CULL_FACE);
   glPopAttrib();
@@ -289,11 +327,11 @@
   int* pCommands = this->data->pGLCommands;
   /* some face culling stuff */
-//   glPushAttrib(GL_POLYGON_BIT);
-//   glFrontFace(GL_CW);
-//   glEnable(GL_CULL_FACE);
-//   glCullFace(GL_BACK);
-//
-//   this->processLighting();
-//   this->interpolate(/*this->verticesList*/);
+  //   glPushAttrib(GL_POLYGON_BIT);
+  //   glFrontFace(GL_CW);
+  //   glEnable(GL_CULL_FACE);
+  //   glCullFace(GL_BACK);
+  //
+  //   this->processLighting();
+  //   this->interpolate(/*this->verticesList*/);
   this->data->material.select();
 
@@ -337,31 +375,31 @@
 
   if( this->animationState.localTime - this->animationState.lastTime > (1.0f / this->animationState.fps))
+  {
+    this->animationState.currentFrame = this->animationState.nextFrame;
+    this->animationState.nextFrame++;
+
+    if( this->animationState.nextFrame > this->animationState.endFrame )
     {
-      this->animationState.currentFrame = this->animationState.nextFrame;
-      this->animationState.nextFrame++;
-
-      if( this->animationState.nextFrame > this->animationState.endFrame )
+      if( this->animationState.animPlaybackMode == MD2_ANIM_LOOP)
       {
-        if( this->animationState.animPlaybackMode == MD2_ANIM_LOOP)
-        {
-          this->animationState.nextFrame = this->animationState.startFrame;
-          this->animationState.numPlays++;
-        }
-        else
-        {
-          this->animationState.nextFrame = this->animationState.endFrame;
-        }
+        this->animationState.nextFrame = this->animationState.startFrame;
+        this->animationState.numPlays++;
       }
-      this->animationState.lastTime = this->animationState.localTime;
+      else
+      {
+        this->animationState.nextFrame = this->animationState.endFrame;
+      }
     }
-
-//     if( this->animationState.currentFrame > (this->data->numFrames - 1) )
-//       this->animationState.currentFrame = 0;
-
-//     if( (this->animationState.nextFrame > (this->data->numFrames - 1)) && this->animationState.animPlaybackMode == MD2_ANIM_LOOP)
-//     this->animationState.nextFrame = 0;
+    this->animationState.lastTime = this->animationState.localTime;
+  }
+
+  //     if( this->animationState.currentFrame > (this->data->numFrames - 1) )
+  //       this->animationState.currentFrame = 0;
+
+  //     if( (this->animationState.nextFrame > (this->data->numFrames - 1)) && this->animationState.animPlaybackMode == MD2_ANIM_LOOP)
+  //     this->animationState.nextFrame = 0;
 
   this->animationState.interpolationState = this->animationState.fps *
-    (this->animationState.localTime - this->animationState.lastTime);
+      (this->animationState.localTime - this->animationState.lastTime);
 }
 
@@ -390,5 +428,5 @@
   PRINT(0)("=  Number of Frames: \t%i\n", this->data->header->numFrames);
   PRINT(0)("=  Height, Width:\t%i, %i\n", this->data->header->skinHeight, this->data->header->skinWidth);
-  PRINT(0)("=  Pointer to the data object: %p\n", this->data);
+  //PRINT(0)("=  Pointer to the data object: %p\n", this->data);
   PRINT(0)("===================================================\n\n");
 }
@@ -399,4 +437,9 @@
  ********************************************************************************/
 
+MD2Data::MD2Data()
+{
+  this->init();
+}
+
 /**
   \brief simple constructor
@@ -404,10 +447,19 @@
 MD2Data::MD2Data(const std::string& modelFileName, const std::string& skinFileName, float scale)
 {
-  scale *= 0.1f;
-
+  this->init();
+  this->scaleFactor = scale * .1;
+
+  this->loadModel(modelFileName);
+  this->loadSkin(skinFileName);
+}
+
+void MD2Data::init()
+{
+  this->scaleFactor = 1.0;
   this->pVertices = NULL;
   this->pGLCommands = NULL;
   this->pLightNormals = NULL;
   this->pTexCoor = NULL;
+  this->header = NULL;
 
   this->numFrames = 0;
@@ -415,14 +467,5 @@
   this->numGLCommands = 0;
   this->numTexCoor = 0;
-
-//   this->scaleFactor = 1.0f;
-  this->scaleFactor = scale;
-
-  this->fileName = "";
-  this->skinFileName = "";
-  this->loadModel(modelFileName);
-  this->loadSkin(skinFileName);
-}
-
+}
 
 /**
@@ -462,16 +505,16 @@
   pFile = fopen(fileName.c_str(), "rb");
   if( unlikely(!pFile))
-    {
-      PRINTF(1)("Couldn't open the MD2 File for loading. Exiting.\n");
-      return false;
-    }
+  {
+    PRINTF(1)("Couldn't open the MD2 File for loading. Exiting.\n");
+    return false;
+  }
   this->header = new MD2Header;
   fread(this->header, 1, sizeof(MD2Header), pFile);
   /* check for the header version: make sure its a md2 file :) */
   if( unlikely(this->header->version != MD2_VERSION) && unlikely(this->header->ident != MD2_IDENT))
-    {
-      PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str());
-      return false;
-    }
+  {
+    PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str());
+    return false;
+  }
 
   this->fileName =fileName;
@@ -506,22 +549,22 @@
 
   for(int i = 0; i < this->numFrames; ++i)
+  {
+    frame = (sFrame*)(buffer + this->header->frameSize * i);
+    pVertex = this->pVertices + this->numVertices  * i;
+    pNormals = this->pLightNormals + this->numVertices * i;
+
+    for(int j = 0; j < this->numVertices; ++j)
     {
-      frame = (sFrame*)(buffer + this->header->frameSize * i);
-      pVertex = this->pVertices + this->numVertices  * i;
-      pNormals = this->pLightNormals + this->numVertices * i;
-
-      for(int j = 0; j < this->numVertices; ++j)
-        {
-          /* SPEEDUP: *(pVerts + i + 0) = (*(frame->pVertices + i + 0)...  */
-           pVertex[j][0] = ((frame->pVertices[j].v[0] * frame->scale[0] ) + frame->translate[0] )* this->scaleFactor;
-           pVertex[j][1] = ((frame->pVertices[j].v[2] * frame->scale[2]) + frame->translate[2]) * this->scaleFactor;
-           pVertex[j][2] = (-1.0 * (frame->pVertices[j].v[1] * frame->scale[1] + frame->translate[1])) * this->scaleFactor;
-
-          //printf("vertex %i/%i: (%f, %f, %f)\n", j, this->numVertices, pVertex[j][0], pVertex[j][1], pVertex[j][2]);
-
-          pNormals[j] = frame->pVertices[j].lightNormalIndex;
-        }
+      /* SPEEDUP: *(pVerts + i + 0) = (*(frame->pVertices + i + 0)...  */
+      pVertex[j][0] = ((frame->pVertices[j].v[0] * frame->scale[0] ) + frame->translate[0] )* this->scaleFactor;
+      pVertex[j][1] = ((frame->pVertices[j].v[2] * frame->scale[2]) + frame->translate[2]) * this->scaleFactor;
+      pVertex[j][2] = (-1.0 * (frame->pVertices[j].v[1] * frame->scale[1] + frame->translate[1])) * this->scaleFactor;
+
+      //printf("vertex %i/%i: (%f, %f, %f)\n", j, this->numVertices, pVertex[j][0], pVertex[j][1], pVertex[j][2]);
+
+      pNormals[j] = frame->pVertices[j].lightNormalIndex;
     }
-    PRINTF(4)("Finished loading the md2 file\n");
+  }
+  PRINTF(4)("Finished loading the md2 file\n");
 
   delete [] buffer;
@@ -538,8 +581,8 @@
 {
   if( fileName.empty())
-    {
-      this->skinFileName = "";
-      return false;
-    }
+  {
+    this->skinFileName = "";
+    return false;
+  }
 
   this->skinFileName = fileName;
Index: trunk/src/lib/graphics/importer/md2/md2Model.h
===================================================================
--- trunk/src/lib/graphics/importer/md2/md2Model.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/md2/md2Model.h	(revision 9869)
@@ -20,4 +20,5 @@
 
 #include "base_object.h"
+#include "count_pointer.h"
 
 #include "interactive_model.h"
@@ -45,24 +46,24 @@
 struct MD2Header
 {
-   int ident;                           //!< This is used to identify the file
-   int version;                         //!< The version number of the file (Must be 8)
-
-   int skinWidth;                       //!< The skin width in pixels
-   int skinHeight;                      //!< The skin height in pixels
-   int frameSize;                       //!< The size in bytes the frames are
-
-   int numSkins;                        //!< The number of skins associated with the model
-   int numVertices;                     //!< The number of vertices (constant for each frame)
-   int numTexCoords;                    //!< The number of texture coordinates
-   int numTriangles;                    //!< The number of faces (polygons)
-   int numGlCommands;                   //!< The number of gl commands
-   int numFrames;                       //!< The number of animation frames
-
-   int offsetSkins;                     //!< The offset in the file for the skin data
-   int offsetTexCoords;                 //!< The offset in the file for the texture data
-   int offsetTriangles;                 //!< The offset in the file for the face data
-   int offsetFrames;                    //!< The offset in the file for the frames data
-   int offsetGlCommands;                //!< The offset in the file for the gl commands data
-   int offsetEnd;                       //!< The end of the file offset
+  int ident;                           //!< This is used to identify the file
+  int version;                         //!< The version number of the file (Must be 8)
+
+  int skinWidth;                       //!< The skin width in pixels
+  int skinHeight;                      //!< The skin height in pixels
+  int frameSize;                       //!< The size in bytes the frames are
+
+  int numSkins;                        //!< The number of skins associated with the model
+  int numVertices;                     //!< The number of vertices (constant for each frame)
+  int numTexCoords;                    //!< The number of texture coordinates
+  int numTriangles;                    //!< The number of faces (polygons)
+  int numGlCommands;                   //!< The number of gl commands
+  int numFrames;                       //!< The number of animation frames
+
+  int offsetSkins;                     //!< The offset in the file for the skin data
+  int offsetTexCoords;                 //!< The offset in the file for the texture data
+  int offsetTriangles;                 //!< The offset in the file for the face data
+  int offsetFrames;                    //!< The offset in the file for the frames data
+  int offsetGlCommands;                //!< The offset in the file for the gl commands data
+  int offsetEnd;                       //!< The end of the file offset
 };
 
@@ -70,30 +71,30 @@
 //! animation names enumeration
 typedef enum MD2animType
-  {
-    STAND,                       //0
-    RUN,                         //1
-    ATTACK,                      //2
-    PAIN_A,                      //3
-    PAIN_B,                      //4
-    PAIN_C,          //5
-    JUMP,            //6
-    FLIP,            //7
-    SALUTE,          //8
-    FALLBACK,        //9
-    WAVE,            //10
-    POINT,           //11
-    CROUCH_STAND,
-    CROUCH_WALK,
-    CROUCH_ATTACK,
-    CROUCH_PAIN,
-    CROUCH_DEATH,
-    DEATH_FALLBACK,
-    DEATH_FALLFORWARD,
-    DEATH_FALLBACKSLOW,
-    BOOM,
-    WALK,
-
-    MAX_ANIMATIONS
-  };
+{
+  STAND,                       //0
+  RUN,                         //1
+  ATTACK,                      //2
+  PAIN_A,                      //3
+  PAIN_B,                      //4
+  PAIN_C,          //5
+  JUMP,            //6
+  FLIP,            //7
+  SALUTE,          //8
+  FALLBACK,        //9
+  WAVE,            //10
+  POINT,           //11
+  CROUCH_STAND,
+  CROUCH_WALK,
+  CROUCH_ATTACK,
+  CROUCH_PAIN,
+  CROUCH_DEATH,
+  DEATH_FALLBACK,
+  DEATH_FALLFORWARD,
+  DEATH_FALLBACKSLOW,
+  BOOM,
+  WALK,
+
+  MAX_ANIMATIONS
+};
 
 
@@ -116,13 +117,17 @@
 class MD2Data : public BaseObject
 {
- public:
-   MD2Data(const std::string& modelFileName, const std::string& skinFileName, float scale = 1.0f);
+public:
+  typedef CountPointer<MD2Data>    Pointer;
+public:
+  MD2Data();
+  MD2Data(const std::string& modelFileName, const std::string& skinFileName, float scale = 1.0f);
   virtual ~MD2Data();
 
- private:
-   bool loadModel(const std::string& fileName);
-   bool loadSkin(const std::string& fileName = "");
-
- public:
+private:
+  void init();
+  bool loadModel(const std::string& fileName);
+  bool loadSkin(const std::string& fileName = "");
+
+public:
   int                numFrames;             //!< number of frames
   int                numVertices;           //!< number of vertices
@@ -148,9 +153,16 @@
 
 //! This is a MD2 Model class
-class MD2Model : public InteractiveModel {
-
-public:
+class MD2Model : public InteractiveModel
+{
+  ObjectListDeclaration(MD2Model);
+public:
+  MD2Model();
   MD2Model(const std::string& modelFileName, const std::string& skinFileName = "", float scale = 1.0f);
+  MD2Model(const MD2Model& model);
   virtual ~MD2Model();
+
+  MD2Model& operator=(const MD2Model& md2model);
+
+  bool load(const std::string& modelFileName, const std::string& skinFileName = "", float scale = 1.0f);
 
   virtual void draw() const;
@@ -160,10 +172,13 @@
   virtual void setAnimation(int firstFrame, int lastFrame, int fps, int bStoppable, int animPlayback);
   /**  returns the current animation @returns animation type */
-  inline int MD2Model::getAnimation() { return this->animationState.type; }
+  inline int getAnimation() const { return this->animationState.type; }
   virtual void setAnimationSpeed(float speed) { this->animationSpeed = speed; }
-  virtual bool isAnimationFinished() { return (this->animationState.currentFrame == this->animationState.endFrame )?true:false; }
+virtual bool isAnimationFinished() const { return (this->animationState.currentFrame == this->animationState.endFrame )?true:false; }
   /**  scales the current model @param scaleFactor: the factor [0..1] to use for scaling */
   void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
 
+
+  void acquireData(const MD2Data::Pointer& data) { this->data = data; rebuildInfo(); };
+  const MD2Data::Pointer& dataPointer() const { return this->data; };
   virtual void tick(float dtS);
   void debug();
@@ -171,4 +186,7 @@
 
 private:
+  void init();
+  void rebuildInfo();
+
   void animate(float time);
   void processLighting();
@@ -177,19 +195,19 @@
 
 
- public:
+public:
   /* these variables are static, because they are all the same for every model */
-  static sVec3D       anorms[NUM_VERTEX_NORMALS];       //!< the anormals
-  static float        anormsDots[SHADEDOT_QUANT][256];  //!< the anormals dot products
-  static sAnim        animationList[22];                //!< the anomation list
-   //! again one of these strange id software parts
-  float*              shadeDots;
-
-  MD2Data*            data;                             //!< the md2 data pointer
-
- private:
-  float               scaleFactor;                      //!< the scale factor (individual)
-  float               animationSpeed;                   //!< the speed of the animation (factor for the time)
-  sAnimState          animationState;                   //!< animation state of the model
-  sVec3D              verticesList[MD2_MAX_VERTICES];   //!< place to temp sav the vert
+  static sVec3D         anorms[NUM_VERTEX_NORMALS];       //!< the anormals
+  static float          anormsDots[SHADEDOT_QUANT][256];  //!< the anormals dot products
+  static sAnim          animationList[22];                //!< the anomation list
+  //! again one of these strange id software parts
+  float*                shadeDots;
+
+  CountPointer<MD2Data> data;                           //!< the md2 data pointer
+
+private:
+  float                 scaleFactor;                      //!< the scale factor (individual)
+  float                 animationSpeed;                   //!< the speed of the animation (factor for the time)
+  sAnimState            animationState;                   //!< animation state of the model
+  sVec3D                verticesList[MD2_MAX_VERTICES];   //!< place to temp sav the vert
 };
 
Index: trunk/src/lib/graphics/importer/md2/resource_md2.cc
===================================================================
--- trunk/src/lib/graphics/importer/md2/resource_md2.cc	(revision 9869)
+++ trunk/src/lib/graphics/importer/md2/resource_md2.cc	(revision 9869)
@@ -0,0 +1,61 @@
+
+#include "resource_md2.h"
+#include "substring.h"
+#include "multi_type.h"
+#include "debug.h"
+
+
+ResourceMD2::ResourceMD2(const std::string& modelName, const std::string& skinName, float scale, const Resources::KeepLevel& keepLevel)
+    : Resource(&ResourceMD2::type)
+{
+  Resources::StorePointer* ptr = this->acquireResource(loadString(modelName, skinName, scale));
+
+  if (ptr)
+  {
+    PRINTF(0)("FOUND MD2: %s\n", modelName.c_str());
+    this->acquireData(static_cast<ResourceMD2::MD2ResourcePointer*>(ptr)->ptr());
+  }
+  else
+  {
+    PRINTF(0)("NOT FOUND MD2: %s\n", modelName.c_str());
+    std::string modelFileName = this->Resource::locateFile(modelName);
+    //std::string skinFileName = this->Resource::locateFile(skinName);
+    this->MD2Model::load(modelFileName, skinName, scale);
+    this->Resource::addResource(new ResourceMD2::MD2ResourcePointer(loadString(modelName, skinName, scale), keepLevel, this->MD2Model::dataPointer()));
+  }
+
+}
+
+ResourceMD2 ResourceMD2::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel)
+{
+  SubString loadValues(loadString, ',');
+  std::string modelName;
+  std::string skinName;
+  float scale = 1.0f;
+  if (loadValues.size() > 0)
+    modelName = loadValues[0];
+  if (loadValues.size() > 1)
+    skinName = loadValues[1];
+  if (loadValues.size() > 2)
+    scale = MultiType(loadValues[2]).getFloat();
+
+  return ResourceMD2(modelName, skinName, scale, keepLevel);
+}
+
+std::string ResourceMD2::loadString(const std::string& modelName, const std::string& skinName, float scale)
+{
+  return modelName + ',' + skinName + ',' + MultiType(scale).getString();
+}
+
+
+Resources::tType<ResourceMD2> ResourceMD2::type("MD2");
+
+
+
+
+
+ResourceMD2::MD2ResourcePointer::MD2ResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const MD2Data::Pointer& data)
+    : Resources::StorePointer(loadString, keepLevel) , pointer(data)
+{}
+
+
Index: trunk/src/lib/graphics/importer/md2/resource_md2.h
===================================================================
--- trunk/src/lib/graphics/importer/md2/resource_md2.h	(revision 9869)
+++ trunk/src/lib/graphics/importer/md2/resource_md2.h	(revision 9869)
@@ -0,0 +1,40 @@
+/*!
+ * @file resource_md2.h
+ * @brief Contains the ResourceMD2 class, that handles the Resource-specific loading part of the MD2.
+ *
+ */
+
+#ifndef _RESOURCE_MD2_H
+#define _RESOURCE_MD2_H
+
+#include "util/loading/resource.h"
+#include "md2Model.h"
+
+
+class ResourceMD2 : public MD2Model, public Resources::Resource
+{
+public:
+  ResourceMD2(const std::string& modelName,
+	      const std::string& skinName = "",
+	      float scale = 1.0f,
+	      const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+  static ResourceMD2 createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+  static std::string loadString(const std::string& modelName, const std::string& skinName = "", float scale = 1.0f);
+
+private:
+class MD2ResourcePointer : public Resources::StorePointer
+  {
+  public:
+    MD2ResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const MD2Data::Pointer& data);
+    inline const MD2Data::Pointer& ptr() const { return pointer; }
+    virtual bool last() const { return pointer.count() == 1; }
+  private:
+    MD2Data::Pointer pointer;
+  };
+
+private:
+  static Resources::tType<ResourceMD2> type;
+};
+
+
+#endif /* _RESOURCE_MD2_H */
Index: trunk/src/lib/graphics/importer/md3/md3_model.h
===================================================================
--- trunk/src/lib/graphics/importer/md3/md3_model.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/md3/md3_model.h	(revision 9869)
@@ -45,5 +45,5 @@
 
     virtual void setAnimation(int animNum, int playbackMode = 0) {}
-    virtual int getAnimation() { return 0;}
+    virtual int getAnimation() const { return 0;}
 
     virtual void tick(float dt);
Index: trunk/src/lib/graphics/importer/media_container.cc
===================================================================
--- trunk/src/lib/graphics/importer/media_container.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/media_container.cc	(revision 9869)
@@ -26,8 +26,8 @@
 
 #include "util/loading/resource_manager.h"
-
 /* header for debug output */
 #include "debug.h"
 
+ObjectListDefinition(MediaContainer);
 
 /**
@@ -37,5 +37,5 @@
 {
   // set the class id for the base object
-  this->setClassID(CL_MEDIA_CONTAINER, "MediaContainer");
+  this->registerObject(this, MediaContainer::_objectList);
 
   fps = 0;
@@ -91,5 +91,5 @@
     return false;
   // check whether file exists
-  if(!ResourceManager::isInDataDir(filename))
+  if(!Resources::ResourceManager::getInstance()->checkFileInMainPath(filename))
   {
     PRINTF(1)("Could not find %s\n", filename.c_str());
@@ -101,7 +101,7 @@
 
   // Open video file
-  if (av_open_input_file(&format_context, ResourceManager::getFullName(filename).c_str(), NULL, 0, NULL) !=0 )
-  {
-    PRINTF(1)("Could not open %s\n", ResourceManager::getFullName(filename).c_str());
+  if (av_open_input_file(&format_context, Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(filename).c_str(), NULL, 0, NULL) !=0 )
+  {
+    PRINTF(1)("Could not open %s\n", Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(filename).c_str());
     return false;
   }
@@ -110,5 +110,5 @@
   if (av_find_stream_info(format_context) < 0)
   {
-    PRINTF(1)("Could not find stream information in %s\n", ResourceManager::getFullName(filename).c_str());
+    PRINTF(1)("Could not find stream information in %s\n", Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(filename).c_str());
     return false;
   }
@@ -119,5 +119,5 @@
   if(video_stream == -1)
   {
-    PRINTF(1)("Could not find a video stream in %s\n", ResourceManager::getFullName(filename).c_str());
+    PRINTF(1)("Could not find a video stream in %s\n", Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(filename).c_str());
     return false;
   }
Index: trunk/src/lib/graphics/importer/media_container.h
===================================================================
--- trunk/src/lib/graphics/importer/media_container.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/media_container.h	(revision 9869)
@@ -24,5 +24,5 @@
 class MediaContainer : public TextureSequence
 {
-
+  ObjectListDeclaration(MediaContainer);
 private:
 
Index: trunk/src/lib/graphics/importer/model.cc
===================================================================
--- trunk/src/lib/graphics/importer/model.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/model.cc	(revision 9869)
@@ -20,5 +20,5 @@
 #include "glincl.h"
 
-
+ObjectListDefinition(Model);
 
 /**
@@ -28,5 +28,5 @@
 Model::Model()
 {
-  this->setClassID(CL_MODEL, "Model");
+  this->registerObject(this, Model::_objectList);
   this->pModelInfo.numVertices = 0;
   this->pModelInfo.numTriangles = 0;
Index: trunk/src/lib/graphics/importer/model.h
===================================================================
--- trunk/src/lib/graphics/importer/model.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/model.h	(revision 9869)
@@ -54,4 +54,5 @@
 //! This class defines the basic components of a model
 class Model : virtual public BaseObject {
+  ObjectListDeclaration(Model);
 
   public:
Index: trunk/src/lib/graphics/importer/movie_player.cc
===================================================================
--- trunk/src/lib/graphics/importer/movie_player.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/movie_player.cc	(revision 9869)
@@ -24,5 +24,4 @@
 // include your own header
 #include "movie_player.h"
-
 #include "util/loading/resource_manager.h"
 
@@ -30,10 +29,10 @@
 #include "debug.h"
 
+ObjectListDefinition(MoviePlayer);
 
 MoviePlayer::MoviePlayer(const std::string& filename)
 {
   // set the class id for the base object
-  this->setClassID(CL_MOVIE_PLAYER, "MoviePlayer");
-
+  this->registerObject(this, MoviePlayer::_objectList);
   status = STOP;
   timer = 0;
@@ -90,5 +89,5 @@
     return false;
   // check whether file exists
-  if(!ResourceManager::isInDataDir(filename))
+  if(!Resources::ResourceManager::getInstance()->checkFileInMainPath(filename))
   {
     PRINTF(1)("Could not find %s\n", filename.c_str());
@@ -100,7 +99,7 @@
 
   // Open video file
-  if (av_open_input_file(&format_context, ResourceManager::getFullName(filename).c_str(), NULL, 0, NULL) !=0 )
-  {
-    PRINTF(1)("Could not open %s\n", ResourceManager::getFullName(filename).c_str());
+  if (av_open_input_file(&format_context, Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(filename).c_str(), NULL, 0, NULL) !=0 )
+  {
+    PRINTF(1)("Could not open %s\n", Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(filename).c_str());
     return false;
   }
@@ -109,5 +108,5 @@
   if (av_find_stream_info(format_context) < 0)
   {
-    PRINTF(1)("Could not find stream information in %s\n", ResourceManager::getFullName(filename).c_str());
+    PRINTF(1)("Could not find stream information in %s\n", Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(filename).c_str());
     return false;
   }
@@ -118,5 +117,5 @@
   if(video_stream == -1)
   {
-    PRINTF(1)("Could not find a video stream in %s\n", ResourceManager::getFullName(filename).c_str());
+    PRINTF(1)("Could not find a video stream in %s\n", Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(filename).c_str());
     return false;
   }
Index: trunk/src/lib/graphics/importer/movie_player.h
===================================================================
--- trunk/src/lib/graphics/importer/movie_player.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/movie_player.h	(revision 9869)
@@ -31,4 +31,5 @@
 class MoviePlayer : public BaseObject
 {
+  ObjectListDeclaration(MoviePlayer);
 
 private:
Index: trunk/src/lib/graphics/importer/objModel.cc
===================================================================
--- trunk/src/lib/graphics/importer/objModel.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/objModel.cc	(revision 9869)
@@ -18,7 +18,6 @@
 #include "objModel.h"
 
-#include <stdio.h>
 #include <string.h>
-#include <stdlib.h>
+#include "loading/resource_manager.h"
 
 #define PARSELINELENGTH 8192
@@ -27,4 +26,5 @@
 #include "compiler.h"
 
+ObjectListDefinition(OBJModel);
 /**
  * @brief Crates a 3D-Model, loads in a File and scales it.
@@ -35,9 +35,9 @@
   : StaticModel(fileName)
 {
-  this->setClassID(CL_OBJ_MODEL, "OBJModel");
+  this->registerObject(this, OBJModel::_objectList);
 
   this->objPath = "./";
 
-  this->scaleFactor = scaling;
+  this->setScaleFactor(scaling);
 
   this->importFile (fileName);
@@ -77,5 +77,5 @@
   else
     this->objPath = "./";
-  Material::addTexturePath(this->objPath);
+  Resources::ResourceManager::getInstance()->addResourcePath("Texture", this->objPath);
 
   this->readFromObjFile (fileName);
Index: trunk/src/lib/graphics/importer/objModel.h
===================================================================
--- trunk/src/lib/graphics/importer/objModel.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/objModel.h	(revision 9869)
@@ -12,24 +12,25 @@
 class OBJModel : public StaticModel
 {
- public:
-   OBJModel(const std::string& fileName, float scaling = 1.0);
+  ObjectListDeclaration(OBJModel);
+public:
+  OBJModel(const std::string& fileName, float scaling = 1.0);
   virtual ~OBJModel();
 
- private:
+private:
   ///// readin /////
-   bool importFile (const std::string& fileName);
-   bool readFromObjFile (const std::string& fileName);
-   bool readMtlLib (const std::string& matFile);
+  bool importFile (const std::string& fileName);
+  bool readFromObjFile (const std::string& fileName);
+  bool readMtlLib (const std::string& matFile);
 
-  private:
-   void setIllum (Material* material, const char* illum);
-   void setDiffuse (Material* material, const char* rgb);
-   void setAmbient (Material* material, const char* rgb);
-   void setSpecular (Material* material, const char* rgb);
-   void setShininess (Material* material, const char* shini);
-   void setTransparency (Material* material, const char* trans);
+private:
+  void setIllum (Material* material, const char* illum);
+  void setDiffuse (Material* material, const char* rgb);
+  void setAmbient (Material* material, const char* rgb);
+  void setSpecular (Material* material, const char* rgb);
+  void setShininess (Material* material, const char* shini);
+  void setTransparency (Material* material, const char* trans);
 
- private:
-   std::string       objPath;     //!< The Path where the obj and mtl-file are located.
+private:
+  std::string       objPath;     //!< The Path where the obj and mtl-file are located.
 };
 
Index: trunk/src/lib/graphics/importer/resource_obj.cc
===================================================================
--- trunk/src/lib/graphics/importer/resource_obj.cc	(revision 9869)
+++ trunk/src/lib/graphics/importer/resource_obj.cc	(revision 9869)
@@ -0,0 +1,52 @@
+
+#include "resource_obj.h"
+#include "substring.h"
+#include "multi_type.h"
+#include "debug.h"
+
+
+ResourceOBJ::ResourceOBJ(const std::string& imageName, float scaling, const Resources::KeepLevel& keepLevel)
+    : Resource(&ResourceOBJ::type)
+{
+  Resources::StorePointer* ptr = this->acquireResource(imageName + ',' + MultiType(scaling).getString());
+
+  if (ptr)
+  {
+    PRINTF(5)("FOUND OBJ: %s\n", imageName.c_str());
+    this->acquireData(static_cast<ResourceOBJ::OBJResourcePointer*>(ptr)->ptr());
+  }
+  else
+  {
+    PRINTF(5)("NOT FOUND OBJ: %s\n", imageName.c_str());
+    std::string fileName = this->Resource::locateFile(imageName);
+    this->acquireData(OBJModel(fileName, scaling).dataPointer());
+    this->Resource::addResource(new ResourceOBJ::OBJResourcePointer(imageName + ',' + MultiType(scaling).getString(), keepLevel, this->StaticModel::dataPointer()));
+  }
+}
+
+ResourceOBJ ResourceOBJ::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel)
+{
+  SubString loadValues(loadString, ',');
+  std::string imageName;
+  float scaling = 1.0f;
+  if (loadValues.size() > 0)
+    imageName = loadValues[0];
+  if (loadValues.size() > 1)
+    scaling = (GLenum)MultiType(loadValues[2]).getFloat();
+
+  return ResourceOBJ(imageName, scaling, keepLevel);
+}
+
+
+
+Resources::tType<ResourceOBJ> ResourceOBJ::type("OBJ");
+
+
+
+
+
+ResourceOBJ::OBJResourcePointer::OBJResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const StaticModelData::Pointer& data)
+    : Resources::StorePointer(loadString, keepLevel) , pointer(data)
+{}
+
+
Index: trunk/src/lib/graphics/importer/resource_obj.h
===================================================================
--- trunk/src/lib/graphics/importer/resource_obj.h	(revision 9869)
+++ trunk/src/lib/graphics/importer/resource_obj.h	(revision 9869)
@@ -0,0 +1,38 @@
+/*!
+ * @file resource_obj.h
+ * @brief Contains the ResourceOBJ class, that handles the Resource-specific loading part of the OBJ.
+ *
+ */
+
+#ifndef _RESOURCE_OBJ_H
+#define _RESOURCE_OBJ_H
+
+#include "util/loading/resource.h"
+#include "objModel.h"
+
+class ResourceOBJ : public StaticModel, public Resources::Resource
+{
+public:
+  ResourceOBJ(const std::string& imageName,
+	      float scaling = 1.0f,
+	      const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+  static ResourceOBJ createFromString(const std::string& loadString,
+				      const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+
+private:
+class OBJResourcePointer : public Resources::StorePointer
+  {
+  public:
+    OBJResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const StaticModelData::Pointer& data);
+    inline const StaticModelData::Pointer& ptr() const { return pointer; }
+    virtual bool last() const { return pointer.count() == 1; }
+private:
+    StaticModelData::Pointer pointer;
+  };
+
+private:
+  static Resources::tType<ResourceOBJ> type;
+};
+
+
+#endif /* _RESOURCE_OBJ_H */
Index: trunk/src/lib/graphics/importer/resource_texture.cc
===================================================================
--- trunk/src/lib/graphics/importer/resource_texture.cc	(revision 9869)
+++ trunk/src/lib/graphics/importer/resource_texture.cc	(revision 9869)
@@ -0,0 +1,52 @@
+
+#include "resource_texture.h"
+#include "substring.h"
+#include "multi_type.h"
+#include "debug.h"
+
+
+ResourceTexture::ResourceTexture(const std::string& imageName, GLenum target, const Resources::KeepLevel& keepLevel)
+    : Resource(&ResourceTexture::type)
+{
+  Resources::StorePointer* ptr = this->acquireResource(imageName + ',' + MultiType((int)target).getString());
+
+  if (ptr)
+  {
+    PRINTF(5)("FOUND TEXTURE: %s\n", imageName.c_str());
+    this->acquireData(static_cast<ResourceTexture::TextureResourcePointer*>(ptr)->ptr());
+  }
+  else
+  {
+    PRINTF(5)("NOT FOUND TEXTURE: %s\n", imageName.c_str());
+    std::string fileName = this->Resource::locateFile(imageName);
+    this->Texture::loadImage(fileName, target);
+    this->Resource::addResource(new ResourceTexture::TextureResourcePointer(imageName + ',' + MultiType((int)target).getString(), keepLevel, this->Texture::dataPointer()));
+  }
+}
+
+ResourceTexture ResourceTexture::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel)
+{
+  SubString loadValues(loadString, ',');
+  std::string imageName;
+  GLenum target = GL_TEXTURE_2D;
+  if (loadValues.size() > 0)
+    imageName = loadValues[0];
+  if (loadValues.size() > 1)
+    target = (GLenum)MultiType(loadValues[2]).getInt();
+
+  return ResourceTexture(imageName, target, keepLevel);
+}
+
+
+
+Resources::tType<ResourceTexture> ResourceTexture::type("Texture");
+
+
+
+
+
+ResourceTexture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const TextureData::Pointer& data)
+    : Resources::StorePointer(loadString, keepLevel) , pointer(data)
+{}
+
+
Index: trunk/src/lib/graphics/importer/resource_texture.h
===================================================================
--- trunk/src/lib/graphics/importer/resource_texture.h	(revision 9869)
+++ trunk/src/lib/graphics/importer/resource_texture.h	(revision 9869)
@@ -0,0 +1,39 @@
+/*!
+ * @file resource_texture.h
+ * @brief Contains the ResourceTexture class, that handles the Resource-specific loading part of the Texture.
+ *
+ */
+
+#ifndef _RESOURCE_TEXTURE_H
+#define _RESOURCE_TEXTURE_H
+
+#include "util/loading/resource.h"
+#include "texture.h"
+
+
+class ResourceTexture : public Texture, public Resources::Resource
+{
+public:
+  ResourceTexture(const std::string& imageName,
+                  GLenum target = GL_TEXTURE_2D,
+		  const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+  static ResourceTexture createFromString(const std::string& loadString,
+					  const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+
+private:
+class TextureResourcePointer : public Resources::StorePointer
+  {
+  public:
+    TextureResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const TextureData::Pointer& data);
+    inline const TextureData::Pointer& ptr() const { return pointer; }
+    virtual bool last() const { return pointer.count() == 1; }
+  private:
+    TextureData::Pointer pointer;
+  };
+
+private:
+  static Resources::tType<ResourceTexture> type;
+};
+
+
+#endif /* _RESOURCE_TEXTURE_H */
Index: trunk/src/lib/graphics/importer/static_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/static_model.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/static_model.cc	(revision 9869)
@@ -26,110 +26,9 @@
 
 
-////////////////////
-/// SUB-Elements ///
-////////////////////
-/**
- * @brief creates a new ModelFaceElement
- */
-ModelFaceElement::ModelFaceElement()
-{
-  this->vertexNumber = -1;
-  this->normalNumber = -1;
-  this->texCoordNumber = -1;
-
-  this->next = NULL;
-}
-
-/**
- * @brief destroys a ModelFaceElement
- */
-ModelFaceElement::~ModelFaceElement()
-{
-  if (this->next)
-    delete this->next;
-}
-
-/**
- * @brief creates a new ModelFace
- */
-ModelFace::ModelFace()
-{
-  this->vertexCount = 0;
-
-  this->firstElem = NULL;
-
-  this->material = NULL;
-
-  this->next = NULL;
-}
-
-/**
- *  deletes a ModelFace
-*/
-ModelFace::~ModelFace()
-{
-  PRINTF(5)("Cleaning up Face\n");
-
-  if (this->firstElem != NULL)
-    delete this->firstElem;
-
-  if (this->next != NULL)
-    delete this->next;
-}
-
-/**
- * @brief Creates a new ModelGroup
- */
-ModelGroup::ModelGroup()
-{
-  PRINTF(4)("Adding new Group\n");
-  this->name = "";
-  this->faceMode = -1;
-  this->faceCount = 0;
-  this->next = NULL;
-  this->listNumber = 0;
-  this->indices = NULL;
-
-  this->firstFace = new ModelFace;
-  this->currentFace = this->firstFace;
-}
-
-/**
- * @brief deletes a ModelGroup
- */
-ModelGroup::~ModelGroup()
-{
-  PRINTF(5)("Cleaning up group\n");
-  if (this->firstFace != NULL)
-    delete this->firstFace;
-
-  // deleting the glList
-  if (this->listNumber != 0)
-    glDeleteLists(this->listNumber, 1);
-
-  if (this->next !=NULL)
-    delete this->next;
-
-}
-
-/**
- * @brief cleans up a ModelGroup
- *
- * actually does the same as the delete Operator, but does not delete the predecessing group
- */
-void ModelGroup::cleanup()
-{
-  PRINTF(5)("Cleaning up group\n");
-  if (this->firstFace)
-    delete this->firstFace;
-  this->firstFace = NULL;
-  if (this->next)
-    this->next->cleanup();
-}
-
-
 /////////////
 /// MODEL ///
 /////////////
+ObjectListDefinition(StaticModel);
+
 /**
  * @brief Creates a 3D-Model.
@@ -138,18 +37,19 @@
  */
 StaticModel::StaticModel(const std::string& modelName)
+    : data(new StaticModelData(modelName))
 {
-  this->setClassID(CL_STATIC_MODEL, "StaticModel");
+  this->registerObject(this, StaticModel::_objectList);
   PRINTF(4)("new 3D-Model is being created\n");
   this->setName(modelName);
+}
 
-  this->finalized = false;
+StaticModel::StaticModel(const StaticModel& staticModel)
+  : data(staticModel.data)
+{
+  this->registerObject(this, StaticModel::_objectList);
+  this->setName(staticModel.getName());
+  this->updateBase();
+}
 
-  // setting the start group;
-  this->currentGroup = this->firstGroup = new ModelGroup;
-  this->groupCount = 0;
-  this->faceCount = 0;
-
-  this->scaleFactor = 1.0f;
-}
 
 /**
@@ -161,28 +61,4 @@
 {
   PRINTF(4)("Deleting Model ");
-  if (!this->getName().empty())
-  {
-    PRINT(4)("%s\n", this->getCName());
-  }
-  else
-  {
-    PRINT(4)("\n");
-  }
-  this->cleanup();
-
-  PRINTF(5)("Deleting display Lists.\n");
-  delete this->firstGroup;
-
-  // deleting the MaterialList
-  PRINTF(5)("Deleting Materials.\n");
-
-  //! @todo do we really have to delete this material??
-  std::list<ModelMaterial*>::iterator modMat;
-  for(modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
-  {
-    if (!(*modMat)->external)
-      delete (*modMat)->material;
-    delete (*modMat);
-  }
 
   // mark this stuff as beeing deleted
@@ -190,5 +66,14 @@
   this->pModelInfo.pNormals = NULL;
   this->pModelInfo.pTexCoor = NULL;
+  this->pModelInfo.pTriangles = NULL;
 }
+
+StaticModel& StaticModel::operator=(const StaticModel& model)
+{
+  this->data = model.data;
+  this->updateBase();
+  return *this;
+};
+
 
 /**
@@ -197,367 +82,12 @@
 void StaticModel::finalize()
 {
-  // this creates the display List.
-  this->importToDisplayList();
-  this->buildTriangleList();
-
-  // write out the modelInfo data used for the collision detection!
-  this->pModelInfo.pVertices = &this->vertices[0];
-  this->pModelInfo.pNormals = &this->normals[0];
-  this->pModelInfo.pTexCoor = &this->vTexture[0];
-
-  this->finalized = true;
+  data->finalize();
+  this->updateBase();
 }
 
-/**
- * @brief rebuild the Model from the Information we got.
- */
-void StaticModel::rebuild()
+void StaticModel::acquireData(const StaticModelData::Pointer& data)
 {
-  PRINTF(3)("Rebuilding Model '%s'\n", this->getCName());
-  this->finalize();
-}
-
-//////////
-// DRAW //
-//////////
-/**
- * @brief Draws the Models of all Groups.
- *
- * It does this by just calling the Lists that must have been created earlier.
- */
-void StaticModel::draw () const
-{
-  PRINTF(4)("drawing the 3D-Models\n");
-  ModelGroup* tmpGroup = this->firstGroup;
-  while (tmpGroup != NULL)
-  {
-    PRINTF(5)("Drawing model %s\n", tmpGroup->name.c_str());
-    glCallList (tmpGroup->listNumber);
-    tmpGroup = tmpGroup->next;
-  }
-}
-
-
-/**
- * @brief Draws the Model number groupNumber
- * @param groupNumber The number of the group that will be displayed.
- *
- * It does this by just calling the List that must have been created earlier.
- */
-void StaticModel::draw (int groupNumber) const
-{
-  if (unlikely(groupNumber >= this->groupCount))
-  {
-    PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);
-    return;
-  }
-  PRINTF(4)("drawing the requested 3D-Models if found.\n");
-  ModelGroup* tmpGroup = this->firstGroup;
-  int counter = 0;
-  while (tmpGroup != NULL)
-  {
-    if (counter == groupNumber)
-    {
-      PRINTF(4)("Drawing model number %i named %s\n", counter, tmpGroup->name.c_str());
-      glCallList (tmpGroup->listNumber);
-      return;
-    }
-    ++counter;
-    tmpGroup = tmpGroup->next;
-  }
-  PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->getCName());
-  return;
-}
-
-
-/**
- * @brief Draws the Model with a specific groupName
- * @param groupName The name of the group that will be displayed.
- *
- * It does this by just calling the List that must have been created earlier.
- */
-void StaticModel::draw (const std::string& groupName) const
-{
-  PRINTF(4)("drawing the requested 3D-Models if found.\n");
-  ModelGroup* tmpGroup = this->firstGroup;
-  while (tmpGroup != NULL)
-  {
-    if (tmpGroup->name == groupName)
-    {
-      PRINTF(4)("Drawing model %s\n", tmpGroup->name.c_str());
-      glCallList (tmpGroup->listNumber);
-      return;
-    }
-    tmpGroup = tmpGroup->next;
-  }
-  PRINTF(2)("Model Named %s in %s not Found.\n", groupName.c_str(), this->getCName());
-  return;
-}
-
-//////////
-// INIT //
-//////////
-
-/**
- * @brief finalizes an Model.
- *
- * This funcion is needed, to delete all the Lists, and arrays that are no more
- * needed because they are already imported into openGL.
- * This will be applied at the end of the importing Process.
-*/
-bool StaticModel::cleanup()
-{
-  PRINTF(4)("cleaning up the 3D-Model to save Memory.\n");
-  this->firstGroup->cleanup();
-  return true;
-}
-
-//////////
-// MESH //
-//////////
-/**
- * @brief adds a new Material to the Material List
- * @param material the Material to add
- * @returns the added material
- *
- * this also tells this Model, that all the Materials are handled externally
- * with this option set the Materials will not be deleted with the Model.
- */
-Material* StaticModel::addMaterial(Material* material)
-{
-  if (material == NULL)
-    return NULL;
-  ModelMaterial* modMat = new ModelMaterial;
-  modMat->external = true;
-  modMat->material = material;
-  this->materialList.push_back(modMat);
-  return modMat->material;
-}
-
-/**
- * @brief adds a new Material to the Material List
- * @param materialName the name of the Material to add
- * @returns the added material
- */
-Material* StaticModel::addMaterial(const std::string& materialName)
-{
-  ModelMaterial* modMat = new ModelMaterial;
-  modMat->external = false;
-  modMat->material = new Material(materialName);
-
-  // adding material to the List of materials
-  this->materialList.push_back(modMat);
-  return modMat->material;
-}
-
-/**
- * @brief finds a Material by its name and returns it
- * @param materialName the Name of the material to search for.
- * @returns the Material if found, NULL otherwise
- */
-Material* StaticModel::findMaterialByName(const std::string& materialName)
-{
-  std::list<ModelMaterial*>::iterator modMat;
-  for  (modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
-    if (materialName == (*modMat)->material->getName())
-      return (*modMat)->material;
-  return NULL;
-}
-
-/**
- * @brief parses a group String
- * @param groupString the new Group to create
- *
- * This function initializes a new Group.
- * With it you should be able to create Models with more than one SubModel inside
- */
-bool StaticModel::addGroup(const std::string& groupString)
-{
-  PRINTF(5)("Read Group: %s.\n", groupString.c_str());
-  if (this->groupCount != 0 && this->currentGroup->faceCount > 0)
-  {
-    // finalizeGroup(currentGroup);
-    this->currentGroup = this->currentGroup->next = new ModelGroup;
-  }
-  // setting the group name if not default.
-  if (groupString == "default")
-  {
-    this->currentGroup->name = groupString;
-  }
-  ++this->groupCount;
-  return true;
-}
-
-/**
- * @brief parses a vertex-String
- * @param vertexString The String that will be parsed.
- *
- *  If a vertex line is found this function will inject it into the vertex-Array
- */
-bool StaticModel::addVertex (const std::string& vertexString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  float subbuffer3;
-  sscanf (vertexString.c_str(), "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
-  this->vertices.push_back(subbuffer1*scaleFactor);
-  this->vertices.push_back(subbuffer2*scaleFactor);
-  this->vertices.push_back(subbuffer3*scaleFactor);
-  this->pModelInfo.numVertices++;
-  return true;
-}
-
-/**
- * @brief parses a vertex-String
- * @param x the X-coordinate of the Vertex to add.
- * @param y the Y-coordinate of the Vertex to add.
- * @param z the Z-coordinate of the Vertex to add.
- */
-bool StaticModel::addVertex(float x, float y, float z)
-{
-  PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z);
-  this->vertices.push_back(x*scaleFactor);
-  this->vertices.push_back(y*scaleFactor);
-  this->vertices.push_back(z*scaleFactor);
-  this->pModelInfo.numVertices++;
-  return true;
-}
-
-/**
- * @brief parses a vertexNormal-String
- * @param normalString The String that will be parsed.
- *
- * If a vertexNormal line is found this function will inject it into the vertexNormal-Array
- */
-bool StaticModel::addVertexNormal (const std::string& normalString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  float subbuffer3;
-  sscanf (normalString.c_str(), "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
-  this->normals.push_back(subbuffer1);
-  this->normals.push_back(subbuffer2);
-  this->normals.push_back(subbuffer3);
-  this->pModelInfo.numNormals++;
-  return true;
-}
-
-/**
- * @brief adds a VertexNormal.
- * @param x The x coordinate of the Normal.
- * @param y The y coordinate of the Normal.
- * @param z The z coordinate of the Normal.
- *
- * If a vertexNormal line is found this function will inject it into the vertexNormal-Array
- */
-bool StaticModel::addVertexNormal(float x, float y, float z)
-{
-  PRINTF(5)("found vertex-Normal %f, %f, %f\n", x, y, z);
-  this->normals.push_back(x);
-  this->normals.push_back(y);
-  this->normals.push_back(z);
-  this->pModelInfo.numNormals++;
-  return true;
-}
-
-/**
- * @brief parses a vertexTextureCoordinate-String
- * @param vTextureString The String that will be parsed.
- *
- * If a vertexTextureCoordinate line is found,
- * this function will inject it into the vertexTexture-Array
- *
- * !! WARNING THIS IS DIFFERNT FROM addVervexTexture(float, float); because it changes the second entry to 1-v !!
- */
-bool StaticModel::addVertexTexture (const std::string& vTextureString)
-{
-  float subbuffer1;
-  float subbuffer2;
-  sscanf (vTextureString.c_str(), "%f %f", &subbuffer1, &subbuffer2);
-  this->vTexture.push_back(subbuffer1);
-  this->vTexture.push_back(1 - subbuffer2);
-  this->pModelInfo.numTexCoor++;
-  return true;
-}
-
-/**
- * @brief adds a Texture Coordinate
- * @param u The u coordinate of the TextureCoordinate.
- * @param v The y coordinate of the TextureCoordinate.
- *
- * If a TextureCoordinate line is found this function will
- *  inject it into the TextureCoordinate-Array
- */
-bool StaticModel::addVertexTexture(float u, float v)
-{
-  PRINTF(5)("found vertex-Texture %f, %f\n", u, v);
-  this->vTexture.push_back(u);
-  this->vTexture.push_back(v);
-  this->pModelInfo.numTexCoor++;
-  return true;
-}
-
-/**
- * @brief parses a face-string
- * @param faceString The String that will be parsed.
- *
- * If a face line is found this function will add it to the glList.
- *
- * String is different from the argument addFace,
- * in this, that the first Vertex/Normal/Texcoord is 1 instead of 0
- *
- * @TODO make it std::string conform
- */
-bool StaticModel::addFace (const std::string& faceStringInput)
-{
-  const char* faceString = faceStringInput.c_str();
-  if (this->currentGroup->faceCount >0)
-    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
-
-  ModelFaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new ModelFaceElement;
-  tmpElem->next = NULL;
-  while(strcmp (faceString, "\0"))
-  {
-    if (this->currentGroup->currentFace->vertexCount>0)
-      tmpElem = tmpElem->next = new ModelFaceElement;
-    tmpElem->next = NULL;
-
-    char tmpValue [50];
-    int tmpLen;
-    char* vertex = NULL;
-    char* texture = NULL;
-    char* normal = NULL;
-
-    sscanf (faceString, "%s", tmpValue);
-    tmpLen = strlen(tmpValue);
-    vertex = tmpValue;
-
-    if ((texture = strstr (vertex, "/")) != NULL)
-    {
-      texture[0] = '\0';
-      texture ++;
-
-      if ((normal = strstr (texture, "/")) !=NULL)
-      {
-        normal[0] = '\0';
-        normal ++;
-      }
-    }
-    if (vertex)
-      tmpElem->vertexNumber = atoi(vertex)-1;
-    if (texture)
-      tmpElem->texCoordNumber = atoi(texture)-1;
-    if (normal)
-      tmpElem->normalNumber = atoi(normal)-1;
-
-    faceString += tmpLen;
-    if (strcmp (faceString, "\0"))
-      faceString++;
-    this->currentGroup->currentFace->vertexCount++;
-  }
-
-  this->currentGroup->faceCount += this->currentGroup->currentFace->vertexCount -2;
-  this->faceCount += this->currentGroup->currentFace->vertexCount -2;
-  return true;
+  this->data = data;
+  this->updateBase();
 }
 
@@ -569,405 +99,31 @@
 bool StaticModel::addFace(int faceElemCount, VERTEX_FORMAT type, ...)
 {
-  if (this->currentGroup->faceCount > 0)
-    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
-
-  ModelFaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new ModelFaceElement;
-
   va_list itemlist;
   va_start (itemlist, type);
-
-  for (int i = 0; i < faceElemCount; i++)
-  {
-    if (this->currentGroup->currentFace->vertexCount > 0)
-      tmpElem = tmpElem->next = new ModelFaceElement;
-
-    tmpElem->vertexNumber = va_arg (itemlist, int);
-    if (type & TEXCOORD)
-      tmpElem->texCoordNumber = va_arg (itemlist, int);
-    if (type & NORMAL)
-      tmpElem->normalNumber = va_arg(itemlist, int);
-    this->currentGroup->currentFace->vertexCount++;
-  }
+  bool retVal = this->data->addFace(faceElemCount, type, itemlist);
   va_end(itemlist);
-
-  this->currentGroup->faceCount += this->currentGroup->currentFace->vertexCount - 2;
-  this->faceCount += this->currentGroup->currentFace->vertexCount -2;
-  return true;
+  return retVal;
 }
 
-/**
- * Function that selects a material, if changed in the obj file.
- * @param matString the Material that will be set.
-*/
-bool StaticModel::setMaterial(const std::string& matString)
+void StaticModel::updateBase()
 {
-  if (this->currentGroup->faceCount > 0)
-    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
+  // write out the modelInfo data used for the collision detection!
+  this->pModelInfo.pVertices = &this->data->getVertices()[0];
+  this->pModelInfo.numVertices = this->data->getVertices().size();
+  this->pModelInfo.pNormals = &this->data->getNormals()[0];
+  this->pModelInfo.numNormals = this->data->getNormals().size();
+  this->pModelInfo.pTexCoor = &this->data->getTexCoords()[0];
+  this->pModelInfo.numTexCoor = this->data->getTexCoords().size();
 
-  this->currentGroup->currentFace->material = this->findMaterialByName(matString);
-
-  if (this->currentGroup->faceCount == 0)
-    this->currentGroup->faceCount++;
-  return true;
-}
-
-/**
- * Function that selects a material, if changed in the obj file.
- * @param mtl the Material that will be set.
-*/
-bool StaticModel::setMaterial(Material* mtl)
-{
-  if (this->currentGroup->faceCount > 0)
-    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
-
-  this->currentGroup->currentFace->material = mtl;
-
-  if (this->currentGroup->faceCount == 0)
-    this->currentGroup->faceCount++;
-  return true;
-}
-
-/**
- * @brief A routine that is able to create normals.
- *
- * The algorithm does the following:
- * 1. It calculates creates Vectors for each normale, and sets them to zero.
- * 2. It then Walks through a) all the Groups b) all the Faces c) all the FaceElements
- * 3. It searches for a points two neighbours per Face, takes Vecotrs to them calculates FaceNormals and adds it to the Points Normal.
- * 4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.
- */
-bool StaticModel::buildVertexNormals ()
-{
-  PRINTF(4)("Normals are being calculated.\n");
-
-  Vector* normArray = new Vector [vertices.size()/3];
-  for (unsigned int i=0; i<vertices.size()/3;i++)
-    normArray[i] = Vector(.0,.0,.0);
-
-  Vector prevV;
-  Vector nextV;
-  Vector curV;
-
-  ModelGroup* tmpGroup = firstGroup;
-  while (tmpGroup != NULL)
-  {
-    ModelFace* tmpFace = tmpGroup->firstFace;
-    while (tmpFace != NULL)
-    {
-      if (tmpFace->firstElem != NULL)
-      {
-        ModelFaceElement* firstElem = tmpFace->firstElem;
-        ModelFaceElement* prevElem;
-        ModelFaceElement* curElem = firstElem;
-        ModelFaceElement* nextElem;
-        ModelFaceElement* lastElem;
-        // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop.
-        while (curElem != NULL)
-        {
-          prevElem = curElem;
-          curElem = curElem->next;
-        }
-        lastElem = prevElem;
-
-        curElem = firstElem;
-        for (unsigned int j = 0; j < tmpFace->vertexCount; j++)
-        {
-          if (!(nextElem = curElem->next))
-            nextElem = firstElem;
-          curElem->normalNumber = curElem->vertexNumber;
-
-          curV = Vector (this->vertices[curElem->vertexNumber*3],
-                         this->vertices[curElem->vertexNumber*3+1],
-                         this->vertices[curElem->vertexNumber*3+2]);
-
-          prevV = Vector (this->vertices[prevElem->vertexNumber*3],
-                          this->vertices[prevElem->vertexNumber*3+1],
-                          this->vertices[prevElem->vertexNumber*3+2]) - curV;
-
-          nextV = Vector (this->vertices[nextElem->vertexNumber*3],
-                          this->vertices[nextElem->vertexNumber*3+1],
-                          this->vertices[nextElem->vertexNumber*3+2]) - curV;
-          normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV);
-
-          prevElem = curElem;
-          curElem = curElem->next;
-        }
-      }
-      tmpFace = tmpFace->next;
-    }
-    tmpGroup = tmpGroup->next;
-  }
-
-  for (unsigned int i=0; i < this->vertices.size()/3;i++)
-  {
-    normArray[i].normalize();
-    PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
-
-    this->addVertexNormal(normArray[i].x, normArray[i].y, normArray[i].z);
-
-  }
-  delete[] normArray;
-  return true;
-}
-
-////////////
-// openGL //
-////////////
-/**
- *  reads and includes the Faces/Materials into the openGL state Machine
-*/
-bool StaticModel::importToDisplayList()
-{
-  // finalize the Arrays
-  if (normals.size() == 0) // vertices-Array must be built for this
-    this->buildVertexNormals();
-
-  this->currentGroup = this->firstGroup;
-
-  while (this->currentGroup != NULL)
-  {
-
-    // creating a glList for the Group
-    if ((this->currentGroup->listNumber = glGenLists(1)) == 0)
-    {
-      PRINTF(2)("glList could not be created for this Model\n");
-      return false;
-    }
-    glNewList (this->currentGroup->listNumber, GL_COMPILE);
-
-    // Putting Faces to GL
-    ModelFace* tmpFace = this->currentGroup->firstFace;
-    while (tmpFace != NULL)
-    {
-      if (tmpFace->vertexCount == 0 && tmpFace->material != NULL)
-      {
-        if (this->currentGroup->faceMode != -1)
-          glEnd();
-        this->currentGroup->faceMode = 0;
-        if (tmpFace->material != NULL)
-        {
-          tmpFace->material->select();
-          PRINTF(5)("using material %s for coming Faces.\n", tmpFace->material->getCName());
-        }
-      }
-
-      else if (tmpFace->vertexCount == 3)
-      {
-        if (this->currentGroup->faceMode != 3)
-        {
-          if (this->currentGroup->faceMode != -1)
-            glEnd();
-          glBegin(GL_TRIANGLES);
-        }
-
-        this->currentGroup->faceMode = 3;
-        PRINTF(5)("found triag.\n");
-      }
-
-      else if (tmpFace->vertexCount == 4)
-      {
-        if (this->currentGroup->faceMode != 4)
-        {
-          if (this->currentGroup->faceMode != -1)
-            glEnd();
-          glBegin(GL_QUADS);
-        }
-        this->currentGroup->faceMode = 4;
-        PRINTF(5)("found quad.\n");
-      }
-
-      else if (tmpFace->vertexCount > 4)
-      {
-        if (this->currentGroup->faceMode != -1)
-          glEnd();
-        glBegin(GL_POLYGON);
-        PRINTF(5)("Polygon with %i faces found.", tmpFace->vertexCount);
-        this->currentGroup->faceMode = tmpFace->vertexCount;
-      }
-
-      ModelFaceElement* tmpElem = tmpFace->firstElem;
-      while (tmpElem != NULL)
-      {
-        //      PRINTF(2)("%s\n", tmpElem->value);
-        this->addGLElement(tmpElem);
-        tmpElem = tmpElem->next;
-      }
-      tmpFace = tmpFace->next;
-    }
-    glEnd();
-    glEndList();
-
-    this->currentGroup = this->currentGroup->next;
-  }
-  return true;
+  this->pModelInfo.pTriangles = this->data->getTrianglesExt();
+  this->pModelInfo.numTriangles = this->data->getTriangles().size();
 }
 
 
 /**
- *  builds an array of triangles, that can later on be used for obb separation and octree separation
+ *  Includes a default model
+ *
+ * This will inject a Cube, because this is the most basic model.
  */
-bool StaticModel::buildTriangleList()
-{
-  if( unlikely(this->pModelInfo.pTriangles != NULL))
-    return true;
-  /* make sure, that all the arrays are finalized */
-  if( normals.size() == 0) // vertices-Array must be built for this
-    this->buildVertexNormals();
-
-  int                index = 0;                   //!< the counter for the triangle array
-  ModelFaceElement*  tmpElem;       //!< the temporary faceelement reference
-  ModelFace*         tmpFace;              //!< the temporary face referece
-
-  bool warned = false;
-
-  this->pModelInfo.numTriangles = 0;
-
-  /* count the number of triangles */
-  /* now iterate through all groups and build up the triangle list */
-  this->currentGroup = this->firstGroup;
-  while( this->currentGroup != NULL)
-  {
-    tmpFace = this->currentGroup->firstFace;
-    while( tmpFace != NULL)
-    {
-      /* if its a triangle just add it to the list */
-      if( tmpFace->vertexCount == 3){
-        ++this->pModelInfo.numTriangles;
-      } /* if the polygon is a quad */
-      else if( tmpFace->vertexCount == 4) {
-        this->pModelInfo.numTriangles += 2;
-      }
-      else if( tmpFace->vertexCount > 4) {
-        if (!warned)        {
-          PRINTF(2)("This model (%s) got over 4 vertices per face <=> conflicts in the CD engine!\n", this->getCName());
-          warned = true;
-        }
-      }
-      tmpFace = tmpFace->next;
-    }
-    this->currentGroup = this->currentGroup->next;
-  }
-
-  PRINTF(3)("got %i triangles, %i vertices\n", this->pModelInfo.numTriangles, this->pModelInfo.numVertices);
-
-
-  /* write MODELINFO structure */
-
-  /* allocate memory for the new triangle structures */
-  if( (this->pModelInfo.pTriangles = new sTriangleExt[this->pModelInfo.numTriangles]) == NULL)
-  {
-    PRINTF(1)("Could not allocate memory for triangle list\n");
-    return false;
-  }
-
-  /* now iterate through all groups and build up the triangle list */
-  this->currentGroup = this->firstGroup;
-  while( this->currentGroup != NULL)
-  {
-    tmpFace = this->currentGroup->firstFace;
-    while( tmpFace != NULL)
-    {
-      tmpElem = tmpFace->firstElem;
-
-      /* if its a triangle just add it to the list */
-      if( tmpFace->vertexCount == 3)
-      {
-        for( int j = 0; j < 3; ++j)
-        {
-          this->pModelInfo.pTriangles[index].indexToVertices[j] = (unsigned int)tmpElem->vertexNumber * 3 ;
-          this->pModelInfo.pTriangles[index].indexToNormals[j] = (unsigned int)tmpElem->normalNumber * 3 ;
-          this->pModelInfo.pTriangles[index].indexToTexCoor[j] = (unsigned int)tmpElem->texCoordNumber * 3 ;
-          tmpElem = tmpElem->next;
-
-        }
-        ++index;
-      } /* if the polygon is a quad */
-      else if( tmpFace->vertexCount == 4)
-      {
-
-        this->pModelInfo.pTriangles[index].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->pModelInfo.pTriangles[index].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3;
-        this->pModelInfo.pTriangles[index].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3;
-
-        this->pModelInfo.pTriangles[index + 1].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->pModelInfo.pTriangles[index + 1].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3;
-        this->pModelInfo.pTriangles[index + 1].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3;
-        tmpElem = tmpElem->next;
-
-        this->pModelInfo.pTriangles[index].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->pModelInfo.pTriangles[index].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3;
-        this->pModelInfo.pTriangles[index].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3;
-        tmpElem = tmpElem->next;
-
-        this->pModelInfo.pTriangles[index].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->pModelInfo.pTriangles[index].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3;
-        this->pModelInfo.pTriangles[index].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3;
-
-        this->pModelInfo.pTriangles[index + 1].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->pModelInfo.pTriangles[index + 1].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3;
-        this->pModelInfo.pTriangles[index + 1].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3;
-        tmpElem = tmpElem->next;
-
-        this->pModelInfo.pTriangles[index + 1].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3;
-        this->pModelInfo.pTriangles[index + 1].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3;
-        this->pModelInfo.pTriangles[index + 1].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3;
-
-        index += 2;
-      }
-      tmpFace = tmpFace->next;
-    }
-    this->currentGroup = this->currentGroup->next;
-  }
-  return true;
-}
-
-
-/**
- *  Adds a Face-element (one vertex of a face) with all its information.
- * @param elem The FaceElement to add to the OpenGL-environment.
-
-   It does this by searching:
-   1. The Vertex itself
-   2. The VertexNormale
-   3. The VertexTextureCoordinate
-   merging this information, the face will be drawn.
-*/
-bool StaticModel::addGLElement (ModelFaceElement* elem)
-{
-  PRINTF(5)("importing grafical Element to openGL.\n");
-
-  if (elem->texCoordNumber > -1)
-  {
-    if (likely((unsigned int)elem->texCoordNumber < this->pModelInfo.numTexCoor))
-      glTexCoord2fv(&this->vTexture[0] + elem->texCoordNumber * 2);
-    else
-      PRINTF(2)("TextureCoordinate %d is not in the List (max: %d)\nThe Model might be incomplete\n",
-                elem->texCoordNumber, this->pModelInfo.numTexCoor);
-  }
-  if (elem->normalNumber > -1)
-  {
-    if (likely((unsigned int)elem->normalNumber < this->pModelInfo.numNormals))
-      glNormal3fv(&this->normals[0] + elem->normalNumber * 3);
-    else
-      PRINTF(2)("Normal %d is not in the List (max: %d)\nThe Model might be incomplete",
-                elem->normalNumber, this->pModelInfo.numNormals);
-  }
-  if (elem->vertexNumber > -1)
-  {
-    if (likely((unsigned int)elem->vertexNumber < this->pModelInfo.numVertices))
-      glVertex3fv(&this->vertices[0]+ elem->vertexNumber * 3);
-    else
-      PRINTF(2)("Vertex %d is not in the List (max: %d)\nThe Model might be incomplete",
-                elem->vertexNumber, this->pModelInfo.numVertices);
-  }
-
-  return true;
-}
-
-/**
- *  Includes a default model
-
-   This will inject a Cube, because this is the most basic model.
-*/
 void StaticModel::cubeModel()
 {
Index: trunk/src/lib/graphics/importer/static_model.h
===================================================================
--- trunk/src/lib/graphics/importer/static_model.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/static_model.h	(revision 9869)
@@ -10,77 +10,6 @@
 
 #include "material.h"
-#include "glincl.h"
 #include <vector>
-#include <list>
-
-// definition of different modes for setting up Faces
-#define VERTEX 0       //!< If Faces are created WITH Vertex-Coordinate
-#define NORMAL 1       //!< If Faces are created WITH Normals (otherwise autocalculate)
-#define TEXCOORD 2     //!< If Faces are created WITH TextureCoordinate
-
-//! an enumerator for VERTEX_FORMAT
-typedef enum VERTEX_FORMAT {
-  VERTEX_ONLY = VERTEX,
-  VERTEX_NORMAL = NORMAL,
-  VERTEX_TEXCOORD = TEXCOORD,
-  VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD
-};
-
-////////////////////
-/// SUB-ELEMENTS ///
-////////////////////
-//! This is the placeholder of one Vertex beloning to a Face.
-class ModelFaceElement
-{
- public:
-  ModelFaceElement();
-  ~ModelFaceElement();
-
-  int                 vertexNumber;         //!< The number of the Vertex out of the Array* vertices, this vertex points to.
-  int                 normalNumber;         //!< The number of the Normal out of the Array* normals, this vertex points to.
-  int                 texCoordNumber;       //!< The number of the textureCoordinate out of the Array* vTexture, this vertex points to.
-
-  ModelFaceElement*   next;                 //!< Point to the next FaceElement in this List.
-};
-
-//! This is the placeholder of a Face belonging to a Group of Faces.
-class ModelFace
-{
- public:
-  ModelFace();
-  ~ModelFace();
-
-  unsigned int        vertexCount;     //!< The Count of vertices this Face has.
-  ModelFaceElement*   firstElem;       //!< Points to the first Vertex (FaceElement) of this Face.
-  Material*           material;        //!< The Material to use.
-
-  ModelFace*          next;            //!< Pointer to the next Face.
-};
-
-//! Group to handle multiple Models per obj-file.
-class ModelGroup
-{
- public:
-  ModelGroup();
-  ~ModelGroup();
-
-  void cleanup();
-
-  std::string  name;           //!< the Name of the Group. this is an identifier, that can be accessed via the draw (std::string name) function.
-  GLubyte*     indices;        //!< The indices of the Groups. Needed for vertex-arrays
-  GLuint       listNumber;     //!< The number of the GL-List this Group gets.
-  ModelFace*   firstFace;      //!< The first Face in this group.
-  ModelFace*   currentFace;    //!< The current Face in this Group (the one we are currently working with.)
-  int          faceMode;       //!< The Mode the Face is in: initially -1, 0 for FaceList opened, 1 for Material,  3 for triangle, 4 for Quad, 5+ for Poly @todo ENUM...
-  int          faceCount;      //!< The Number of Faces this Group holds.
-
-  ModelGroup*  next;           //!< Pointer to the next Group.
-};
-
-struct ModelMaterial
-{
-  Material* material;
-  bool external;
-};
+#include "static_model_data.h"
 
 /////////////
@@ -94,69 +23,53 @@
 class StaticModel : public Model
 {
- public:
+  ObjectListDeclaration(StaticModel);
+public:
   StaticModel(const std::string& modelName = "");
+  StaticModel(const StaticModel& staticModel);
   virtual ~StaticModel();
 
-  virtual void draw() const;
-  void draw(int groupNumber) const;
-  void draw(const std::string& groupName) const;
+  StaticModel& operator=(const StaticModel& model);
 
-  void rebuild();
+  virtual void draw() const { data->draw(); };
+  void draw(int groupNumber) const { data->draw(groupNumber); };
+  void draw(const std::string& groupName) const { data->draw(groupName); };
 
-  Material* addMaterial(Material* material);
-  Material* addMaterial(const std::string& materialName);
+  void rebuild() { data->rebuild(); };
 
-  bool addGroup(const std::string& groupString);
+  Material* addMaterial(Material* material) { return data->addMaterial(material); };
+  Material* addMaterial(const std::string& materialName) { return data->addMaterial(materialName); };
 
-  bool addVertex(const std::string& vertexString);
-  bool addVertex(float x, float y, float z);
+  bool addGroup(const std::string& groupString) { return data->addGroup(groupString); };
 
-  bool addFace(const std::string& faceString);
+  bool addVertex(const std::string& vertexString) { return data->addVertex(vertexString); };
+  bool addVertex(float x, float y, float z) { return data->addVertex(x, y, z); };
+
+  bool addFace(const std::string& faceString) { return data->addFace(faceString); };
   bool addFace(int faceElemCount, VERTEX_FORMAT type, ...);
 
-  bool addVertexNormal(const std::string& normalString);
-  bool addVertexNormal(float x, float y, float z);
+  bool addVertexNormal(const std::string& normalString) { return this->data->addVertexNormal(normalString); };
+  bool addVertexNormal(float x, float y, float z) { return this->data->addVertexNormal(x,y,z); };
 
-  bool addVertexTexture(const std::string& vTextureString);
-  bool addVertexTexture(float u, float v);
+  bool addVertexTexture(const std::string& vTextureString) { return this->data->addVertexTexture(vTextureString); };
+  bool addVertexTexture(float u, float v) { return this->data->addVertexTexture(u, v); };
 
-  bool setMaterial(const std::string& mtlString);
-  bool setMaterial(Material* mtl);
+  bool setMaterial(const std::string& mtlString) { return data->setMaterial(mtlString); };
+  bool setMaterial(Material* mtl) { return data->setMaterial(mtl);};
 
   void finalize();
 
+  void acquireData(const StaticModelData::Pointer& data);
+  const StaticModelData::Pointer& dataPointer() const { return this->data; };
 
- protected:
+  inline void setScaleFactor(float scaleFactor) { this->data->setScaleFactor(scaleFactor); };
+  float getScaleFactor() const { return data->getScaleFactor(); }
+
+protected:
   void cubeModel();
 
-  Material* findMaterialByName(const std::string& materialName);
-
- protected:
-  float            scaleFactor;     //!< The Factor with which the Model should be scaled. @todo maybe one wants to scale the Model after Initialisation
-
- private:
-  bool buildVertexNormals();
-
-  bool importToDisplayList();
-  bool buildTriangleList();
-
-  bool addGLElement(ModelFaceElement* elem);
-
-  bool cleanup();
-
- private:
-  bool                       finalized;       //!< Sets the Object to be finalized.
-
-  unsigned int               faceCount;       //!< A modelwide Counter for the faces
-
-  std::vector<GLfloat>       vertices;        //!< The Array that handles the Vertices.
-  std::vector<GLfloat>       normals;         //!< The Array that handles the Normals.
-  std::vector<GLfloat>       vTexture;        //!< The Array that handles the VertexTextureCoordinates.
-
-  ModelGroup*                firstGroup;      //!< The first of all groups.
-  ModelGroup*                currentGroup;    //!< The currentGroup. this is the one we will work with.
-  int                        groupCount;      //!< The Count of Groups.
-
-  std::list<ModelMaterial*>  materialList;    //!< A list for all the Materials in this Model
+private:
+  void updateBase();
+private:
+  StaticModelData::Pointer         data;
 };
 
Index: trunk/src/lib/graphics/importer/static_model_data.cc
===================================================================
--- trunk/src/lib/graphics/importer/static_model_data.cc	(revision 9869)
+++ trunk/src/lib/graphics/importer/static_model_data.cc	(revision 9869)
@@ -0,0 +1,948 @@
+/*
+   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: ...
+
+   2005-07-06: (Patrick) added new function buildTriangleList()
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
+
+#include "static_model_data.h"
+
+#include "debug.h"
+#include <stdarg.h>
+
+
+
+
+////////////////////
+/// SUB-Elements ///
+////////////////////
+/**
+ * @brief creates a new ModelFaceElement
+ */
+ModelFaceElement::ModelFaceElement()
+{
+  this->vertexNumber = -1;
+  this->normalNumber = -1;
+  this->texCoordNumber = -1;
+
+  this->next = NULL;
+}
+
+/**
+ * @brief destroys a ModelFaceElement
+ */
+ModelFaceElement::~ModelFaceElement()
+{
+  if (this->next)
+    delete this->next;
+}
+
+/**
+ * @brief creates a new ModelFace
+ */
+ModelFace::ModelFace()
+{
+  this->vertexCount = 0;
+
+  this->firstElem = NULL;
+
+  this->material = NULL;
+
+  this->next = NULL;
+}
+
+/**
+ *  deletes a ModelFace
+*/
+ModelFace::~ModelFace()
+{
+  PRINTF(5)("Cleaning up Face\n");
+
+  if (this->firstElem != NULL)
+    delete this->firstElem;
+
+  if (this->next != NULL)
+    delete this->next;
+}
+
+/**
+ * @brief Creates a new ModelGroup
+ */
+ModelGroup::ModelGroup()
+{
+  PRINTF(4)("Adding new Group\n");
+  this->name = "";
+  this->faceMode = -1;
+  this->faceCount = 0;
+  this->next = NULL;
+  this->listNumber = 0;
+  this->indices = NULL;
+
+  this->firstFace = new ModelFace;
+  this->currentFace = this->firstFace;
+}
+
+/**
+ * @brief deletes a ModelGroup
+ */
+ModelGroup::~ModelGroup()
+{
+  PRINTF(5)("Cleaning up group\n");
+  if (this->firstFace != NULL)
+    delete this->firstFace;
+
+  // deleting the glList
+  if (this->listNumber != 0)
+    glDeleteLists(this->listNumber, 1);
+
+  if (this->next !=NULL)
+    delete this->next;
+
+}
+
+/**
+ * @brief cleans up a ModelGroup
+ *
+ * actually does the same as the delete Operator, but does not delete the predecessing group
+ */
+void ModelGroup::cleanup()
+{
+  PRINTF(5)("Cleaning up group\n");
+  if (this->firstFace)
+    delete this->firstFace;
+  this->firstFace = NULL;
+  if (this->next)
+    this->next->cleanup();
+}
+
+
+
+
+/////////////
+/// MODEL ///
+/////////////
+ObjectListDefinition(StaticModelData);
+
+/**
+ * @brief Creates a 3D-Model.
+ *
+ * assigns it a Name and a Type
+ */
+StaticModelData::StaticModelData(const std::string& modelName)
+{
+  this->registerObject(this, StaticModelData::_objectList);
+  PRINTF(4)("new 3D-Model is being created\n");
+  this->setName(modelName);
+
+  this->finalized = false;
+
+  // setting the start group;
+  this->currentGroup = this->firstGroup = new ModelGroup;
+  this->groupCount = 0;
+  this->faceCount = 0;
+
+  this->scaleFactor = 1.0f;
+}
+
+/**
+ * @brief deletes an Model.
+ *
+ * Looks if any from model allocated space is still in use, and if so deleted it.
+ */
+StaticModelData::~StaticModelData()
+{
+  PRINTF(4)("Deleting Model ");
+  if (!this->getName().empty())
+  {
+    PRINT(4)("%s\n", this->getCName());
+  }
+  else
+  {
+    PRINT(4)("\n");
+  }
+  this->cleanup();
+
+  PRINTF(5)("Deleting display Lists.\n");
+  delete this->firstGroup;
+
+  // deleting the MaterialList
+  PRINTF(5)("Deleting Materials.\n");
+
+  //! @todo do we really have to delete this material??
+  std::list<ModelMaterial*>::iterator modMat;
+  for(modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
+  {
+    if (!(*modMat)->external)
+      delete (*modMat)->material;
+    delete (*modMat);
+  }
+}
+
+/**
+ * @brief Finalizes an Object. This can be done outside of the Class.
+ */
+void StaticModelData::finalize()
+{
+  // this creates the display List.
+  this->importToDisplayList();
+  this->buildTriangleList();
+
+  this->finalized = true;
+}
+
+/**
+ * @brief rebuild the Model from the Information we got.
+ */
+void StaticModelData::rebuild()
+{
+  PRINTF(3)("Rebuilding Model '%s'\n", this->getCName());
+  this->finalize();
+}
+
+//////////
+// DRAW //
+//////////
+/**
+ * @brief Draws the Models of all Groups.
+ *
+ * It does this by just calling the Lists that must have been created earlier.
+ */
+void StaticModelData::draw () const
+{
+  PRINTF(4)("drawing the 3D-Models\n");
+  ModelGroup* tmpGroup = this->firstGroup;
+  while (tmpGroup != NULL)
+  {
+    PRINTF(5)("Drawing model %s\n", tmpGroup->name.c_str());
+    glCallList (tmpGroup->listNumber);
+    tmpGroup = tmpGroup->next;
+  }
+}
+
+
+/**
+ * @brief Draws the Model number groupNumber
+ * @param groupNumber The number of the group that will be displayed.
+ *
+ * It does this by just calling the List that must have been created earlier.
+ */
+void StaticModelData::draw (int groupNumber) const
+{
+  if (unlikely(groupNumber >= this->groupCount))
+  {
+    PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);
+    return;
+  }
+  PRINTF(4)("drawing the requested 3D-Models if found.\n");
+  ModelGroup* tmpGroup = this->firstGroup;
+  int counter = 0;
+  while (tmpGroup != NULL)
+  {
+    if (counter == groupNumber)
+    {
+      PRINTF(4)("Drawing model number %i named %s\n", counter, tmpGroup->name.c_str());
+      glCallList (tmpGroup->listNumber);
+      return;
+    }
+    ++counter;
+    tmpGroup = tmpGroup->next;
+  }
+  PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->getCName());
+  return;
+}
+
+
+/**
+ * @brief Draws the Model with a specific groupName
+ * @param groupName The name of the group that will be displayed.
+ *
+ * It does this by just calling the List that must have been created earlier.
+ */
+void StaticModelData::draw (const std::string& groupName) const
+{
+  PRINTF(4)("drawing the requested 3D-Models if found.\n");
+  ModelGroup* tmpGroup = this->firstGroup;
+  while (tmpGroup != NULL)
+  {
+    if (tmpGroup->name == groupName)
+    {
+      PRINTF(4)("Drawing model %s\n", tmpGroup->name.c_str());
+      glCallList (tmpGroup->listNumber);
+      return;
+    }
+    tmpGroup = tmpGroup->next;
+  }
+  PRINTF(2)("Model Named %s in %s not Found.\n", groupName.c_str(), this->getCName());
+  return;
+}
+
+//////////
+// INIT //
+//////////
+
+/**
+ * @brief finalizes an Model.
+ *
+ * This funcion is needed, to delete all the Lists, and arrays that are no more
+ * needed because they are already imported into openGL.
+ * This will be applied at the end of the importing Process.
+*/
+bool StaticModelData::cleanup()
+{
+  PRINTF(4)("cleaning up the 3D-Model to save Memory.\n");
+  this->firstGroup->cleanup();
+  return true;
+}
+
+//////////
+// MESH //
+//////////
+/**
+ * @brief adds a new Material to the Material List
+ * @param material the Material to add
+ * @returns the added material
+ *
+ * this also tells this Model, that all the Materials are handled externally
+ * with this option set the Materials will not be deleted with the Model.
+ */
+Material* StaticModelData::addMaterial(Material* material)
+{
+  if (material == NULL)
+    return NULL;
+  ModelMaterial* modMat = new ModelMaterial;
+  modMat->external = true;
+  modMat->material = material;
+  this->materialList.push_back(modMat);
+  return modMat->material;
+}
+
+/**
+ * @brief adds a new Material to the Material List
+ * @param materialName the name of the Material to add
+ * @returns the added material
+ */
+Material* StaticModelData::addMaterial(const std::string& materialName)
+{
+  ModelMaterial* modMat = new ModelMaterial;
+  modMat->external = false;
+  modMat->material = new Material(materialName);
+
+  // adding material to the List of materials
+  this->materialList.push_back(modMat);
+  return modMat->material;
+}
+
+/**
+ * @brief finds a Material by its name and returns it
+ * @param materialName the Name of the material to search for.
+ * @returns the Material if found, NULL otherwise
+ */
+Material* StaticModelData::findMaterialByName(const std::string& materialName)
+{
+  std::list<ModelMaterial*>::iterator modMat;
+  for  (modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
+    if (materialName == (*modMat)->material->getName())
+      return (*modMat)->material;
+  return NULL;
+}
+
+/**
+ * @brief parses a group String
+ * @param groupString the new Group to create
+ *
+ * This function initializes a new Group.
+ * With it you should be able to create Models with more than one SubModel inside
+ */
+bool StaticModelData::addGroup(const std::string& groupString)
+{
+  PRINTF(5)("Read Group: %s.\n", groupString.c_str());
+  if (this->groupCount != 0 && this->currentGroup->faceCount > 0)
+  {
+    // finalizeGroup(currentGroup);
+    this->currentGroup = this->currentGroup->next = new ModelGroup;
+  }
+  // setting the group name if not default.
+  if (groupString == "default")
+  {
+    this->currentGroup->name = groupString;
+  }
+  ++this->groupCount;
+  return true;
+}
+
+/**
+ * @brief parses a vertex-String
+ * @param vertexString The String that will be parsed.
+ *
+ *  If a vertex line is found this function will inject it into the vertex-Array
+ */
+bool StaticModelData::addVertex (const std::string& vertexString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  float subbuffer3;
+  sscanf (vertexString.c_str(), "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
+  this->vertices.push_back(subbuffer1*scaleFactor);
+  this->vertices.push_back(subbuffer2*scaleFactor);
+  this->vertices.push_back(subbuffer3*scaleFactor);
+  return true;
+}
+
+/**
+ * @brief parses a vertex-String
+ * @param x the X-coordinate of the Vertex to add.
+ * @param y the Y-coordinate of the Vertex to add.
+ * @param z the Z-coordinate of the Vertex to add.
+ */
+bool StaticModelData::addVertex(float x, float y, float z)
+{
+  PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z);
+  this->vertices.push_back(x*scaleFactor);
+  this->vertices.push_back(y*scaleFactor);
+  this->vertices.push_back(z*scaleFactor);
+  return true;
+}
+
+/**
+ * @brief parses a vertexNormal-String
+ * @param normalString The String that will be parsed.
+ *
+ * If a vertexNormal line is found this function will inject it into the vertexNormal-Array
+ */
+bool StaticModelData::addVertexNormal (const std::string& normalString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  float subbuffer3;
+  sscanf (normalString.c_str(), "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
+  this->normals.push_back(subbuffer1);
+  this->normals.push_back(subbuffer2);
+  this->normals.push_back(subbuffer3);
+  return true;
+}
+
+/**
+ * @brief adds a VertexNormal.
+ * @param x The x coordinate of the Normal.
+ * @param y The y coordinate of the Normal.
+ * @param z The z coordinate of the Normal.
+ *
+ * If a vertexNormal line is found this function will inject it into the vertexNormal-Array
+ */
+bool StaticModelData::addVertexNormal(float x, float y, float z)
+{
+  PRINTF(5)("found vertex-Normal %f, %f, %f\n", x, y, z);
+  this->normals.push_back(x);
+  this->normals.push_back(y);
+  this->normals.push_back(z);
+  return true;
+}
+
+/**
+ * @brief parses a vertexTextureCoordinate-String
+ * @param vTextureString The String that will be parsed.
+ *
+ * If a vertexTextureCoordinate line is found,
+ * this function will inject it into the vertexTexture-Array
+ *
+ * !! WARNING THIS IS DIFFERNT FROM addVervexTexture(float, float); because it changes the second entry to 1-v !!
+ */
+bool StaticModelData::addVertexTexture (const std::string& vTextureString)
+{
+  float subbuffer1;
+  float subbuffer2;
+  sscanf (vTextureString.c_str(), "%f %f", &subbuffer1, &subbuffer2);
+  this->vTexture.push_back(subbuffer1);
+  this->vTexture.push_back(1 - subbuffer2);
+  return true;
+}
+
+/**
+ * @brief adds a Texture Coordinate
+ * @param u The u coordinate of the TextureCoordinate.
+ * @param v The y coordinate of the TextureCoordinate.
+ *
+ * If a TextureCoordinate line is found this function will
+ *  inject it into the TextureCoordinate-Array
+ */
+bool StaticModelData::addVertexTexture(float u, float v)
+{
+  PRINTF(5)("found vertex-Texture %f, %f\n", u, v);
+  this->vTexture.push_back(u);
+  this->vTexture.push_back(v);
+  return true;
+}
+
+/**
+ * @brief parses a face-string
+ * @param faceString The String that will be parsed.
+ *
+ * If a face line is found this function will add it to the glList.
+ *
+ * String is different from the argument addFace,
+ * in this, that the first Vertex/Normal/Texcoord is 1 instead of 0
+ *
+ * @TODO make it std::string conform
+ */
+bool StaticModelData::addFace (const std::string& faceStringInput)
+{
+  const char* faceString = faceStringInput.c_str();
+  if (this->currentGroup->faceCount >0)
+    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
+
+  ModelFaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new ModelFaceElement;
+  tmpElem->next = NULL;
+  while(strcmp (faceString, "\0"))
+  {
+    if (this->currentGroup->currentFace->vertexCount>0)
+      tmpElem = tmpElem->next = new ModelFaceElement;
+    tmpElem->next = NULL;
+
+    char tmpValue [50];
+    int tmpLen;
+    char* vertex = NULL;
+    char* texture = NULL;
+    char* normal = NULL;
+
+    sscanf (faceString, "%s", tmpValue);
+    tmpLen = strlen(tmpValue);
+    vertex = tmpValue;
+
+    if ((texture = strstr (vertex, "/")) != NULL)
+    {
+      texture[0] = '\0';
+      texture ++;
+
+      if ((normal = strstr (texture, "/")) !=NULL)
+      {
+        normal[0] = '\0';
+        normal ++;
+      }
+    }
+    if (vertex)
+      tmpElem->vertexNumber = atoi(vertex)-1;
+    if (texture)
+      tmpElem->texCoordNumber = atoi(texture)-1;
+    if (normal)
+      tmpElem->normalNumber = atoi(normal)-1;
+
+    faceString += tmpLen;
+    if (strcmp (faceString, "\0"))
+      faceString++;
+    this->currentGroup->currentFace->vertexCount++;
+  }
+
+  this->currentGroup->faceCount += this->currentGroup->currentFace->vertexCount -2;
+  this->faceCount += this->currentGroup->currentFace->vertexCount -2;
+  return true;
+}
+
+/**
+ * @brief adds a new Face
+ * @param faceElemCount the number of Vertices to add to the Face.
+ * @param type The information Passed with each Vertex
+*/
+bool StaticModelData::addFace(int faceElemCount, VERTEX_FORMAT type, va_list args)
+{
+  if (this->currentGroup->faceCount > 0)
+    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
+
+  ModelFaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new ModelFaceElement;
+
+  for (int i = 0; i < faceElemCount; i++)
+  {
+    if (this->currentGroup->currentFace->vertexCount > 0)
+      tmpElem = tmpElem->next = new ModelFaceElement;
+
+    tmpElem->vertexNumber = va_arg (args, int);
+    if (type & TEXCOORD)
+      tmpElem->texCoordNumber = va_arg (args, int);
+    if (type & NORMAL)
+      tmpElem->normalNumber = va_arg(args, int);
+    this->currentGroup->currentFace->vertexCount++;
+  }
+
+  this->currentGroup->faceCount += this->currentGroup->currentFace->vertexCount - 2;
+  this->faceCount += this->currentGroup->currentFace->vertexCount -2;
+  return true;
+}
+
+/**
+ * Function that selects a material, if changed in the obj file.
+ * @param matString the Material that will be set.
+*/
+bool StaticModelData::setMaterial(const std::string& matString)
+{
+  if (this->currentGroup->faceCount > 0)
+    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
+
+  this->currentGroup->currentFace->material = this->findMaterialByName(matString);
+
+  if (this->currentGroup->faceCount == 0)
+    this->currentGroup->faceCount++;
+  return true;
+}
+
+/**
+ * Function that selects a material, if changed in the obj file.
+ * @param mtl the Material that will be set.
+*/
+bool StaticModelData::setMaterial(Material* mtl)
+{
+  if (this->currentGroup->faceCount > 0)
+    this->currentGroup->currentFace = this->currentGroup->currentFace->next = new ModelFace;
+
+  this->currentGroup->currentFace->material = mtl;
+
+  if (this->currentGroup->faceCount == 0)
+    this->currentGroup->faceCount++;
+  return true;
+}
+
+/**
+ * @brief A routine that is able to create normals.
+ *
+ * The algorithm does the following:
+ * 1. It calculates creates Vectors for each normale, and sets them to zero.
+ * 2. It then Walks through a) all the Groups b) all the Faces c) all the FaceElements
+ * 3. It searches for a points two neighbours per Face, takes Vecotrs to them calculates FaceNormals and adds it to the Points Normal.
+ * 4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.
+ */
+bool StaticModelData::buildVertexNormals ()
+{
+  PRINTF(4)("Normals are being calculated.\n");
+
+  Vector* normArray = new Vector [vertices.size()/3];
+  for (unsigned int i=0; i<vertices.size()/3;i++)
+    normArray[i] = Vector(.0,.0,.0);
+
+  Vector prevV;
+  Vector nextV;
+  Vector curV;
+
+  ModelGroup* tmpGroup = firstGroup;
+  while (tmpGroup != NULL)
+  {
+    ModelFace* tmpFace = tmpGroup->firstFace;
+    while (tmpFace != NULL)
+    {
+      if (tmpFace->firstElem != NULL)
+      {
+        ModelFaceElement* firstElem = tmpFace->firstElem;
+        ModelFaceElement* prevElem;
+        ModelFaceElement* curElem = firstElem;
+        ModelFaceElement* nextElem;
+        ModelFaceElement* lastElem;
+        // find last Element of the Chain. !! IMPORTANT:the last Element of the Chain must point to NULL, or it will resolv into an infinity-loop.
+        while (curElem != NULL)
+        {
+          prevElem = curElem;
+          curElem = curElem->next;
+        }
+        lastElem = prevElem;
+
+        curElem = firstElem;
+        for (unsigned int j = 0; j < tmpFace->vertexCount; j++)
+        {
+          if (!(nextElem = curElem->next))
+            nextElem = firstElem;
+          curElem->normalNumber = curElem->vertexNumber;
+
+          curV = Vector (this->vertices[curElem->vertexNumber*3],
+                         this->vertices[curElem->vertexNumber*3+1],
+                         this->vertices[curElem->vertexNumber*3+2]);
+
+          prevV = Vector (this->vertices[prevElem->vertexNumber*3],
+                          this->vertices[prevElem->vertexNumber*3+1],
+                          this->vertices[prevElem->vertexNumber*3+2]) - curV;
+
+          nextV = Vector (this->vertices[nextElem->vertexNumber*3],
+                          this->vertices[nextElem->vertexNumber*3+1],
+                          this->vertices[nextElem->vertexNumber*3+2]) - curV;
+          normArray[curElem->vertexNumber] = normArray[curElem->vertexNumber] + nextV.cross(prevV);
+
+          prevElem = curElem;
+          curElem = curElem->next;
+        }
+      }
+      tmpFace = tmpFace->next;
+    }
+    tmpGroup = tmpGroup->next;
+  }
+
+  for (unsigned int i=0; i < this->vertices.size()/3;i++)
+  {
+    normArray[i].normalize();
+    PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
+
+    this->addVertexNormal(normArray[i].x, normArray[i].y, normArray[i].z);
+
+  }
+  delete[] normArray;
+  return true;
+}
+
+////////////
+// openGL //
+////////////
+/**
+ *  reads and includes the Faces/Materials into the openGL state Machine
+*/
+bool StaticModelData::importToDisplayList()
+{
+  // finalize the Arrays
+  if (normals.size() == 0) // vertices-Array must be built for this
+    this->buildVertexNormals();
+
+  this->currentGroup = this->firstGroup;
+
+  while (this->currentGroup != NULL)
+  {
+
+    // creating a glList for the Group
+    if ((this->currentGroup->listNumber = glGenLists(1)) == 0)
+    {
+      PRINTF(2)("glList could not be created for this Model\n");
+      return false;
+    }
+    glNewList (this->currentGroup->listNumber, GL_COMPILE);
+
+    // Putting Faces to GL
+    ModelFace* tmpFace = this->currentGroup->firstFace;
+    while (tmpFace != NULL)
+    {
+      if (tmpFace->vertexCount == 0 && tmpFace->material != NULL)
+      {
+        if (this->currentGroup->faceMode != -1)
+          glEnd();
+        this->currentGroup->faceMode = 0;
+        if (tmpFace->material != NULL)
+        {
+          tmpFace->material->select();
+          PRINTF(5)("using material %s for coming Faces.\n", tmpFace->material->getCName());
+        }
+      }
+
+      else if (tmpFace->vertexCount == 3)
+      {
+        if (this->currentGroup->faceMode != 3)
+        {
+          if (this->currentGroup->faceMode != -1)
+            glEnd();
+          glBegin(GL_TRIANGLES);
+        }
+
+        this->currentGroup->faceMode = 3;
+        PRINTF(5)("found triag.\n");
+      }
+
+      else if (tmpFace->vertexCount == 4)
+      {
+        if (this->currentGroup->faceMode != 4)
+        {
+          if (this->currentGroup->faceMode != -1)
+            glEnd();
+          glBegin(GL_QUADS);
+        }
+        this->currentGroup->faceMode = 4;
+        PRINTF(5)("found quad.\n");
+      }
+
+      else if (tmpFace->vertexCount > 4)
+      {
+        if (this->currentGroup->faceMode != -1)
+          glEnd();
+        glBegin(GL_POLYGON);
+        PRINTF(5)("Polygon with %i faces found.", tmpFace->vertexCount);
+        this->currentGroup->faceMode = tmpFace->vertexCount;
+      }
+
+      ModelFaceElement* tmpElem = tmpFace->firstElem;
+      while (tmpElem != NULL)
+      {
+        //      PRINTF(2)("%s\n", tmpElem->value);
+        this->addGLElement(tmpElem);
+        tmpElem = tmpElem->next;
+      }
+      tmpFace = tmpFace->next;
+    }
+    glEnd();
+    glEndList();
+
+    this->currentGroup = this->currentGroup->next;
+  }
+  return true;
+}
+
+
+/**
+ *  builds an array of triangles, that can later on be used for obb separation and octree separation
+ */
+bool StaticModelData::buildTriangleList()
+{
+  if( unlikely(!this->triangles.empty()))
+    return true;
+  /* make sure, that all the arrays are finalized */
+  if( normals.size() == 0) // vertices-Array must be built for this
+    this->buildVertexNormals();
+
+  int                index = 0;                   //!< the counter for the triangle array
+  ModelFaceElement*  tmpElem;       //!< the temporary faceelement reference
+  ModelFace*         tmpFace;              //!< the temporary face referece
+
+  unsigned int numTriangles = 0;
+  bool warned = false;
+
+  /* count the number of triangles */
+  /* now iterate through all groups and build up the triangle list */
+  this->currentGroup = this->firstGroup;
+  while( this->currentGroup != NULL)
+  {
+    tmpFace = this->currentGroup->firstFace;
+    while( tmpFace != NULL)
+    {
+      /* if its a triangle just add it to the list */
+      if( tmpFace->vertexCount == 3)
+      {
+        ++numTriangles;
+      } /* if the polygon is a quad */
+      else if( tmpFace->vertexCount == 4)
+      {
+        numTriangles += 2;
+      }
+      else if( tmpFace->vertexCount > 4)
+      {
+        if (!warned)
+        {
+          PRINTF(2)("This model (%s) got over 4 vertices per face <=> conflicts in the CD engine!\n", this->getCName());
+          warned = true;
+        }
+      }
+      tmpFace = tmpFace->next;
+    }
+    this->currentGroup = this->currentGroup->next;
+  }
+
+  PRINTF(3)("got %i triangles, %i vertices\n", numTriangles, this->vertices.size());
+
+
+  /* write MODELINFO structure */
+
+  /* allocate memory for the new triangle structures */
+  this->triangles.resize(numTriangles);
+
+  /* now iterate through all groups and build up the triangle list */
+  this->currentGroup = this->firstGroup;
+  while( this->currentGroup != NULL)
+  {
+    tmpFace = this->currentGroup->firstFace;
+    while( tmpFace != NULL)
+    {
+      tmpElem = tmpFace->firstElem;
+
+      /* if its a triangle just add it to the list */
+      if( tmpFace->vertexCount == 3)
+      {
+        for( int j = 0; j < 3; ++j)
+        {
+          this->triangles[index].indexToVertices[j] = (unsigned int)tmpElem->vertexNumber * 3 ;
+          this->triangles[index].indexToNormals[j] = (unsigned int)tmpElem->normalNumber * 3 ;
+          this->triangles[index].indexToTexCoor[j] = (unsigned int)tmpElem->texCoordNumber * 3 ;
+          tmpElem = tmpElem->next;
+
+        }
+        ++index;
+      } /* if the polygon is a quad */
+      else if( tmpFace->vertexCount == 4)
+      {
+
+        this->triangles[index].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3;
+
+        this->triangles[index + 1].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index + 1].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index + 1].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3;
+        tmpElem = tmpElem->next;
+
+        this->triangles[index].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3;
+        tmpElem = tmpElem->next;
+
+        this->triangles[index].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3;
+
+        this->triangles[index + 1].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index + 1].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index + 1].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3;
+        tmpElem = tmpElem->next;
+
+        this->triangles[index + 1].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3;
+        this->triangles[index + 1].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3;
+        this->triangles[index + 1].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3;
+
+        index += 2;
+      }
+      tmpFace = tmpFace->next;
+    }
+    this->currentGroup = this->currentGroup->next;
+  }
+  return true;
+}
+
+
+/**
+ *  Adds a Face-element (one vertex of a face) with all its information.
+ * @param elem The FaceElement to add to the OpenGL-environment.
+
+   It does this by searching:
+   1. The Vertex itself
+   2. The VertexNormale
+   3. The VertexTextureCoordinate
+   merging this information, the face will be drawn.
+*/
+bool StaticModelData::addGLElement (ModelFaceElement* elem)
+{
+  PRINTF(5)("importing grafical Element to openGL.\n");
+
+  if (elem->texCoordNumber > -1)
+  {
+    if (likely((unsigned int)elem->texCoordNumber < this->vTexture.size()))
+      glTexCoord2fv(&this->vTexture[0] + elem->texCoordNumber * 2);
+    else
+      PRINTF(2)("TextureCoordinate %d is not in the List (max: %d)\nThe Model might be incomplete\n",
+                elem->texCoordNumber, this->vTexture.size());
+  }
+  if (elem->normalNumber > -1)
+  {
+    if (likely((unsigned int)elem->normalNumber < this->normals.size()))
+      glNormal3fv(&this->normals[0] + elem->normalNumber * 3);
+    else
+      PRINTF(2)("Normal %d is not in the List (max: %d)\nThe Model might be incomplete",
+                elem->normalNumber, this->normals.size());
+  }
+  if (elem->vertexNumber > -1)
+  {
+    if (likely((unsigned int)elem->vertexNumber < this->vertices.size()))
+      glVertex3fv(&this->vertices[0]+ elem->vertexNumber * 3);
+    else
+      PRINTF(2)("Vertex %d is not in the List (max: %d)\nThe Model might be incomplete",
+                elem->vertexNumber, this->vertices.size());
+  }
+
+  return true;
+}
Index: trunk/src/lib/graphics/importer/static_model_data.h
===================================================================
--- trunk/src/lib/graphics/importer/static_model_data.h	(revision 9869)
+++ trunk/src/lib/graphics/importer/static_model_data.h	(revision 9869)
@@ -0,0 +1,177 @@
+/*!
+ * @file static_model.h
+ * @brief Contains the Model Class that handles Static 3D-Models rendered with glList's
+ */
+
+#ifndef _STATIC_MODEL_DATA_H
+#define _STATIC_MODEL_DATA_H
+
+#include "model.h"
+
+#include "material.h"
+#include <vector>
+#include "count_pointer.h"
+
+
+// definition of different modes for setting up Faces
+#define VERTEX 0       //!< If Faces are created WITH Vertex-Coordinate
+#define NORMAL 1       //!< If Faces are created WITH Normals (otherwise autocalculate)
+#define TEXCOORD 2     //!< If Faces are created WITH TextureCoordinate
+
+//! an enumerator for VERTEX_FORMAT
+typedef enum VERTEX_FORMAT {
+  VERTEX_ONLY = VERTEX,
+  VERTEX_NORMAL = NORMAL,
+  VERTEX_TEXCOORD = TEXCOORD,
+  VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD
+};
+
+////////////////////
+/// SUB-ELEMENTS ///
+////////////////////
+//! This is the placeholder of one Vertex beloning to a Face.
+class ModelFaceElement
+{
+public:
+  ModelFaceElement();
+  ~ModelFaceElement();
+
+  int                 vertexNumber;         //!< The number of the Vertex out of the Array* vertices, this vertex points to.
+  int                 normalNumber;         //!< The number of the Normal out of the Array* normals, this vertex points to.
+  int                 texCoordNumber;       //!< The number of the textureCoordinate out of the Array* vTexture, this vertex points to.
+
+  ModelFaceElement*   next;                 //!< Point to the next FaceElement in this List.
+};
+
+//! This is the placeholder of a Face belonging to a Group of Faces.
+class ModelFace
+{
+public:
+  ModelFace();
+  ~ModelFace();
+
+  unsigned int        vertexCount;     //!< The Count of vertices this Face has.
+  ModelFaceElement*   firstElem;       //!< Points to the first Vertex (FaceElement) of this Face.
+  Material*           material;        //!< The Material to use.
+
+  ModelFace*          next;            //!< Pointer to the next Face.
+};
+
+//! Group to handle multiple Models per obj-file.
+class ModelGroup
+{
+public:
+  ModelGroup();
+  ~ModelGroup();
+
+  void cleanup();
+
+  std::string  name;           //!< the Name of the Group. this is an identifier, that can be accessed via the draw (std::string name) function.
+  GLubyte*     indices;        //!< The indices of the Groups. Needed for vertex-arrays
+  GLuint       listNumber;     //!< The number of the GL-List this Group gets.
+  ModelFace*   firstFace;      //!< The first Face in this group.
+  ModelFace*   currentFace;    //!< The current Face in this Group (the one we are currently working with.)
+  int          faceMode;       //!< The Mode the Face is in: initially -1, 0 for FaceList opened, 1 for Material,  3 for triangle, 4 for Quad, 5+ for Poly @todo ENUM...
+  int          faceCount;      //!< The Number of Faces this Group holds.
+
+  ModelGroup*  next;           //!< Pointer to the next Group.
+};
+
+struct ModelMaterial
+{
+  Material* material;
+  bool external;
+};
+
+/////////////
+/// MODEL ///
+/////////////
+//! Class that handles static 3D-Models.
+/**
+ * it can also read them in and display them.
+ * All the objects are rendered with glLists
+ */
+class StaticModelData : public BaseObject
+{
+  ObjectListDeclaration(StaticModelData);
+  public:
+    typedef CountPointer<StaticModelData> Pointer;
+
+  public:
+  StaticModelData(const std::string& modelName = "");
+  virtual ~StaticModelData();
+
+  void draw() const;
+  void draw(int groupNumber) const;
+  void draw(const std::string& groupName) const;
+
+  void rebuild();
+
+  Material* addMaterial(Material* material);
+  Material* addMaterial(const std::string& materialName);
+
+  bool addGroup(const std::string& groupString);
+
+  void setScaleFactor(float scaleFactor) { this->scaleFactor = scaleFactor; };
+
+  bool addVertex(const std::string& vertexString);
+  bool addVertex(float x, float y, float z);
+
+  bool addFace(const std::string& faceString);
+  bool addFace(int faceElemCount, VERTEX_FORMAT type, va_list args);
+
+  bool addVertexNormal(const std::string& normalString);
+  bool addVertexNormal(float x, float y, float z);
+
+  bool addVertexTexture(const std::string& vTextureString);
+  bool addVertexTexture(float u, float v);
+
+  bool setMaterial(const std::string& mtlString);
+  bool setMaterial(Material* mtl);
+
+  void finalize();
+
+
+  const std::vector<GLfloat>& getVertices() const { return this->vertices; };
+  const std::vector<GLfloat>& getNormals() const { return this->normals; };
+  const std::vector<GLfloat>& getTexCoords() const { return this->vTexture; };
+  const std::vector<sTriangleExt>& getTriangles() const { return this->triangles; };
+  ///! HACK SOLUTION sTriangleExt should be const in the modelInfo.
+  sTriangleExt* getTrianglesExt() { return &this->triangles[0]; };
+
+  float getScaleFactor() const  { return scaleFactor; }
+
+protected:
+  Material* findMaterialByName(const std::string& materialName);
+
+private:
+  bool buildVertexNormals();
+
+  bool importToDisplayList();
+  bool buildTriangleList();
+
+  bool addGLElement(ModelFaceElement* elem);
+
+  bool cleanup();
+
+private:
+  bool                       finalized;       //!< Sets the Object to be finalized.
+
+  float                      scaleFactor;     //!< The Factor with which the Model should be scaled. @todo maybe one wants to scale the Model after Initialisation
+
+  unsigned int               faceCount;       //!< A modelwide Counter for the faces
+
+  std::vector<GLfloat>       vertices;        //!< The Array that handles the Vertices.
+  std::vector<GLfloat>       normals;         //!< The Array that handles the Normals.
+  std::vector<GLfloat>       vTexture;        //!< The Array that handles the VertexTextureCoordinates.
+
+  std::vector<sTriangleExt>  triangles;       //!< The Triangles if built.
+
+  ModelGroup*                firstGroup;      //!< The first of all groups.
+  ModelGroup*                currentGroup;    //!< The currentGroup. this is the one we will work with.
+  int                        groupCount;      //!< The Count of Groups.
+
+  std::list<ModelMaterial*>  materialList;    //!< A list for all the Materials in this Model
+};
+
+#endif /* _STATIC_MODEL_DATA_H */
Index: trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/texture.cc	(revision 9869)
@@ -64,5 +64,5 @@
 #endif
 
-
+ObjectListDefinition(Texture);
 
 /**
@@ -86,5 +86,5 @@
     : data(texture.data)
 {
-  this->setClassID(CL_TEXTURE, "Texture");
+  this->registerObject(this, Texture::_objectList);
   this->priority = 0.5;
 }
@@ -149,7 +149,7 @@
 void Texture::init()
 {
-  this->setClassID(CL_TEXTURE, "Texture");
-
-  this->data = TextureDataPointer(new TextureData());
+  this->registerObject(this, Texture::_objectList);
+
+  this->data = TextureData::Pointer(new TextureData());
 
   this->priority = 0.5;
@@ -176,5 +176,5 @@
 }
 
-Texture& Texture::operator=(const TextureDataPointer& textureDataPointer)
+Texture& Texture::operator=(const TextureData::Pointer& textureDataPointer)
 {
   this->data = textureDataPointer;
Index: trunk/src/lib/graphics/importer/texture.h
===================================================================
--- trunk/src/lib/graphics/importer/texture.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/texture.h	(revision 9869)
@@ -1,5 +1,5 @@
 /*!
  * @file texture.h
- * @brief Contains the texture class, that handles the reading of Images into Texutre-files.
+ * @brief Contains the texture class, that handles the reading of Images into Texture-files.
  */
 
@@ -20,4 +20,5 @@
 class Texture : public BaseObject
 {
+  ObjectListDeclaration(Texture);
 public:
   Texture();
@@ -28,5 +29,7 @@
 
   Texture& operator=(const Texture& texture);
-  Texture& operator=(const TextureDataPointer& textureDataPointer);
+  Texture& operator=(const TextureData::Pointer& textureDataPointer);
+  void acquireData(const TextureData::Pointer& textureDataPointer) { this->data = textureDataPointer; };
+  const TextureData::Pointer& dataPointer() const { return data; }
 
   virtual ~Texture();
@@ -62,5 +65,5 @@
 
 private:
-  TextureDataPointer            data;               //!< The TextureData
+  TextureData::Pointer          data;               //!< The TextureData
   GLclampf                      priority;           //!< the priority of the current texture (used for garphics cards with limited mem)
 
Index: trunk/src/lib/graphics/importer/texture_data.h
===================================================================
--- trunk/src/lib/graphics/importer/texture_data.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/texture_data.h	(revision 9869)
@@ -18,4 +18,6 @@
 class TextureData
 {
+  public:
+    typedef CountPointer<TextureData> Pointer;
   public:
     TextureData();
@@ -43,5 +45,3 @@
 };
 
-typedef CountPointer<TextureData> TextureDataPointer;
-
 #endif /* _TEXTURE_DATA_H */
Index: trunk/src/lib/graphics/importer/texture_sequence.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture_sequence.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/texture_sequence.cc	(revision 9869)
@@ -28,4 +28,6 @@
 #endif
 
+ObjectListDefinition(TextureSequence);
+
 /**
  * @brief Constructor for a Texture
@@ -33,5 +35,5 @@
 TextureSequence::TextureSequence(unsigned int count, ...)
 {
-  this->setClassID(CL_TEXTURE_SEQUENCE, "TextureSequence");
+  this->registerObject(this, TextureSequence::_objectList);
 
   va_list textureNameList;
@@ -54,5 +56,5 @@
 TextureSequence::TextureSequence(const std::vector<std::string>& textureNames, const std::string& prependFolder)
 {
-  this->setClassID(CL_TEXTURE_SEQUENCE, "TextureSequence");
+  this->registerObject(this, TextureSequence::_objectList);
   this->loadImageSeries(textureNames, prependFolder);
 }
Index: trunk/src/lib/graphics/importer/texture_sequence.h
===================================================================
--- trunk/src/lib/graphics/importer/texture_sequence.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/texture_sequence.h	(revision 9869)
@@ -15,4 +15,5 @@
 class TextureSequence : public Texture
 {
+  ObjectListDeclaration(TextureSequence);
   public:
     TextureSequence(unsigned int count = 0, ...);
Index: trunk/src/lib/graphics/importer/vertex_array_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/vertex_array_model.cc	(revision 9682)
+++ trunk/src/lib/graphics/importer/vertex_array_model.cc	(revision 9869)
@@ -24,4 +24,5 @@
 
 
+ObjectListDefinition(VertexArrayModel);
 
 /////////////
@@ -35,5 +36,5 @@
 VertexArrayModel::VertexArrayModel()
 {
-  this->setClassID(CL_MODEL, "VertexArrayModel");
+  this->registerObject(this, VertexArrayModel::_objectList);
 
   this->newStripe();
@@ -49,5 +50,5 @@
 VertexArrayModel::VertexArrayModel(const Model& model)
 {
-  this->setClassID(CL_MODEL, "VertexArrayModel");
+  this->registerObject(this, VertexArrayModel::_objectList);
 
   // importing the data to the new Model.
Index: trunk/src/lib/graphics/importer/vertex_array_model.h
===================================================================
--- trunk/src/lib/graphics/importer/vertex_array_model.h	(revision 9682)
+++ trunk/src/lib/graphics/importer/vertex_array_model.h	(revision 9869)
@@ -27,5 +27,6 @@
 class VertexArrayModel : public Model
 {
- public:
+  ObjectListDeclaration(VertexArrayModel);
+  public:
   VertexArrayModel();
   VertexArrayModel(const Model& model);
Index: trunk/src/lib/graphics/light.cc
===================================================================
--- trunk/src/lib/graphics/light.cc	(revision 9682)
+++ trunk/src/lib/graphics/light.cc	(revision 9869)
@@ -22,10 +22,12 @@
 #include "glincl.h"
 #include "vector.h"
-#include "parser/tinyxml/tinyxml.h"
-#include "util/loading/load_param.h"
+#include "util/loading/load_param_xml.h"
 #include "util/loading/factory.h"
 #include "debug.h"
 
-CREATE_FACTORY(Light, CL_LIGHT);
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(Light, CL_LIGHT);
+CREATE_FACTORY(Light);
 
 //! Definition of the Lights and their Names
@@ -51,7 +53,8 @@
   PRINTF(4)("initializing Light number %d.\n", this->lightNumber);
 
+  this->registerObject(this, Light::_objectList);
+
   this->lightNumber = LightManager::getInstance()->registerLight(this);
 
-  this->setClassID(CL_LIGHT, "Light");
   char tmpName[10];
   sprintf(tmpName, "Light[%d]", this->lightNumber);
@@ -211,4 +214,5 @@
 ** LIGHT-MANAGER **
 ******************/
+ObjectListDefinition(LightManager);
 /**
  *  standard constructor for a Light
@@ -216,5 +220,5 @@
 LightManager::LightManager ()
 {
-  this->setClassID(CL_LIGHT_MANAGER, "LightManager");
+  this->registerObject(this, LightManager::_objectList);
 
   glEnable (GL_LIGHTING);
Index: trunk/src/lib/graphics/light.h
===================================================================
--- trunk/src/lib/graphics/light.h	(revision 9682)
+++ trunk/src/lib/graphics/light.h	(revision 9869)
@@ -25,38 +25,39 @@
 class Light : public PNode
 {
-	public:
-		Light(const TiXmlElement* root = NULL);
-		virtual ~Light();
-		
-		virtual void loadParams(const TiXmlElement* root);
-		
-		void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
-		void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
-		void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation);
-		void setSpotDirection(const Vector& direction);
-		void setSpotDirection(float x, float y, float z) { setSpotDirection(Vector(x,y,z)); };
-		void setSpotCutoff(GLfloat cutoff);
-		
-		/** @returns the lightNumber*/
-		int getLightNumber() const {return this->lightNumber;}
-		
-		virtual void draw() const;
-		
-		void debug() const;
-	
-	// attributes
-	private:
-		int              lightNumber;               //!< The number of this Light.
-		GLfloat          diffuseColor[4];           //!< The Diffuse Color this Light emmits.
-		GLfloat          specularColor[4];          //!< The specular Color of this Light.
-		float            constantAttenuation;       //!< The Factor of the the Constant Attenuation.
-		float            linearAttenuation;         //!< The Factor of the the Linear Attenuation.
-		float            quadraticAttenuation;      //!< The Factor of the the Quadratic Attenuation.
-		GLfloat          spotDirection[4];          //!< The direction of the Spot Light.
-		GLfloat          spotCutoff;                //!< The cutoff Angle of the Light Source
+  ObjectListDeclaration(Light);
+public:
+  Light(const TiXmlElement* root = NULL);
+  virtual ~Light();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b);
+  void setSpecularColor(GLfloat r, GLfloat g, GLfloat b);
+  void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation);
+  void setSpotDirection(const Vector& direction);
+  void setSpotDirection(float x, float y, float z) { setSpotDirection(Vector(x,y,z)); };
+  void setSpotCutoff(GLfloat cutoff);
+
+  /** @returns the lightNumber*/
+  int getLightNumber() const {return this->lightNumber;}
+
+  virtual void draw() const;
+
+  void debug() const;
+
+  // attributes
+private:
+  int              lightNumber;               //!< The number of this Light.
+  GLfloat          diffuseColor[4];           //!< The Diffuse Color this Light emmits.
+  GLfloat          specularColor[4];          //!< The specular Color of this Light.
+  float            constantAttenuation;       //!< The Factor of the the Constant Attenuation.
+  float            linearAttenuation;         //!< The Factor of the the Linear Attenuation.
+  float            quadraticAttenuation;      //!< The Factor of the the Quadratic Attenuation.
+  GLfloat          spotDirection[4];          //!< The direction of the Spot Light.
+  GLfloat          spotCutoff;                //!< The cutoff Angle of the Light Source
 };
-	
-	
-	
+
+
+
 //! A class that handles Lights
 /**
@@ -87,38 +88,39 @@
 */
 class LightManager : public BaseObject
-	{
-	friend class Light;
+{
+  ObjectListDeclaration(LightManager);
 
-	public:
-		virtual ~LightManager();
-		/** @returns a Pointer to the only object of this Class */
-		inline static LightManager* getInstance() { if (!singletonRef) singletonRef = new LightManager();  return singletonRef; };
+  friend class Light;
+public:
+  virtual ~LightManager();
+  /** @returns a Pointer to the only object of this Class */
+  inline static LightManager* getInstance() { if (!singletonRef) singletonRef = new LightManager();  return singletonRef; };
 
-		virtual void loadParams(const TiXmlElement* root);
-		void loadLights(const TiXmlElement* root);
+  virtual void loadParams(const TiXmlElement* root);
+  void loadLights(const TiXmlElement* root);
 
-		void setAmbientColor(GLfloat r, GLfloat g, GLfloat b);
-		// HACK: Assuming r = g = b values
-		inline GLfloat getAmbientColor() {  return this->ambientColor[0]; }
+  void setAmbientColor(GLfloat r, GLfloat g, GLfloat b);
+  // HACK: Assuming r = g = b values
+inline GLfloat getAmbientColor() {  return this->ambientColor[0]; }
 
-		Light* getLight(int lightNumber) const;
-		inline Light* getLight() const { return this->currentLight; };
+  Light* getLight(int lightNumber) const;
+  inline Light* getLight() const { return this->currentLight; };
 
-		void draw() const;
+  void draw() const;
 
-		void debug() const;
+  void debug() const;
 
-	private:
-		LightManager();
+private:
+  LightManager();
 
-		int  registerLight(Light* light);
-		void unregisterLight(Light* light);
+  int  registerLight(Light* light);
+  void unregisterLight(Light* light);
 
-	private:
-		static LightManager*    singletonRef;       //!< This is the LightHandlers Reference.
-		GLfloat                 ambientColor[4];    //!< The ambient Color of the scene.
+private:
+  static LightManager*    singletonRef;       //!< This is the LightHandlers Reference.
+  GLfloat                 ambientColor[4];    //!< The ambient Color of the scene.
 
-		Light**                 lights;             //!< An array of Lenght NUMBEROFLIGHTS, that holds pointers to all LightValues.
-		Light*                  currentLight;       //!< The current Light, we are working with.
+  Light**                 lights;             //!< An array of Lenght NUMBEROFLIGHTS, that holds pointers to all LightValues.
+  Light*                  currentLight;       //!< The current Light, we are working with.
 
 };
Index: trunk/src/lib/graphics/render2D/element_2d.cc
===================================================================
--- trunk/src/lib/graphics/render2D/element_2d.cc	(revision 9682)
+++ trunk/src/lib/graphics/render2D/element_2d.cc	(revision 9869)
@@ -29,10 +29,12 @@
 #include "graphics_engine.h"
 #include "util/loading/load_param.h"
-#include "class_list.h"
 
 #include "color.h"
-
+#include "debug.h"
 #include "shell_command.h"
+
 SHELL_COMMAND(debug, Element2D, debug2D);
+
+ObjectListDefinition(Element2D);
 
 
@@ -46,5 +48,5 @@
 Element2D::Element2D (Element2D* parent, E2D_LAYER layer, short nodeFlags)
 {
-  this->setClassID(CL_ELEMENT_2D, "Element2D");
+  this->registerObject(this, Element2D::_objectList);
 
   this->setVisibility(true);
@@ -268,5 +270,5 @@
 void Element2D::setBindNode(const std::string& bindNode)
 {
-  const PNode* tmpBindNode = dynamic_cast<const PNode*>(ClassList::getObject(bindNode, CL_PARENT_NODE));
+  const PNode* tmpBindNode = PNode::objectList().getObject(bindNode);
   if (tmpBindNode != NULL)
     this->bindNode = tmpBindNode;
@@ -640,5 +642,5 @@
 void Element2D::addChild2D (const std::string& childName)
 {
-  Element2D* childNode = dynamic_cast<Element2D*>(ClassList::getObject(childName, CL_ELEMENT_2D));
+  Element2D* childNode = Element2D::objectList().getObject(childName);
   if (childNode != NULL)
     this->addChild2D(childNode);
@@ -718,5 +720,5 @@
 void Element2D::setParent2D (const std::string& parentName)
 {
-  Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
+  Element2D* parentNode = Element2D::objectList().getObject(parentName);
   if (parentNode != NULL)
     parentNode->addChild2D(this);
@@ -771,5 +773,5 @@
 void Element2D::setParentSoft2D(const std::string& parentName, float bias)
 {
-  Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
+  Element2D* parentNode = Element2D::objectList().getObject(parentName);
   if (parentNode != NULL)
     this->setParentSoft2D(parentNode, bias);
Index: trunk/src/lib/graphics/render2D/element_2d.h
===================================================================
--- trunk/src/lib/graphics/render2D/element_2d.h	(revision 9682)
+++ trunk/src/lib/graphics/render2D/element_2d.h	(revision 9869)
@@ -47,5 +47,5 @@
 
   E2D_PARENT_MOVEMENT                = 0x0004,    //!< Moves all children along with the parent.
-// special linkage modes
+  // special linkage modes
   E2D_PARENT_ALL                     = 0x0003,    //!< Moves all children around the center of their parent, and also rotates their centers
   E2D_PARENT_ROTATE_AND_MOVE         = 0x0005,    //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent.
@@ -58,5 +58,5 @@
   E2D_REPARENT_DELETE_CHILDREN       = 0x0040,    //!< Deletes the Children of the node when This Node is Removed. (Use with care).
   /// FIXME
-   E2D_REPARENT_KEEP_POSITION         = 0x0080,   //!< Tries to keep the Position if the Node is reparented.
+  E2D_REPARENT_KEEP_POSITION         = 0x0080,   //!< Tries to keep the Position if the Node is reparented.
 
 
@@ -87,195 +87,197 @@
  * -> the tree is sorted on insertion of a new Child: @see Element2D::addChild2D()
  */
-class Element2D : virtual public BaseObject {
-
-  public:
-    Element2D(Element2D* parent = Element2D::getNullElement(), E2D_LAYER layer = E2D_DEFAULT_LAYER, short nodeFlags = E2D_PARENT_MODE_DEFAULT);
-    virtual ~Element2D();
-
-    virtual void loadParams(const TiXmlElement* root);
-
-    // ACTIVATION //
-    inline void activate2D() { this->bActive = this->bRelCoorChanged = this->bRelDirChanged = true; };
-    inline void deactivate2D() { this->bActive = false; };
-    inline bool get2DActiveState() { return this->bActive; };
-
-    // ALIGNMENT //
-    /** @param alignment the new Alignment of the 2D-Element */
-    inline void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; };
-    void setAlignment(const std::string& alignment);
-    inline E2D_ALIGNMENT getAlignment() const { return this->alignment; };
-
-    // LAYERING //
-    void setLayer(E2D_LAYER layer);
-    void setLayer(const std::string& layer);
-    /** @returns the Layer this Element is drawn to */
-    inline E2D_LAYER getLayer() const { return this->layer; };
-
-    // VISIBILITY //
-    /** @param visible true if the Element should be visible false otherwise (will not be rendered) */
-    inline void setVisibility(bool visible) { this->bVisible = visible; };
-    /** @returns the visibility state */
-    inline bool isVisible() const { return (this->bVisible && this->bCurrentlyVisible);  };
-
-
-    // POSITIONAL (E2D-specials) //
-    /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */
-    void setBindNode(const PNode* bindNode);
-    void setBindNode(const std::string& bindNode);
-    inline const PNode* getBindNode() const { return this->bindNode; };
-
-    inline void setSize2D(float x, float y) { this->size = Vector2D(x, y); };
-    inline void setSize2D(const Vector2D& size) { this->size = size; };
-    inline const Vector2D& getSize2D() const { return this->size; };
-    void setSizeSoft2D(float x, float y, float bias = 1.0);
-    inline void setSizeX2D(float x) { this->size.x = x; };
-    inline void setSizeY2D(float y) { this->size.y = y; };
-    inline float getSizeX2D() const { return this->size.x; };
-    inline float getSizeY2D() const { return this->size.y; };
-
-  public:
-    virtual void tick(float dt) {};
-    virtual void draw() const  {};
-    void tick2D(float dt);
-    void draw2D(E2D_LAYER from, E2D_LAYER to) const;
-    void drawChildren(E2D_LAYER from, E2D_LAYER to) const;
-
-    // LIKE PNODE
-  public:
-    void setRelCoor2D (const Vector2D& relCoord);
-    void setRelCoorX2D(float x);
-    void setRelCoorY2D(float y);
-    void setRelCoor2D (float x, float y);
-    void setRelCoor2Dpx (int x, int y);
-    void setRelCoorSoft2D (const Vector2D& relCoordSoft, float bias = 1.0);
-    void setRelCoorSoft2D (float x, float y, float bias = 1.0);
-    void setRelCoorSoft2Dpx (int x, int y, float bias = 1.0);
-    /** @returns the relative position */
-    inline const Vector2D& getRelCoor2D () const { return this->prevRelCoordinate; };
-    /** @returns the Relative Coordinate Destination */
-    inline const Vector2D& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; };
-    const Vector2D& getRelCoor2Dpx() const;
-    void setAbsCoor2D (const Vector2D& absCoord);
-    void setAbsCoor2D (float x, float y);
-    void setAbsCoorX2D(float x);
-    void setAbsCoorY2D(float y);
-    void setAbsCoor2Dpx (int x, int y);
-    void setAbsCoorSoft2D (const Vector2D& absCoordSoft, float bias = 1.0);
-    void setAbsCoorSoft2D (float x, float y, float bias = 1.0);
-    /** @returns the absolute position */
-    inline const Vector2D& getAbsCoor2D () const { return this->absCoordinate; };
-    const Vector2D& getAbsCoor2Dpx () const;
-
-    void shiftCoor2D (const Vector2D& shift);
-    void shiftCoor2Dpx (int x, int y);
-
-    void setRelDir2D (float relDir);
-    void setRelDirSoft2D(float relDirSoft, float bias = 1.0);
-    /** @returns the relative Direction */
-    inline float getRelDir2D () const { return this->prevRelDirection; };
-    /** @returns the Relative Directional Destination */
-    inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; };
-    void setAbsDir2D (float absDir);
-    void setAbsDirSoft2D (float absDirSoft, float bias = 1.0);
-    /** @returns the absolute Direction */
-    inline float getAbsDir2D () const { return this->absDirection; };
-    void shiftDir2D (float shiftDir);
-
-    /** @returns the Speed of the Node */
-    inline float getSpeed() const { return 0; };
-    /** @returns the Velocity of the Node */
-    inline const Vector2D& getVelocity() const { return this->velocity; };
-
-
-    void addChild2D (Element2D* child);
-    void addChild2D (const std::string& childName);
-    void removeChild2D (Element2D* child);
-    void remove2D();
-
-    /** @param parent the new parent of this Element2D */
-    void setParent2D (Element2D* parent) { parent->addChild2D(this); };
-    void setParent2D (const std::string& parentName);
-    /** @returns the parent of this Element2D */
-    inline Element2D* getParent2D () const { return this->parent; };
-    /** @returns the List of Children of this Element2D */
-    inline const std::list<Element2D*>& getChildren2D() const { return this->children; };
-
-    void setParentSoft2D(Element2D* parentNode, float bias = 1.0);
-    void setParentSoft2D(const std::string& parentName, float bias = 1.0);
-
-    void setParentMode2D (E2D_PARENT_MODE parentMode);
-    void setParentMode2D (const std::string& parentingMode);
-    /** @returns the Parenting mode of this node */
-    int getParentMode2D() const { return this->parentMode; };
-
-    // NULL_PARENT //
-    /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */
-    static Element2D* getNullElement()  { return (Element2D::nullElement != NULL)? Element2D::nullElement : Element2D::createNullElement(); };
-
-
-    void update2D (float dt);
-
-    void debug2D (unsigned int depth = 1, unsigned int level = 0) const;
-    void debugDraw2D(unsigned int depth = 1, float size = 1.0, Vector color = Vector(1,0,0), unsigned int level = 0) const;
-
-    // helper functions //
-    static const char* parentingModeToString2D(int parentingMode);
-    static E2D_PARENT_MODE stringToParentingMode2D(const std::string& parentingMode);
-
-    static const char* layer2DToChar(E2D_LAYER layer);
-    static E2D_LAYER charToLayer2D(const std::string& layer);
-
-    static bool layerSortPredicate(const Element2D* elem1, const Element2D* elem2);
-
-  private:
-    void eraseChild2D(Element2D* child);
-    /** tells the child that the parent's Coordinate has changed */
-    inline void parentCoorChanged2D () { this->bRelCoorChanged = true; }
-    /** tells the child that the parent's Direction has changed */
-    inline void parentDirChanged2D () { this->bRelDirChanged = true; }
-    /** @returns the last calculated coordinate */
-    inline Vector2D getLastAbsCoor2D() { return this->lastAbsCoordinate; }
-
-    void reparent2D();
-    static Element2D* createNullElement();
-    bool checkIntegrity(const Element2D* checkParent) const;
-
-
-  private:
-    const PNode*            bindNode;           //!< a node over which to display this 2D-element
-    Vector2D                size;               //!< The size of the rendered item
-    Vector2D*               toSize;             //!< The Size to iterate to.
-
-    E2D_ALIGNMENT           alignment;          //!< How the Element is aligned around its Position
-
-    bool                    bVisible;           //!< If the given Element2D is visible.
-    bool                    bCurrentlyVisible;  //!< Evaluated in the TICK process, to see if the Element is Currently visible.
-    bool                    bActive;            //!< If the given Element2D is active.
-    E2D_LAYER               layer;              //!< What layer this Element2D is on.
-
-    bool                    bRelCoorChanged;    //!< If Relative Coordinate has changed since last time we checked
-    bool                    bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
-
-    Vector2D                relCoordinate;      //!< coordinates relative to the parent
-    Vector2D                absCoordinate;      //!< absolute coordinates in the world ( from (0,0,0) )
-    float                   relDirection;       //!< direction relative to the parent
-    float                   absDirection;       //!< absolute diretion in the world ( from (0,0,1) )
-
-    Vector2D                prevRelCoordinate;  //!< The last Relative Coordinate from the last update-Cycle.
-    Vector2D                lastAbsCoordinate;  //!< this is used for speedcalculation, it stores the last coordinate
-    float                   prevRelDirection;   //!< The last Relative Direciton from the last update-Cycle.
-
-    Vector2D                velocity;           //!< Saves the velocity.
-
-    Vector2D*               toCoordinate;       //!< a position to which to iterate. (This is used in conjunction with setParentSoft.and set*CoorSoft)
-    float*                  toDirection;        //!< a direction to which to iterate. (This is used in conjunction with setParentSoft and set*DirSoft)
-    float                   bias;               //!< how fast to iterate to the given position (default is 1)
-
-    Element2D*              parent;             //!< a pointer to the parent node
-    std::list<Element2D*>   children;           //!< list of the children of this Element2D
-
-    unsigned int            parentMode;         //!< the mode of the binding
-
-    static Element2D*       nullElement;        //!< The top-most Element
+class Element2D : virtual public BaseObject
+{
+  ObjectListDeclaration(Element2D);
+
+public:
+  Element2D(Element2D* parent = Element2D::getNullElement(), E2D_LAYER layer = E2D_DEFAULT_LAYER, short nodeFlags = E2D_PARENT_MODE_DEFAULT);
+  virtual ~Element2D();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  // ACTIVATION //
+  inline void activate2D() { this->bActive = this->bRelCoorChanged = this->bRelDirChanged = true; };
+  inline void deactivate2D() { this->bActive = false; };
+  inline bool get2DActiveState() { return this->bActive; };
+
+  // ALIGNMENT //
+  /** @param alignment the new Alignment of the 2D-Element */
+  inline void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; };
+  void setAlignment(const std::string& alignment);
+  inline E2D_ALIGNMENT getAlignment() const { return this->alignment; };
+
+  // LAYERING //
+  void setLayer(E2D_LAYER layer);
+  void setLayer(const std::string& layer);
+  /** @returns the Layer this Element is drawn to */
+  inline E2D_LAYER getLayer() const { return this->layer; };
+
+  // VISIBILITY //
+  /** @param visible true if the Element should be visible false otherwise (will not be rendered) */
+  inline void setVisibility(bool visible) { this->bVisible = visible; };
+  /** @returns the visibility state */
+  inline bool isVisible() const { return (this->bVisible && this->bCurrentlyVisible);  };
+
+
+  // POSITIONAL (E2D-specials) //
+  /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */
+  void setBindNode(const PNode* bindNode);
+  void setBindNode(const std::string& bindNode);
+  inline const PNode* getBindNode() const { return this->bindNode; };
+
+  inline void setSize2D(float x, float y) { this->size = Vector2D(x, y); };
+  inline void setSize2D(const Vector2D& size) { this->size = size; };
+  inline const Vector2D& getSize2D() const { return this->size; };
+  void setSizeSoft2D(float x, float y, float bias = 1.0);
+  inline void setSizeX2D(float x) { this->size.x = x; };
+  inline void setSizeY2D(float y) { this->size.y = y; };
+  inline float getSizeX2D() const { return this->size.x; };
+  inline float getSizeY2D() const { return this->size.y; };
+
+public:
+  virtual void tick(float dt) {};
+  virtual void draw() const  {};
+  void tick2D(float dt);
+  void draw2D(E2D_LAYER from, E2D_LAYER to) const;
+  void drawChildren(E2D_LAYER from, E2D_LAYER to) const;
+
+  // LIKE PNODE
+public:
+  void setRelCoor2D (const Vector2D& relCoord);
+  void setRelCoorX2D(float x);
+  void setRelCoorY2D(float y);
+  void setRelCoor2D (float x, float y);
+  void setRelCoor2Dpx (int x, int y);
+  void setRelCoorSoft2D (const Vector2D& relCoordSoft, float bias = 1.0);
+  void setRelCoorSoft2D (float x, float y, float bias = 1.0);
+  void setRelCoorSoft2Dpx (int x, int y, float bias = 1.0);
+  /** @returns the relative position */
+  inline const Vector2D& getRelCoor2D () const { return this->prevRelCoordinate; };
+  /** @returns the Relative Coordinate Destination */
+inline const Vector2D& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; };
+  const Vector2D& getRelCoor2Dpx() const;
+  void setAbsCoor2D (const Vector2D& absCoord);
+  void setAbsCoor2D (float x, float y);
+  void setAbsCoorX2D(float x);
+  void setAbsCoorY2D(float y);
+  void setAbsCoor2Dpx (int x, int y);
+  void setAbsCoorSoft2D (const Vector2D& absCoordSoft, float bias = 1.0);
+  void setAbsCoorSoft2D (float x, float y, float bias = 1.0);
+  /** @returns the absolute position */
+  inline const Vector2D& getAbsCoor2D () const { return this->absCoordinate; };
+  const Vector2D& getAbsCoor2Dpx () const;
+
+  void shiftCoor2D (const Vector2D& shift);
+  void shiftCoor2Dpx (int x, int y);
+
+  void setRelDir2D (float relDir);
+  void setRelDirSoft2D(float relDirSoft, float bias = 1.0);
+  /** @returns the relative Direction */
+  inline float getRelDir2D () const { return this->prevRelDirection; };
+  /** @returns the Relative Directional Destination */
+inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; };
+  void setAbsDir2D (float absDir);
+  void setAbsDirSoft2D (float absDirSoft, float bias = 1.0);
+  /** @returns the absolute Direction */
+  inline float getAbsDir2D () const { return this->absDirection; };
+  void shiftDir2D (float shiftDir);
+
+  /** @returns the Speed of the Node */
+  inline float getSpeed() const { return 0; };
+  /** @returns the Velocity of the Node */
+  inline const Vector2D& getVelocity() const { return this->velocity; };
+
+
+  void addChild2D (Element2D* child);
+  void addChild2D (const std::string& childName);
+  void removeChild2D (Element2D* child);
+  void remove2D();
+
+  /** @param parent the new parent of this Element2D */
+  void setParent2D (Element2D* parent) { parent->addChild2D(this); };
+  void setParent2D (const std::string& parentName);
+  /** @returns the parent of this Element2D */
+  inline Element2D* getParent2D () const { return this->parent; };
+  /** @returns the List of Children of this Element2D */
+  inline const std::list<Element2D*>& getChildren2D() const { return this->children; };
+
+  void setParentSoft2D(Element2D* parentNode, float bias = 1.0);
+  void setParentSoft2D(const std::string& parentName, float bias = 1.0);
+
+  void setParentMode2D (E2D_PARENT_MODE parentMode);
+  void setParentMode2D (const std::string& parentingMode);
+  /** @returns the Parenting mode of this node */
+  int getParentMode2D() const { return this->parentMode; };
+
+  // NULL_PARENT //
+  /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */
+static Element2D* getNullElement()  { return (Element2D::nullElement != NULL)? Element2D::nullElement : Element2D::createNullElement(); };
+
+
+  void update2D (float dt);
+
+  void debug2D (unsigned int depth = 1, unsigned int level = 0) const;
+  void debugDraw2D(unsigned int depth = 1, float size = 1.0, Vector color = Vector(1,0,0), unsigned int level = 0) const;
+
+  // helper functions //
+  static const char* parentingModeToString2D(int parentingMode);
+  static E2D_PARENT_MODE stringToParentingMode2D(const std::string& parentingMode);
+
+  static const char* layer2DToChar(E2D_LAYER layer);
+  static E2D_LAYER charToLayer2D(const std::string& layer);
+
+  static bool layerSortPredicate(const Element2D* elem1, const Element2D* elem2);
+
+private:
+  void eraseChild2D(Element2D* child);
+  /** tells the child that the parent's Coordinate has changed */
+  inline void parentCoorChanged2D () { this->bRelCoorChanged = true; }
+  /** tells the child that the parent's Direction has changed */
+  inline void parentDirChanged2D () { this->bRelDirChanged = true; }
+  /** @returns the last calculated coordinate */
+  inline Vector2D getLastAbsCoor2D() { return this->lastAbsCoordinate; }
+
+  void reparent2D();
+  static Element2D* createNullElement();
+  bool checkIntegrity(const Element2D* checkParent) const;
+
+
+private:
+  const PNode*            bindNode;           //!< a node over which to display this 2D-element
+  Vector2D                size;               //!< The size of the rendered item
+  Vector2D*               toSize;             //!< The Size to iterate to.
+
+  E2D_ALIGNMENT           alignment;          //!< How the Element is aligned around its Position
+
+  bool                    bVisible;           //!< If the given Element2D is visible.
+  bool                    bCurrentlyVisible;  //!< Evaluated in the TICK process, to see if the Element is Currently visible.
+  bool                    bActive;            //!< If the given Element2D is active.
+  E2D_LAYER               layer;              //!< What layer this Element2D is on.
+
+  bool                    bRelCoorChanged;    //!< If Relative Coordinate has changed since last time we checked
+  bool                    bRelDirChanged;     //!< If Relative Direction has changed since last time we checked
+
+  Vector2D                relCoordinate;      //!< coordinates relative to the parent
+  Vector2D                absCoordinate;      //!< absolute coordinates in the world ( from (0,0,0) )
+  float                   relDirection;       //!< direction relative to the parent
+  float                   absDirection;       //!< absolute diretion in the world ( from (0,0,1) )
+
+  Vector2D                prevRelCoordinate;  //!< The last Relative Coordinate from the last update-Cycle.
+  Vector2D                lastAbsCoordinate;  //!< this is used for speedcalculation, it stores the last coordinate
+  float                   prevRelDirection;   //!< The last Relative Direciton from the last update-Cycle.
+
+  Vector2D                velocity;           //!< Saves the velocity.
+
+  Vector2D*               toCoordinate;       //!< a position to which to iterate. (This is used in conjunction with setParentSoft.and set*CoorSoft)
+  float*                  toDirection;        //!< a direction to which to iterate. (This is used in conjunction with setParentSoft and set*DirSoft)
+  float                   bias;               //!< how fast to iterate to the given position (default is 1)
+
+  Element2D*              parent;             //!< a pointer to the parent node
+  std::list<Element2D*>   children;           //!< list of the children of this Element2D
+
+  unsigned int            parentMode;         //!< the mode of the binding
+
+  static Element2D*       nullElement;        //!< The top-most Element
 };
 
Index: trunk/src/lib/graphics/render2D/image_plane.cc
===================================================================
--- trunk/src/lib/graphics/render2D/image_plane.cc	(revision 9682)
+++ trunk/src/lib/graphics/render2D/image_plane.cc	(revision 9869)
@@ -21,12 +21,11 @@
 
 #include "graphics_engine.h"
-#include "glincl.h"
 #include "p_node.h"
 
 
+#include "class_id_DEPRECATED.h"
 
-
-
-CREATE_FACTORY(ImagePlane, CL_IMAGE_ENTITY);
+ObjectListDefinitionID(ImagePlane, CL_IMAGE_PLANE);
+CREATE_FACTORY(ImagePlane);
 
 
@@ -56,5 +55,5 @@
 void ImagePlane::init()
 {
-  this->setClassID(CL_IMAGE_PLANE, "ImagePlane");
+  this->registerObject(this, ImagePlane::_objectList);
   this->setName("ImagePlane");
 
Index: trunk/src/lib/graphics/render2D/image_plane.h
===================================================================
--- trunk/src/lib/graphics/render2D/image_plane.h	(revision 9682)
+++ trunk/src/lib/graphics/render2D/image_plane.h	(revision 9869)
@@ -17,5 +17,5 @@
 class ImagePlane :  public Element2D
 {
-
+  ObjectListDeclaration(ImagePlane);
   public:
     ImagePlane(const TiXmlElement* root = NULL);
Index: trunk/src/lib/graphics/render2D/render_2d.cc
===================================================================
--- trunk/src/lib/graphics/render2D/render_2d.cc	(revision 9682)
+++ trunk/src/lib/graphics/render2D/render_2d.cc	(revision 9869)
@@ -19,7 +19,7 @@
 
 #include "graphics_engine.h"
-#include "class_list.h"
 #include "element_2d.h"
 
+ObjectListDefinition(Render2D);
 
 
@@ -29,8 +29,8 @@
 Render2D::Render2D ()
 {
-   this->setClassID(CL_RENDER_2D, "Render2D");
-   this->setName("Render2D");
+  this->registerObject(this, Render2D::_objectList);
+  this->setName("Render2D");
 
-   this->showNodes = false;
+  this->showNodes = false;
 }
 
Index: trunk/src/lib/graphics/render2D/render_2d.h
===================================================================
--- trunk/src/lib/graphics/render2D/render_2d.h	(revision 9682)
+++ trunk/src/lib/graphics/render2D/render_2d.h	(revision 9869)
@@ -12,24 +12,27 @@
 
 //! A default singleton class.
-class Render2D : public BaseObject {
+class Render2D : public BaseObject
+{
+  ObjectListDeclaration(Render2D);
+
   friend class Element2D;
 
-  public:
-    virtual ~Render2D();
-    /** @returns a Pointer to the only object of this Class */
-    inline static Render2D* getInstance() { if (!singletonRef) singletonRef = new Render2D();  return singletonRef; };
+public:
+  virtual ~Render2D();
+  /** @returns a Pointer to the only object of this Class */
+  inline static Render2D* getInstance() { if (!singletonRef) singletonRef = new Render2D();  return singletonRef; };
 
-    void toggleNodesVisibility() { this->showNodes = !this->showNodes; };
+void toggleNodesVisibility() { this->showNodes = !this->showNodes; };
 
-    void update(float dt);
-    void tick(float dt);
-    void draw(E2D_LAYER from, E2D_LAYER to) const;
+  void update(float dt);
+  void tick(float dt);
+  void draw(E2D_LAYER from, E2D_LAYER to) const;
 
-  private:
-    Render2D();
-    static Render2D*              singletonRef;                    //!< Reference to this class.
+private:
+  Render2D();
+  static Render2D*              singletonRef;                    //!< Reference to this class.
 
-    bool                          showNodes;                       //!< If the debug-Nodes should be visible
- };
+  bool                          showNodes;                       //!< If the debug-Nodes should be visible
+};
 
 #endif /* _RENDER_2D_H */
Index: trunk/src/lib/graphics/resource_shader.cc
===================================================================
--- trunk/src/lib/graphics/resource_shader.cc	(revision 9869)
+++ trunk/src/lib/graphics/resource_shader.cc	(revision 9869)
@@ -0,0 +1,47 @@
+
+#include "resource_shader.h"
+#include "debug.h"
+#include "substring.h"
+
+ResourceShader::ResourceShader(const std::string& vertexShaderName, const std::string& fragmentShaderName, const Resources::KeepLevel& keepLevel)
+    : Resource(&ResourceShader::type)
+{
+  Resources::StorePointer* ptr = this->acquireResource(vertexShaderName +','+fragmentShaderName);
+
+  if (ptr)
+  {
+    PRINTF(5)("FOUND SHADER: %s\n", vertexShaderName.c_str());
+    this->acquireData(static_cast<ResourceShader::ShaderResourcePointer*>(ptr)->ptr());
+  }
+  else
+  {
+    PRINTF(5)("NOT FOUND SHADER: %s\n", vertexShaderName.c_str());
+    std::string vertexFileName = this->Resource::locateFile(vertexShaderName);
+    std::string fragmentFileName;
+    if (!fragmentShaderName.empty())
+      fragmentFileName = this->Resource::locateFile(fragmentShaderName);
+
+    this->Shader::load(vertexFileName, fragmentFileName);
+    this->Resource::addResource(new ResourceShader::ShaderResourcePointer(vertexShaderName+','+fragmentShaderName, keepLevel, this->Shader::dataPointer()));
+  }
+}
+
+ResourceShader ResourceShader::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel)
+{
+  std::string vertexShaderName;
+  std::string fragmentShaderName;
+
+  SubString shaderNames(loadString, ',');
+  if (shaderNames.size() > 0)
+    vertexShaderName = shaderNames[0];
+  if (shaderNames.size() > 1)
+    fragmentShaderName = shaderNames[1];
+
+  return ResourceShader(vertexShaderName, fragmentShaderName, keepLevel);
+}
+
+Resources::tType<ResourceShader> ResourceShader::type("Shader");
+
+ResourceShader::ShaderResourcePointer::ShaderResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const ShaderData::Pointer& data)
+    : Resources::StorePointer(loadString, keepLevel) , pointer(data)
+{}
Index: trunk/src/lib/graphics/resource_shader.h
===================================================================
--- trunk/src/lib/graphics/resource_shader.h	(revision 9869)
+++ trunk/src/lib/graphics/resource_shader.h	(revision 9869)
@@ -0,0 +1,39 @@
+/*!
+ * @file resource_shader.h
+ * @brief Contains the ResourceShader class, that handles the Resource-specific loading part of the Shader.
+ *
+ */
+
+#ifndef _RESOURCE_SHADER_H
+#define _RESOURCE_SHADER_H
+
+#include "util/loading/resource.h"
+#include "shader.h"
+
+
+class ResourceShader : public Shader, public Resources::Resource
+{
+public:
+  ResourceShader(const std::string& vertexShaderName,
+		 const std::string& fragmentShaderName,
+		 const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+  static ResourceShader createFromString(const std::string& loadString,
+					 const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+
+private:
+class ShaderResourcePointer : public Resources::StorePointer
+  {
+  public:
+    ShaderResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const ShaderData::Pointer& data);
+    inline const ShaderData::Pointer& ptr() const { return pointer; }
+    virtual bool last() const { return pointer.count() == 1; }
+  private:
+    ShaderData::Pointer pointer;
+  };
+
+private:
+  static Resources::tType<ResourceShader> type;
+};
+
+
+#endif /* _RESOURCE_SHADER_H */
Index: trunk/src/lib/graphics/shader.cc
===================================================================
--- trunk/src/lib/graphics/shader.cc	(revision 9682)
+++ trunk/src/lib/graphics/shader.cc	(revision 9869)
@@ -18,5 +18,4 @@
 #include "shader.h"
 
-#include "stdlibincl.h"
 #include "compiler.h"
 //#include <stdio.h>
@@ -25,5 +24,4 @@
 #include "debug.h"
 
-#include "util/loading/resource_manager.h"
 
 
@@ -33,5 +31,50 @@
 
 
+ObjectListDefinition(Shader);
 
+void Shader::Uniform::setV(unsigned int count, float* vv) const
+{
+  switch (count)
+  {
+    case 1:
+    glUniform1fv(this->uniform, 1, vv);
+    break;
+    case 2:
+    glUniform2fv(this->uniform, 2, vv);
+    break;
+    case 3:
+    glUniform3fv(this->uniform, 3, vv);
+    break;
+    case 4:
+    glUniform4fv(this->uniform, 4, vv);
+    break;
+  }
+}
+void Shader::Uniform::setV(unsigned int count, int* vv) const
+{
+  switch (count)
+  {
+    case 1:
+    glUniform1iv(this->uniform, 1, vv);
+    break;
+    case 2:
+    glUniform2iv(this->uniform, 2, vv);
+    break;
+    case 3:
+    glUniform3iv(this->uniform, 3, vv);
+    break;
+    case 4:
+    glUniform4iv(this->uniform, 4, vv);
+    break;
+  }
+}
+
+
+
+Shader::Shader()
+  : data(new ShaderData)
+{
+
+}
 
 /**
@@ -39,240 +82,27 @@
 */
 Shader::Shader (const std::string& vertexShaderFile, const std::string& fragmentShaderFile)
+  : data(new ShaderData)
 {
-   this->setClassID(CL_SHADER, "Shader");
+  if (!Shader::checkShaderAbility())
+    PRINTF(2)("Your system does not support shaders\n");
+  this->load(vertexShaderFile, fragmentShaderFile);
 
-   this->shaderProgram = 0;
-   this->vertexShader = 0;
-   this->fragmentShader = 0;
-
-   if (GLEW_ARB_shader_objects && GLEW_ARB_shading_language_100)
-     {
-       this->shaderProgram = glCreateProgramObjectARB();
-
-       if (!vertexShaderFile.empty())
-         this->loadShaderProgramm(Shader::Vertex, vertexShaderFile);
-       if (!fragmentShaderFile.empty())
-         this->loadShaderProgramm(Shader::Fragment, fragmentShaderFile);
-
-       this->linkShaderProgram();
-
-    }
-   else
-     {
-       PRINTF(2)("Shaders are not supported on your hardware\n");
-     }
 }
 
+const Shader* Shader::storedShader = NULL;
 
-/**
- * standard deconstructor
- */
-Shader::~Shader ()
+void Shader::activateShader() const
 {
-  if (this->shaderProgram == glGetHandleARB(GL_PROGRAM_OBJECT_ARB))
-    Shader::deactivateShader();
-
-  // delete what has to be deleted here
-  this->deleteProgram(Shader::Vertex);
-  this->deleteProgram(Shader::Fragment);
-
-  if (this->fragmentShader != 0)
+  if (likely (this->getProgram() != 0))
   {
-    glDetachObjectARB(this->shaderProgram, this->fragmentShader);
-    glDeleteObjectARB(this->fragmentShader);
-  }
-  if (this->vertexShader != 0)
-  {
-    glDetachObjectARB(this->shaderProgram, this->vertexShader);
-    glDeleteObjectARB(this->vertexShader);
-  }
-  if (this->shaderProgram != 0)
-  {
-    GLint status = 0;
-    //glLinkProgramARB(this->shaderProgram);
-    glDeleteObjectARB(this->shaderProgram);
-       // link error checking
-    glGetObjectParameterivARB(this->shaderProgram, GL_OBJECT_DELETE_STATUS_ARB, &status);
-    if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION)
-      this->printError(this->shaderProgram);
-  }
-}
-
-Shader* Shader::getShader(const std::string& vertexShaderFile, const std::string& fragmentShaderFile)
-{
-  return (Shader*)ResourceManager::getInstance()->load(vertexShaderFile, SHADER,  RP_LEVEL, fragmentShaderFile);
-}
-
-bool Shader::unload(Shader* shader)
-{
-  return ResourceManager::getInstance()->unload(shader);
-}
-
-Shader* Shader::storedShader = NULL;
-
-
-bool Shader::loadShaderProgramm(Shader::Type type, const std::string& fileName)
-{
-  GLhandleARB shader = 0;
-
-  if (type != Shader::Vertex && type != Shader::Fragment)
-    return false;
-  this->deleteProgram(type);
-
-
-  std::string program;
-  if (!readShader(fileName, program))
-    return false;
-
-  if (type == Shader::Vertex && GLEW_ARB_vertex_shader)
-  {
-    this->vertexShaderFile = fileName;
-
-    shader = this->vertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
-  }
-
-  if (type == Shader::Fragment && GLEW_ARB_fragment_shader)
-  {
-    this->fragmentShaderFile = fileName;
-
-    shader = this->fragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
-  }
-
-  if (shader != 0)
-  {
-    GLint status = 0;
-    const char* prog = program.c_str();
-
-    glShaderSourceARB(shader, 1, &prog, NULL);
-    glCompileShaderARB(shader);
-    // checking on error.
-    glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status);
-    if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION)
-      this->printError(shader);
-    else
-      glAttachObjectARB(this->shaderProgram, shader);
-  }
-  return true;
-}
-
-
-void Shader::linkShaderProgram()
-{
-  GLint status = 0;
-
-  glLinkProgramARB(this->shaderProgram);
-       // link error checking
-  glGetObjectParameterivARB(this->shaderProgram, GL_OBJECT_LINK_STATUS_ARB, &status);
-  if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION)
-    this->printError(this->shaderProgram);
-}
-
-
-bool Shader::readShader(const std::string& fileName, std::string& output)
-{
-  char lineBuffer[PARSELINELENGTH];
-
-  std::ifstream shader;
-  shader.open(fileName.c_str());
-  if (!shader.is_open())
-    return false;
-
-
-  while (!shader.eof())
-  {
-    shader.getline(lineBuffer, PARSELINELENGTH);
-    output += lineBuffer;
-    output += "\n";
-  }
-
-
-  shader.close();
-  return true;
-}
-
-
-
-void Shader::activateShader()
-{
-  if (likely (this->shaderProgram != 0))
-  {
-    glUseProgramObjectARB(this->shaderProgram);
+    glUseProgramObjectARB(this->getProgram());
     Shader::storedShader = this;
   }
 }
-
-void Shader::bindShader(const char* name, const float* value, size_t size)
-{
-	if (likely (this->shaderProgram != 0)) {
-		glUseProgramObjectARB(this->shaderProgram);
-
-		unsigned int location = glGetUniformLocationARB(this->shaderProgram, name);
-		/* This is EXPENSIVE and should be avoided. */
-
-		if      (size == 1)  glUniform1fvARB(location, 1, value);
-		else if (size == 2)  glUniform2fvARB(location, 1, value);
-		else if (size == 3)  glUniform3fvARB(location, 1, value);
-		else if (size == 4)  glUniform4fvARB(location, 1, value);
-		else if (size == 9)  glUniformMatrix3fvARB(location, 1, false, value);
-		else if (size == 16) glUniformMatrix4fvARB(location, 1, false, value);
-
-	}
-}
-
 void Shader::deactivateShader()
 {
- if (storedShader != NULL)
-   glUseProgramObjectARB(0);
- Shader::storedShader = NULL;
-}
-
-
-void Shader::deleteProgram(Shader::Type type)
-{
-  GLint status = 0;
-  if (type == Shader::Vertex && this->vertexShader != 0)
-  {
-    this->vertexShaderFile = "";
-    glDetachObjectARB(this->shaderProgram, this->vertexShader);
-    glDeleteObjectARB(this->vertexShader);
-    glGetObjectParameterivARB(this->vertexShader, GL_OBJECT_DELETE_STATUS_ARB, &status);
-    if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION)
-      Shader::printError(this->vertexShader);
-    this->vertexShader = 0;
-  }
-  else if (type == Shader::Fragment && this->fragmentShader != 0)
-  {
-    this->fragmentShaderFile = "";
-    glDetachObjectARB(this->shaderProgram, this->fragmentShader);
-    glDeleteObjectARB(this->fragmentShader);
-    glGetObjectParameterivARB(this->fragmentShader, GL_OBJECT_DELETE_STATUS_ARB, &status);
-    if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION)
-      Shader::printError(this->fragmentShader);
-    this->fragmentShader = 0;
-  }
-  else
-    return;
-}
-
-
-void Shader::printError(GLhandleARB program)
-{
-  if (program == 0)
-    return;
-
-  int infologLength = 0;
-  int charsWritten  = 0;
-  char *infoLog;
-
-  glGetObjectParameterivARB(program, GL_OBJECT_INFO_LOG_LENGTH_ARB,
-                            &infologLength);
-
-  if (infologLength > 0)
-  {
-    infoLog = new char[infologLength+1];
-    glGetInfoLogARB(program, infologLength, &charsWritten, infoLog);
-    printf("%s\n", infoLog);
-    delete[] infoLog;
-  }
+  if (storedShader != NULL)
+    glUseProgramObjectARB(0);
+  Shader::storedShader = NULL;
 }
 
@@ -288,21 +118,3 @@
 }
 
-void Shader::debug() const
-{
-  PRINT(3)("Shader info: (SHADER: %d)\n", this->shaderProgram);
-  if (this->vertexShader != 0)
-  {
-/*    PRINT(3)("VertexShaderProgramm: number=%d, file='%s'\n", this->vertexShader, this->vertexShaderFile);
-    if (this->vertexShaderSource != NULL)
-      for (unsigned int i = 0; i < this->vertexShaderSource->getCount(); i++)
-        PRINT(3)("%d: %s\n", i, this->vertexShaderSource->getEntry(i));
-  }
-  if (this->fragmentShader != 0)
-  {
-    PRINT(3)("FragmentShaderProgramm: number=%d, file='%s'\n", this->fragmentShader, this->fragmentShaderFile);
-    if (this->fragmentShaderSource != NULL)
-      for (unsigned int i = 0; i < this->fragmentShaderSource->getCount(); i++)
-        PRINT(3)("%d: %s\n", i, this->fragmentShaderSource->getEntry(i));*/
-  }
-}
 
Index: trunk/src/lib/graphics/shader.h
===================================================================
--- trunk/src/lib/graphics/shader.h	(revision 9682)
+++ trunk/src/lib/graphics/shader.h	(revision 9869)
@@ -8,7 +8,5 @@
 
 #include "base_object.h"
-#include "glincl.h"
-#include <vector>
-
+#include "shader_data.h"
 
 // FORWARD DECLARATION
@@ -16,12 +14,12 @@
 
 
-//! A class for ...
+//! The Shader is a Class-wrapper around the OpenGL Shader Language (GLSL).
 class Shader : public BaseObject
 {
+  ObjectListDeclaration(Shader);
 public:
   class Uniform
   {
   public:
-    Uniform(const Shader* shader, const std::string& location) { this->uniform = glGetUniformLocationARB(shader->getProgram(), location.c_str()) ; }
     Uniform(const Shader& shader, const std::string& location) { this->uniform = glGetUniformLocation(shader.getProgram(), location.c_str()) ; };
     Uniform(GLhandleARB shaderProgram, const std::string& location) { this->uniform = glGetUniformLocation(shaderProgram, location.c_str()) ; };
@@ -37,105 +35,48 @@
     void set(int v0, int v1, int v2, int v3) const { glUniform4i(this->uniform, v0, v1, v2, v3); }
 
-    void setV(unsigned int count, float* vv) const
-    {
-      switch (count)
-      {
-        case 1:
-          glUniform1fv(this->uniform, 1, vv);
-          break;
-        case 2:
-          glUniform2fv(this->uniform, 2, vv);
-          break;
-        case 3:
-          glUniform3fv(this->uniform, 3, vv);
-          break;
-        case 4:
-          glUniform4fv(this->uniform, 4, vv);
-          break;
-      }
-    }
-    void setV(unsigned int count, int* vv) const
-    {
-      switch (count)
-      {
-        case 1:
-          glUniform1iv(this->uniform, 1, vv);
-          break;
-        case 2:
-          glUniform2iv(this->uniform, 2, vv);
-          break;
-        case 3:
-          glUniform3iv(this->uniform, 3, vv);
-          break;
-        case 4:
-          glUniform4iv(this->uniform, 4, vv);
-          break;
-      }
-    }
-    private:
+    void setV(unsigned int count, float* vv) const;
+    void setV(unsigned int count, int* vv) const;
+
+  private:
     GLint uniform;
   };
 
-  typedef enum
-  {
-    None       = 0,
-    Fragment   = 1,
-    Vertex     = 2,
-
-    Program    = 4,
-  }
-  Type;
 
 public:
-  Shader(const std::string& vertexShaderFile = "", const std::string& fragmentShaderFile = "");
-  virtual ~Shader();
-  static Shader* getShader(const std::string& vertexShaderFile, const std::string& fragmentShaderFile);
-  static bool unload(Shader* shader);
+  Shader();
+  Shader(const std::string& vertexShaderFile, const std::string& fragmentShaderFile = "");
+
+  Shader& operator=(const Shader& shader) { this->data = shader.data; return *this; };
+  const ShaderData::Pointer& dataPointer() const { return data; };
+  void acquireData(const ShaderData::Pointer& pointer) { this->data = pointer; };
+
+  bool load(const std::string& vertexShaderFile, const std::string& fragmentShaderFile = "")
+    { return this->data->load(vertexShaderFile, fragmentShaderFile); }
+
+
+  Shader::Uniform getUniform(const std::string& location) { return Shader::Uniform(*this, location); }
+
+  GLhandleARB getProgram() const { return this->data->getProgram(); }
+  GLhandleARB getVertexS() const { return this->data->getVertexS(); }
+  GLhandleARB getFragmentS() const { return this->data->getFragmentS(); }
+
+  void activateShader() const;
+  static void deactivateShader();
+
+  void debug() const { this->data->debug(); };
 
 
   static bool checkShaderAbility();
-  void activateShader();
-  void bindShader(const char* name, const float* value, size_t size);
-  static void deactivateShader();
 
-  Shader::Uniform getUniform(const std::string& location) { return Shader::Uniform(this, location); }
+  inline static bool isShaderActive() { return (Shader::storedShader != NULL) ? true : false; };
+  inline static const Shader* getActiveShader() { return Shader::storedShader; };
 
-  bool loadShaderProgramm(Shader::Type type, const std::string& fileName);
-  void deleteProgram(Shader::Type type);
-
-  void linkShaderProgram();
-
-
-  bool readShader(const std::string& fileName, std::string& output);
-
-
-inline static bool shaderActive() { return (Shader::storedShader != NULL)? true : false; };
-  inline static Shader* getActiveShader() { return Shader::storedShader; };
-  inline static void suspendShader() { Shader* currShader = storedShader; if (storedShader!= NULL) { Shader::deactivateShader(); Shader::storedShader = currShader;} };
+  inline static void suspendShader() { const Shader* currShader = storedShader; if (storedShader!= NULL) { Shader::deactivateShader(); Shader::storedShader = currShader;} };
   inline static void restoreShader() { if (storedShader != NULL) storedShader->activateShader(); storedShader = NULL; };
 
+private:
+  ShaderData::Pointer    data;
 
-
-
-  GLhandleARB getProgram() const { return this->shaderProgram; }
-  GLhandleARB getVertexS() const { return this->vertexShader; }
-  GLhandleARB getFragmentS() const { return this->fragmentShader; }
-
-  void debug() const;
-
-  static void printError(GLhandleARB program);
-
-
-private:
-  std::string            fragmentShaderFile;
-  std::string            vertexShaderFile;
-
-  GLhandleARB            shaderProgram;
-
-  GLhandleARB            vertexShader;
-  GLhandleARB            fragmentShader;
-
-
-  static Shader*         storedShader;
+  static const Shader*         storedShader;
 };
 
Index: trunk/src/lib/graphics/shader_data.cc
===================================================================
--- trunk/src/lib/graphics/shader_data.cc	(revision 9869)
+++ trunk/src/lib/graphics/shader_data.cc	(revision 9869)
@@ -0,0 +1,267 @@
+/*
+   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_
+
+#include "shader_data.h"
+
+#include "stdlibincl.h"
+#include "compiler.h"
+//#include <stdio.h>
+#include <fstream>
+
+#include "debug.h"
+
+
+#ifndef PARSELINELENGTH
+#define PARSELINELENGTH     512       //!< how many chars to read at once
+#endif
+
+
+ObjectListDefinition(ShaderData);
+
+/**
+ * standard constructor
+*/
+ShaderData::ShaderData ()
+{
+  this->registerObject(this, ShaderData::_objectList);
+  this->shaderProgram = 0;
+  this->vertexShader = 0;
+  this->fragmentShader = 0;
+}
+
+
+/// TODO fix that shaders are unloaded first. then loaded
+bool ShaderData::load(const std::string& vertexShaderFile, const std::string& fragmentShaderFile)
+{
+  if (GLEW_ARB_shader_objects && GLEW_ARB_shading_language_100)
+  {
+    this->shaderProgram = glCreateProgramObjectARB();
+
+    if (!vertexShaderFile.empty())
+      this->loadShaderProgramm(ShaderData::Vertex, vertexShaderFile);
+    if (!fragmentShaderFile.empty())
+      this->loadShaderProgramm(ShaderData::Fragment, fragmentShaderFile);
+
+    this->linkShaderProgram();
+
+  }
+  else
+  {
+    PRINTF(2)("Shaders are not supported on your hardware\n");
+  }
+}
+
+/**
+ * standard deconstructor
+ */
+ShaderData::~ShaderData ()
+{
+  if (this->shaderProgram == glGetHandleARB(GL_PROGRAM_OBJECT_ARB))
+    glUseProgramObjectARB(0);
+
+  // delete what has to be deleted here
+  this->deleteProgram(ShaderData::Vertex);
+  this->deleteProgram(ShaderData::Fragment);
+
+  if (this->fragmentShader != 0)
+  {
+    glDetachObjectARB(this->shaderProgram, this->fragmentShader);
+    glDeleteObjectARB(this->fragmentShader);
+  }
+  if (this->vertexShader != 0)
+  {
+    glDetachObjectARB(this->shaderProgram, this->vertexShader);
+    glDeleteObjectARB(this->vertexShader);
+  }
+  if (this->shaderProgram != 0)
+  {
+    GLint status = 0;
+    //glLinkProgramARB(this->shaderProgram);
+    glDeleteObjectARB(this->shaderProgram);
+    // link error checking
+    glGetObjectParameterivARB(this->shaderProgram, GL_OBJECT_DELETE_STATUS_ARB, &status);
+    if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION)
+      this->printError(this->shaderProgram);
+  }
+}
+
+bool ShaderData::loadShaderProgramm(ShaderData::Type type, const std::string& fileName)
+{
+  GLhandleARB shader = 0;
+
+  if (type != ShaderData::Vertex && type != ShaderData::Fragment)
+    return false;
+  this->deleteProgram(type);
+
+
+  std::string program;
+  if (!readShader(fileName, program))
+    return false;
+
+  if (type == ShaderData::Vertex && GLEW_ARB_vertex_shader)
+  {
+    this->vertexShaderFile = fileName;
+
+    shader = this->vertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
+  }
+
+  if (type == ShaderData::Fragment && GLEW_ARB_fragment_shader)
+  {
+    this->fragmentShaderFile = fileName;
+
+    shader = this->fragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
+  }
+
+  if (shader != 0)
+  {
+    GLint status = 0;
+    const char* prog = program.c_str();
+
+    glShaderSourceARB(shader, 1, &prog, NULL);
+    glCompileShaderARB(shader);
+    // checking on error.
+    glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status);
+    if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION)
+      this->printError(shader);
+    else
+      glAttachObjectARB(this->shaderProgram, shader);
+  }
+  return true;
+}
+
+
+void ShaderData::linkShaderProgram()
+{
+  GLint status = 0;
+
+  glLinkProgramARB(this->shaderProgram);
+  // link error checking
+  glGetObjectParameterivARB(this->shaderProgram, GL_OBJECT_LINK_STATUS_ARB, &status);
+  if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION)
+    this->printError(this->shaderProgram);
+}
+
+
+bool ShaderData::readShader(const std::string& fileName, std::string& output)
+{
+  char lineBuffer[PARSELINELENGTH];
+
+  std::ifstream shader;
+  shader.open(fileName.c_str());
+  if (!shader.is_open())
+    return false;
+
+
+  while (!shader.eof())
+  {
+    shader.getline(lineBuffer, PARSELINELENGTH);
+    output += lineBuffer;
+    output += "\n";
+  }
+
+
+  shader.close();
+  return true;
+}
+
+void ShaderData::bindShader(const char* name, const float* value, size_t size)
+{
+  if (likely (this->shaderProgram != 0))
+  {
+    glUseProgramObjectARB(this->shaderProgram);
+
+    unsigned int location = glGetUniformLocationARB(this->shaderProgram, name);
+    /* This is EXPENSIVE and should be avoided. */
+
+    if      (size == 1)  glUniform1fvARB(location, 1, value);
+    else if (size == 2)  glUniform2fvARB(location, 1, value);
+    else if (size == 3)  glUniform3fvARB(location, 1, value);
+    else if (size == 4)  glUniform4fvARB(location, 1, value);
+    else if (size == 9)  glUniformMatrix3fvARB(location, 1, false, value);
+    else if (size == 16) glUniformMatrix4fvARB(location, 1, false, value);
+
+  }
+}
+
+void ShaderData::deleteProgram(ShaderData::Type type)
+{
+  GLint status = 0;
+  if (type == ShaderData::Vertex && this->vertexShader != 0)
+  {
+    this->vertexShaderFile = "";
+    glDetachObjectARB(this->shaderProgram, this->vertexShader);
+    glDeleteObjectARB(this->vertexShader);
+    glGetObjectParameterivARB(this->vertexShader, GL_OBJECT_DELETE_STATUS_ARB, &status);
+    if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION)
+      ShaderData::printError(this->vertexShader);
+    this->vertexShader = 0;
+  }
+  else if (type == ShaderData::Fragment && this->fragmentShader != 0)
+  {
+    this->fragmentShaderFile = "";
+    glDetachObjectARB(this->shaderProgram, this->fragmentShader);
+    glDeleteObjectARB(this->fragmentShader);
+    glGetObjectParameterivARB(this->fragmentShader, GL_OBJECT_DELETE_STATUS_ARB, &status);
+    if (status == GL_INVALID_VALUE || status == GL_INVALID_OPERATION)
+      ShaderData::printError(this->fragmentShader);
+    this->fragmentShader = 0;
+  }
+  else
+    return;
+}
+
+
+void ShaderData::printError(GLhandleARB program)
+{
+  if (program == 0)
+    return;
+
+  int infologLength = 0;
+  int charsWritten  = 0;
+  char *infoLog;
+
+  glGetObjectParameterivARB(program, GL_OBJECT_INFO_LOG_LENGTH_ARB,
+                            &infologLength);
+
+  if (infologLength > 0)
+  {
+    infoLog = new char[infologLength+1];
+    glGetInfoLogARB(program, infologLength, &charsWritten, infoLog);
+    printf("%s\n", infoLog);
+    delete[] infoLog;
+  }
+}
+
+void ShaderData::debug() const
+{
+  PRINT(3)("ShaderData info: (SHADER: %d)\n", this->shaderProgram);
+  if (this->vertexShader != 0)
+  {
+    /*    PRINT(3)("VertexShaderProgramm: number=%d, file='%s'\n", this->vertexShader, this->vertexShaderFile);
+        if (this->vertexShaderSource != NULL)
+          for (unsigned int i = 0; i < this->vertexShaderSource->getCount(); i++)
+            PRINT(3)("%d: %s\n", i, this->vertexShaderSource->getEntry(i));
+      }
+      if (this->fragmentShader != 0)
+      {
+        PRINT(3)("FragmentShaderProgramm: number=%d, file='%s'\n", this->fragmentShader, this->fragmentShaderFile);
+        if (this->fragmentShaderSource != NULL)
+          for (unsigned int i = 0; i < this->fragmentShaderSource->getCount(); i++)
+            PRINT(3)("%d: %s\n", i, this->fragmentShaderSource->getEntry(i));*/
+  }
+}
+
Index: trunk/src/lib/graphics/shader_data.h
===================================================================
--- trunk/src/lib/graphics/shader_data.h	(revision 9869)
+++ trunk/src/lib/graphics/shader_data.h	(revision 9869)
@@ -0,0 +1,67 @@
+/*!
+ * @file shader_data.h
+ * @brief Definition of the Shader rendering class
+*/
+
+#ifndef _SHADER_DATA_H
+#define _SHADER_DATA_H
+
+#include "base_object.h"
+
+#include "glincl.h"
+#include <vector>
+#include "count_pointer.h"
+
+// FORWARD DECLARATION
+
+
+
+//! The ShaderData is a Class-wrapper around the OpenGL Shader Language (GLSL).
+class ShaderData : public BaseObject
+{
+  ObjectListDeclaration(ShaderData);
+  //! The Type of Shader.
+  typedef enum  {
+    None       = 0,     //!< No Type at all
+    Fragment   = 1,     //!< Fragment Shader.
+    Vertex     = 2,     //!< Vertex Shader.
+    Program    = 4,     //!< Compiled Shader Programm.
+  }  Type;
+
+ public:
+  typedef CountPointer<ShaderData> Pointer;
+public:
+  ShaderData();
+  virtual ~ShaderData();
+
+  bool load(const std::string& vertexShaderFile = "", const std::string& fragmentShaderFile = "");
+
+
+  GLhandleARB getProgram() const { return this->shaderProgram; }
+  GLhandleARB getVertexS() const { return this->vertexShader; }
+  GLhandleARB getFragmentS() const { return this->fragmentShader; }
+
+  void activateShader();
+
+  void debug() const;
+private:
+  void bindShader(const char* name, const float* value, size_t size);
+  void linkShaderProgram();
+  bool readShader(const std::string& fileName, std::string& output);
+  bool loadShaderProgramm(ShaderData::Type type, const std::string& fileName);
+  void deleteProgram(ShaderData::Type type);
+
+  static void printError(GLhandleARB program);
+
+private:
+
+  std::string            fragmentShaderFile;
+  std::string            vertexShaderFile;
+
+  GLhandleARB            shaderProgram;
+
+  GLhandleARB            vertexShader;
+  GLhandleARB            fragmentShader;
+};
+
+#endif /* _SHADER_DATA_H */
Index: trunk/src/lib/graphics/spatial_separation/quadtree.cc
===================================================================
--- trunk/src/lib/graphics/spatial_separation/quadtree.cc	(revision 9682)
+++ trunk/src/lib/graphics/spatial_separation/quadtree.cc	(revision 9869)
@@ -27,4 +27,5 @@
 #define QUADTREE_MATERIAL_COUNT       4
 
+ObjectListDefinition(Quadtree);
 /**
  *  standard constructor
@@ -32,5 +33,5 @@
 Quadtree::Quadtree (const modelInfo* pModelInfo, const int treeDepth)
 {
-  this->setClassID(CL_QUADTREE, "Quadtree");
+  this->registerObject(this, Quadtree::_objectList);
   this->pModelInfo = pModelInfo;
   this->treeDepth = treeDepth;
Index: trunk/src/lib/graphics/spatial_separation/quadtree.h
===================================================================
--- trunk/src/lib/graphics/spatial_separation/quadtree.h	(revision 9682)
+++ trunk/src/lib/graphics/spatial_separation/quadtree.h	(revision 9869)
@@ -21,5 +21,5 @@
 //! A class for quadtree separation of the world
 class Quadtree : public BaseObject {
-
+  ObjectListDeclaration(Quadtree);
 
   public:
Index: trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
===================================================================
--- trunk/src/lib/graphics/spatial_separation/quadtree_node.cc	(revision 9682)
+++ trunk/src/lib/graphics/spatial_separation/quadtree_node.cc	(revision 9869)
@@ -27,5 +27,5 @@
 
 
-
+ObjectListDefinition(QuadtreeNode);
 
 /**
@@ -102,5 +102,5 @@
 void QuadtreeNode::init()
 {
-  this->setClassID(CL_QUADTREE_NODE, "QuadtreeNode");
+  this->registerObject(this, QuadtreeNode::_objectList);
 
   /* init the rest of the variables for both init types */
Index: trunk/src/lib/graphics/spatial_separation/quadtree_node.h
===================================================================
--- trunk/src/lib/graphics/spatial_separation/quadtree_node.h	(revision 9682)
+++ trunk/src/lib/graphics/spatial_separation/quadtree_node.h	(revision 9869)
@@ -26,4 +26,5 @@
 //! A class for a Quadtree Node representation
 class QuadtreeNode : public BaseObject {
+  ObjectListDeclaration(QuadtreeNode);
 
   public:
Index: trunk/src/lib/graphics/spatial_separation/spatial_separation.cc
===================================================================
--- trunk/src/lib/graphics/spatial_separation/spatial_separation.cc	(revision 9682)
+++ trunk/src/lib/graphics/spatial_separation/spatial_separation.cc	(revision 9869)
@@ -24,13 +24,13 @@
 
 
-
+ObjectListDefinition(SpatialSeparation);
 
 /**
- *  standard constructor
+ * @brief standard constructor
  * @param model the model that is to be separated
  * @param overlapSize each box will overlap for a given size
-
-   The boxes are overlaping because this makes collision detection a lot simpler
-
+ *
+ * The boxes are overlaping because this makes collision detection a lot simpler
+ *
  */
 SpatialSeparation::SpatialSeparation (Model* model, float overlapSize)
@@ -39,5 +39,5 @@
   PRINT(3)("+-| (Event) Spatial Separation process kicked on\n");
 
-  this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
+  this->registerObject(this, SpatialSeparation::_objectList);
   /* debug vice */
   this->createQuadtree(model);
@@ -46,5 +46,5 @@
 
 /**
- *  standard constructor
+ * @brief standard constructor
  * @param model the model that is to be separated
  * @param overlapSize each box will overlap for a given size
@@ -54,5 +54,5 @@
 SpatialSeparation::SpatialSeparation (Model* model, Model* playerModel)
 {
-  this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
+  this->registerObject(this, SpatialSeparation::_objectList);
 
 }
@@ -60,5 +60,5 @@
 
 /**
- *  standard deconstructor
+ * @brief standard deconstructor
  */
 SpatialSeparation::~SpatialSeparation ()
@@ -70,5 +70,5 @@
 
 /**
- *  creates a quadtree
+ * @brief creates a quadtree
  * @param model the model to do a quadtree on
  * @param minLength the minimal length of a quadtree node
@@ -83,5 +83,5 @@
 
 /**
- *  brief creates a quadtree
+ * @brief creates a quadtree
  * @param model the model to do a quadtree on
  * @param minLength the minimal length of a quadtree node
@@ -95,5 +95,5 @@
 
 /**
- *  creates a quadtree
+ * @brief creates a quadtree
  * @param model the model to do a quadtree on
  * @param minLength the minimal length of a quadtree node
@@ -109,5 +109,5 @@
 
 /**
- *  draws all the quadtrees
+ * @brief draws all the quadtrees
  */
 void SpatialSeparation::drawQuadtree()
@@ -118,14 +118,2 @@
   this->quadtree->drawTree();
 }
-
-
-
-
-
-
-
-
-
-
-
-
Index: trunk/src/lib/graphics/spatial_separation/spatial_separation.h
===================================================================
--- trunk/src/lib/graphics/spatial_separation/spatial_separation.h	(revision 9682)
+++ trunk/src/lib/graphics/spatial_separation/spatial_separation.h	(revision 9869)
@@ -19,4 +19,5 @@
 //! A class for spatial separation of vertices based arrays
 class SpatialSeparation : public BaseObject {
+  ObjectListDeclaration(SpatialSeparation);
 
   public:
Index: trunk/src/lib/graphics/text_engine/font.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/font.cc	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/font.cc	(revision 9869)
@@ -29,4 +29,5 @@
 #include "compiler.h"
 
+ObjectListDefinition(Font);
 
 Font::Font()
@@ -34,5 +35,4 @@
 {
   this->init();
-
 }
 
@@ -118,4 +118,5 @@
   Material::operator=(font);
   this->data = font.data;
+  this->setTexture(this->data->textureData());
 
   return *this;
@@ -130,6 +131,6 @@
   this->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
-  this->setClassID(CL_FONT, "Font");
-  if (Font::defaultFontData.get() == NULL)
+  this->registerObject(this, Font::_objectList);
+  if (Font::defaultFontData.isNull())
   {
     Font::initDefaultFont();
@@ -138,5 +139,5 @@
 }
 
-FontDataPointer Font::defaultFontData(NULL);
+FontData::Pointer Font::defaultFontData(NULL);
 
 /**
@@ -146,5 +147,5 @@
 {
   // temporarily create a Font.
-  Font::defaultFontData = FontDataPointer(new FontData);
+  Font::defaultFontData = FontData::Pointer(new FontData);
   // apply the Data.
   Font::defaultFontData = Font(font_xpm).data;
@@ -159,5 +160,5 @@
 bool Font::loadFontFromTTF(const std::string& fontFile, unsigned int renderSize)
 {
-  this->data = FontDataPointer (new FontData());
+  this->data = FontData::Pointer (new FontData());
   bool retVal = this->data->loadFontFromTTF(fontFile, renderSize);
   if (!retVal)
@@ -174,5 +175,5 @@
 bool Font::loadFontFromSDL_Surface(SDL_Surface* surface)
 {
-  this->data = FontDataPointer (new FontData());
+  this->data = FontData::Pointer (new FontData());
   bool retVal = this->data->loadFontFromSDL_Surface(surface);
   if (!retVal)
@@ -196,5 +197,5 @@
 
 
-void Font::setTexture(const TextureDataPointer& texDataPointer)
+void Font::setTexture(const TextureData::Pointer& texDataPointer)
 {
   this->setDiffuseMap(texDataPointer);
Index: trunk/src/lib/graphics/text_engine/font.h
===================================================================
--- trunk/src/lib/graphics/text_engine/font.h	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/font.h	(revision 9869)
@@ -19,5 +19,7 @@
 class Font : public Material
 {
-
+  ObjectListDeclaration(Font);
+public:
+  typedef FontData::Glyph Glyph;
 public:
   Font();
@@ -39,5 +41,5 @@
 
   /** @returns a Pointer to the Array of Glyphs */
-  inline Glyph** getGlyphArray() const { return this->data->getGlyphArray(); };
+  inline const Glyph* const * const getGlyphArray() const { return this->data->getGlyphArray(); };
 
   inline int getMaxHeight() const { return data->getMaxHeight(); };
@@ -50,14 +52,16 @@
   void debug() const;
 
+  void acquireData(const FontData::Pointer& data) { this->data = data; };
+  const FontData::Pointer& dataPointer() const { return data; };
 private:
   void init();
   static void initDefaultFont();
 
-  void setTexture(const TextureDataPointer& texDataPointer);
+  void setTexture(const TextureData::Pointer& texDataPointer);
 
 private:
-  FontDataPointer           data;                //!< A Data-Pointer to a Font.
+  FontData::Pointer         data;                //!< A Data-Pointer to a Font.
 
-  static FontDataPointer    defaultFontData;     //!< a default font, that is used, if other fonts were unable to be loaded.
+  static FontData::Pointer  defaultFontData;     //!< a default font, that is used, if other fonts were unable to be loaded.
 };
 
Index: trunk/src/lib/graphics/text_engine/font_data.h
===================================================================
--- trunk/src/lib/graphics/text_engine/font_data.h	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/font_data.h	(revision 9869)
@@ -26,28 +26,32 @@
 #define FONT_DEFAULT_RENDER_SIZE     50            //!< At what Resolution to render fonts.
 
+class FontData
+{
+
+
+public:
+
 //! A struct for handling glyphs
 /**
  * a Glyph is one letter of a certain font
  */
-struct Glyph
-{
+  struct Glyph
+  {
   // Glyph-specific (size and so on)
-  Uint16   character;         //!< The character
-  float    minX;              //!< The minimum distance from the origin in X
-  float    maxX;              //!< The maximum distance from the origin in X
-  float    minY;              //!< The minimum distance from the origin in Y
-  float    maxY;              //!< The maximum distance from the origin in Y
-  float    width;             //!< The width of the Glyph
-  float    height;            //!< The height of the Glyph
-  float    bearingX;          //!< How much is right of the Origin
-  float    bearingY;          //!< How much is above the Origin
-  float    advance;           //!< How big a Glyph would be in monospace-mode
+    Uint16   character;         //!< The character
+    float    minX;              //!< The minimum distance from the origin in X
+    float    maxX;              //!< The maximum distance from the origin in X
+    float    minY;              //!< The minimum distance from the origin in Y
+    float    maxY;              //!< The maximum distance from the origin in Y
+    float    width;             //!< The width of the Glyph
+    float    height;            //!< The height of the Glyph
+    float    bearingX;          //!< How much is right of the Origin
+    float    bearingY;          //!< How much is above the Origin
+    float    advance;           //!< How big a Glyph would be in monospace-mode
 
-  GLfloat texCoord[4];        //!< Texture coordinates: 0:left, 1:right, 2: top, 3: bottom.
-};
+    GLfloat texCoord[4];        //!< Texture coordinates: 0:left, 1:right, 2: top, 3: bottom.
+  };
 
-
-class FontData
-{
+  typedef CountPointer<FontData> Pointer;
 public:
   FontData();
@@ -61,5 +65,5 @@
 
   /** @returns a Pointer to the Array of Glyphs */
-  inline Glyph** getGlyphArray() const { return this->glyphArray; };
+  inline const Glyph* const * const getGlyphArray() const { return this->glyphArray; };
 
   int getMaxHeight() const { return maxHeight; };
@@ -68,5 +72,5 @@
 
   /** @returns the Texture-Data of this FontData */
-  const TextureDataPointer& textureData() const { return texData; };
+  const TextureData::Pointer& textureData() const { return texData; };
 
   bool rebuild() { return texData->rebuild(); };
@@ -91,8 +95,6 @@
   int           maxDescent;          //!< Max Desent of the Font.
 
-  TextureDataPointer   texData;
+  TextureData::Pointer   texData;
 };
 
-typedef CountPointer<FontData> FontDataPointer;
-
 #endif /* _FONT_DATA_H */
Index: trunk/src/lib/graphics/text_engine/limited_width_text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/limited_width_text.cc	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/limited_width_text.cc	(revision 9869)
@@ -19,4 +19,5 @@
 #include "font.h"
 
+ObjectListDefinition(LimitedWidthText);
 /**
  * @brief creates a new Text Element
@@ -27,5 +28,5 @@
     : Text(fontFile, textSize)
 {
-  this->setClassID(CL_LIMITED_WIDTH_TEXT, "LimitedWidthText");
+  this->registerObject(this, LimitedWidthText::_objectList);
 
   this->_dotsPosition = End;
@@ -75,5 +76,5 @@
   glRotatef(this->getAbsDir2D(), 0, 0, 1);
 
-  Glyph* tmpGlyph;
+  const Font::Glyph* tmpGlyph;
   float posX = 0.0f;
   glBegin(GL_QUADS);
Index: trunk/src/lib/graphics/text_engine/limited_width_text.h
===================================================================
--- trunk/src/lib/graphics/text_engine/limited_width_text.h	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/limited_width_text.h	(revision 9869)
@@ -14,4 +14,5 @@
 class LimitedWidthText : public Text
 {
+  ObjectListDeclaration(LimitedWidthText);
   public:
     typedef enum {
Index: trunk/src/lib/graphics/text_engine/multi_line_text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/multi_line_text.cc	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/multi_line_text.cc	(revision 9869)
@@ -19,4 +19,6 @@
 #include "font.h"
 
+ObjectListDefinition(MultiLineText);
+
 /**
  * @brief creates a new Text Element
@@ -27,5 +29,5 @@
   : Text(fontFile, textSize)
 {
-  this->setClassID(CL_MULTI_LINE_TEXT, "MultiLineText");
+  this->registerObject(this, MultiLineText::_objectList);
 
   this->lineSpacing = 1.0;
@@ -78,5 +80,5 @@
   glRotatef(this->getAbsDir2D(), 0, 0, 1);
 
-  Glyph* tmpGlyph;
+  const Font::Glyph* tmpGlyph;
   float posX = 0.0f;
   float posY = 0.0f;
Index: trunk/src/lib/graphics/text_engine/multi_line_text.h
===================================================================
--- trunk/src/lib/graphics/text_engine/multi_line_text.h	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/multi_line_text.h	(revision 9869)
@@ -14,4 +14,5 @@
 class MultiLineText : public Text
 {
+  ObjectListDeclaration(MultiLineText);
   public:
     MultiLineText(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE, float lineWidth = 100.0);
Index: trunk/src/lib/graphics/text_engine/resource_font.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/resource_font.cc	(revision 9869)
+++ trunk/src/lib/graphics/text_engine/resource_font.cc	(revision 9869)
@@ -0,0 +1,54 @@
+
+#include "resource_font.h"
+#include "substring.h"
+#include "multi_type.h"
+#include "debug.h"
+
+
+ResourceFont::ResourceFont(const std::string& fontName, unsigned int renderSize, const Resources::KeepLevel& keepLevel)
+  : Font(), Resource(&ResourceFont::type)
+{
+  assert(!fontName.empty());
+  Resources::StorePointer* ptr = this->acquireResource(fontName + ',' + MultiType((int)renderSize).getString());
+
+  if (ptr)
+  {
+    PRINTF(5)("FOUND FONT: %s\n", fontName.c_str());
+    this->Font::acquireData(static_cast<ResourceFont::FontResourcePointer*>(ptr)->ptr());
+  }
+  else
+  {
+    PRINTF(5)("NOT FOUND FONT: %s\n", fontName.c_str());
+    std::string fileName = this->Resource::locateFile(fontName);
+
+    this->Font::loadFontFromTTF(fileName, renderSize);
+    this->Resource::addResource(new ResourceFont::FontResourcePointer(fontName + ',' + MultiType((int)renderSize).getString(), keepLevel, this->Font::dataPointer()));
+  }
+}
+
+ResourceFont ResourceFont::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel)
+{
+  SubString loadValues(loadString, ',');
+  std::string fontName;
+  unsigned int renderSize = 20;
+  if (loadValues.size() > 0)
+    fontName = loadValues[0];
+  if (loadValues.size() > 1)
+    renderSize = (unsigned int)MultiType(loadValues[2]).getInt();
+
+  return ResourceFont(fontName, renderSize, keepLevel);
+}
+
+
+
+Resources::tType<ResourceFont> ResourceFont::type("Font");
+
+
+
+
+
+ResourceFont::FontResourcePointer::FontResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const FontData::Pointer& data)
+    : Resources::StorePointer(loadString, keepLevel) , pointer(data)
+{}
+
+
Index: trunk/src/lib/graphics/text_engine/resource_font.h
===================================================================
--- trunk/src/lib/graphics/text_engine/resource_font.h	(revision 9869)
+++ trunk/src/lib/graphics/text_engine/resource_font.h	(revision 9869)
@@ -0,0 +1,36 @@
+/*!
+ * @file resource_font.h
+ * @brief Contains the ResourceFont class, that handles the Resource-specific loading part of the Font.
+ *
+ */
+
+#ifndef _RESOURCE_FONT_H
+#define _RESOURCE_FONT_H
+
+#include "util/loading/resource.h"
+#include "font.h"
+
+
+class ResourceFont : public Font, public Resources::Resource
+{
+public:
+  ResourceFont(const std::string& fontName, unsigned int renderSize, const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+  static ResourceFont createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+
+private:
+class FontResourcePointer : public Resources::StorePointer
+  {
+  public:
+    FontResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const FontData::Pointer& data);
+    inline const FontData::Pointer& ptr() const { return pointer; }
+    virtual bool last() const { return pointer.count() == 1; }
+  private:
+    FontData::Pointer pointer;
+  };
+
+private:
+  static Resources::tType<ResourceFont> type;
+};
+
+
+#endif /* _RESOURCE_FONT_H */
Index: trunk/src/lib/graphics/text_engine/text.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/text.cc	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/text.cc	(revision 9869)
@@ -17,8 +17,9 @@
 
 #include "text.h"
+#include "resource_font.h"
 #include "font.h"
-
-#include "util/loading/resource_manager.h"
 #include "debug.h"
+
+ObjectListDefinition(Text);
 
 /**
@@ -28,10 +29,13 @@
  */
 Text::Text(const std::string& fontFile, unsigned int textSize)
-    // : _font(fontFile, FONT_DEFAULT_RENDER_SIZE)
-{
-  this->setClassID(CL_TEXT, "Text");
+// : _font(fontFile, FONT_DEFAULT_RENDER_SIZE)
+{
+  this->registerObject(this, Text::_objectList);
 
   // initialize this Text
-  this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);
+  if (!fontFile.empty())
+    this->setFont(fontFile, FONT_DEFAULT_RENDER_SIZE);
+  else
+    this->setFont("fonts/final_frontier.ttf", FONT_DEFAULT_RENDER_SIZE);
   this->_size = textSize;
   this->setSizeY2D(textSize);
@@ -44,5 +48,5 @@
     : _font()
 {
-  this->setClassID(CL_TEXT, "Text");
+  this->registerObject(this, Text::_objectList);
 
   *this = text;
@@ -169,22 +173,5 @@
 void Text::setFont(const std::string& fontFile, unsigned int fontSize)
 {
-  Font* newFont = NULL;
-  //  Font* oldFont = this->_font;
-
-  // load a new Font
-  if (!fontFile.empty())
-  {
-    newFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, (int)fontSize);
-    if (newFont == NULL)
-    {
-      //      newFont = &Font::();
-      PRINTF(2)("Font %s could not be loaded, probably file not found\n", fontFile.c_str());
-    }
-  }
-
-  if (newFont == NULL)
-    this->_font = Font();
-  else
-    this->_font = *newFont;
+  this->_font = ResourceFont(fontFile, fontSize);
 
   this->setupTextWidth();
@@ -233,5 +220,5 @@
   glRotatef(this->getAbsDir2D(), 0, 0, 1);
 
-  Glyph* tmpGlyph;
+  const Font::Glyph* tmpGlyph;
   float posX = 0.0f;
   glBegin(GL_QUADS);
Index: trunk/src/lib/graphics/text_engine/text.h
===================================================================
--- trunk/src/lib/graphics/text_engine/text.h	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/text.h	(revision 9869)
@@ -26,4 +26,5 @@
 class Text : public Element2D
 {
+  ObjectListDeclaration(Text);
   public:
     Text(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE);
Index: trunk/src/lib/graphics/text_engine/text_engine.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/text_engine.cc	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/text_engine.cc	(revision 9869)
@@ -33,6 +33,4 @@
 
 #include "graphics_engine.h"
-#include "util/loading/resource_manager.h"
-#include "class_list.h"
 
 #include "debug.h"
@@ -40,4 +38,5 @@
 /// TEXT-ENGINE ///
 ///////////////////
+ObjectListDefinition(TextEngine);
 /**
  *  standard constructor
@@ -45,7 +44,7 @@
 TextEngine::TextEngine ()
 {
-   this->setClassID(CL_TEXT_ENGINE, "TextEngine");
-   this->setName("TextEngine");
-   this->enableFonts();
+  this->registerObject(this, TextEngine::_objectList);
+  this->setName("TextEngine");
+  this->enableFonts();
 }
 
@@ -62,18 +61,15 @@
 {
   // first remove all the remaining Texts (if any).
-  const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
-  if (textList != NULL)
-  {
-    while(textList->size() > 0)
-      delete dynamic_cast<Text*>(textList->front());
-  }
+  while (!Text::objectList().empty())
+    delete Text::objectList().front();
   // delete all remaining fonts (There should not be Anything to do here)
-  const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT);
-  if (fontList != NULL)
+
+  //const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT);
+  //if (fontList != NULL)
   {
     ///FIXME
-//    while (fontList->size() > 0)
+    //    while (fontList->size() > 0)
     {
-//      Font* font = dynamic_cast<Font*>(fontList->back());
+      //      Font* font = dynamic_cast<Font*>(fontList->back());
       //if (likely(font != Font::getDefaultFont()))
       //        ResourceManager::getInstance()->unload(font, RP_GAME);
@@ -91,10 +87,10 @@
 {
   if (!TTF_WasInit())
-    {
-      if(TTF_Init()==-1)
-        PRINTF(1)("TTF_Init: %s\n", TTF_GetError());
+  {
+    if(TTF_Init()==-1)
+      PRINTF(1)("TTF_Init: %s\n", TTF_GetError());
 
-      TextEngine::checkVersion();
-    }
+    TextEngine::checkVersion();
+  }
   else
     PRINTF(4)("Fonts already initialized\n");
@@ -107,8 +103,8 @@
 {
   if (TTF_WasInit())
-    {
-//      Font::removeDefaultFont();
-      TTF_Quit();
-    }
+  {
+    //      Font::removeDefaultFont();
+    TTF_Quit();
+  }
   else
     PRINTF(4)("Fonts were not initialized.\n");
@@ -122,15 +118,14 @@
 void TextEngine::debug() const
 {
-  const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT);
-  if (textList != NULL)
+  PRINT(0)("+-------------------------------+\n");
+  PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n");
+  PRINT(0)("+-------------------------------+\n");
+  PRINT(0)("Reference: %p; Text Counts: %d\n", this, Text::objectList().size());
+
+  for (ObjectList<Text>::const_iterator it = Text::objectList().begin();
+       it != Text::objectList().end();
+       ++it)
   {
-    PRINT(0)("+-------------------------------+\n");
-    PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n");
-    PRINT(0)("+-------------------------------+\n");
-    PRINT(0)("Reference: %p; Text Counts: %d\n", this, textList->size());
-
-    std::list<BaseObject*>::const_iterator text;
-    for ( text = textList->begin(); text != textList->end(); text++)
-      dynamic_cast<Text*>(*text)->debug();
+      (*it)->debug();
     PRINT(0)("+---------------------------TE--+\n");
   }
@@ -152,19 +147,19 @@
       compile_version.minor == link_version.minor &&
       compile_version.patch == link_version.patch)
-    {
-      return true;
-    }
+  {
+    return true;
+  }
   else
-    {
-      PRINTF(2)("compiled with SDL_ttf version: %d.%d.%d\n",
-                compile_version.major,
-                compile_version.minor,
-                compile_version.patch);
+  {
+    PRINTF(2)("compiled with SDL_ttf version: %d.%d.%d\n",
+              compile_version.major,
+              compile_version.minor,
+              compile_version.patch);
 
-      PRINTF(2)("running with SDL_ttf version: %d.%d.%d\n",
-                link_version.major,
-                link_version.minor,
-                link_version.patch);
-      return false;
-    }
+    PRINTF(2)("running with SDL_ttf version: %d.%d.%d\n",
+              link_version.major,
+              link_version.minor,
+              link_version.patch);
+    return false;
+  }
 }
Index: trunk/src/lib/graphics/text_engine/text_engine.h
===================================================================
--- trunk/src/lib/graphics/text_engine/text_engine.h	(revision 9682)
+++ trunk/src/lib/graphics/text_engine/text_engine.h	(revision 9869)
@@ -24,5 +24,6 @@
 class TextEngine : public BaseObject
 {
- public:
+  ObjectListDeclaration(TextEngine);
+  public:
   virtual ~TextEngine();
   /** @returns a Pointer to the only object of this Class */
Index: trunk/src/lib/gui/gl/glgui_bar.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_bar.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_bar.cc	(revision 9869)
@@ -23,4 +23,5 @@
 {
 
+  ObjectListDefinition(GLGuiBar);
   /**
    * @brief standard constructor
@@ -44,5 +45,5 @@
   void GLGuiBar::init()
   {
-    this->setClassID(CL_GLGUI_BAR, "GLGuiBar");
+    this->registerObject(this, GLGuiBar::_objectList);
 
     this->setFrontColor(_changedValueColor, true);
Index: trunk/src/lib/gui/gl/glgui_bar.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_bar.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_bar.h	(revision 9869)
@@ -21,5 +21,5 @@
   class GLGuiBar : public GLGuiWidget
   {
-
+    ObjectListDeclaration(GLGuiBar);
   public:
     GLGuiBar();
Index: trunk/src/lib/gui/gl/glgui_box.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_box.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_box.cc	(revision 9869)
@@ -22,4 +22,5 @@
 namespace OrxGui
 {
+  ObjectListDefinition(GLGuiBox);
   /**
    * standard constructor
@@ -52,5 +53,5 @@
   void GLGuiBox::init()
   {
-    this->setClassID(CL_GLGUI_BOX, "GLGuiBox");
+    this->registerObject(this, GLGuiBox::_objectList);
   }
 
@@ -149,5 +150,5 @@
     while (itC != this->_children.end())
     {
-      if ((*itC)->isA(CL_GLGUI_CONTAINER))
+      if ((*itC)->isA(GLGuiContainer::staticClassID()))
         static_cast<GLGuiContainer*>(*itC)->showAll();
       else
@@ -164,5 +165,5 @@
     while (itC != this->_children.end())
     {
-      if ((*itC)->isA(CL_GLGUI_CONTAINER))
+      if ((*itC)->isA(GLGuiContainer::staticClassID()))
         static_cast<GLGuiContainer*>(*itC)->hideAll();
       else
Index: trunk/src/lib/gui/gl/glgui_box.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_box.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_box.h	(revision 9869)
@@ -19,5 +19,5 @@
   class GLGuiBox : public GLGuiContainer
   {
-
+    ObjectListDeclaration(GLGuiBox);
   public:
     GLGuiBox(OrxGui::Orientation orientation = OrxGui::Vertical);
Index: trunk/src/lib/gui/gl/glgui_button.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_button.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_button.cc	(revision 9869)
@@ -23,4 +23,5 @@
 namespace OrxGui
 {
+  ObjectListDefinition(GLGuiButton);
   /**
    * standard constructor
@@ -50,5 +51,5 @@
   void GLGuiButton::init()
   {
-    this->setClassID(CL_GLGUI_BUTTON, "GLGuiButton");
+    this->registerObject(this, GLGuiButton::_objectList);
 
     this->setSelectable(true);
Index: trunk/src/lib/gui/gl/glgui_button.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_button.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_button.h	(revision 9869)
@@ -31,5 +31,5 @@
   class GLGuiButton : public GLGuiWidget
   {
-
+    ObjectListDeclaration(GLGuiButton);
     public:
       GLGuiButton(const std::string& label);
Index: trunk/src/lib/gui/gl/glgui_checkbutton.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_checkbutton.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_checkbutton.cc	(revision 9869)
@@ -22,5 +22,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiCheckButton);
 
   /**
@@ -49,5 +49,5 @@
   void GLGuiCheckButton::init()
   {
-    this->setClassID(CL_GLGUI_CHECKBUTTON, "GLGuiCheckButton");
+    this->registerObject(this, GLGuiCheckButton::_objectList);
   }
 
Index: trunk/src/lib/gui/gl/glgui_checkbutton.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_checkbutton.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_checkbutton.h	(revision 9869)
@@ -21,5 +21,5 @@
   class GLGuiCheckButton : public GLGuiButton
   {
-
+    ObjectListDeclaration(GLGuiCheckButton);
   public:
     GLGuiCheckButton(const std::string& label = "", bool active = false);
Index: trunk/src/lib/gui/gl/glgui_colorselector.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_colorselector.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_colorselector.h	(revision 9869)
@@ -21,5 +21,5 @@
   class GLGui : public GLGui
   {
-
+    ObjectListDeclaration(GLGuiColorSelector);
   public:
     GLGui();
Index: trunk/src/lib/gui/gl/glgui_container.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_container.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_container.cc	(revision 9869)
@@ -20,5 +20,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiContainer);
   /**
    * standard constructor
@@ -41,5 +41,5 @@
   void GLGuiContainer::init()
   {
-    this->setClassID(CL_GLGUI_CONTAINER, "GLGuiContainer");
+    this->registerObject(this, GLGuiContainer::_objectList);
 
     this->setBackgroundTexture("gui_container_background.png");
Index: trunk/src/lib/gui/gl/glgui_container.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_container.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_container.h	(revision 9869)
@@ -20,5 +20,5 @@
   class GLGuiContainer : public GLGuiWidget
   {
-
+    ObjectListDeclaration(GLGuiContainer);
   public:
     GLGuiContainer();
Index: trunk/src/lib/gui/gl/glgui_cursor.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_cursor.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_cursor.cc	(revision 9869)
@@ -23,5 +23,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiCursor);
   /**
    * standard constructor
@@ -55,5 +55,5 @@
   void GLGuiCursor::init()
   {
-    this->setClassID(CL_GLGUI_CURSOR, "GLGuiCursor");
+    this->registerObject(this, GLGuiCursor::_objectList);
 
     this->setBackgroundColor(Color(1.0, 1.0, 1.0, 1.0));
Index: trunk/src/lib/gui/gl/glgui_cursor.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_cursor.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_cursor.h	(revision 9869)
@@ -26,5 +26,5 @@
   class GLGuiCursor : public GLGuiWidget, public EventListener
   {
-
+    ObjectListDeclaration(GLGuiCursor);
   public:
     GLGuiCursor();
Index: trunk/src/lib/gui/gl/glgui_fixedposition_box.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_fixedposition_box.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_fixedposition_box.cc	(revision 9869)
@@ -23,4 +23,5 @@
 namespace OrxGui
 {
+  ObjectListDefinition(GLGuiFixedpositionBox);
   /**
    * standard constructor
@@ -29,4 +30,6 @@
       : GLGuiBox(orientation)
   {
+    this->registerObject(this, GLGuiFixedpositionBox::_objectList);
+
     this->subscribeEvent(ES_ALL, EV_VIDEO_RESIZE);
     this->setPosition(position);
Index: trunk/src/lib/gui/gl/glgui_fixedposition_box.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_fixedposition_box.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_fixedposition_box.h	(revision 9869)
@@ -21,5 +21,5 @@
   class GLGuiFixedpositionBox : public OrxGui::GLGuiBox, EventListener
   {
-
+    ObjectListDeclaration(GLGuiFixedpositionBox);
     public:
       GLGuiFixedpositionBox(OrxGui::Position position = OrxGui::Center, OrxGui::Orientation orientation = OrxGui::Vertical);
Index: trunk/src/lib/gui/gl/glgui_frame.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_frame.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_frame.cc	(revision 9869)
@@ -21,5 +21,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiFrame);
   /**
    * standard constructor
@@ -44,5 +44,5 @@
   void GLGuiFrame::init()
   {
-    this->setClassID(CL_GLGUI_FRAME, "GLGuiFrame");
+    this->registerObject(this, GLGuiFrame::_objectList);
     this->child = NULL;
   }
@@ -71,5 +71,5 @@
     if (this->child != NULL)
     {
-      if (this->child->isA(CL_GLGUI_CONTAINER))
+      if (this->child->isA(GLGuiContainer::staticClassID()))
         static_cast<GLGuiContainer*>(this->child)->showAll();
       else
@@ -83,5 +83,5 @@
     if (this->child != NULL)
     {
-      if (this->child->isA(CL_GLGUI_CONTAINER))
+      if (this->child->isA(GLGuiContainer::staticClassID()))
         static_cast<GLGuiContainer*>(this->child)->hideAll();
       else
Index: trunk/src/lib/gui/gl/glgui_frame.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_frame.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_frame.h	(revision 9869)
@@ -20,5 +20,5 @@
   class GLGuiFrame : public GLGuiContainer
   {
-
+    ObjectListDeclaration(GLGuiFrame);
   public:
     GLGuiFrame();
Index: trunk/src/lib/gui/gl/glgui_handler.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_handler.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_handler.cc	(revision 9869)
@@ -23,5 +23,6 @@
 #include "glgui_cursor.h"
 
-#include "class_list.h"
+#include "loading/resource_manager.h"
+
 #include <cassert>
 
@@ -31,9 +32,8 @@
 /// TAKE THIS OUT OF HERE.
 #include "graphics_engine.h"
-#include "loading/resource_manager.h"
 
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiHandler);
   /**
    * standard constructor
@@ -41,5 +41,5 @@
   GLGuiHandler::GLGuiHandler ()
   {
-    this->setClassID(CL_GLGUI_HANDLER, "GLGuiHandler");
+    this->registerObject(this, GLGuiHandler::_objectList);
     this->setName("GLGuiHandler");
 
@@ -77,5 +77,5 @@
     this->_cursor->setMaxBorders(Vector2D(GraphicsEngine::getInstance()->getResolutionX(), GraphicsEngine::getInstance()->getResolutionY()));
 
-    _cursor->loadTextureSequence(ResourceManager::getInstance()->getDataDir() + "/" + "maps/reap_mouse/reap_mouse_##.png", 1, 49);
+    _cursor->loadTextureSequence(Resources::ResourceManager::getInstance()->mainGlobalPath().name() + "/" + "maps/reap_mouse/reap_mouse_##.png", 1, 49);
 
   }
@@ -117,63 +117,49 @@
   {
     // retrieve Objects.
-    const std::list<BaseObject*>* objects = ClassList::getList(CL_GLGUI_WIDGET);
-
-    if (objects)
-    {
-      std::list<BaseObject*>::const_iterator it ;
-      std::list<BaseObject*>::const_iterator currentIt = objects->end();
+    ObjectList<GLGuiWidget>::const_iterator it, currentIt;
+    currentIt = GLGuiWidget::objectList().end();
+
+    if (GLGuiWidget::selected() != NULL)
+    {
+      it = std::find(GLGuiWidget::objectList().begin(), GLGuiWidget::objectList().end(), GLGuiWidget::selected());
+      if (it != GLGuiWidget::objectList().end())
+      {
+        currentIt = it;
+        it++;
+      }
+    }
+    else
+    {
+      it = GLGuiWidget::objectList().begin();
+    }
+
+    bool cycledOnce = false;
+
+    for (; it != currentIt; ++it)
+    {
+      if (it == GLGuiWidget::objectList().end() && !cycledOnce)
+      {
+        it = GLGuiWidget::objectList().begin();
+        cycledOnce = true;
+      }
+
+      if ((*it)->selectable() && (*it)->isVisible())
+      {
+        (*it)->select();
+        return;
+      }
+    }
+
+  }
+
+  void GLGuiHandler::selectPrevious()
+  {
+    ObjectList<GLGuiWidget>::const_iterator it, currentIt;
+    currentIt = GLGuiWidget::objectList().begin();
 
       if (GLGuiWidget::selected() != NULL)
       {
-        it = std::find(objects->begin(), objects->end(), GLGuiWidget::selected());
-        if (it != objects->end())
-        {
-          currentIt = it;
-          it++;
-        }
-      }
-      else
-      {
-        it = objects->begin();
-      }
-
-      bool cycledOnce = false;
-
-      for (; it != currentIt; ++it)
-      {
-        if (it == objects->end() && !cycledOnce)
-        {
-          it = objects->begin();
-          cycledOnce = true;
-        }
-
-        if (dynamic_cast<GLGuiWidget*>(*it)->selectable() && dynamic_cast<GLGuiWidget*>(*it)->isVisible())
-        {
-          dynamic_cast<GLGuiWidget*>(*it)->select();
-          return;
-        }
-      }
-
-    }
-    else
-    {
-      PRINTF(0)("NO GUI-ELEMENTS EXISTING\n");
-    }
-  }
-
-  void GLGuiHandler::selectPrevious()
-  {
-    // retrieve Objects.
-    const std::list<BaseObject*>* objects = ClassList::getList(CL_GLGUI_WIDGET);
-
-    if (objects)
-    {
-      std::list<BaseObject*>::const_iterator it ;
-      std::list<BaseObject*>::const_iterator currentIt = objects->begin();
-
-      if (GLGuiWidget::selected() != NULL)
-      {
-        it = std::find(objects->begin(), objects->end(), GLGuiWidget::selected());
-        if (it != objects->end())
+	it = std::find(GLGuiWidget::objectList().begin(), GLGuiWidget::objectList().end(), GLGuiWidget::selected());
+	if (it != GLGuiWidget::objectList().end())
         {
           currentIt = it;
@@ -183,5 +169,5 @@
       else
       {
-        it = objects->end();
+	it = GLGuiWidget::objectList().end();
       }
 
@@ -190,5 +176,5 @@
       for (; it != currentIt; --it)
       {
-        if (it == objects->end() && !cycledOnce)
+	if (it == GLGuiWidget::objectList().end() && !cycledOnce)
         {
           --it ;
@@ -196,16 +182,11 @@
         }
 
-        if (dynamic_cast<GLGuiWidget*>(*it)->selectable() && dynamic_cast<GLGuiWidget*>(*it)->isVisible())
-        {
-          dynamic_cast<GLGuiWidget*>(*it)->select();
+        if ((*it)->selectable() && (*it)->isVisible())
+        {
+          (*it)->select();
           return;
         }
       }
 
-    }
-    else
-    {
-      PRINTF(0)("NO GUI-ELEMENTS EXISTING\n");
-    }
   }
 
@@ -217,51 +198,51 @@
     {
       case EV_MOUSE_MOTION:
-        this->checkFocus();
-        break;
+      this->checkFocus();
+      break;
 
       case  EV_MOUSE_BUTTON_LEFT:
-        if (GLGuiWidget::mouseFocused() != NULL && event.bPressed)
-        {
-          // if clickable select the Widget.
-          if (GLGuiWidget::mouseFocused()->clickable())
-          {
-            Vector2D cursorPos = (this->_cursor != NULL) ? this->_cursor->getAbsCoor2D() : Vector2D(event.x, event.y);
-            GLGuiWidget::mouseFocused()->select();
-            GLGuiWidget::mouseFocused()->click(cursorPos - GLGuiWidget::mouseFocused()->getAbsCoor2D());
-          }
-        }
-        else if (GLGuiWidget::selected() != NULL && !event.bPressed)
-        {
-          if (GLGuiWidget::selected()->clickable())
-          {
-            Vector2D cursorPos = (this->_cursor != NULL) ? this->_cursor->getAbsCoor2D() : Vector2D(event.x, event.y);
-            GLGuiWidget::selected()->release(cursorPos - GLGuiWidget::selected()->getAbsCoor2D());
-          }
-        }
-
-        break;
+      if (GLGuiWidget::mouseFocused() != NULL && event.bPressed)
+      {
+        // if clickable select the Widget.
+        if (GLGuiWidget::mouseFocused()->clickable())
+        {
+          Vector2D cursorPos = (this->_cursor != NULL) ? this->_cursor->getAbsCoor2D() : Vector2D(event.x, event.y);
+          GLGuiWidget::mouseFocused()->select();
+          GLGuiWidget::mouseFocused()->click(cursorPos - GLGuiWidget::mouseFocused()->getAbsCoor2D());
+        }
+      }
+      else if (GLGuiWidget::selected() != NULL && !event.bPressed)
+      {
+        if (GLGuiWidget::selected()->clickable())
+        {
+          Vector2D cursorPos = (this->_cursor != NULL) ? this->_cursor->getAbsCoor2D() : Vector2D(event.x, event.y);
+          GLGuiWidget::selected()->release(cursorPos - GLGuiWidget::selected()->getAbsCoor2D());
+        }
+      }
+
+      break;
       case EV_LEAVE_STATE:
-        if (GLGuiWidget::selected() != NULL)
-          GLGuiWidget::selected()->unselect();
-
-        if (GLGuiWidget::mouseFocused() != NULL)
-          GLGuiWidget::mouseFocused()->breakMouseFocus();
-        break;
+      if (GLGuiWidget::selected() != NULL)
+        GLGuiWidget::selected()->unselect();
+
+      if (GLGuiWidget::mouseFocused() != NULL)
+        GLGuiWidget::mouseFocused()->breakMouseFocus();
+      break;
 
       case EV_VIDEO_RESIZE:
-        if (this->_cursor != NULL)
-          this->_cursor->setMaxBorders(Vector2D(event.resize.w, event.resize.h));
-        this->_resolution = Vector2D(event.resize.w, event.resize.h);
-        break;
+      if (this->_cursor != NULL)
+        this->_cursor->setMaxBorders(Vector2D(event.resize.w, event.resize.h));
+      this->_resolution = Vector2D(event.resize.w, event.resize.h);
+      break;
 
       case SDLK_TAB:
-        if (event.bPressed)
-        {
-          if (EventHandler::getInstance()->isPressed(SDLK_LSHIFT) || EventHandler::getInstance()->isPressed(SDLK_RSHIFT))
-            this->selectPrevious();
-          else
-            this->selectNext();
-        }
-        break;
+      if (event.bPressed)
+      {
+        if (EventHandler::getInstance()->isPressed(SDLK_LSHIFT) || EventHandler::getInstance()->isPressed(SDLK_RSHIFT))
+          this->selectPrevious();
+        else
+          this->selectNext();
+      }
+      break;
     }
 
@@ -304,11 +285,11 @@
   {
     // CHECK THE COLLISIONS.
-    const std::list<BaseObject*>* objects = ClassList::getList(CL_GLGUI_WIDGET);
-
-    if (objects != NULL && this->_cursor != NULL)
-    {
-      for (std::list<BaseObject*>::const_iterator it = objects->begin(); it != objects->end(); it++)
-      {
-        GLGuiWidget* widget = dynamic_cast<GLGuiWidget*>(*it);
+    if (this->_cursor != NULL)
+    {
+      for (ObjectList<GLGuiWidget>::const_iterator it = GLGuiWidget::objectList().begin();
+	   it != GLGuiWidget::objectList().end();
+	   it++)
+      {
+        GLGuiWidget* widget = (*it);
 
         if (widget->isVisible() &&
Index: trunk/src/lib/gui/gl/glgui_handler.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_handler.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_handler.h	(revision 9869)
@@ -19,5 +19,5 @@
   class GLGuiHandler : public EventListener
   {
-
+    ObjectListDeclaration(GLGuiHandler);
   public:
     /** @returns a Pointer to the only object of this Class */
Index: trunk/src/lib/gui/gl/glgui_image.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_image.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_image.cc	(revision 9869)
@@ -22,5 +22,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiImage);
   /**
    * standard constructor
@@ -45,5 +45,5 @@
   void GLGuiImage::init()
   {
-    this->setClassID(CL_GLGUI_IMAGE, "GLGuiImage");
+    this->registerObject(this, GLGuiImage::_objectList);
 
     this->setForegroundColor(Color(1,1,1,1));
Index: trunk/src/lib/gui/gl/glgui_image.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_image.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_image.h	(revision 9869)
@@ -21,5 +21,5 @@
   class GLGuiImage : public GLGuiWidget
   {
-
+    ObjectListDeclaration(GLGuiImage);
   public:
     GLGuiImage();
Index: trunk/src/lib/gui/gl/glgui_inputline.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_inputline.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_inputline.cc	(revision 9869)
@@ -20,4 +20,5 @@
 namespace OrxGui
 {
+  ObjectListDefinition(GLGuiInputLine);
   /**
    * @brief standard constructor
@@ -44,5 +45,5 @@
   void GLGuiInputLine::init()
   {
-    this->setClassID(CL_GLGUI_INPUTLINE, "GLGuiInputLine");
+    this->registerObject(this, GLGuiInputLine::_objectList);
 
     this->setFocusable(true);
Index: trunk/src/lib/gui/gl/glgui_inputline.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_inputline.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_inputline.h	(revision 9869)
@@ -25,5 +25,5 @@
   class GLGuiInputLine : public OrxGui::GLGuiWidget
   {
-
+    ObjectListDeclaration(GLGuiInputLine);
   public:
     GLGuiInputLine();
Index: trunk/src/lib/gui/gl/glgui_mainwidget.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_mainwidget.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_mainwidget.cc	(revision 9869)
@@ -20,5 +20,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiMainWidget);
 
   /**
@@ -27,5 +27,5 @@
   GLGuiMainWidget::GLGuiMainWidget()
   {
-    this->setClassID(CL_GLGUI_MAIN_WIDGET, "GLGuiMainWidget");
+    this->registerObject(this, GLGuiMainWidget::_objectList);
     this->setName("GLGuiMainWidget");
   }
Index: trunk/src/lib/gui/gl/glgui_mainwidget.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_mainwidget.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_mainwidget.h	(revision 9869)
@@ -15,5 +15,5 @@
   class GLGuiMainWidget : public GLGuiWidget
   {
-
+    ObjectListDeclaration(GLGuiMainWidget);
   public:
     virtual ~GLGuiMainWidget(void);
Index: trunk/src/lib/gui/gl/glgui_menu.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_menu.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_menu.cc	(revision 9869)
@@ -20,5 +20,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiMenu);
   /**
    * standard constructor
Index: trunk/src/lib/gui/gl/glgui_menu.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_menu.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_menu.h	(revision 9869)
@@ -19,5 +19,5 @@
   class GLGuiMenu : public GLGuiMenu
   {
-
+    ObjectListDeclaration(GLGuiMenu);
   public:
     GLGuiMenu();
Index: trunk/src/lib/gui/gl/glgui_pushbutton.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_pushbutton.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_pushbutton.cc	(revision 9869)
@@ -23,5 +23,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiPushButton);
   /**
    * @brief standard constructor
@@ -58,5 +58,5 @@
   void GLGuiPushButton::init()
   {
-    this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton");
+    this->registerObject(this, GLGuiPushButton::_objectList);
   }
 
Index: trunk/src/lib/gui/gl/glgui_pushbutton.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_pushbutton.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_pushbutton.h	(revision 9869)
@@ -21,5 +21,5 @@
   class GLGuiPushButton : public GLGuiButton
   {
-
+    ObjectListDeclaration(GLGuiPushButton);
   public:
     GLGuiPushButton(const std::string& label = "");
Index: trunk/src/lib/gui/gl/glgui_slider.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_slider.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_slider.cc	(revision 9869)
@@ -23,5 +23,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiSlider);
   /**
    * @brief standard constructor
@@ -46,5 +46,5 @@
   {
 
-    this->setClassID(CL_GLGUI_SLIDER, "GLGuiSlider");
+    this->registerObject(this, GLGuiSlider::_objectList);
 
     this->setClickable(true);
Index: trunk/src/lib/gui/gl/glgui_slider.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_slider.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_slider.h	(revision 9869)
@@ -21,5 +21,5 @@
   class GLGuiSlider : public GLGuiWidget
   {
-
+    ObjectListDeclaration(GLGuiSlider);
   public:
     GLGuiSlider();
Index: trunk/src/lib/gui/gl/glgui_table.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_table.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_table.cc	(revision 9869)
@@ -23,4 +23,5 @@
 namespace OrxGui
 {
+  ObjectListDefinition(GLGuiTable);
   /**
    * @brief standard constructor
@@ -47,5 +48,5 @@
   void GLGuiTable::init()
   {
-    this->setClassID(CL_GLGUI_TABLE, "GLGuiTable");
+    this->registerObject(this, GLGuiTable::_objectList);
 
     this->setBorderTop(10);
Index: trunk/src/lib/gui/gl/glgui_table.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_table.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_table.h	(revision 9869)
@@ -25,5 +25,5 @@
   class GLGuiTable : public OrxGui::GLGuiWidget
   {
-
+    ObjectListDeclaration(GLGuiTable);
   public:
     GLGuiTable(unsigned int rows, unsigned int columns);
Index: trunk/src/lib/gui/gl/glgui_text.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_text.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_text.cc	(revision 9869)
@@ -22,4 +22,5 @@
 namespace OrxGui
 {
+  ObjectListDefinition(GLGuiText);
   /**
    * standard constructor
@@ -43,5 +44,5 @@
   void GLGuiText::init()
   {
-    this->setClassID(CL_GLGUI_TEXT, "GLGuiText");
+    this->registerObject(this, GLGuiText::_objectList);
 
     this->_text.setParent2D(this);
Index: trunk/src/lib/gui/gl/glgui_text.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_text.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_text.h	(revision 9869)
@@ -20,5 +20,5 @@
   class GLGuiText : public GLGuiWidget
   {
-
+    ObjectListDeclaration(GLGuiText);
   public:
     GLGuiText();
Index: trunk/src/lib/gui/gl/glgui_textfield.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_textfield.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_textfield.cc	(revision 9869)
@@ -22,4 +22,5 @@
 namespace OrxGui
 {
+  ObjectListDefinition(GLGuiTextfield);
   /**
    * standard constructor
@@ -43,5 +44,5 @@
   void GLGuiTextfield::init()
   {
-    this->setClassID(CL_GLGUI_TEXTFIELD, "GLGuiTextfield");
+    this->registerObject(this, GLGuiTextfield::_objectList);
 
     this->_text.setParent2D(this);
Index: trunk/src/lib/gui/gl/glgui_textfield.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_textfield.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_textfield.h	(revision 9869)
@@ -20,5 +20,5 @@
   class GLGuiTextfield : public GLGuiWidget
   {
-
+    ObjectListDeclaration(GLGuiTextfield);
   public:
     GLGuiTextfield();
Index: trunk/src/lib/gui/gl/glgui_widget.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_widget.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_widget.cc	(revision 9869)
@@ -25,11 +25,9 @@
 
 #include "loading/load_param.h"
-
-/// TODO TAKE THIS OUT OF HERE
 #include "loading/resource_manager.h"
 
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiWidget);
   /**
    * @brief standard constructor
@@ -95,5 +93,5 @@
   void GLGuiWidget::init()
   {
-    this->setClassID(CL_GLGUI_WIDGET, "GLGuiWidget");
+    this->registerObject(this, GLGuiWidget::_objectList);
 
     this->_focusable = false;
@@ -104,5 +102,5 @@
 
     if(GLGuiWidget::_defaultFont == NULL)
-      GLGuiWidget::_defaultFont = new Font(ResourceManager::getInstance()->getDataDir() + "/fonts/final_frontier.ttf", 20);
+      GLGuiWidget::_defaultFont = new Font(Resources::ResourceManager::getInstance()->mainGlobalPath().name() + "/fonts/final_frontier.ttf", 20);
 
     this->_font = *GLGuiWidget::_defaultFont;
Index: trunk/src/lib/gui/gl/glgui_widget.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_widget.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_widget.h	(revision 9869)
@@ -21,5 +21,4 @@
 namespace OrxGui
 {
-
   class GLGuiCursor;
 
@@ -31,4 +30,5 @@
   class GLGuiWidget : public Element2D
   {
+    ObjectListDeclaration(GLGuiWidget);
   public:
     GLGuiWidget(GLGuiWidget* parent = NULL);
Index: trunk/src/lib/gui/gl/glgui_window.cc
===================================================================
--- trunk/src/lib/gui/gl/glgui_window.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_window.cc	(revision 9869)
@@ -20,5 +20,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiWindow);
   /**
    * standard constructor
@@ -43,5 +43,5 @@
   void GLGuiWindow::init()
   {
-    this->setClassID(CL_GLGUI_WINDOW, "GLGuiWindow");
+    this->registerObject(this, GLGuiWindow::_objectList);
 
   }
Index: trunk/src/lib/gui/gl/glgui_window.h
===================================================================
--- trunk/src/lib/gui/gl/glgui_window.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glgui_window.h	(revision 9869)
@@ -20,5 +20,5 @@
   class GLGuiWindow : public GLGuiContainer
   {
-
+    ObjectListDeclaration(GLGuiWindow);
   public:
     GLGuiWindow();
Index: trunk/src/lib/gui/gl/glmenu/glmenu_imagescreen.cc
===================================================================
--- trunk/src/lib/gui/gl/glmenu/glmenu_imagescreen.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/glmenu/glmenu_imagescreen.cc	(revision 9869)
@@ -24,7 +24,9 @@
 #include "util/loading/factory.h"
 #include "util/loading/load_param.h"
-
-CREATE_FACTORY(GLMenuImageScreen, CL_GLMENU_IMAGE_SCREEN);
-
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(GLMenuImageScreen, CL_GLMENU_IMAGE_SCREEN);
+CREATE_FACTORY(GLMenuImageScreen);
 
 /**
@@ -33,5 +35,5 @@
 GLMenuImageScreen::GLMenuImageScreen(const TiXmlElement* root)
 {
-  this->setClassID(CL_GLMENU_IMAGE_SCREEN, "GLMenuImageScreen");
+  this->registerObject(this, GLMenuImageScreen::_objectList);
   this->setName("GLMenuLoadScreen");
   // Select Our VU Meter Background Texture
@@ -58,17 +60,17 @@
 {
   LoadParam(root, "BackgroundImage", this, GLMenuImageScreen, setBackgroundImage)
-    .describe("sets the image to load onto the loadscreen");
+  .describe("sets the image to load onto the loadscreen");
 
   LoadParam(root, "BackgroundPS", this, GLMenuImageScreen, setPosScale)
-    .describe("The Position and Scale of the Background Image in %(0-1.0). PosX, PosY, SizeX, SizeY");
+  .describe("The Position and Scale of the Background Image in %(0-1.0). PosX, PosY, SizeX, SizeY");
 
   LoadParam(root, "BarImage", this, GLMenuImageScreen, setBarImage)
-    .describe("sets the image of the LoadingBar");
+  .describe("sets the image of the LoadingBar");
 
   LoadParam(root, "BarPS", this, GLMenuImageScreen, setBarPosScale)
-    .describe("The Position and Scale of the Loading Bar in %(0-1.0). PosX, PosY, SizeX, SizeY");
+  .describe("The Position and Scale of the Loading Bar in %(0-1.0). PosX, PosY, SizeX, SizeY");
 
   LoadParam(root, "ElementCount", this, GLMenuImageScreen, setMaximum)
-    .describe("The Count of elements to load into the bar (this is only a maximum value)");
+  .describe("The Count of elements to load into the bar (this is only a maximum value)");
 }
 
Index: trunk/src/lib/gui/gl/glmenu/glmenu_imagescreen.h
===================================================================
--- trunk/src/lib/gui/gl/glmenu/glmenu_imagescreen.h	(revision 9682)
+++ trunk/src/lib/gui/gl/glmenu/glmenu_imagescreen.h	(revision 9869)
@@ -15,5 +15,5 @@
 class GLMenuImageScreen : public BaseObject
 {
-
+  ObjectListDeclaration(GLMenuImageScreen);
 public:
   GLMenuImageScreen (const TiXmlElement* root = NULL);
@@ -33,5 +33,5 @@
   void setMaximum (int maxValue);
   /** @returns the maximum of countable steps*/
-  inline int GLMenuImageScreen::getMaximum() const { return this->maxValue; };
+  inline int getMaximum() const { return this->maxValue; };
 
   void setValue (int currentValue);
Index: trunk/src/lib/gui/gl/specials/glgui_notifier.cc
===================================================================
--- trunk/src/lib/gui/gl/specials/glgui_notifier.cc	(revision 9682)
+++ trunk/src/lib/gui/gl/specials/glgui_notifier.cc	(revision 9869)
@@ -23,5 +23,5 @@
 namespace OrxGui
 {
-
+  ObjectListDefinition(GLGuiNotifier);
   /**
    * @brief standard constructor
@@ -29,5 +29,5 @@
   GLGuiNotifier::GLGuiNotifier ()
   {
-    this->setClassID(CL_GLGUI_NOTIFIER, "GLGuiNotifier");
+    this->registerObject(this, GLGuiNotifier::_objectList);
 
     // Element2D and generals
Index: trunk/src/lib/gui/gl/specials/glgui_notifier.h
===================================================================
--- trunk/src/lib/gui/gl/specials/glgui_notifier.h	(revision 9682)
+++ trunk/src/lib/gui/gl/specials/glgui_notifier.h	(revision 9869)
@@ -24,4 +24,5 @@
   class GLGuiNotifier : public GLGuiWidget
   {
+    ObjectListDeclaration(GLGuiNotifier);
   public:
     GLGuiNotifier();
@@ -67,5 +68,6 @@
       MultiLineText*    text;
 
-    } DisplayLine;
+    }
+    DisplayLine;
 
 
Index: trunk/src/lib/gui/gui.cc
===================================================================
--- trunk/src/lib/gui/gui.cc	(revision 9682)
+++ trunk/src/lib/gui/gui.cc	(revision 9869)
@@ -18,5 +18,5 @@
 #include "gui.h"
 #include "gui_saveable.h"
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 
 namespace OrxGui
Index: trunk/src/lib/gui/gui_saveable.cc
===================================================================
--- trunk/src/lib/gui/gui_saveable.cc	(revision 9682)
+++ trunk/src/lib/gui/gui_saveable.cc	(revision 9869)
@@ -18,5 +18,5 @@
 #include "gui_saveable.h"
 #include "gui.h"
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 
 #include "debug.h"
Index: trunk/src/lib/lang/Makefile.am
===================================================================
--- trunk/src/lib/lang/Makefile.am	(revision 9682)
+++ trunk/src/lib/lang/Makefile.am	(revision 9869)
@@ -1,7 +1,5 @@
-MAINSRCDIR=../..
-include $(MAINSRCDIR)/defs/include_paths.am
-
-LIB_PREFIX=$(MAINSRCDIR)/lib
-include $(MAINSRCDIR)/lib/BuildLibs.am
+INCLUDES = -I../..
+INCLUDES +=-I..
+INCLUDES +=-I../util
 
 noinst_LIBRARIES = libORXlang.a
@@ -9,33 +7,9 @@
 libORXlang_a_SOURCES = \
 		base_object.cc \
-		class_list.cc \
-		new_class_id.cc \
-		new_object_list.cc
+		class_id.cc \
+		object_list.cc
 
 noinst_HEADERS = \
 		base_object.h \
-		class_list.h \
-		new_class_id.h \
-		new_object_list.h
-
-
-
-
-
-## THIS ALL IS JUST FOR TESTING!!
-check_PROGRAMS = test_object_list
-
-test_object_list_SOURCES = \
-		test_object_list.cc
-
-test_object_list_DEPENDENCIES = libORXlang.a
-
-test_object_list_LDADD = \
-		$(MAINSRCDIR)/util/libORXutils.a \
-		$(libORXlibs_a_LIBRARIES_) \
-		$(MAINSRCDIR)/world_entities/libORXwe.a \
-		$(libORXlibs_a_LIBRARIES_) \
-		$(MAINSRCDIR)/util/libORXutils.a
-
-#test_object_list_LDADD = \
-		libORXlang.a
+		class_id.h \
+		object_list.h
Index: trunk/src/lib/lang/base_object.cc
===================================================================
--- trunk/src/lib/lang/base_object.cc	(revision 9682)
+++ trunk/src/lib/lang/base_object.cc	(revision 9869)
@@ -1,4 +1,2 @@
-
-
 /*
    orxonox - the future of 3D-vertical-scrollers
@@ -19,21 +17,20 @@
 #include "base_object.h"
 
+#include "util/debug.h"
 #include "util/loading/load_param.h"
-#include "class_list.h"
+
+ObjectListDefinition(BaseObject);
 
 /**
  * @brief sets the name from a LoadXML-Element
- * @param root the element to load from
+ * @param objectName: The name of the Object.
  */
 BaseObject::BaseObject(const std::string& objectName)
 {
-  this->classID = CL_BASE_OBJECT;
   this->className = "BaseObject";
 
   this->objectName = objectName;
-  this->classList = NULL;
   this->xmlElem = NULL;
-
-  //ClassList::addToClassList(this, this->classID, "BaseObject");
+  this->registerObject(this, BaseObject::_objectList);
 }
 
@@ -43,5 +40,14 @@
 BaseObject::~BaseObject ()
 {
-  ClassList::removeFromClassList(this);
+  /// Remove from the ObjectLists
+  ClassEntries::iterator it;
+  PRINTF(5)("Deleting Object of type %s::%s\n", this->getClassCName(), getCName());
+  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
+  {
+    if (ORX_DEBUG >= 5)
+      assert((*it)._objectList->checkIteratorInList((*it)._iterator) || (*it)._objectList->checkObjectInList(this));
+    (*it)._objectList->unregisterObject((*it)._iterator);
+    delete (*it)._iterator;
+  }
 
   if (this->xmlElem != NULL)
@@ -69,22 +75,4 @@
 
 /**
- * @brief sets the class identifiers
- * @param id a number for the class from class_id.h enumeration
- * @param className the class name
-*/
-void BaseObject::setClassID(ClassID classID, const std::string& className)
-{
-  //printf("%s(0x%.8X)->%s(0x%.8X)\n", this->className, this->classID, className, classID);
-  assert (!(this->classID & classID & !CL_MASK_SUBSUPER_CLASS_IDA ));
-
-  this->leafClassID = classID;
-  this->classID |= (long)classID;
-  this->className = className;
-
-  this->classList = ClassList::addToClassList(this, classID, this->classID, className);
-}
-
-
-/**
  * @brief set the name of the Object
  * @param objectName The new name of the Object.
@@ -97,71 +85,74 @@
 
 /**
- * @brief queries for the ClassID of the Leaf Class (the last made class of this type
- * @returns the ClassID of the Leaf Class (e.g. the ID of the Class)
- *
- * the returned ID can be used to generate new Objects of the same type through
- * Factory::fabricate(Object->getLeafClassID());
+ * @brief Seeks in the Inheritance if it matches objectList.
+ * @param objectList The ObjectList this should be a member of (by Pointer-comparison).
+ * @return True if found, false if not.
  */
-const ClassID& BaseObject::getLeafClassID() const
+bool BaseObject::isA(const ObjectListBase& objectList) const
 {
-  return this->leafClassID;
-}
-
-
-
-/**
- * @brief checks if the class is a classID
- * @param classID the Identifier to check for
- * @returns true if it is, false otherwise
-*/
-bool BaseObject::isA (ClassID classID) const
-{
-  // if classID is a derivable object from a SUPERCLASS
-  if (classID & CL_MASK_SUPER_CLASS)
-  {
-    if( likely(this->classID & classID))
+  ClassEntries::const_iterator it;
+  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
+    if ((*it)._objectList == &objectList)
       return true;
-  }
-  // if classID is a SubSuperClass, and
-  else if (classID & CL_MASK_SUBSUPER_CLASS)
-  {
-    if (likely(((this->classID & CL_MASK_SUBSUPER_CLASS_IDA) == (classID & CL_MASK_SUBSUPER_CLASS_IDA)) &&
-        this->classID & classID & CL_MASK_SUBSUPER_CLASS_IDB))
-      return true;
-  }
-  // if classID is a LOWLEVEL-class
-  else
-  {
-    if( likely((this->classID & CL_MASK_LOWLEVEL_CLASS) == classID))
-      return true;
-  }
   return false;
 }
 
 
+/**
+ * @brief Seeks in the Inheritance if it matches objectList.
+ * @param classID The ClassID this should be a member of (by Pointer-comparison).
+ * @return True if found, false if not.
+ */
+bool BaseObject::isA(const ClassID& classID) const
+{
+  ClassEntries::const_iterator it;
+  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
+    if (*(*it)._objectList == classID)
+      return true;
+  return false;
+}
 
 /**
- * @brief checks if the class is a classID
- * @param classID the Identifier to check for
- * @returns true if it is, false otherwise
+ * @brief Seeks in the Inheritance if it matches objectList.
+ * @param classID The ClassID of the class this should be a member of.
+ * @return True if found, false if not.
  */
-bool BaseObject::isA (const std::string& className) const
+bool BaseObject::isA(int classID) const
 {
-  ClassID classID = ClassList::StringToID(className);
-  if (classID != CL_NULL)
-    return this->isA(classID);
-  else
-    return false;
+  ClassEntries::const_iterator it;
+  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
+    if (*(*it)._objectList == classID)
+
+      return true;
+  return false;
+}
+
+/**
+ * @brief Seeks in the Inheritance if it matches objectList.
+ * @param className The ClassName of the class this should be a member of.
+ * @return True if found, false if not.
+ */
+bool BaseObject::isA(const std::string& className) const
+{
+  ClassEntries::const_iterator it;
+  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
+    if (*(*it)._objectList == className)
+      return true;
+  return false;
 }
 
 
 /**
- * @brief compares the ObjectName with an external name
- * @param objectName: the name to check.
- * @returns true on match, false otherwise.
+ * @brief This is for debug purposes, to see the Inheritances of this Object and its classes.
+ *
+ * The Inheritance will be listed in a Linear fashion, diamand structures are resolved in a linear dependency.
  */
-bool BaseObject::operator==(const std::string& objectName) const
+void BaseObject::listInheritance() const
 {
-  return (this->objectName == objectName);
+  PRINT(0)("Listing inheritance diagram for %s::%s: ", getClassCName(), getCName());
+  ClassEntries::const_iterator it;
+  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
+    PRINT(0)(" -> %s(id:%d)", (*it)._objectList->name().c_str(), (*it)._objectList->id());
+  PRINT(0)("\n");
+
 }
-
Index: trunk/src/lib/lang/base_object.h
===================================================================
--- trunk/src/lib/lang/base_object.h	(revision 9682)
+++ trunk/src/lib/lang/base_object.h	(revision 9869)
@@ -14,6 +14,6 @@
 #define __BASE_OBJECT_H_
 
-#include "class_id.h"
-#include "sigslot/slot.h"
+#include "object_list.h"
+#include "util/sigslot/slot.h"
 
 #include <string>
@@ -26,5 +26,6 @@
 class BaseObject : public sigslot::has_slots<>
 {
-
+  //! Declare an ObjectList for this Class.
+  ObjectListDeclaration(BaseObject);
 public:
   BaseObject (const std::string& objectName = "");
@@ -41,21 +42,30 @@
   inline TiXmlNode* getXmlElem() const { return this->xmlElem; };
 
-  /** @returns the className of the corresponding Object */
-  inline const std::string& getClassName() const { return this->className; }
+  //  /** @returns the className of the corresponding Object */
+  //inline const std::string& getClassName() const { return this->className; }
   /** @returns the className of the corresponding Object as a C-compliant string (const char*) */
-  inline const char* getClassCName() const { return this->className.c_str(); };
-  /** @returns the classID of the corresponding Object */
-  inline int getClassID() const { return this->classID; };
-  const ClassID& getLeafClassID() const;
+  inline const char* getClassCName() const { return _classes.front()._objectList->name().c_str(); };
+  /** @returns the ClassName of the Topmost Object of the ClassStack */
+  inline const std::string& getClassName() const { return _classes.front()._objectList->name(); };
 
-  bool isA (ClassID classID) const;
-  bool isA (const std::string& className) const;
+  /** @returns the ClassID of this Object */
+  inline const ClassID& getClassID() const { return _classes.front()._objectList->identity(); }
+  /** @returns the ID of the Topmost object of the ClassStack */
+  inline const int& getLeafClassID() const { return _classes.front()._objectList->identity().id(); }
+
+  bool isA(const ObjectListBase& objectList) const;
+  bool isA(const ClassID& classID) const;
+  bool isA(int classID) const;
+  bool isA(const std::string& className) const;
+
+  void listInheritance() const;
 
   /** @param classID comparer for a ClassID @returns true on match, false otherwise */
-  bool operator==(ClassID classID) const  { return this->isA(classID); };
-  bool operator==(const std::string& objectName) const;
+  bool operator==(int classID) const  { return this->isA(classID); };
+  /** @param objectName: the name to check. * @returns true on match, false otherwise. */
+  bool operator==(const std::string& objectName) const { return this->objectName == objectName;};
 
 protected:
-  void setClassID(ClassID classID, const std::string& className);
+  template<class T> void registerObject(T* object, ObjectList<T>& list);
 
 protected:
@@ -63,12 +73,39 @@
 
 private:
-  std::string        className;        //!< the name of the class
-  long               classID;          //!< this is the id from the class_id.h enumeration
-  ClassID            leafClassID;      //!< The Leaf Class ID
-
-  ClassList*         classList;        //!< Pointer to the ClassList this Object is inside of
 
   TiXmlNode*         xmlElem;          //!< The XML Element with wich this Object was loaded(saved).
+
+  //////////////////////////////
+  //// Type Definition Part ////
+  //////////////////////////////
+  //! A ClassEntry so we can store Classes inside of Objects
+  struct ClassEntry
+  {
+    /** Simple Constuctor @param objectList the ObjectList, @param iterator the (intrusive) Iterator inside of the ObjectList */
+    inline ClassEntry (ObjectListBase* objectList, ObjectListBase::IteratorBase* iterator) : _objectList(objectList), _iterator(iterator) {}
+    ObjectListBase*                _objectList;  //!< An ObjectList this Object is part of
+    ObjectListBase::IteratorBase*  _iterator;    //!< An iterator pointing to the position of the Object inside of the List.
+  };
+  typedef std::list<ClassEntry>       ClassEntries;   //!< Type definition for the List.
+
+  std::string                         className;    //!< the name of the class
+  ClassEntries                        _classes;     //!< All Classes this object is part of.
 };
 
+
+/**
+ * @brief Registeres an Object of Type T to objectList
+ * @param object The Object to append to the objectList.
+ * @param objectList The ObjectList to append the Object to.
+ *
+ * This function is essential to integrate objects into their designated ObjectList.
+ * Remember if you do not want objects to be stored in Lists (less overhead),
+ * do not attempt to call this function.
+ */
+template<class T>
+inline void BaseObject::registerObject(T* object, ObjectList<T>& objectList)
+{
+  this->_classes.push_front(ClassEntry(&objectList, objectList.registerObject(object)));
+}
+
 #endif /* __BASE_OBJECT_H_ */
Index: trunk/src/lib/lang/class_id.cc
===================================================================
--- trunk/src/lib/lang/class_id.cc	(revision 9869)
+++ trunk/src/lib/lang/class_id.cc	(revision 9869)
@@ -0,0 +1,43 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2006 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_
+
+#include "class_id.h"
+#include "object_list.h"
+
+/**
+ * @brief a Default Constructor.
+ * this Always points to the ID of the NullClass.
+ */
+ClassID::ClassID()
+{
+  NullClass::acquireID(this->_id, this->_name);
+};
+
+/**
+ * @brief Acquiring the ID of a objectList.
+ * @param objList The ObjectList to acquire the ID from.
+ */
+ClassID::ClassID(const ObjectListBase* const objList)
+{
+  objList->acquireID(this->_id, this->_name);
+}
+
+
+ClassID NullClass::_classID;
+
+int NullClass::_nullID;
+const std::string NullClass::_nullName = std::string("NullClass");
Index: trunk/src/lib/lang/class_id.h
===================================================================
--- trunk/src/lib/lang/class_id.h	(revision 9869)
+++ trunk/src/lib/lang/class_id.h	(revision 9869)
@@ -0,0 +1,78 @@
+/*!
+ * @file class_id.h
+ * @brief Definition of a dynamically allocating ClassID
+ *
+ */
+
+#ifndef _CLASS_ID_H
+#define _CLASS_ID_H
+
+#include <string>
+
+class ObjectListBase;
+
+//! A class to dynamically allocate ClassID's and to support a isA operator
+/**
+ * A ClassID can only be aquired over a ObjectList,
+ * thus enabling the developer to have permanent access to the correct ID and ClassName
+ *
+ * The Idea behind this concept is, that storing a ClassID that changes its internal state
+ * all ClassID's will be updated correctly.
+ *
+ * Since the Existance of any ObjectList is a requirement during the working process all
+ * ID's should reference a valid ID and ClassName
+ */
+class ClassID
+{
+public:
+  ClassID();
+  ClassID(const ObjectListBase* const id);
+  /// the copy constructor is also defined implicitely.
+
+  /** @returns A constant reference to the ID. */
+  const int& id() const { return *_id; };
+  /** @returns A constant reference to the Name. */
+  const std::string& name() const { return *_name; };
+
+  /** @param id the id to compare @returns true on match (match is same ID) @brief compares two id's */
+  bool operator==(const ClassID& id) const { return *_id == *id._id /* || _name == id._name */; };
+  /** @param id the id to compare @returns true on match (match is same ID) @brief compares two id's */
+  bool operator==(int id) const { return *_id == id; };
+  /** @param name the id to compare @returns true on match (match is same Name) @brief compares an ID with a ClassName */
+  bool operator==(const std::string& name) const { return *_name == name; };
+  /** @param id the id to compare @returns false on match (match is same ID) @brief compares two id's */
+  bool operator!=(const ClassID& id) const { return *_id != *id._id /* && _name != id._name*/;  };
+  /** @param id the id to compare @returns false on match (match is same ID) @brief compares two id's */
+  bool operator!=(int id) const { return *_id != id; };
+  /** @param name the id to compare @returns false on match (match is same Name) @brief compares an ID with a ClassName */
+  bool operator!=(const std::string& name) const { return *_name != name; };
+  /** @param classID: the Id to compare @returns true if this id is smaller than the classID's ID */
+  bool operator<(const ClassID& classID) const { return *this->_id < *classID._id; };
+
+private:
+  const int*                _id;           //!< A pointer to the ID of the ClassID.
+  const std::string*        _name;         //!< A pointer to the Name of the ClassID.
+};
+
+//! A NullClass. This is the Null of the ClassID.
+/**
+ * implemented as a Class id can be used to reference NullObjects.
+ */
+class NullClass
+{
+public:
+  /** @returns the NullClass' ID. */
+  static const ClassID& staticClassID() { return NullClass::_classID; }
+  /** @param id the ID to acquire @param name the name to acquire @brief acquires the ID of this Class */
+  static void acquireID(const int*& id, const std::string*& name) { id = &_nullID; name = &_nullName; };
+
+private:
+  NullClass() {}; //!< The Default Constructor is hidden from the User.
+
+private:
+  static ClassID            _classID;      //!< The NullClass' ID
+  static const std::string  _nullName;     //!< The NullClass' Name ("NullClass")
+  static int                _nullID;       //!< The NullClass' ID
+};
+
+#endif /* _CLASS_ID_H */
Index: trunk/src/lib/lang/class_list.cc
===================================================================
--- trunk/src/lib/lang/class_list.cc	(revision 9682)
+++ 	(revision )
@@ -1,402 +1,0 @@
-/*
-   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_
-
-#include "class_list.h"
-#include "base_object.h"
-
-#include "compiler.h"
-#include "debug.h"
-#include <cmath>
-
-
-
-/**
- * @brief Creates a new ClassList
-*/
-ClassList::ClassList(ClassID classID, unsigned long classIDFull, const std::string& className)
-  : className(className)
-{
-  this->classID = classID;
-  this->classIDFull = classIDFull;
-}
-
-/**
- * @brief standard deconstructor
-*/
-ClassList::~ClassList ()
-{
-//   ClassList::classList->clear());
-}
-
-//! a List of all known Classes.
-std::list<ClassList>* ClassList::classList = NULL;
-
-//! a List of all strings of all classes, that have registered so far.
-std::list<std::string> ClassList::classNames;
-
-/**
- * @brief Adds a new Object to the ClassList (and if necessary a new Class)
- * @param objectPointer Pointer to the Object at hand
- * @param classID ID of the Given ObjectType \see ClassID
- * @param className name of the Class to add
- *
- * !! FIRST YOU HAVE TO CALL THIS FUNCTION ONCE
- * !! Before unsing the ClassList, as it creates the ClassLits
- */
-ClassList* ClassList::addToClassList(BaseObject* objectPointer, ClassID classID, unsigned long classIDFull, const std::string& className)
-{
-  if (unlikely(classList == NULL))
-    ClassList::classList = new std::list<ClassList>();
-
-  PRINTF(5)("subscribe a '%s'\n", className.c_str() );
-
-  ClassList* regClass = ClassList::getClassList(classID);
-  if (regClass != NULL)
-  {
-    regClass->objectList.push_back(objectPointer);
-    return regClass;
-  }
-  else
-  {
-    ClassList::classList->push_back(ClassList(classID, classIDFull, className));
-    ClassList::classList->back().objectList.push_back(objectPointer);
-    return &ClassList::classList->back();
-  }
-}
-
-/**
- * @brief removes an Object from a the ClassList
- * @param objectPointer the Object to delete from the List
- */
-void ClassList::removeFromClassList(BaseObject* objectPointer)
-{
-  std::list<ClassList>::iterator cl;
-  for(cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
-  {
-    if (objectPointer->isA((*cl).classID))
-    {
-      std::list<BaseObject*>::iterator bo = std::find ((*cl).objectList.begin(), (*cl).objectList.end(), objectPointer);
-      if (bo != (*cl).objectList.end())
-          (*cl).objectList.erase(bo);
-    }
-  }
-}
-
-/**
- * @brief grabs the names of all Classes, and injects it into a List of const chars
- * @return the generated List
- *
- * This function first looks, if the List has been changed (by the ListSize)
- * befor it changes anything.
- */
-const std::list<std::string>* ClassList::getClassNames()
-{
-  if (ClassList::classNames.size() != ClassList::classList->size())
-  {
-      ClassList::classNames.clear();
-
-      std::list<ClassList>::const_iterator cl;
-      for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
-        ClassList::classNames.push_back((*cl).className);
-  }
-
-  return &ClassList::classNames;
-}
-
-/**
- * @brief searches for classID and returns the list of Entities
- * @param classID the ID of the class to get the list from
- * @return the List accessed by classID, or NULL if not found
- */
-const std::list<BaseObject*>* ClassList::getList(ClassID classID)
-{
-  ClassList* fl;
-  return ((fl = ClassList::getClassList(classID)) != NULL)?
-       &(fl->objectList) : NULL;
-
-/*
-  std::list<ClassList>::iterator classIT = find (classList->begin(), classList->end(), classID);
-  return (likely(classIT != classList->end()))? &(*classIT).objectList : NULL;*/
-
-/*  for (classIT = ClassList::classList->begin(); classIT != ClassList::classList->end(); classIT++)
-  {
-    if ((*classIT) == classID )
-      return &(*classIT).objectList;
-  }
-  return NULL;*/
-}
-
-/**
- * @brief searches for className and returns the list of Entities
- * @param className the name of the class to get the list from
- * @return the List accessed by classID, or NULL if not found
- */
-const std::list<BaseObject*>* ClassList::getList(const std::string& className)
-{
-  ClassList* fl;
-  return ((fl = ClassList::getClassList(className)) != NULL)?
-      &(fl->objectList) : NULL;
-
-  /*
-  std::list<ClassList>::iterator classIT = find (classList->begin(), classList->end(), className);
-  return (likely(classIT != classList->end()))? &(*classIT).objectList : NULL;*/
-
-
-/*  for (classIT = ClassList::classList->begin(); classIT != ClassList::classList->end(); classIT++)
-  {
-    if ((*classIT) == className )
-      return &(*classIT).objectList;
-  }
-  return NULL;*/
-}
-
-/**
- * !!PRIVATE!!
- * @param classID the ClassID to search for
- * @returns the ClassList with classID as specifyer, or NULL if not
- */
-ClassList* ClassList::getClassList(ClassID classID)
-{
-  std::list<ClassList>::iterator classIT = find (ClassList::classList->begin(), ClassList::classList->end(), classID);
-  return (likely(classIT != classList->end()))? &(*classIT) : NULL;
-}
-
-
-/**
- * !!PRIVATE!!
- * @param className the ClassName to search for
- * @returns the ClassList with className as specifyer, or NULL if not
- */
-ClassList* ClassList::getClassList(const std::string& className)
-{
-  if (className.empty())
-    return NULL;
-  std::list<ClassList>::iterator classIT = find (classList->begin(), classList->end(), className);
-  return (likely(classIT != classList->end()))? &(*classIT) : NULL;
-}
-
-
-/**
- * @brief checks if the BaseObject* object exists.
- * @param objectName the name of the BaseObject to look for
- * @param classID if not CL_NULL it will only search through a specific type of Objects. Otherwise it will be searched everywhere.
- * @return true, if the Object Exists in the specified ClassID, false otherwise
- * @todo: speed this up!!
- */
-BaseObject* ClassList::getObject(const std::string& objectName, ClassID classID)
-{
-  if (classID != CL_NULL)
-  {
-    ClassList* cl = ClassList::getClassList(classID);
-    if (cl != NULL)
-    {
-      std::list<BaseObject*>::iterator bo;
-      for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
-        if (objectName == (*bo)->getName())
-          return (*bo);
-    }
-  }
-  else
-  {
-    std::list<ClassList>::iterator cl;
-    for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
-    {
-      std::list<BaseObject*>::iterator bo;
-      for (bo = (*cl).objectList.begin(); bo != (*cl).objectList.end(); bo++)
-        if (objectName == (*bo)->getName())
-          return (*bo);
-    }
-  }
-  return NULL;
-}
-
-
-/**
- * @brief checks if the BaseObject* object exists.
- * @param objectName the name of the BaseObject to look for
- * @param classID if not CL_NULL it will only search through a specific type of Objects. Otherwise it will be searched everywhere.
- * @return true, if the Object Exists in the specified ClassID, false otherwise
- * @todo: speed this up!!
- */
-BaseObject* ClassList::getObject(const std::string& objectName, const std::string& className)
-{
-
-  ClassList* cl = ClassList::getClassList(className);
-  if (cl != NULL)
-  {
-    std::list<BaseObject*>::iterator bo;
-    for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
-      if (objectName == (*bo)->getName())
-        return (*bo);
-  }
-  return NULL;
-}
-
-
-/**
- * @brief checks if the BaseObject* object exists.
- * @param object the Pointer to a BaseObject to check if it exists
- * @param classID if not CL_NULL it will only search through a specific type of Objects. Otherwise it will be searched everywhere.
- * @return true, if the Object Exists in the specified ClassID, false otherwise
- * @todo: speed this up!!
- */
-bool ClassList::exists(const BaseObject* object, ClassID classID)
-{
-  if (classID != CL_NULL)
-  {
-    ClassList* cl = ClassList::getClassList(classID);
-    if (cl != NULL)
-    {
-      std::list<BaseObject*>::const_iterator bo = std::find (cl->objectList.begin(), cl->objectList.end(), object);
-      return (bo != cl->objectList.end());
-    }
-  }
-  else
-  {
-    std::list<ClassList>::iterator cl;
-    for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
-    {
-      std::list<BaseObject*>::const_iterator bo = std::find ((*cl).objectList.begin(), (*cl).objectList.end(), object);
-      if (bo != (*cl).objectList.end())
-        return true;
-    }
-  }
-  return false;
-}
-
-bool ClassList::exists(const std::string& className, const std::string& objectName)
-{
-  ClassList* cl = ClassList::getClassList(className);
-  if (likely(cl != NULL))
-  {
-    std::list<BaseObject*>::iterator bo;
-    for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
-      if (objectName == (*bo)->getName())
-        return true;
-  }
-  return false;
-}
-
-
-/**
- * @brief prints out a string of all the types this Object matches
- * @param object a Pointer to the object to analyze
- */
-void ClassList::whatIs(const BaseObject* object)
-{
-  std::list<ClassList>::iterator cl;
-  for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
-    if (object->isA((*cl).classID))
-  {
-    PRINT(0)("=%s::0x%.8X=-", (*cl).className.c_str(), (*cl).classID);
-  }
-}
-
-/**
- * @brief converts a ClassID into a string
- * @param classID the ClassID to search for
- * @return a String containing the name of the Class, NULL if the Class was not found
- */
-const std::string& ClassList::IDToString(ClassID classID)
-{
-  static const std::string empty("");
-
-  ClassList* cl = ClassList::getClassList(classID);
-  return (cl != NULL) ? cl->className : empty;
-}
-
-/**
- * @brief converts a String into a ClassID
- * @param className the name of the class to search for
- * @return the ClassID. CL_NULL, if the class was not found.
- */
-ClassID ClassList::StringToID(const std::string& className)
-{
-  ClassList* cl = ClassList::getClassList(className);
-  return (cl != NULL) ? cl->classID : CL_NULL;
-}
-
-/**
- * @brief checks if this ClassList is named className
- * @param className the Name to check this ClassList's ClassName against
- * @returns true on match, false otherwise
- */
-bool ClassList::operator==(const std::string& className)
-{
-  return (this->className == className);
-}
-
-
-
-/**
- * @brief Print out some very nice debug information
- * @param debugLevel the level of verbosity
- * @param classID the class that should be displayed (if CL_NULL (default) all classes will be displayed)
- */
-void ClassList::debug(unsigned int debugLevel, ClassID classID)
-{
-  if (debugLevel > 3)
-    debugLevel = 3;
-  PRINT(0)("==========================\n");
-  PRINT(0)("=  CLASS_LIST (level %d)  =\n", debugLevel);
-  PRINT(0)("==========================\n");
-  PRINT(0)("| knows %d Classes\n|\n", ClassList::classList->size());
-  char niceString[100];
-  int lenCount = 0;
-
-  std::list<ClassList>::iterator cl;
-  for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
-  {
-    if ((debugLevel >= 1 || (*cl).objectList.size() > 0 ) &&
-         (classID == CL_NULL || unlikely (classID == (*cl).classID)))
-    {
-      lenCount = 1;
-      while (std::pow((float)10, (int)lenCount) <= (*cl).objectList.size())
-        ++lenCount;
-      for (unsigned int i=0; i < 30-(*cl).className.size() - lenCount; i++)
-        (niceString[i]) = ' ';
-      niceString[30-(*cl).className.size() - lenCount] = '\0';
-
-      PRINT(0)("| CLASS %s::%s %d\n", (*cl).className.c_str(), niceString, (*cl).objectList.size());
-
-      if (debugLevel >=2 && (*cl).objectList.size() > 0)
-      {
-        PRINT(0)("|  Listing Instances:\n");
-        std::list<BaseObject*>::const_iterator bo;
-        for (bo = (*cl).objectList.begin(); bo != (*cl).objectList.end(); bo++)
-        {
-          PRINT(0)("|   %s::%s::(0x%.8X->%p ", (*bo)->getClassCName(), (*bo)->getCName(), (*bo)->getClassID(), (*bo));
-          if (debugLevel == 3)
-            ClassList::whatIs(*bo);
-          PRINT(0)("\n");
-        }
-      }
-    }
-  }
-  PRINT(0)("=======================CL=\n");
-}
-
-/**
- * @brief Print out some very nice debug information
- * @param debugLevel the level of verbosity
- * @param className the class that should be displayed.
- * @see ClassList::debug
- */
-void ClassList::debugS(const std::string& className, unsigned int debugLevel)
-{
-  ClassList::debug(debugLevel, ClassList::StringToID(className));
-}
Index: trunk/src/lib/lang/class_list.h
===================================================================
--- trunk/src/lib/lang/class_list.h	(revision 9682)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*!
- * @file class_list.h
-  *  Definition of the Class List, that handles a Class-Specific-Control structure
-
- */
-
-#ifndef _CLASS_LIST_H
-#define _CLASS_LIST_H
-
-#include "class_id.h"
-#include <list>
-#include <string>
-
-// FORWARD DECLARATION
-class BaseObject;
-
-//! A class that handles Pointers to Objects of all type.
-/**
- * here all the Pointers to all the Object of orxonox are stored, that implement BaseObject
- * for now.
- * You can get Any Object's Reference to BaseObject with dynamic_cast<T>(ClassList::getObject(name, CL_T_NAME));
- *  where: T: is the Class to cast to,
- *   name: the name of the Object (not className)
- *   CL_T_NAME: the class Identifier, (if CL_NULL or nothing it will take longer, because all BaseObject's are searched through)
- *
- * There is also the exists-function, that just checks, if a Reference is still in existence.
- *
- * @see ClassID, BaseObject, dynamic_cast
- */
-class ClassList {
-  friend class BaseObject;
-
-  public:
-    ClassList(ClassID classID, unsigned long classIDFull, const std::string& className);
-    virtual ~ClassList();
-
-    static const std::list<BaseObject*>*  getList(ClassID classID = CL_NULL);// { return (ClassList* fl = ClassList::getClassList(classID) != NULL)? &(fl->objectList) : NULL; };
-    static const std::list<BaseObject*>*  getList(const std::string& className); // { return (ClassList* fl = ClassList::getClassList(className) != NULL)? &(fl->objectList) : NULL;  };
-    static const std::list<std::string>*  getClassNames();
-    static BaseObject*                    getObject(const std::string& objectName, ClassID classID = CL_NULL);
-    static BaseObject*                    getObject(const std::string& objectName, const std::string& className);
-    static bool                           exists(const BaseObject* object, ClassID classID = CL_NULL);
-    static bool                           exists(const std::string& className, const std::string& objectName);
-
-    void                                  sendBack(std::list<BaseObject*>::const_iterator it);
-
-    static void                           whatIs(const BaseObject* object);
-
-    static const std::string&             IDToString(ClassID classID = CL_NULL);
-    static ClassID                        StringToID(const std::string& className);
-    static void                           debug(unsigned int debugLevel = 0, ClassID classID = CL_NULL);
-    static void                           debugS(const std::string& className = "", unsigned int debugLevel = 0);
-
-    inline bool                           operator==(ClassID classID) { return (this->classID == classID); };
-    bool                                  operator==(const std::string& className);
-    inline ClassID                        getLeafClassID() const { return this->classID; };
-
-  private:
-    /* MAINTENANCE FUNCTIONS THESE ARE !!ONLY FOR BASEOBJECT !! */
-    static ClassList*                     addToClassList(BaseObject* objectPointer, ClassID classID, unsigned long classIDFull, const std::string& className);
-    static void                           removeFromClassList(BaseObject* objectPointer);
-
-    static ClassList*                     getClassList(ClassID classID);
-    static ClassList*                     getClassList(const std::string& className);
-
-  private:
-    ClassID                               classID;                //!< ClassID stored in this ClassList
-    unsigned long                         classIDFull;            //!< The Full ClassID of this Class.
-
-    const std::string                     className;              //!< Name of the Class Stored here
-
-    std::list<BaseObject*>                objectList;             //!< A list of Objects belonging to this Class
-
-    // STATIC MEMBERS
-    static std::list<ClassList>*          classList;              //!< The first Class in the List
-    static std::list<std::string>         classNames;             //!< a List of all Names of all classes, that have registered so far.
-};
-
-#endif /* _CLASS_LIST_H */
Index: trunk/src/lib/lang/new_class_id.cc
===================================================================
--- trunk/src/lib/lang/new_class_id.cc	(revision 9682)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2006 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_
-
-#include "new_class_id.h"
-#include <cassert>
-#include "debug.h"
-
-///////////////////////////////////////////////////////////
-//// CLASS ID definiton. //////////////////////////////////
-///////////////////////////////////////////////////////////
-/**
- * @brief standard constructor
- */
-NewClassID::NewClassID ()
-{}
-
-
-/**
- * @brief standard deconstructor
- */
-NewClassID::~NewClassID ()
-{
-  ClassList::iterator it;
-  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
-  {
-    (*it)._objectList->unregisterObject((*it)._iterator);
-    delete (*it)._iterator;
-  }
-}
-
-
-/**
- * @brief Seeks in the Inheritance if it matches objectList.
- * @param objectList The ObjectList this should be a member of (by Pointer-comparison).
- * @return True if found, false if not.
- */
-bool NewClassID::isA(const NewObjectListBase& objectList) const
-{
-  ClassList::const_iterator it;
-  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
-    if ((*it)._objectList == &objectList)
-      return true;
-  return false;
-}
-
-/**
- * @brief Seeks in the Inheritance if it matches objectList.
- * @param classID The ClassID of the class this should be a member of.
- * @return True if found, false if not.
- */
-bool NewClassID::isA(int classID) const
-{
-  ClassList::const_iterator it;
-  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
-    if (*(*it)._objectList == classID)
-      return true;
-  return false;
-}
-
-/**
- * @brief Seeks in the Inheritance if it matches objectList.
- * @param className The ClassName of the class this should be a member of.
- * @return True if found, false if not.
- */
-bool NewClassID::isA(const std::string& className) const
-{
-  ClassList::const_iterator it;
-  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
-    if (*(*it)._objectList == className)
-      return true;
-  return false;
-}
-
-
-void NewClassID::listInheritance() const
-{
-  PRINT(0)("Listing inheritance diagram for ....: ");
-  ClassList::const_iterator it;
-  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
-    PRINT(0)(" -> %s(id:%d)", (*it)._objectList->name().c_str(), (*it)._objectList->id());
-  PRINT(0)("\n");
-
-}
Index: trunk/src/lib/lang/new_class_id.h
===================================================================
--- trunk/src/lib/lang/new_class_id.h	(revision 9682)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*!
- * @file new_class_id.h
- * @brief Definition of a dynamically allocating ClassID
- *
- */
-
-#ifndef _NEW_CLASS_ID_H
-#define _NEW_CLASS_ID_H
-
-#include "new_object_list.h"
-
-#include <string>
-#include <list>
-
-//! A class to dynamically allocate ClassID's and support a isA operator
-class NewClassID
-{
-public:
-  NewClassID();
-  ~NewClassID();
-
-  /** @returns the ClassName of the Topmost Object of the ClassStack */
-  inline const std::string& getClassName() const { return _classes.front()._objectList->name(); }
-  /** @returns the ID of the Topmost object of the ClassStack */
-  inline int leafClassID() const { return _classes.front()._objectList->id(); }
-
-  template<class T> void registerObject(T* object, NewObjectList<T>& list);
-  bool isA(const NewObjectListBase& objectList) const;
-  bool isA(int classID) const;
-  bool isA(const std::string& className) const;
-
-  void listInheritance() const;
-
-private:
-  //////////////////////////////
-  //// Type Definition Part ////
-  //////////////////////////////
-  //! A ClassEntry so we can store Classes inside of Objects
-  struct ClassEntry
-  {
-    /** Simple Constuctor @param objectList the NewObjectList, @param iterator the (intrusive) Iterator inside of the ObjectList */
-    inline ClassEntry (NewObjectListBase* objectList, NewObjectListBase::IteratorBase* iterator) : _objectList(objectList), _iterator(iterator) {}
-    NewObjectListBase*                _objectList;  //!< A ObjectList this Object is part of
-    NewObjectListBase::IteratorBase*  _iterator;    //!< An iterator pointing to the position of the Object inside of the List.
-  };
-  typedef std::list<ClassEntry>        ClassList;   //!< Type definition for the List.
-
-  ClassList                           _classes;     //!< All Classes this object is part of.
-};
-
-
-/**
- * @brief Registeres an Object of Type T to objectList
- * @param object The Object to append to the objectList.
- * @param objectList The ObjectList to append the Object to.
- *
- * This function is essential to integrate objects into their designated ObjectList.
- * Remember if you do not want objects to be stored in Lists (less overhead),
- * do not attempt to call this function.
- */
-template<class T>
-inline void NewClassID::registerObject(T* object, NewObjectList<T>& objectList)
-{
-  this->_classes.push_front(ClassEntry(&objectList, objectList.registerObject(object)));
-}
-
-#endif /* _NEW_CLASS_ID_H */
Index: trunk/src/lib/lang/new_object_list.cc
===================================================================
--- trunk/src/lib/lang/new_object_list.cc	(revision 9682)
+++ 	(revision )
@@ -1,151 +1,0 @@
-/*
-   orxonox - the future of 3D-vertical-scrollers
-
-   Copyright (C) 2006 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_
-
-#include "new_object_list.h"
-#include <cassert>
-
-
-/**
- * @brief Constructor, that creates an ObjectList while checking (development mode) for uniqueness of all Keys (names and ID's)
- * @param className The Name of the Class to create an ObjectList for.
- * @param id The ID if you like, or -1 otherwise.
- * @return a new NewObejctList
- */
-NewObjectListBase::NewObjectListBase(const std::string& className, int id)
-    : _name(className)
-{
-  if (NewObjectListBase::_classesByID == NULL)
-  {
-    NewObjectListBase::_classesByID = new classIDMap;
-    assert (NewObjectListBase::_classesByName == NULL);
-    NewObjectListBase::_classesByName = new classNameMap;
-  }
-  assert(!NewObjectListBase::classNameExists(className) && "Classes should only be included once, and no two classes should have the same name (key value)");
-
-  if (id != -1)
-  {
-    this->_id = id;
-  }
-  else
-  {
-    this->_id = NewObjectListBase::_classesByID->size();
-    // searching for a free ID
-    while (NewObjectListBase::classIDExists(_id)) ++id;
-  }
-  assert(!NewObjectListBase::classIDExists(id) && "Classes should only be included once, and no two classes should have the same ID (key value)");
-
-  /// Some Output, that will fall out later
-  //std::cout << "register new ObjectList " << className << " ID: " << this->_id << std::endl;
-
-  (*NewObjectListBase::_classesByID)[this->_id] = this;
-  (*NewObjectListBase::_classesByName)[this->_name] = this;
-}
-
-
-/**
- * Destructor.
- *
- * This destructor deletes the NewObjectList, and cleans up the NewObjectList sorted Maps.
- */
-NewObjectListBase::~NewObjectListBase()
-{
-  assert (NewObjectListBase::_classesByName != NULL && NewObjectListBase::_classesByID != NULL);
-  /*
-  std::cout << "Erasing: " << this->_name << " "<< this->_id  << std::endl;
-  std::cout << "SIZE OF _classByID: " << NewObjectListBase::_classesByID->size() << std::endl;
-  std::cout << "SIZE OF _classByName: " << NewObjectListBase::_classesByName->size() << std::endl;
-  */
-  NewObjectListBase::_classesByName->erase(this->_name);
-  NewObjectListBase::_classesByID->erase(this->_id);
-
-  if (NewObjectListBase::_classesByID->empty())
-  {
-    delete NewObjectListBase::_classesByID;
-    NewObjectListBase::_classesByID = NULL;
-    assert(NewObjectListBase::_classesByName != NULL);
-    delete NewObjectListBase::_classesByName;
-    NewObjectListBase::_classesByName = NULL;
-  }
-}
-
-NewObjectListBase::classIDMap* NewObjectListBase::_classesByID = NULL;
-NewObjectListBase::classNameMap* NewObjectListBase::_classesByName = NULL;
-
-/**
- * @returns the Registered Class Count.
- */
-unsigned int NewObjectListBase::classCount()
-{
-  assert (NewObjectListBase::_classesByID != NULL);
-  return NewObjectListBase::_classesByID->size();
-};
-
-/**
- * @brief Checks if a Class with name already exists.
- * @param name The Name of the Class to check.
- * @return true if such a class already exists.
- */
-bool NewObjectListBase::classNameExists(const std::string& name)
-{
-  return (NewObjectListBase::_classesByName->find(name) != NewObjectListBase::_classesByName->end());
-}
-
-/**
- * @brief Checks if a Class with name already exists.
- * @param name The Name of the Class to check.
- * @return true if such a class already exists.
- */
-bool NewObjectListBase::classIDExists(int id)
-{
-  return (NewObjectListBase::_classesByID->find(id) != NewObjectListBase::_classesByID->end());
-}
-
-
-/**
- * @brief Converts an ID into a ClassName String.
- * @param classID The ID to convert.
- * @return The ClassName or an empty string if the ID was not found.
- */
-const std::string& NewObjectListBase::IDToString(int classID)
-{
-  assert (NewObjectListBase::_classesByID != NULL);
-  NewObjectListBase::classIDMap::iterator it = NewObjectListBase::_classesByID->find(classID);
-  if (it != NewObjectListBase::_classesByID->end())
-    return (*it).second->name();
-  else
-  {
-    static std::string empty;
-    return empty;
-  }
-}
-
-
-/**
- * @brief Converts a String into an ID
- * @param className the Name of the Class to search for
- * @return The Classes ID if found, -1 otherwise.
- */
-int NewObjectListBase::StringToID(const std::string& className)
-{
-  assert (NewObjectListBase::_classesByName != NULL);
-  NewObjectListBase::classNameMap::iterator it = NewObjectListBase::_classesByName->find(className);
-  if (it != NewObjectListBase::_classesByName->end())
-    return (*it).second->id();
-  else
-    return -1;
-}
-
Index: trunk/src/lib/lang/new_object_list.h
===================================================================
--- trunk/src/lib/lang/new_object_list.h	(revision 9682)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*!
- * @file new_object_list.h
- * @brief Definition of a dynamically allocating ClassID
- *
- */
-
-#ifndef _NEW_OBJECT_LIST_H
-#define _NEW_OBJECT_LIST_H
-
-#include "type_info.h"
-#include <map>
-#include <list>
-#include <string>
-#include <iostream>
-
-
-#define NewObjectListDeclaration(ClassName) \
-   static NewObjectList<ClassName> objectList
-
-#define NewObjectListDefinitionID(ClassName, ID) \
-   NewObjectList<ClassName> ClassName::objectList(#ClassName, ID)
-
-
-#define NewObjectListDefinition(ClassName) \
-    NewObjectListDefinitionID(ClassName, -1)
-
-
-//! The superclass that all NewObjectLists follow.
-/**
- * @see template<class T> NewObjectList<T>
- */
-class NewObjectListBase
-{
-public:
-  //! An iterator Base-Class, for iterator-casting and storing.
-  class IteratorBase { };
-
-public:
-  inline int id() const { return _id; };
-  inline const std::string& name() const { return _name; };
-  bool operator==(int id) const { return _id == id; };
-  bool operator==(const std::string& name) const { return _name == name; };
-
-  virtual void debug() const = 0;
-
-  static unsigned int                   classCount();
-  static const std::string&             IDToString(int classID);
-  static int                            StringToID(const std::string& className);
-
-  static const std::list<std::string>&  getClassNames();
-
-  virtual void unregisterObject(IteratorBase* _iterators) = 0;
-
-protected:
-  NewObjectListBase(const std::string& className, int id = -1);
-  virtual ~NewObjectListBase();
-
-private:
-  NewObjectListBase(const NewObjectListBase&);
-
-  static bool classIDExists(int id);
-  static bool classNameExists(const std::string& className);
-
-protected:
-  typedef std::map<int, NewObjectListBase*> classIDMap;    //!< The Generic Map.
-  typedef std::map<std::string, NewObjectListBase*> classNameMap;//!< The Generic Map.
-
-  int                           _id;                //!< The ID of the class.
-  std::string                   _name;              //!< The Name of the Class.
-
-private:
-  static classIDMap*            _classesByID;       //!< A Map of all the classes in existance.
-  static classNameMap*          _classesByName;     //!< A Map of all the classes in existance.
-  static std::list<std::string> _classNames;        //!< A list of all the registered ClassNames.
-};
-
-
-/////////////////////////
-//// TEMPLATISATION /////
-/////////////////////////
-//! Defines a ObjectsList handler for objects of type T.
-/**
- * To define a Class with a ObjectList, you have to:
- *  1. Include 'NewObjectListDeclaration(T);' in its Declaration (at the beginning)
- *  2. Include 'NewObjectListDefinition(T);' in some Definition file (cc-file)
- *  3. In the constructor add 'registerObject(this, objectList);'
- *
- * @note The Class must define the compare with const std::string& operator for this to work.
- */
-template<class T>
-class NewObjectList : public NewObjectListBase
-{
-public:
-  typedef std::list<T*>                  list;
-  typedef typename list::iterator        iterator;
-  typedef typename list::const_iterator  const_iterator;
-
-class Iterator : public NewObjectListBase::IteratorBase
-  {
-  public:
-    Iterator(iterator it) { _it = it; }
-    inline iterator& it() { return _it; }
-    typename NewObjectList::iterator _it;
-  };
-
-public:
-  NewObjectList(const std::string& name, int id = -1);
-  ~NewObjectList();
-
-  T*                      getObject(const std::string& name) const;
-  inline const list&      objects() const { return _objects; };
-
-  NewObjectListBase::IteratorBase* registerObject(T* object);
-  void unregisterObject(IteratorBase* iterator);
-
-  virtual void debug() const;
-
-private:
-  //! the copy constructor will be hidden.
-  NewObjectList(const NewObjectList& definer) {};
-
-private:
-  list                _objects;
-};
-
-
-
-
-
-/////////////////////////
-//// IMPLEMENTATION /////
-/////////////////////////
-/**
- * @brief creates a new NewObjectList
- * @param name The name of the Class.
- * @param id The ID of the class if desired, or -1 if an id should be assigned automatically.
- */
-template <class T>
-NewObjectList<T>::NewObjectList(const std::string& name, int id)
-    : NewObjectListBase(name, id)
-{}
-
-/**
- * @brief deletes the NewObjectList.
- */
-template <class T>
-NewObjectList<T>::~NewObjectList()
-{
-  if (!_objects.empty())
-  {
-    std::cout << "There are still Object in the ObjectList of " << this->name() << "(id:" << this->id() << ")\n";
-    this->debug();
-  }
-}
-
-template <class T>
-T* NewObjectList<T>::getObject(const std::string& name) const
-{
-  iterator it = std::find(this->_objects.begin(), this->_objects.end(), name);
-  if (it != this->_objects.end())
-    return *it;
-  else
-    return NULL;
-}
-
-template <class T>
-NewObjectListBase::IteratorBase* NewObjectList<T>::registerObject(T* object)
-{
-  this->_objects.push_front(object);
-  return new Iterator(this->_objects.begin());
-}
-
-template <class T>
-void NewObjectList<T>::unregisterObject(IteratorBase* iterator)
-{
-  this->_objects.erase(static_cast<Iterator*>(iterator)->it());
-  //_objects.erase(std::find(_objects.begin(), _objects.end(), object));
-}
-
-
-template <class T>
-void NewObjectList<T>::debug() const
-{
-  const_iterator it;
-  for (it = this->_objects.begin(); it != this->_objects.end(); ++it)
-  {
-    std::cout << (*it)->getName() << std::endl;
-  }
-}
-
-#endif /* _NEW_OBJECT_LIST_H */
Index: trunk/src/lib/lang/object_list.cc
===================================================================
--- trunk/src/lib/lang/object_list.cc	(revision 9869)
+++ trunk/src/lib/lang/object_list.cc	(revision 9869)
@@ -0,0 +1,331 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2006 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_
+
+#include "object_list.h"
+#include <cassert>
+
+/**
+ * @brief Constructor, that creates an ObjectList while checking (development mode) for uniqueness of all Keys (names and ID's)
+ * @param className The Name of the Class to create an ObjectList for.
+ * @param id The ID if you like, or -1 otherwise.
+ * @return a new NewObejctList
+ */
+ObjectListBase::ObjectListBase(const std::string& className, int id)
+    : _name(className)
+{
+  if (ObjectListBase::_classesByID == NULL)
+  {
+    ObjectListBase::_classesByID = new IDMap;
+    assert (ObjectListBase::_classesByName == NULL);
+    ObjectListBase::_classesByName = new NameMap;
+  }
+  assert(!ObjectListBase::classNameExists(className) && "Classes should only be included once, and no two classes should have the same name (key value)");
+
+  if (id == -1)
+  {
+    id = ObjectListBase::_classesByID->size();
+    // searching for a free ID
+    while (ObjectListBase::classIDExists(id)) ++id;
+  }
+  assert(!ObjectListBase::classIDExists(id) && "Classes should only be included once, and no two classes should have the same ID (key value)");
+
+  this->_id = id;
+  /// Some Output, that will fall out later
+  //  std::cout << "register new ObjectList " << className << " ID: " << this->_id << std::endl;
+
+  this->_identity = ClassID(this);
+  (*ObjectListBase::_classesByID)[this->_identity.id()] = this;
+  (*ObjectListBase::_classesByName)[this->_identity.name()] = this;
+}
+
+
+/**
+ * Destructor.
+ *
+ * This destructor deletes the ObjectList, and cleans up the ObjectList sorted Maps.
+ */
+ObjectListBase::~ObjectListBase()
+{
+  assert (ObjectListBase::_classesByName != NULL && ObjectListBase::_classesByID != NULL);
+  /*
+  std::cout << "Erasing: " << this->_name << " "<< this->_id  << std::endl;
+  std::cout << "SIZE OF _classByID: " << ObjectListBase::_classesByID->size() << std::endl;
+  std::cout << "SIZE OF _classByName: " << ObjectListBase::_classesByName->size() << std::endl;
+  */
+  ObjectListBase::_classesByID->erase(this->_identity.id());
+  ObjectListBase::_classesByName->erase(this->_identity.name());
+
+  if (ObjectListBase::_classesByID->empty())
+  {
+    delete ObjectListBase::_classesByID;
+    ObjectListBase::_classesByID = NULL;
+    assert(ObjectListBase::_classesByName != NULL);
+    delete ObjectListBase::_classesByName;
+    ObjectListBase::_classesByName = NULL;
+  }
+}
+
+ObjectListBase::IDMap* ObjectListBase::_classesByID = NULL;
+ObjectListBase::NameMap* ObjectListBase::_classesByName = NULL;
+std::list<std::string> ObjectListBase::_classNames;
+
+/**
+ * @returns the Registered Class Count.
+ */
+unsigned int ObjectListBase::classCount()
+{
+  assert (ObjectListBase::_classesByID != NULL);
+  return ObjectListBase::_classesByID->size();
+};
+
+/**
+ * @brief Checks if a Class with name already exists.
+ * @param id The id of the Class to check.
+ * @return true if such a class already exists.
+ */
+bool ObjectListBase::classIDExists(int id)
+{
+  return (ObjectListBase::_classesByID->find(id) != ObjectListBase::_classesByID->end());
+}
+
+/**
+ * @brief Checks if a Class with name already exists.
+ * @param name The Name of the Class to check.
+ * @return true if such a class already exists.
+ */
+bool ObjectListBase::classNameExists(const std::string& name)
+{
+  return (ObjectListBase::_classesByName->find(name) != ObjectListBase::_classesByName->end());
+}
+
+/**
+ * @brief searches for a ClassID in the list of all ObjectLists, and returns its Identity
+ * @param id: The Id to search for
+ * @returns the ClassID if found and NullClass' identity if not.
+ */
+const ClassID& ObjectListBase::retrieveIdentity(int id)
+{
+  const ObjectListBase* const base = ObjectListBase::getObjectList(id);
+
+  if (base != NULL)
+    return base->_identity;
+  else
+    return NullClass::staticClassID();
+}
+
+
+/**
+ * @brief searches for a ClassID in the list of all ObjectLists, and returns its Identity
+ * @param name: The Name to search for
+ * @returns the ClassID if found and NullClass' identity if not.
+ */
+const ClassID& ObjectListBase::retrieveIdentity(const std::string& name)
+{
+  const ObjectListBase* const base = ObjectListBase::getObjectList(name);
+
+  if (base != NULL)
+    return base->_identity;
+  else
+    return NullClass::staticClassID();
+}
+
+
+/**
+ * @brief Searches for a ObjectList with the ID classID
+ * @param classID the ID to search for.
+ * @return The ObjectList if found, NULL otherwise.
+ */
+const ObjectListBase* const ObjectListBase::getObjectList(int classID)
+{
+  assert (ObjectListBase::_classesByID != NULL);
+  ObjectListBase::IDMap::iterator it = ObjectListBase::_classesByID->find(classID);
+  if (it != ObjectListBase::_classesByID->end())
+    return (*it).second;
+  else
+    return NULL;
+}
+
+/**
+ * @brief Searches for a ObjectList with the Name className
+ * @param className the Name to search for.
+ * @return The ObjectList if found, NULL otherwise.
+ */
+const ObjectListBase* const ObjectListBase::getObjectList(const std::string& className)
+{
+  assert (ObjectListBase::_classesByName != NULL);
+  ObjectListBase::NameMap::iterator it = ObjectListBase::_classesByName->find(className);
+  if (it != ObjectListBase::_classesByName->end())
+    return (*it).second;
+  else
+    return NULL;
+}
+
+/**
+ * @brief Searches for a ObjectList with the ClassID classID
+ * @param classID the ID to search for.
+ * @return The ObjectList if found, NULL otherwise.
+ */
+const ObjectListBase* const ObjectListBase::getObjectList(const ClassID& classID)
+{
+  return ObjectListBase::getObjectList(classID.id());
+}
+
+/**
+ * @brief Retrieves the first BaseObject matching the name objectName from the List matching classID.
+ * @param classID the ID of the List.
+ * @param objectName the Name of the Object to search for
+ */
+BaseObject* ObjectListBase::getBaseObject(int classID, const std::string& objectName)
+{
+  const ObjectListBase* const base = ObjectListBase::getObjectList(classID);
+
+  if (base != NULL)
+    return base->getBaseObject(objectName);
+  else
+    return NULL;
+}
+
+/**
+ * @brief Retrieves the first BaseObject matching the name objectName from the List matching className.
+ * @param className the Name of the List.
+ * @param objectName the Name of the Object to search for
+ */
+BaseObject* ObjectListBase::getBaseObject(const std::string& className, const std::string& objectName)
+{
+  const ObjectListBase* const base = ObjectListBase::getObjectList(className);
+
+  if (base != NULL)
+    return base->getBaseObject(objectName);
+  else
+    return NULL;
+}
+
+/**
+ * @brief Retrieves the first BaseObject matching the name objectName from the List matching classID.
+ * @param classID The ClassID of the List.
+ * @param objectName the Name of the Object to search for
+ */
+BaseObject* ObjectListBase::getBaseObject(const ClassID& classID, const std::string& objectName)
+{
+  const ObjectListBase* const base = ObjectListBase::getObjectList(classID);
+
+  if (base != NULL)
+    return base->getBaseObject(objectName);
+  else
+    return NULL;
+}
+
+
+/**
+ * @returns An alphabetically sorted List of all stored ClassNames.
+ */
+const std::list<std::string>& ObjectListBase::getClassNames()
+{
+  if (ObjectListBase::classCount() != ObjectListBase::_classNames.size())
+  {
+    ObjectListBase::_classNames.clear();
+
+    for (NameMap::const_iterator it = ObjectListBase::_classesByName->begin();
+         it != ObjectListBase::_classesByName->end();
+         ++it)
+      ObjectListBase::_classNames.push_back((*it).second->name());
+  }
+  return ObjectListBase::_classNames;
+}
+
+
+#include "base_object.h"
+
+/**
+ * @brief Prints out some debugging information about a given List.
+ * @param level:
+ *  1: List ObjectListsand how many object.
+ *  2: 1+List ObjectLists entries, and information about Objects.
+ */
+void ObjectListBase::debug(unsigned int level) const
+{
+  base_list list;
+  this->getBaseObjectList(&list);
+
+  if (level > 1 || !list.empty())
+    printf(" ObjectList of class %s(id:%d) contains %d objects\n", this->name().c_str(), this->id(), list.size());
+
+  if (level >= 2)
+  {
+    printf("  - listing Instances: \n");
+    for (base_iterator it = list.begin();
+         it != list.end();
+         ++it)
+    {
+      printf("   + %s::%s (%p)\n", (*it)->getClassCName(), (*it)->getCName(), (*it));
+    }
+  }
+}
+
+
+/**
+ * @brief prints out debug output about all Lists
+ * @param level:
+ *  0: list number of ClassList and general info.
+ *  1: 0+List ObjectLists and how many object.
+ *  2: 1+List ObjectLists entries, and information about Objects.
+ */
+void ObjectListBase::debugAll(unsigned int level)
+{
+  printf("Listing all %d ObjectLists \n", ObjectListBase::_classesByID->size());
+
+  for (NameMap::const_iterator it = ObjectListBase::_classesByName->begin();
+       it != ObjectListBase::_classesByName->end();
+       ++it)
+    (*it).second->debug(level);
+}
+
+
+
+/**
+ * @brief Converts an ID into a ClassName String.
+ * @param classID The ID to convert.
+ * @return The ClassName or an empty string if the ID was not found.
+ */
+const std::string& ObjectListBase::IDToString(int classID)
+{
+  const ObjectListBase* const base = ObjectListBase::getObjectList(classID);
+
+  if (base != NULL)
+    return base->name();
+  else
+  {
+    static std::string empty;
+    return empty;
+  }
+}
+
+
+/**
+ * @brief Converts a String into an ID
+ * @param className the Name of the Class to search for
+ * @return The Classes ID if found, -1 otherwise.
+ */
+int ObjectListBase::StringToID(const std::string& className)
+{
+  const ObjectListBase* const base = ObjectListBase::getObjectList(className);
+
+  if (base != NULL)
+    return base->id();
+  else
+    return -1;
+}
Index: trunk/src/lib/lang/object_list.h
===================================================================
--- trunk/src/lib/lang/object_list.h	(revision 9869)
+++ trunk/src/lib/lang/object_list.h	(revision 9869)
@@ -0,0 +1,383 @@
+/*!
+ * @file object_list.h
+ * @brief Definition of a dynamically allocating ClassID
+ *
+ */
+
+#ifndef _OBJECT_LIST_H
+#define _OBJECT_LIST_H
+
+#include "class_id.h"
+#include <map>
+#include <list>
+#include <string>
+
+#include <cassert>
+#include <iostream>
+
+/**
+ * @brief Use this macro to easily declare a Class to store its own ObjectListDeclaration
+ * @param ClassName the Name of the Class.
+ * @note: Using this inside of a Class means, that you loose the member: _objectList, while defining
+ * two new functions objectList() and classID().
+ */
+#define ObjectListDeclaration(ClassName) \
+  public: \
+   static inline const ObjectList<ClassName>& objectList() { return ClassName::_objectList; }; \
+   static inline const ClassID& staticClassID() { return ClassName::_objectList.identity(); }; \
+  private: \
+   static ObjectList<ClassName> _objectList
+
+/**
+ * @brief Use this macro to easily define a Class to store its own ObjectListDefinition
+ * @param ClassName: the Name of the Class.
+ * @param ID: optional set a Fixed ID.
+ */
+#define ObjectListDefinitionID(ClassName, ID) \
+   ObjectList<ClassName> ClassName::_objectList(#ClassName, ID)
+
+/**
+ * @brief Use this macro to easily define a Class to store its own ObjectListDefinition
+ * @param ClassName: the Name of the Class.
+ */
+#define ObjectListDefinition(ClassName) \
+    ObjectListDefinitionID(ClassName, -1)
+
+class BaseObject;
+//! The superclass that all ObjectLists follow.
+/**
+ * @see template<class T> ObjectList<T>
+ */
+class ObjectListBase
+{
+public:
+  /** @brief A Typedefinition for the Base-List that can be retrieved with getBaseObjectList(base_list*) */
+  typedef std::list<BaseObject*>        base_list;
+  /** @brief An iterator for the base_list */
+  typedef base_list::iterator           base_iterator;
+  //! A fast iterator Base-Class, for iterator-casting and storing.
+  /** @note This Iterator is explicitely used only for storage purposes in the BaseObject */
+  class IteratorBase { };
+
+public:
+  /** @returns The Identity of the Class stored within. */
+  inline const ClassID&                 identity() const { return _identity; }
+  /** @returns the ID of the Identity of the ObjectList */
+  inline int                            id() const { return _id; };
+  /** @returns The Name of the Class stored in this ObjectList */
+  inline const std::string&             name() const { return _name; };
+  /** @param id The id to compare @returns true on match, false otherwise */
+  inline bool                           operator==(int id) const { return _id == id; };
+  /** @param id The id to compare @returns true on match, false otherwise */
+  inline bool                           operator==(const ClassID& id) const { return id == _id; };
+  /** @param name The name to compare @returns true on match, false otherwise */
+  inline bool                           operator==(const std::string& name) const { return _name == name; };
+  /** @param id The id to acquire @param name the Name to acquire @brief stores a Name and an ID in a pointer. */
+  inline void                           acquireID(const int*& id, const std::string*& name) const { id = &_id; name = &_name; };
+  /** @brief fills a list of Objects into a BaseObject*-List. @param list the list to fill */
+  virtual void                          getBaseObjectList(base_list* list) const = 0;
+
+  static const ClassID&                 retrieveIdentity(int id);
+  static const ClassID&                 retrieveIdentity(const std::string& name);
+
+  static const ObjectListBase* const    getObjectList(int classID);
+  static const ObjectListBase* const    getObjectList(const std::string& className);
+  static const ObjectListBase* const    getObjectList(const ClassID& classID);
+
+  static BaseObject*                    getBaseObject(int classID, const std::string& objectName);
+  static BaseObject*                    getBaseObject(const std::string& className, const std::string& objectName);
+  static BaseObject*                    getBaseObject(const ClassID& classID, const std::string& objectName);
+
+  /** @returns an Object with Name name out of this List @param name the name of the Object. */
+  virtual BaseObject*                   getBaseObject(const std::string& name) const = 0;
+
+  static const std::list<std::string>&  getClassNames();
+
+
+  static unsigned int                   classCount();
+  void                                  debug(unsigned int level) const;
+  static void                           debugAll(unsigned int level);
+
+  static const std::string&             IDToString(int classID);
+  static int                            StringToID(const std::string& className);
+
+  //! Only used to unsubscribe a BaseObject. (just try to make a valid iterator, stupid :))
+  virtual void                          unregisterObject(IteratorBase* _iterators) = 0;
+  //! Only for debug purposes
+  virtual bool                          checkIteratorInList(IteratorBase* _iterator) const = 0;
+  virtual bool                          checkObjectInList(BaseObject* obj) const = 0;
+
+protected:
+  ObjectListBase(const std::string& className, int id = -1);
+  virtual ~ObjectListBase();
+
+private:
+  /** @brief hidden copy constructor. */
+  ObjectListBase(const ObjectListBase&) {};
+
+  static bool                         classIDExists(int id);
+  static bool                         classNameExists(const std::string& className);
+
+
+protected:
+  typedef std::map<int, ObjectListBase*>         IDMap;   //!< The Generic Map.
+  typedef std::map<std::string, ObjectListBase*> NameMap; //!< The Generic Map.
+
+private:
+  int                           _id;                //!< The Unique ID of the Class.
+  const std::string             _name;              //!< The Name of the Class.
+  ClassID                       _identity;          //!< The Identity of the Class. (equal to _id and _name)
+
+private:
+  static IDMap*                 _classesByID;       //!< A Map of all the classes in existance.
+  static NameMap*               _classesByName;     //!< A Map of all the classes in existance.
+  static std::list<std::string> _classNames;        //!< A list of all the registered ClassNames.
+};
+
+
+/////////////////////////
+//// TEMPLATISATION /////
+/////////////////////////
+//! Defines a ObjectList handler for objects of type T.
+/**
+ * The ObjectList is a generic way to store every object created from a Class 'T'
+ *  in a List. The list can be retrieved, and used constantly over iterators,
+ *  as with normal std::list.
+ *
+ * Furthermore the linkage over the single Lists is given over the Superclass ObjectListBase.
+ *
+ * The approach of ObjectList is an intrusive one, meaning, that each Class that wants to
+ * support it must implement a Declaration and a Definition for the ObjectList, as mentioned
+ * in the next statement:
+ *
+ * To define a Class with a ObjectList, you have to:
+ *  1. Include 'ObjectListDeclaration(T);' in its Declaration (at the beginning)
+ *  2. Include 'ObjectListDefinition(T);' in some Definition file (cc-file)
+ *  3. In the constructor add 'registerObject(this, objectList);'
+ *
+ * @note The Class must define the compare with const std::string& operator for this to work.
+ *  The operator==(const std::string& name) should compare the object's name with name.
+ *
+ *
+ *
+ * Limitations:
+ *  ObjectList cannot be used with other Factory style Classes, if the class is also a BaseObject,
+ *   and not loaded before the ObjectList.
+ *
+ * example: Iterating: Iteration is made easy, and fast as follows:
+ *   for (ObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
+ *      it != PlayerStats::objectList().end();
+ *     ++it)
+ *   {
+ *    (*it)->dosomething
+ *   }
+ *
+ * example: Find an Object:
+ * Playable* playable = Playable::objectList("orxonox-super-rocket-fighter"); // searches an Object By its name.
+ *
+ */
+template<class T>
+class ObjectList : public ObjectListBase
+{
+public:
+  typedef std::list<T*>                  list;             //!< The list of Type T* (used for Objects in this ObjectList)
+  typedef typename list::iterator        iterator;         //!< The iterator for the List of type T (use with ObjectList<Type>::iterator)
+  typedef typename list::const_iterator  const_iterator;   //!< A constant iterator for the List of type T (use with ObjectList<Type>::const_iterator)
+
+
+  //! An iterator to store Objects in the BaseObject, and remove Objects fast.
+class Iterator : public ObjectListBase::IteratorBase
+  {
+  public:
+    /** @brief creates an Iterator fast. @param it the Iterator. */
+    inline Iterator(iterator it) { _it = it; }
+    /** @returns the Iterator */
+    inline iterator& it() { return _it; }
+  private:
+    typename ObjectList::iterator _it;  //!< Stored Iterator
+  };
+
+public:
+  ObjectList(const std::string& name, int id = -1);
+  ~ObjectList();
+
+  virtual BaseObject*                getBaseObject(const std::string& name) const;
+  T*                                 getObject(const std::string& name) const;
+  /** @returns A constant list of Objects of this Class. */
+  inline const list&                 objects() const { return _objects; };
+  bool                               exists(const T* const object) const;
+
+  /** @returns an Iterator to the beginning of the List. */
+  inline iterator                    begin() { return _objects.begin(); };
+  /** @returns a constant Iterator to the beginning of the List. */
+  inline const_iterator              begin() const { return _objects.begin(); };
+  /** @returns an Iterator to the end of the List. */
+  inline iterator                    end() { return _objects.end(); };
+  /** @returns a constant Iterator to the beginning of the List. */
+  inline const_iterator              end() const { return _objects.end(); };
+
+  /** @returns true if the List is empty. */
+  inline bool                        empty() const { return _objects.empty(); };
+  /** @returns the size of the List */
+  inline int                         size() const { return _objects.size(); };
+  /** @returns the frontmost Element of the list (normaly the last added Object). */
+  inline T*                          front() const { return _objects.front(); };
+  /** @returns the last added Object */
+  inline T*                          back() const { return _objects.back(); };
+
+
+  ObjectListBase::IteratorBase*      registerObject(T* object);
+  virtual void                       unregisterObject(IteratorBase* iterator);
+  bool                               checkIteratorInList(IteratorBase* iterator) const;
+  bool                               checkObjectInList(BaseObject* obj) const;
+protected:
+  virtual void                       getBaseObjectList(ObjectListBase::base_list* list) const;
+
+
+private:
+  //! the copy constructor will be hidden.
+  ObjectList(const ObjectList& definer) {};
+
+private:
+  list                _objects;     //!< The List of stored Objects of Type T.
+};
+
+
+
+
+
+/////////////////////////
+//// IMPLEMENTATION /////
+/////////////////////////
+/**
+ * @brief creates a new ObjectList
+ * @param name The name of the Class.
+ * @param id The ID of the class if desired, or -1 if an id should be assigned automatically.
+ */
+template <class T>
+ObjectList<T>::ObjectList(const std::string& name, int id)
+    : ObjectListBase(name, id)
+{}
+
+/**
+ * @brief deletes the ObjectList.
+ */
+template <class T>
+ObjectList<T>::~ObjectList()
+{
+  if (!_objects.empty())
+  {
+    // std::cout << "There are " << this->size() << " objects from class " << this->name() << "(id:" << this->id() << ") in existance\n";
+  }
+}
+
+/**
+ * @brief Retrieves a BaseObject matching the Name name in this List.
+ * @param name the Name of the Object.
+ * @returns a BaseObject pointing to the object if found, NULL otherwise.
+ */
+template <class T>
+BaseObject* ObjectList<T>::getBaseObject(const std::string& name) const
+{
+  return this->getObject(name);
+}
+
+
+
+/**
+ * @brief Retrieves an Object of type T matching the Name name in this List.
+ * @param name the Name of the Object.
+ * @returns an Object of type T pointing to the object if found, NULL otherwise.
+ */
+template <class T>
+T* ObjectList<T>::getObject(const std::string& name) const
+{
+  const_iterator it;
+  for (it = this->_objects.begin(); it != this->_objects.end(); ++it)
+    if ((*it)->getName() == name)
+      return (*it);
+  return NULL;
+}
+
+/**
+ * @brief checks if Object object exists in this ClassList.
+ * @param object the Object to check for
+ * @returns True if the object is found within the List, false otherwise
+ */
+template <class T>
+bool ObjectList<T>::exists(const T* const object) const
+{
+  return (std::find(_objects.begin(), _objects.end(), object) != _objects.end());
+}
+
+
+/**
+ * @brief retrieves a List of BaseObjects
+ * @param list the list to push the ObjectList into.
+ */
+template <class T>
+void ObjectList<T>::getBaseObjectList(ObjectListBase::base_list* list) const
+{
+  assert (list != NULL);
+  const_iterator it;
+  for (it = this->_objects.begin(); it != this->_objects.end(); ++it)
+    list->push_back(*it);
+}
+
+
+/**
+ * @brief registers an Object to the ObjectList.
+ * @param object The Object to register.
+ * @returns a pointer to the iterator inside of the list.
+ */
+template <class T>
+ObjectListBase::IteratorBase* ObjectList<T>::registerObject(T* object)
+{
+  this->_objects.push_back(object);
+  return new Iterator(--this->_objects.end());
+}
+
+/**
+ * @brief removes an Object from the ClassList.
+ * @param iterator the Position at which to remove the Object.
+ */
+template <class T>
+void ObjectList<T>::unregisterObject(IteratorBase* iterator)
+{
+  this->_objects.erase(static_cast<Iterator*>(iterator)->it());
+  //_objects.erase(std::find(_objects.begin(), _objects.end(), object));
+}
+
+template <class T>
+bool ObjectList<T>::checkIteratorInList(IteratorBase* iterator) const
+{
+  const_iterator it;
+  for (it = this->_objects.begin(); it != this->_objects.end(); ++it)
+    if (static_cast<Iterator*>(iterator)->it() == it)
+      return true;
+  printf("ObjectList:: checkIteratorInList:: ITERATOR NOT IN THE LIST '%s' (UN-SYNC SHOULD NOT HAPPEN!!)\n", this->name().c_str());
+  return false;
+}
+
+template <class T>
+bool ObjectList<T>::checkObjectInList(BaseObject* obj) const
+{
+  T* object = dynamic_cast<T*>(obj);
+  if (object != NULL)
+  {
+    printf("EXTREME BUG: Object does not exist anymore!! (or a bug in ObjectList)\n");
+    return false;;
+  }
+
+  const_iterator it;
+  for (it = this->_objects.begin(); it != this->_objects.end(); ++it)
+  {
+    if (*it == object)
+      return true;
+  }
+  printf("ObjectList:: checkObjectInList:: OBJECT NOT IN THE LIST '%s' (UN-SYNC SHOULD NOT HAPPEN!!)\n", this->name().c_str());
+  return false;
+}
+
+
+#endif /* _OBJECT_LIST_H */
Index: trunk/src/lib/lang/test_object_list.cc
===================================================================
--- trunk/src/lib/lang/test_object_list.cc	(revision 9682)
+++ 	(revision )
@@ -1,106 +1,0 @@
-#include "new_class_id.h"
-#include "new_object_list.h"
-#include <iostream>
-
-#include <base_object.h>
-
-class NewBaseObject
-{
-public:
-  //   void setName(const std::string& name) { this->_objectName = name; };
-     const std::string& getName() const { return _objectName; };
-  //   bool operator==(const std::string& name) const { return _objectName == name; };
-
-    NewObjectListDeclaration(NewBaseObject);
-
-protected:
-  NewBaseObject(const std::string& objectName = "") : _objectName(objectName)
-  {
-       this->registerObject(this, objectList);
-  };
-  template<class T>
-  inline void registerObject(T* object, NewObjectList<T>& objectList) { _id.registerObject(object, objectList); };
-protected:
-  NewClassID    _id;
-  std::string   _objectName;
-
-
-};
-NewObjectListDefinition(NewBaseObject);
-
-
-class Test :
-      public   NewBaseObject
-//    ,
-//      public BaseObject
-{
-public:
-  Test();
-  ~Test();
-
-
-  NewObjectListDeclaration(Test);
-  //ObjectListDeclaration(Test);
-};
-NewObjectListDefinitionID(Test, -1);
-
-Test::Test()
-{
-  this->registerObject(this, Test::objectList);
-
-
-//  this->setClassID(CL_PARENT_NODE, "Test");
-  // std::cout << "Test()\n";
-};
-Test::~Test()
-{
-  //  std::cout << "~Test()\n";
-}
-
-class Bone : public Test
-{
-public:
-  Bone()
-  {
-    this->registerObject(this, Bone::objectList);
-    //this->_id.listInheritance();
-    //std::cout << "LeafID:" << this->_id.leafClassID() << std::endl;
-
-    //std::cout << "Bone()\n";
-  };
-  ~Bone()
-  {
-    //  std::cout << "~Bone()\n";
-  };
-  NewObjectListDeclaration(Bone);
-};
-NewObjectListDefinitionID(Bone, -1);
-
-int main()
-{
-#define ITERATIONS 20
-#define COUNT 100
-  for (unsigned int i = 0; i < ITERATIONS; ++i)
-  {
-    std::cout<< i <<  std::endl ;
-    Bone* test = new Bone[COUNT];
-    delete []test;
-  }
-  //   char tmp[100];
-  //   for (unsigned int i = 0 ; i < 100; ++i)
-  //   {
-  //     sprintf(tmp, "Tmp_%d", i);
-  //     test[i].setName(tmp);
-  //   }
-  //   Test::objectList.debug();
-  //   //test->setName("Test-object");
-  //
-  //   std::cout << "Here is debug of all BaseObject\n";
-  //   BaseObject::objectList.debug();
-  // //   delete bone;
-  //   delete []test;
-  //   std::cout << "Again\n";
-  //   BaseObject::objectList.debug();
-
-}
-
Index: trunk/src/lib/network/converter.cc
===================================================================
--- trunk/src/lib/network/converter.cc	(revision 9682)
+++ trunk/src/lib/network/converter.cc	(revision 9869)
@@ -28,5 +28,5 @@
 SHELL_COMMAND_STATIC(debug, Converter, Converter::debug);
 
-
+ObjectListDefinition(Converter);
 /* using namespace std is default, this needs to be here */
 
Index: trunk/src/lib/network/converter.h
===================================================================
--- trunk/src/lib/network/converter.h	(revision 9682)
+++ trunk/src/lib/network/converter.h	(revision 9869)
@@ -24,4 +24,5 @@
 class Converter : public BaseObject
 {
+  ObjectListDeclaration(Converter);
   public:
     static byte* intToByteArray(int x);
Index: trunk/src/lib/network/data_stream.cc
===================================================================
--- trunk/src/lib/network/data_stream.cc	(revision 9682)
+++ trunk/src/lib/network/data_stream.cc	(revision 9869)
@@ -20,6 +20,5 @@
 /* using namespace std is default, this needs to be here */
 
-
-
+ObjectListDefinition(DataStream);
 
 /**
@@ -28,5 +27,4 @@
 DataStream::DataStream()
 {
-  this->setClassID(CL_DATA_STREAM, "DataStream");
   this->upBuffer = new byte[DATA_STREAM_BUFFER_SIZE];
   this->downBuffer = new byte[DATA_STREAM_BUFFER_SIZE];
@@ -38,5 +36,5 @@
 DataStream::DataStream(DataStream& inStream, DataStream& outStream)
 {
-    this->setClassID(CL_DATA_STREAM, "DataStream");
+  this->registerObject(this, DataStream::_objectList);
     this->downStream = &outStream;
     this->upStream = &inStream;
Index: trunk/src/lib/network/data_stream.h
===================================================================
--- trunk/src/lib/network/data_stream.h	(revision 9682)
+++ trunk/src/lib/network/data_stream.h	(revision 9869)
@@ -17,5 +17,6 @@
 class DataStream : public BaseObject
 {
-      public:
+  ObjectListDeclaration(DataStream);
+  public:
       DataStream();
       DataStream(DataStream& inStream, DataStream& outStream);
Index: trunk/src/lib/network/handshake.cc
===================================================================
--- trunk/src/lib/network/handshake.cc	(revision 9682)
+++ trunk/src/lib/network/handshake.cc	(revision 9869)
@@ -23,5 +23,5 @@
 
 
-
+ObjectListDefinition(Handshake);
 
 
@@ -30,5 +30,5 @@
 {
   /* set the class id for the base object */
-  this->setClassID(CL_HANDSHAKE, "Handshake");
+  this->registerObject(this, Handshake::_objectList);
 
 
Index: trunk/src/lib/network/handshake.h
===================================================================
--- trunk/src/lib/network/handshake.h	(revision 9682)
+++ trunk/src/lib/network/handshake.h	(revision 9869)
@@ -42,5 +42,5 @@
 class Handshake : public Synchronizeable
 {
-
+  ObjectListDeclaration(Handshake);
   public:
     Handshake( int nodeType, int clientId = 0, int networkGameManagerId = 0, int messageManagerId = 0 );
Index: trunk/src/lib/network/message_manager.cc
===================================================================
--- trunk/src/lib/network/message_manager.cc	(revision 9682)
+++ trunk/src/lib/network/message_manager.cc	(revision 9869)
@@ -28,5 +28,5 @@
 
 
-
+ObjectListDefinition(MessageManager);
 MessageManager* MessageManager::singletonRef = NULL;
 
@@ -37,5 +37,5 @@
 MessageManager::MessageManager ()
 {
-  this->setClassID( CL_MESSAGE_MANAGER, "MessageManager" );
+  this->registerObject(this, MessageManager::_objectList);
   newNumber = 1;
   setSynchronized( true );
Index: trunk/src/lib/network/message_manager.h
===================================================================
--- trunk/src/lib/network/message_manager.h	(revision 9682)
+++ trunk/src/lib/network/message_manager.h	(revision 9869)
@@ -96,5 +96,5 @@
 class MessageManager : public Synchronizeable {
 
-
+  ObjectListDeclaration(MessageManager);
  public:
    inline static MessageManager * getInstance(){ if (!singletonRef) singletonRef = new MessageManager();  return singletonRef; }
Index: trunk/src/lib/network/monitor/connection_monitor.cc
===================================================================
--- trunk/src/lib/network/monitor/connection_monitor.cc	(revision 9682)
+++ trunk/src/lib/network/monitor/connection_monitor.cc	(revision 9869)
@@ -23,5 +23,5 @@
 /* using namespace std is default, this needs to be here */
 
-
+ObjectListDefinition(ConnectionMonitor);
 /**
  * constructor
@@ -31,5 +31,5 @@
 {
   /* set the class id for the base object and add ist to class list*/
-  this->setClassID(CL_CONNECTION_MONITOR, "ConnectionMonitor");
+  this->registerObject(this, ConnectionMonitor::_objectList);
 
   this->userId = userId;
Index: trunk/src/lib/network/monitor/connection_monitor.h
===================================================================
--- trunk/src/lib/network/monitor/connection_monitor.h	(revision 9682)
+++ trunk/src/lib/network/monitor/connection_monitor.h	(revision 9869)
@@ -19,4 +19,5 @@
 class ConnectionMonitor : virtual public BaseObject
 {
+  ObjectListDeclaration(ConnectionMonitor);
   public:
     ConnectionMonitor( int userId );
Index: trunk/src/lib/network/monitor/network_monitor.cc
===================================================================
--- trunk/src/lib/network/monitor/network_monitor.cc	(revision 9682)
+++ trunk/src/lib/network/monitor/network_monitor.cc	(revision 9869)
@@ -37,4 +37,5 @@
 SHELL_COMMAND(debug, NetworkMonitor, debug);
 
+ObjectListDefinition(NetworkMonitor);
 
 
@@ -45,5 +46,5 @@
   : Synchronizeable()
 {
-  this->setClassID(CL_NETWORK_MONITOR, "NetworkMonitor");
+  this->registerObject(this, NetworkMonitor::_objectList);
 
   this->networkStream = networkStream;
Index: trunk/src/lib/network/monitor/network_monitor.h
===================================================================
--- trunk/src/lib/network/monitor/network_monitor.h	(revision 9682)
+++ trunk/src/lib/network/monitor/network_monitor.h	(revision 9869)
@@ -27,5 +27,5 @@
 class NetworkMonitor : public Synchronizeable
 {
-
+  ObjectListDeclaration(NetworkMonitor);
   public:
     NetworkMonitor(NetworkStream* networkStream);
Index: trunk/src/lib/network/monitor/network_stats_widget.cc
===================================================================
--- trunk/src/lib/network/monitor/network_stats_widget.cc	(revision 9682)
+++ trunk/src/lib/network/monitor/network_stats_widget.cc	(revision 9869)
@@ -20,9 +20,9 @@
 #include "peer_info.h"
 
+#include "loading/resource_manager.h"
+
 #include "multi_type.h"
 
 #include "shell_command.h"
-
-#include "loading/resource_manager.h"
 
 // this fcuk does not work!
@@ -30,5 +30,4 @@
 // ->setAlias("ProxyGui");
 
-
 HostWidget::HostWidget(const std::string& name, const IP& ip)
     : GLGuiBox(OrxGui::Horizontal)
@@ -57,5 +56,5 @@
 {
   if(_font == NULL)
-    _font = new Font(ResourceManager::getInstance()->getDataDir() + "/fonts/arial.ttf", 20);
+    _font = new Font(Resources::ResourceManager::getInstance()->mainGlobalPath().name() + "/fonts/arial.ttf", 20);
 
   //this->_name.setFont(*_font);
@@ -211,4 +210,6 @@
 //======================================================//
 
+
+ObjectListDefinition(NetworkStatsWidget);
 /**
  * @brief standard constructor
@@ -273,16 +274,13 @@
 NetworkStatsWidget* NetworkStatsWidget::_statsWidget = NULL;
 
-#include "class_list.h"
-
 void NetworkStatsWidget::toggleGUI()
 {
-  BaseObject* bo = NULL;
-  const std::list<BaseObject*>* ls = ClassList::getList(CL_NETWORK_MONITOR);
-  if (ls != NULL && !ls->empty())
-    bo = ls->front();
-
-  if (bo != NULL && NetworkStatsWidget::_statsWidget == NULL)
-  {
-    NetworkStatsWidget::_statsWidget = new NetworkStatsWidget(dynamic_cast<NetworkMonitor*> (bo));
+  NetworkMonitor* monitor;
+  if (!NetworkMonitor::objectList().empty())
+    monitor = NetworkMonitor::objectList().front();
+
+  if (monitor != NULL && NetworkStatsWidget::_statsWidget == NULL)
+  {
+    NetworkStatsWidget::_statsWidget = new NetworkStatsWidget(monitor);
     NetworkStatsWidget::_statsWidget->showAll();
   }
Index: trunk/src/lib/network/monitor/network_stats_widget.h
===================================================================
--- trunk/src/lib/network/monitor/network_stats_widget.h	(revision 9682)
+++ trunk/src/lib/network/monitor/network_stats_widget.h	(revision 9869)
@@ -81,4 +81,5 @@
 class NetworkStatsWidget : public OrxGui::GLGuiFixedpositionBox
 {
+  ObjectListDeclaration(NetworkStatsWidget);
   public:
     static void toggleGUI();
Index: trunk/src/lib/network/network_game_manager.cc
===================================================================
--- trunk/src/lib/network/network_game_manager.cc	(revision 9682)
+++ trunk/src/lib/network/network_game_manager.cc	(revision 9869)
@@ -23,5 +23,4 @@
 #include "util/loading/factory.h"
 #include "state.h"
-#include "class_list.h"
 #include "debug.h"
 
@@ -43,9 +42,9 @@
 #include "multiplayer_team_deathmatch.h"
 
-#include "preferences.h"
-
-
-
-
+#include "parser/preferences/preferences.h"
+
+
+
+ObjectListDefinition(NetworkGameManager);
 NetworkGameManager* NetworkGameManager::singletonRef = NULL;
 
@@ -59,5 +58,5 @@
 
   /* set the class id for the base object */
-  this->setClassID(CL_NETWORK_GAME_MANAGER, "NetworkGameManager");
+  this->registerObject(this, NetworkGameManager::_objectList);
 
   this->setSynchronized(true);
@@ -93,10 +92,10 @@
   assert( SharedNetworkData::getInstance()->isMasterServer());
   assert( State::getGameRules() );
-  assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
+  assert( State::getGameRules()->isA( NetworkGameRules::staticClassID()) );
 
   NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
 
   int          team = rules.getTeamForNewUser();
-  ClassID      playableClassId = rules.getPlayableClassId( userId, team );
+  ClassID   playableClassId = rules.getPlayableClassId( userId, team );
   std::string  playableModel = rules.getPlayableModelFileName( userId, team, playableClassId );
   std::string  playableTexture = rules.getPlayableModelFileName( userId, team, playableClassId );
@@ -106,5 +105,5 @@
 
   assert( bo != NULL );
-  assert( bo->isA( CL_PLAYABLE ) );
+  assert( bo->isA( Playable::staticClassID()) );
 
   Playable & playable = *(dynamic_cast<Playable*>(bo));
@@ -131,5 +130,5 @@
     stats->setNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Server" ) );
 
-  if ( rules.isA( CL_MULTIPLAYER_TEAM_DEATHMATCH ) )
+  if ( rules.isA( MultiplayerTeamDeathmatch::staticClassID()) )
     dynamic_cast<MultiplayerTeamDeathmatch*>(&rules)->respawnPlayable( &playable, team, 0.0f );
 
@@ -187,11 +186,11 @@
   }
 
-  const std::list<BaseObject*> * list = ClassList::getList( CL_SYNCHRONIZEABLE );
-
-  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
-  {
-    if ( dynamic_cast<Synchronizeable*>(*it)->getUniqueID() == uniqueId )
+  for (ObjectList<Synchronizeable>::const_iterator it = Synchronizeable::objectList().begin();
+       it != Synchronizeable::objectList().end();
+      ++it)
+  {
+    if ( (*it)->getUniqueID() == uniqueId )
     {
-      if ( (*it)->isA(CL_PLAYABLE) )
+      if ( (*it)->isA(Playable::staticClassID()) )
       {
         getInstance()->playablesToDelete.push_back( dynamic_cast<Playable*>(*it) );
@@ -199,5 +198,5 @@
       }
 
-      delete dynamic_cast<Synchronizeable*>(*it);
+      delete (*it);
       return true;
     }
@@ -297,7 +296,5 @@
     if ( State::getPlayer()->getPlayable() != *it )
     {
-      const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
-
-      if ( list && std::find( list->begin(), list->end(), *it ) != list->end() )
+      if ( std::find( Playable::objectList().begin(), Playable::objectList().end(), *it ) != Playable::objectList().end() )
       {
         PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassCName(), (*it)->getOwner() );
@@ -324,5 +321,5 @@
 
   assert( State::getGameRules() );
-  assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
+  assert( State::getGameRules()->isA( NetworkGameRules::staticClassID()) );
 
   NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
Index: trunk/src/lib/network/network_game_manager.h
===================================================================
--- trunk/src/lib/network/network_game_manager.h	(revision 9682)
+++ trunk/src/lib/network/network_game_manager.h	(revision 9869)
@@ -33,9 +33,9 @@
 class NetworkGameManager: public Synchronizeable
 {
-
+  ObjectListDeclaration(NetworkGameManager);
   public:
     virtual ~NetworkGameManager();
 
-    static NetworkGameManager* NetworkGameManager::getInstance()
+    static NetworkGameManager* getInstance()
     { if (!NetworkGameManager::singletonRef) NetworkGameManager::singletonRef = new NetworkGameManager(); return NetworkGameManager::singletonRef; }
 
Index: trunk/src/lib/network/network_log.cc
===================================================================
--- trunk/src/lib/network/network_log.cc	(revision 9682)
+++ trunk/src/lib/network/network_log.cc	(revision 9869)
@@ -15,4 +15,5 @@
 
 #include "network_log.h"
+#include <cassert>
 
 /**
@@ -53,11 +54,11 @@
     return false;
   }
-  
+
   listensock = SDLNet_TCP_Open( &ip );
-  
+
   if( !listensock ) {
     PRINT(1)( "SDLNet_TCP_Open: %s\n", SDLNet_GetError() );
     return false;
-  } 
+  }
 
   return true;
@@ -71,9 +72,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
- 
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   printfnet();
 }
@@ -85,5 +86,5 @@
 {
   TCPsocket newSock = SDLNet_TCP_Accept( listensock );
-  
+
   if ( newSock )
     sockets.push_back( newSock );
@@ -97,9 +98,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(0)( buf );
   printfnet();
@@ -114,9 +115,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(1)( buf );
   printfnet();
@@ -131,9 +132,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(2)( buf );
   printfnet();
@@ -148,9 +149,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(3)( buf );
   printfnet();
@@ -165,9 +166,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(4)( buf );
   printfnet();
@@ -182,9 +183,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(5)( buf );
   printfnet();
@@ -200,5 +201,5 @@
   if ( !listensock )
     return;
-  
+
   acceptNewConnections();
 
@@ -213,5 +214,5 @@
       continue;
     }
-    
+
     it++;
   }
Index: trunk/src/lib/network/network_log.h
===================================================================
--- trunk/src/lib/network/network_log.h	(revision 9682)
+++ trunk/src/lib/network/network_log.h	(revision 9869)
@@ -38,5 +38,4 @@
 class NetworkLog
 {
-
   public:
     virtual ~NetworkLog(void);
Index: trunk/src/lib/network/network_manager.cc
===================================================================
--- trunk/src/lib/network/network_manager.cc	(revision 9682)
+++ trunk/src/lib/network/network_manager.cc	(revision 9869)
@@ -20,5 +20,4 @@
 #define DEBUG_MODULE_NETWORK
 
-#include "class_list.h"
 #include "debug.h"
 #include "shell_command.h"
@@ -28,5 +27,5 @@
 #include "shared_network_data.h"
 #include "network_stream.h"
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 #include "network_log.h"
 #include "network_game_manager.h"
@@ -41,5 +40,5 @@
 
 
-
+ObjectListDefinition(NetworkManager);
 NetworkManager* NetworkManager::singletonRef = NULL;
 
@@ -50,5 +49,5 @@
 {
   /* set the class id for the base object */
-  this->setClassID(CL_NETWORK_MANAGER, "NetworkManager");
+  this->registerObject(this, NetworkManager::_objectList);
   PRINTF(0)("START\n");
 
Index: trunk/src/lib/network/network_manager.h
===================================================================
--- trunk/src/lib/network/network_manager.h	(revision 9682)
+++ trunk/src/lib/network/network_manager.h	(revision 9869)
@@ -25,5 +25,5 @@
 class NetworkManager : public BaseObject
 {
-
+  ObjectListDeclaration(NetworkManager);
   public:
 
Index: trunk/src/lib/network/network_protocol.cc
===================================================================
--- trunk/src/lib/network/network_protocol.cc	(revision 9682)
+++ trunk/src/lib/network/network_protocol.cc	(revision 9869)
@@ -35,5 +35,5 @@
 
 
-
+ObjectListDefinition(NetworkProtocol);
 /**
   standard constructor
@@ -42,5 +42,5 @@
 {
   /* set the class id for the base object */
-  this->setClassID(CL_NETWORK_PROTOCOL, "NetworkProtocol");
+  this->registerObject(this, NetworkProtocol::_objectList);
   this->headerLength = INTSIZE+FLOATSIZE;
 }
Index: trunk/src/lib/network/network_protocol.h
===================================================================
--- trunk/src/lib/network/network_protocol.h	(revision 9682)
+++ trunk/src/lib/network/network_protocol.h	(revision 9869)
@@ -25,4 +25,5 @@
 class NetworkProtocol : virtual public BaseObject
 {
+  ObjectListDeclaration(NetworkProtocol);
   public:
     NetworkProtocol();
Index: trunk/src/lib/network/network_socket.cc
===================================================================
--- trunk/src/lib/network/network_socket.cc	(revision 9682)
+++ trunk/src/lib/network/network_socket.cc	(revision 9869)
@@ -24,7 +24,5 @@
 #include "network_socket.h"
 
-/* header for debug output */
-#include "debug.h"
-
+ObjectListDefinition(NetworkSocket);
 /**
  * Default constructor
Index: trunk/src/lib/network/network_socket.h
===================================================================
--- trunk/src/lib/network/network_socket.h	(revision 9682)
+++ trunk/src/lib/network/network_socket.h	(revision 9869)
@@ -17,4 +17,5 @@
 class NetworkSocket : public BaseObject
 {
+  ObjectListDeclaration(NetworkSocket);
   public:
     NetworkSocket();
Index: trunk/src/lib/network/network_stream.cc
===================================================================
--- trunk/src/lib/network/network_stream.cc	(revision 9682)
+++ trunk/src/lib/network/network_stream.cc	(revision 9869)
@@ -33,19 +33,15 @@
 #include "shared_network_data.h"
 #include "message_manager.h"
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 #include "zip.h"
 
-#include "src/lib/util/loading/resource_manager.h"
-
 #include "network_log.h"
 
 #include "player_stats.h"
 
-#include "lib/util/loading/factory.h"
+#include "loading/factory.h"
+#include "loading/resource_manager.h"
 
 #include "debug.h"
-#include "class_list.h"
-#include <algorithm>
-
 
 #include "network_stream.h"
@@ -57,5 +53,5 @@
 #define PACKAGE_SIZE  256
 
-
+ObjectListDefinition(NetworkStream);
 /**
  * empty constructor
@@ -118,5 +114,5 @@
 {
   /* set the class id for the base object */
-  this->setClassID(CL_NETWORK_STREAM, "NetworkStream");
+  this->registerObject(this, NetworkStream::_objectList);
   this->clientSocket = NULL;
   this->clientSoftSocket = NULL;
@@ -970,5 +966,5 @@
 
       // if handshake not finished only sync handshake
-      if ( peer->second.handshake && sync.getLeafClassID() != CL_HANDSHAKE )
+      if ( peer->second.handshake && Handshake::staticClassID() != sync.getLeafClassID())
         continue;
 
@@ -976,10 +972,10 @@
       if ( ( SharedNetworkData::getInstance()->isMasterServer() ||
              SharedNetworkData::getInstance()->isProxyServerActive() &&  peer->second.isClient())
-             && sync.getLeafClassID() == CL_HANDSHAKE && sync.getUniqueID() != peer->second.userId )
+	     && Handshake::staticClassID() == sync.getLeafClassID() && sync.getUniqueID() != peer->second.userId )
         continue;
 
       /* list of synchronizeables that will never be synchronized over the network: */
       // do not sync null parent
-      if ( sync.getLeafClassID() == CL_NULL_PARENT )
+      if ( NullParent::staticClassID() == sync.getLeafClassID())
         continue;
 
@@ -1190,5 +1186,5 @@
           /* These are some small exeptions in creation: Not all objects can/should be created via Factory */
           /* Exception 1: NullParent */
-          if( leafClassId == CL_NULL_PARENT || leafClassId == CL_SYNCHRONIZEABLE || leafClassId == CL_NETWORK_GAME_MANAGER )
+	  if( NullParent::staticClassID() == leafClassId || Synchronizeable::staticClassID() == leafClassId || NetworkGameManager::staticClassID() == leafClassId)
           {
             PRINTF(1)("Don't create Object with ID %x, ignored!\n", (int)leafClassId);
@@ -1197,5 +1193,5 @@
           }
           else
-            b = Factory::fabricate( (ClassID)leafClassId );
+	    ; /// FIXME CLASS_ID :: b = Factory::fabricate( leafClassId );
 
           if ( !b )
@@ -1206,5 +1202,5 @@
           }
 
-          if ( b->isA(CL_SYNCHRONIZEABLE) )
+	  if ( b->isA(Synchronizeable::staticClassID()) )
           {
             sync = dynamic_cast<Synchronizeable*>(b);
@@ -1303,5 +1299,5 @@
     length = remainingBytesToWriteToDict;
 
-  std::string fileName = ResourceManager::getInstance()->getDataDir();
+  std::string fileName = Resources::ResourceManager::getInstance()->mainGlobalPath().name();
   fileName += "/dicts/newdict";
 
Index: trunk/src/lib/network/network_stream.h
===================================================================
--- trunk/src/lib/network/network_stream.h	(revision 9682)
+++ trunk/src/lib/network/network_stream.h	(revision 9869)
@@ -33,5 +33,5 @@
 class NetworkStream : public DataStream
 {
-
+  ObjectListDeclaration(NetworkStream);
   public:
     NetworkStream();
Index: trunk/src/lib/network/player_stats.cc
===================================================================
--- trunk/src/lib/network/player_stats.cc	(revision 9682)
+++ trunk/src/lib/network/player_stats.cc	(revision 9869)
@@ -16,8 +16,8 @@
 #include "player_stats.h"
 
-#include "class_list.h"
 #include "src/lib/util/loading/factory.h"
 
 #include "player.h"
+#include "playable.h"
 #include "state.h"
 #include "shared_network_data.h"
@@ -25,12 +25,13 @@
 #include "converter.h"
 
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 
 #include "debug.h"
 #include "shell_command.h"
 
-
-CREATE_FACTORY(PlayerStats, CL_PLAYER_STATS);
-
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(PlayerStats, CL_PLAYER_STATS);
+CREATE_FACTORY(PlayerStats);
 
 /**
@@ -54,5 +55,5 @@
 void PlayerStats::init( )
 {
-  this->setClassID( CL_PLAYER_STATS, "PlayerStats" );
+  this->registerObject(this, PlayerStats::_objectList);
 
   this->assignedUserId = 0;
@@ -122,21 +123,11 @@
 PlayerStats * PlayerStats::getStats( int userId )
 {
-  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
-
-  if ( !list )
-  {
-    return NULL;
-  }
-
-  for ( std::list<BaseObject*>::const_iterator it = list->
-        begin();
-        it != list->end();
-        it++ )
-  {
-
-
-    if ( dynamic_cast<PlayerStats*>(*it)->getAssignedUserId() == userId )
+  for (ObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
+       it != PlayerStats::objectList().end();
+       ++it)
+  {
+    if ( (*it)->getAssignedUserId() == userId )
     {
-      return dynamic_cast<PlayerStats*>(*it);
+      return (*it);
     }
   }
@@ -150,22 +141,12 @@
 void PlayerStats::setPlayableUniqueId( int uniqueId )
 {
-  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
-
-  if ( !list )
-  {
-    this->playableUniqueId = uniqueId;
-    return;
-  }
-
   this->playable = NULL;
-  for ( std::list<BaseObject*>::const_iterator it = list->
-        begin();
-        it != list->end();
-        it++ )
-  {
-    if ( dynamic_cast<Playable*>(*it)->
-         getUniqueID() == uniqueId )
+  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
+       it != Playable::objectList().end();
+       ++it)
+  {
+    if ( (*it)->getUniqueID() == uniqueId )
     {
-      this->playable = dynamic_cast<Playable*>(*it);
+      this->playable = (*it);
       //TODO when OM_PLAYERS is ticked add line:
       //this->playable->toList( OM_PLAYERS );
@@ -174,6 +155,5 @@
   }
 
-  if ( this->playable && this->assignedUserId == SharedNetworkData::getInstance()
-       ->getHostID() )
+  if ( this->playable && this->assignedUserId == SharedNetworkData::getInstance()->getHostID() )
   {
     State::getPlayer()->setPlayable( this->playable );
@@ -272,8 +252,7 @@
 void PlayerStats::deleteAllPlayerStats( )
 {
-  const std::list<BaseObject*> * list;
-
-  while ( (list  = ClassList::getList( CL_PLAYER_STATS )) != NULL && list->begin() != list->end() )
-    delete *list->begin();
+
+  while(!PlayerStats::objectList().empty())
+    delete PlayerStats::objectList().front();
 }
 
@@ -287,17 +266,9 @@
   ScoreList result;
 
-  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
-
-  if ( !list )
-  {
-    return result;
-  }
-
-  for ( std::list<BaseObject*>::const_iterator it = list->
-        begin();
-        it != list->end();
-        it++ )
-  {
-    PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
+  for (ObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
+       it != PlayerStats::objectList().end();
+       ++it)
+  {
+    PlayerStats& stats = *(*it);
 
     TeamScoreList::iterator it = result[stats.getTeamId()].begin();
Index: trunk/src/lib/network/player_stats.h
===================================================================
--- trunk/src/lib/network/player_stats.h	(revision 9682)
+++ trunk/src/lib/network/player_stats.h	(revision 9869)
@@ -36,5 +36,5 @@
 class PlayerStats : public Synchronizeable
 {
-
+  ObjectListDeclaration(PlayerStats);
   public:
     PlayerStats( const TiXmlElement* root = NULL );
@@ -58,5 +58,5 @@
 
     inline int getPlayableClassId(){ return playableClassId; }
-    void setPlayableClassId( int classId ){ this->playableClassId = classId; };
+    void setPlayableClassId( const ClassID& classId ){ this->playableClassId = classId.id(); };
 
     inline int getPlayableUniqueId(){ return playableUniqueId; }
Index: trunk/src/lib/network/proxy/network_settings.cc
===================================================================
--- trunk/src/lib/network/proxy/network_settings.cc	(revision 9682)
+++ trunk/src/lib/network/proxy/network_settings.cc	(revision 9869)
@@ -21,10 +21,10 @@
 #include "shared_network_data.h"
 
+#include "loading/load_param.h"
 #include "loading/resource_manager.h"
-#include "loading/load_param.h"
-
 #include "debug.h"
 
 
+ObjectListDefinition(NetworkSettings);
 
 NetworkSettings* NetworkSettings::singletonRef = NULL;
@@ -36,5 +36,5 @@
 {
   /* set the class id for the base object */
-  this->setClassID(CL_NETWORK_SETTINGS, "NetworkSettings");
+  this->registerObject(this, NetworkSettings::_objectList);
 
   // suggest a good standard max players value
@@ -64,5 +64,5 @@
 void NetworkSettings::loadData()
 {
-  std::string fileName = ResourceManager::getInstance()->getDataDir();
+  std::string fileName = Resources::ResourceManager::getInstance()->mainGlobalPath().name();
   fileName += "configs/network_settings.conf";
 
Index: trunk/src/lib/network/proxy/network_settings.h
===================================================================
--- trunk/src/lib/network/proxy/network_settings.h	(revision 9682)
+++ trunk/src/lib/network/proxy/network_settings.h	(revision 9869)
@@ -24,5 +24,5 @@
 class NetworkSettings : public BaseObject
 {
-
+  ObjectListDeclaration(NetworkSettings);
   public:
     inline static NetworkSettings* getInstance() { if (!NetworkSettings::singletonRef) NetworkSettings::singletonRef = new NetworkSettings();
Index: trunk/src/lib/network/proxy/proxy_control.cc
===================================================================
--- trunk/src/lib/network/proxy/proxy_control.cc	(revision 9682)
+++ trunk/src/lib/network/proxy/proxy_control.cc	(revision 9869)
@@ -15,5 +15,4 @@
 #include "proxy_control.h"
 
-#include "class_list.h"
 #include "shell_command.h"
 
@@ -28,5 +27,5 @@
 #include "converter.h"
 
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 
 #include "debug.h"
@@ -41,4 +40,5 @@
 
 SHELL_COMMAND(forceReconnect, ProxyControl, forceReconnectionShell);
+ObjectListDefinition(ProxyControl);
 
 /**
@@ -47,5 +47,5 @@
 ProxyControl::ProxyControl()
 {
-  this->setClassID( CL_PROXY_CONTROL, "ProxyControl" );
+  this->registerObject(this, ProxyControl::_objectList);
 
   this->setSynchronized(false);
Index: trunk/src/lib/network/proxy/proxy_control.h
===================================================================
--- trunk/src/lib/network/proxy/proxy_control.h	(revision 9682)
+++ trunk/src/lib/network/proxy/proxy_control.h	(revision 9869)
@@ -30,5 +30,5 @@
 class ProxyControl : public Synchronizeable
 {
-
+  ObjectListDeclaration(ProxyControl);
   public:
     inline static ProxyControl* getInstance() { if (!ProxyControl::singletonRef) ProxyControl::singletonRef = new ProxyControl();
Index: trunk/src/lib/network/server_socket.cc
===================================================================
--- trunk/src/lib/network/server_socket.cc	(revision 9682)
+++ trunk/src/lib/network/server_socket.cc	(revision 9869)
@@ -23,8 +23,5 @@
 #include "server_socket.h"
 
-/* header for debug output */
-#include "debug.h"
-
-
+ObjectListDefinition(ServerSocket);
 /**
  * constructor
Index: trunk/src/lib/network/server_socket.h
===================================================================
--- trunk/src/lib/network/server_socket.h	(revision 9682)
+++ trunk/src/lib/network/server_socket.h	(revision 9869)
@@ -19,4 +19,5 @@
 class ServerSocket : public BaseObject
 {
+  ObjectListDeclaration(ServerSocket);
   public:
     ServerSocket( int port);
Index: trunk/src/lib/network/shared_network_data.cc
===================================================================
--- trunk/src/lib/network/shared_network_data.cc	(revision 9682)
+++ trunk/src/lib/network/shared_network_data.cc	(revision 9869)
@@ -25,5 +25,5 @@
 
 
-
+ObjectListDefinition(SharedNetworkData);
 SharedNetworkData* SharedNetworkData::singletonRef = NULL;
 
@@ -34,5 +34,5 @@
 {
   /* set the class id for the base object */
-  this->setClassID(CL_SHARED_NETWORK_DATA, "SharedNetworkData");
+  this->registerObject(this, SharedNetworkData::_objectList);
 
   this->nodeType = NET_MASTER_SERVER;
Index: trunk/src/lib/network/shared_network_data.h
===================================================================
--- trunk/src/lib/network/shared_network_data.h	(revision 9682)
+++ trunk/src/lib/network/shared_network_data.h	(revision 9869)
@@ -22,5 +22,5 @@
 class SharedNetworkData : public BaseObject
 {
-
+  ObjectListDeclaration(SharedNetworkData);
   public:
     inline static SharedNetworkData* getInstance() { if (!SharedNetworkData::singletonRef) SharedNetworkData::singletonRef = new SharedNetworkData();
Index: trunk/src/lib/network/synchronizeable.cc
===================================================================
--- trunk/src/lib/network/synchronizeable.cc	(revision 9682)
+++ trunk/src/lib/network/synchronizeable.cc	(revision 9869)
@@ -32,4 +32,5 @@
 
 
+ObjectListDefinition(Synchronizeable);
 
 /**
@@ -38,5 +39,5 @@
 Synchronizeable::Synchronizeable()
 {
-  this->setClassID(CL_SYNCHRONIZEABLE, "Synchronizeable");
+  this->registerObject(this, Synchronizeable::_objectList);
   this->owner = 0;
 //   this->setIsServer(SharedNetworkData::getInstance()->getHostID() == 0);
@@ -74,5 +75,5 @@
     // remove the message manager only by the server
     if ( (SharedNetworkData::getInstance()->isMasterServer() )
-           && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( CL_MESSAGE_MANAGER ) )
+	  && this->beSynchronized() && this->getUniqueID() > 0 && !this->isA( MessageManager::staticClassID() ) )
       NetworkGameManager::getInstance()->removeSynchronizeable( this->getUniqueID() );
   }
Index: trunk/src/lib/network/synchronizeable.h
===================================================================
--- trunk/src/lib/network/synchronizeable.h	(revision 9682)
+++ trunk/src/lib/network/synchronizeable.h	(revision 9869)
@@ -41,4 +41,5 @@
 class Synchronizeable : virtual public BaseObject
 {
+  ObjectListDeclaration(Synchronizeable);
 
   public:
Index: trunk/src/lib/network/tcp_server_socket.cc
===================================================================
--- trunk/src/lib/network/tcp_server_socket.cc	(revision 9682)
+++ trunk/src/lib/network/tcp_server_socket.cc	(revision 9869)
@@ -26,4 +26,5 @@
 #include "debug.h"
 
+ObjectListDefinition(TcpServerSocket);
 TcpServerSocket::TcpServerSocket( int port ) : ServerSocket( port )
 {
@@ -48,5 +49,5 @@
 {
   /* set the class id for the base object */
-  this->setClassID(CL_SERVER_SOCKET, "TcpServerSocket");
+  this->registerObject(this, TcpServerSocket::_objectList);
 
   terminateThread = false;
Index: trunk/src/lib/network/tcp_server_socket.h
===================================================================
--- trunk/src/lib/network/tcp_server_socket.h	(revision 9682)
+++ trunk/src/lib/network/tcp_server_socket.h	(revision 9869)
@@ -19,4 +19,5 @@
 class TcpServerSocket : public ServerSocket
 {
+  ObjectListDeclaration(TcpServerSocket);
   public:
     TcpServerSocket( int port );
Index: trunk/src/lib/network/tcp_socket.cc
===================================================================
--- trunk/src/lib/network/tcp_socket.cc	(revision 9682)
+++ trunk/src/lib/network/tcp_socket.cc	(revision 9869)
@@ -30,4 +30,5 @@
 #include "debug.h"
 
+ObjectListDefinition(TcpSocket);
 /**
  * Default constructor
@@ -60,5 +61,5 @@
 {
   /* set the class id for the base object */
-  this->setClassID(CL_NETWORK_SOCKET, "TcpSocket");
+  this->registerObject(this, TcpSocket::_objectList);
 
   tcpSocket = NULL;
@@ -122,7 +123,7 @@
 {
   IPaddress ip;
-  
-  bOk = true; 
-  
+
+  bOk = true;
+
   if ( SDLNet_ResolveHost( &ip, host.c_str(), port ) != 0 )
   {
@@ -131,5 +132,5 @@
     return;
   }
-  
+
   //check if not already connected or listening
   if (tcpSocket)
@@ -345,7 +346,7 @@
 }
 #endif
-  
+
   PRINTF(0)("QUIT READ THREAD\n");
-  
+
   return 0;
 }
@@ -425,5 +426,5 @@
 
   return 0;
-  
+
 }
 
Index: trunk/src/lib/network/tcp_socket.h
===================================================================
--- trunk/src/lib/network/tcp_socket.h	(revision 9682)
+++ trunk/src/lib/network/tcp_socket.h	(revision 9869)
@@ -40,4 +40,5 @@
 class TcpSocket : public NetworkSocket
 {
+  ObjectListDeclaration(TcpSocket);
   public:
     TcpSocket();
Index: trunk/src/lib/network/udp_broadcast.cc
===================================================================
--- trunk/src/lib/network/udp_broadcast.cc	(revision 9682)
+++ trunk/src/lib/network/udp_broadcast.cc	(revision 9869)
@@ -26,11 +26,11 @@
   this->port = 0;
   packet = SDLNet_AllocPacket( BROADCAST_PACKET_SIZE );
-  
-  if ( !packet ) 
+
+  if ( !packet )
   {
     printf( "SDLNet_AllocPacket: %s\n", SDLNet_GetError() );
     assert( packet );
   }
-  
+
   this->socket = NULL;
 }
@@ -47,5 +47,5 @@
     this->packet = NULL;
   }
-  
+
   if ( this->socket )
   {
@@ -53,10 +53,10 @@
     this->socket = NULL;
   }
-  
+
 }
 
 /**
  * listen for incoming broadcast packets
- * @param port port to listen on 
+ * @param port port to listen on
  * @return true on success
  */
@@ -74,5 +74,5 @@
 {
   this->port = port;
-  
+
   return true;
 }
@@ -80,5 +80,5 @@
 /**
  * send packet
- * @param data data to send 
+ * @param data data to send
  * @param length length of data
  * @param ip if ip == NULL broadcast is used
Index: trunk/src/lib/network/udp_broadcast.h
===================================================================
--- trunk/src/lib/network/udp_broadcast.h	(revision 9682)
+++ trunk/src/lib/network/udp_broadcast.h	(revision 9869)
@@ -15,9 +15,8 @@
 class UdpBroadcast
 {
-
   public:
     UdpBroadcast();
     virtual ~UdpBroadcast();
-    
+
     bool listen( int port );
     bool open( int port );
Index: trunk/src/lib/network/udp_server_socket.cc
===================================================================
--- trunk/src/lib/network/udp_server_socket.cc	(revision 9682)
+++ trunk/src/lib/network/udp_server_socket.cc	(revision 9869)
@@ -18,5 +18,5 @@
 
 
-
+ObjectListDefinition(UdpServerSocket);
 /**
  * constructor
Index: trunk/src/lib/network/udp_server_socket.h
===================================================================
--- trunk/src/lib/network/udp_server_socket.h	(revision 9682)
+++ trunk/src/lib/network/udp_server_socket.h	(revision 9869)
@@ -50,4 +50,5 @@
 class UdpServerSocket : public ServerSocket
 {
+  ObjectListDeclaration(UdpServerSocket);
   public:
     UdpServerSocket( int port);
Index: trunk/src/lib/network/udp_socket.cc
===================================================================
--- trunk/src/lib/network/udp_socket.cc	(revision 9682)
+++ trunk/src/lib/network/udp_socket.cc	(revision 9869)
@@ -18,4 +18,5 @@
 #include "debug.h"
 
+ObjectListDefinition(UdpSocket);
 
 void UdpSocket::init( )
Index: trunk/src/lib/network/udp_socket.h
===================================================================
--- trunk/src/lib/network/udp_socket.h	(revision 9682)
+++ trunk/src/lib/network/udp_socket.h	(revision 9869)
@@ -24,4 +24,5 @@
 class UdpSocket : public NetworkSocket
 {
+  ObjectListDeclaration(UdpSocket);
   public:
     UdpSocket();
Index: trunk/src/lib/network/zip.cc
===================================================================
--- trunk/src/lib/network/zip.cc	(revision 9682)
+++ trunk/src/lib/network/zip.cc	(revision 9869)
@@ -15,6 +15,5 @@
 
 #include "zip.h"
-
-#include "src/lib/util/loading/resource_manager.h"
+#include "loading/resource_manager.h"
 #include "debug.h"
 
@@ -51,5 +50,5 @@
 int Zip::loadDictionary( std::string name )
 {
-  std::string fileName = ResourceManager::getInstance()->getDataDir();
+  std::string fileName = Resources::ResourceManager::getInstance()->mainGlobalPath().name();
   //PRINTF(0)("datadir: %s\n", fileName.c_str());
   fileName = fileName + "/dicts/" + name;
Index: trunk/src/lib/parser/Makefile.am
===================================================================
--- trunk/src/lib/parser/Makefile.am	(revision 9682)
+++ trunk/src/lib/parser/Makefile.am	(revision 9869)
@@ -2,6 +2,6 @@
           tinyxml \
 	  ini_parser \
-	  preferences \
-	  cmdline_parser
+	  cmdline_parser \
+	  preferences
 
 
Index: trunk/src/lib/parser/cmdline_parser/Makefile.am
===================================================================
--- trunk/src/lib/parser/cmdline_parser/Makefile.am	(revision 9682)
+++ trunk/src/lib/parser/cmdline_parser/Makefile.am	(revision 9869)
@@ -1,2 +1,4 @@
+
+INCLUDES = -I../../..
 
 noinst_LIBRARIES = libCmdLineParser.a
Index: trunk/src/lib/parser/cmdline_parser/cmdline_parser.cc
===================================================================
--- trunk/src/lib/parser/cmdline_parser/cmdline_parser.cc	(revision 9682)
+++ trunk/src/lib/parser/cmdline_parser/cmdline_parser.cc	(revision 9869)
@@ -16,4 +16,5 @@
 #include "cmdline_parser.h"
 
+#include <cassert>
 #include "src/lib/util/substring.h"
 
Index: trunk/src/lib/parser/cmdline_parser/cmdline_parser.h
===================================================================
--- trunk/src/lib/parser/cmdline_parser/cmdline_parser.h	(revision 9682)
+++ trunk/src/lib/parser/cmdline_parser/cmdline_parser.h	(revision 9869)
@@ -11,6 +11,6 @@
 #include <vector>
 
-#include "src/defs/debug.h"
-#include "src/lib/util/multi_type.h"
+#include "lib/util/debug.h"
+#include "lib/util/multi_type.h"
 
 
Index: trunk/src/lib/parser/ini_parser/Makefile.am
===================================================================
--- trunk/src/lib/parser/ini_parser/Makefile.am	(revision 9682)
+++ trunk/src/lib/parser/ini_parser/Makefile.am	(revision 9869)
@@ -1,3 +1,3 @@
-INCLUDES=-I../../util
+INCLUDES = -I../../..
 
 
Index: trunk/src/lib/parser/ini_parser/ini_parser.cc
===================================================================
--- trunk/src/lib/parser/ini_parser/ini_parser.cc	(revision 9682)
+++ trunk/src/lib/parser/ini_parser/ini_parser.cc	(revision 9869)
@@ -29,5 +29,5 @@
 
 #ifdef DEBUG_LEVEL
- #include "../../../defs/debug.h"
+ #include "../../../lib/util/debug.h"
 #else
  #define PRINTF(x) printf
@@ -165,5 +165,5 @@
       else if( (ptr = strchr( lineBegin, '=')) != NULL)
       {
-        if (currentSection == NULL)
+        if (currentSection == this->sections.end())
         {
           PRINTF(2)("Not in a Section yet for %s\n", lineBegin);
@@ -470,5 +470,5 @@
   {
     std::list<IniEntry>::const_iterator entry = this->getEntryIT(entryName, sectionName);
-    if (entry != NULL &&  (*entry).name == entryName)
+    if (/** FIXME entry != NULL && */  (*entry).name == entryName)
       return (*entry).value;
     PRINTF(2)("Entry '%s' in section '%s' not found.\n", entryName.c_str(), sectionName.c_str());
@@ -627,8 +627,5 @@
       if ((*entry).name == entryName)
         break;
-  if (entry == (*section).entries.end())
-    return NULL;
-  else
-    return entry;
+  return entry;
 }
 
@@ -650,8 +647,5 @@
       if ((*entry).name == entryName)
         break;
-  if (entry == (*section).entries.end())
-    return NULL;
-  else
-    return entry;
+  return entry;
 }
 
Index: trunk/src/lib/parser/ini_parser/ini_parser.h
===================================================================
--- trunk/src/lib/parser/ini_parser/ini_parser.h	(revision 9682)
+++ trunk/src/lib/parser/ini_parser/ini_parser.h	(revision 9869)
@@ -11,5 +11,5 @@
 #define PARSELINELENGHT     512       //!< how many chars to read at once
 
-#include "filesys/file.h"
+#include "lib/util/filesys/file.h"
 #include <list>
 
@@ -66,5 +66,5 @@
     bool addVar(const std::string& entryName, const std::string& value, const std::string& sectionName = "" );
     const std::string& getVar(const std::string& entryName, const std::string& sectionName, const std::string& defaultValue = "") const;
-    bool IniParser::editVar(const std::string& entryName, const std::string& value, const std::string& sectionName = "", bool createMissing = true);
+    bool editVar(const std::string& entryName, const std::string& value, const std::string& sectionName = "", bool createMissing = true);
     void setEntryComment(const std::string& comment, const std::string& entryName, const std::string& sectionName);
     const std::string& getEntryComment(const std::string& entryName, const std::string& sectionName) const;
Index: trunk/src/lib/parser/preferences/Makefile.am
===================================================================
--- trunk/src/lib/parser/preferences/Makefile.am	(revision 9682)
+++ trunk/src/lib/parser/preferences/Makefile.am	(revision 9869)
@@ -6,8 +6,10 @@
 libPrefsParser_a_SOURCES = \
 		cmd_line_prefs_reader.cc \
-		ini_file_prefs_reader.cc
+		ini_file_prefs_reader.cc \
+		preferences.cc
 
 
 noinst_HEADERS = \
 		cmd_line_prefs_reader.h \
-		ini_file_prefs_reader.h
+		ini_file_prefs_reader.h \
+		preferences.h
Index: trunk/src/lib/parser/preferences/cmd_line_prefs_reader.h
===================================================================
--- trunk/src/lib/parser/preferences/cmd_line_prefs_reader.h	(revision 9682)
+++ trunk/src/lib/parser/preferences/cmd_line_prefs_reader.h	(revision 9869)
@@ -7,5 +7,4 @@
 #define _CMD_LINE_PREFS_READER_H
 
-#include "stdincl.h"
 #include "debug.h"
 
@@ -45,10 +44,10 @@
 };
 
-#define REGISTER_ARG_FLAG(shortOption,longOption,section,key,description,value) bool _ARGVAR_##shortOption##_##longOption = CmdLinePrefsReader::registerArgument(#shortOption[0],#longOption,section,key,description,"",value) 
+#define REGISTER_ARG_FLAG(shortOption,longOption,section,key,description,value) bool _ARGVAR_##shortOption##_##longOption = CmdLinePrefsReader::registerArgument(#shortOption[0],#longOption,section,key,description,"",value)
 
-#define REGISTER_ARG_ARG(shortOption,longOption,section,key,description,argname) bool _ARGVAR_##shortOption##_##longOption = CmdLinePrefsReader::registerArgument(#shortOption[0],#longOption,section,key,description,argname) 
+#define REGISTER_ARG_ARG(shortOption,longOption,section,key,description,argname) bool _ARGVAR_##shortOption##_##longOption = CmdLinePrefsReader::registerArgument(#shortOption[0],#longOption,section,key,description,argname)
 
 //! A class for reading commandline arguments into Preferences
-class CmdLinePrefsReader 
+class CmdLinePrefsReader
 {
 
@@ -58,12 +57,12 @@
 
     bool parse(int argc, char** argv);
-    
+
     static bool registerArgument( const char shortOption, const std::string & longOption, const std::string & section, const std::string & key, const std::string & help,  const std::string & argName = "", const std::string & value = "%arg%" );
-    
+
     static bool asdf;
-    
+
   private:
     static bool callBack( ArgTableEntry entry, void* data, const std::string & arg, const std::vector<MultiType> & argArgs );
-    
+
     static RegistredArgs regArgs;
 
Index: trunk/src/lib/parser/preferences/ini_file_prefs_reader.h
===================================================================
--- trunk/src/lib/parser/preferences/ini_file_prefs_reader.h	(revision 9682)
+++ trunk/src/lib/parser/preferences/ini_file_prefs_reader.h	(revision 9869)
@@ -7,6 +7,6 @@
 #define _INI_FILE_PREFS_READER_H
 
-#include "src/lib/parser/ini_parser/ini_parser.h"
-#include "src/lib/util/preferences.h"
+#include "lib/parser/ini_parser/ini_parser.h"
+#include "lib/parser/preferences/preferences.h"
 
 
Index: trunk/src/lib/parser/preferences/preferences.cc
===================================================================
--- trunk/src/lib/parser/preferences/preferences.cc	(revision 9869)
+++ trunk/src/lib/parser/preferences/preferences.cc	(revision 9869)
@@ -0,0 +1,335 @@
+/*
+   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: Christoph Renner
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "preferences.h"
+#include "lib/parser/ini_parser/ini_parser.h"
+#include "debug.h"
+
+ObjectListDefinition(Preferences);
+
+/**
+ * standard constructor
+ */
+Preferences::Preferences ()
+{
+  this->registerObject(this, Preferences::_objectList);
+   this->setName("Preferences");
+   this->fileName = "";
+}
+
+/**
+ *  the singleton reference to this class
+ */
+Preferences* Preferences::singletonRef = NULL;
+
+/**
+   @brief standard deconstructor
+ */
+Preferences::~Preferences ()
+{
+  Preferences::singletonRef = NULL;
+}
+
+/**
+ * Check if this item exists
+ * @param section name of the section
+ * @param name name of the item to check
+ * @return true if the item exists
+ */
+bool Preferences::exists( const std::string& section, const std::string& name)
+{
+  std::list<prefSection>::const_iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    if ( it->sectionName == section )
+    {
+      std::list<prefItem>::const_iterator it2 = it->items.begin();
+
+      for ( ; it2!=it->items.end(); it2++)
+      {
+        if ( it2->name == name )
+          return true;
+      }
+
+      break;
+    }
+  }
+
+  return false;
+}
+
+/**
+ * Check if this section exists
+ * @param section name of the section
+ * @param name name of the item to check
+ * @return true if the item exists
+ */
+bool Preferences::sectionExists( const std::string& section )
+{
+  std::list<prefSection>::const_iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    if ( it->sectionName == section )
+    {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+/**
+ * Sets the value of an item. Creates it if doesn't exits.
+ * @param section name of the section
+ * @param name name of the item
+ * @param value value
+ */
+void Preferences::setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified)
+{
+  MultiType t(value);
+  setMultiType(section, name, t, dontSetModified);
+}
+
+/**
+ * Sets the value of an item. Creates it if doesn't exits.
+ * @param section name of the section
+ * @param name name of the item
+ * @param value value
+ */
+void Preferences::setInt(const std::string& section, const std::string& name, int value, bool dontSetModified)
+{
+  MultiType t(value);
+  setMultiType(section, name, t, dontSetModified);
+}
+
+/**
+ * Sets the value of an item. Creates it if doesn't exits.
+ * @param section name of the section
+ * @param name name of the item
+ * @param value value
+ */
+void Preferences::setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified)
+{
+  MultiType t(value);
+  setMultiType(section, name, t, dontSetModified);
+}
+
+/**
+ * Get the value of an item
+ * @param section name of the section
+ * @param name name of the item to check
+ * @param defaultValue value to return if item doesn't exist
+ * @return value of the item if found. defaultValue else
+ */
+std::string Preferences::getString(const std::string& section, const std::string& name, const std::string& defaultValue)
+{
+  return getMultiType(section, name, MultiType(defaultValue)).getString();
+}
+
+/**
+ * Get the value of an item
+ * @param section name of the section
+ * @param name name of the item to check
+ * @param defaultValue value to return if item doesn't exist
+ * @return value of the item if found. defaultValue else
+ */
+int Preferences::getInt(const std::string& section, const std::string& name, int defaultValue)
+{
+  return getMultiType(section, name, MultiType(defaultValue)).getInt();
+}
+
+/**
+ * Get the value of an item
+ * @param section name of the section
+ * @param name name of the item to check
+ * @param defaultValue value to return if item doesn't exist
+ * @return value of the item if found. defaultValue else
+ */
+float Preferences::getFloat(const std::string& section, const std::string& name, float defaultValue)
+{
+  return getMultiType(section, name, MultiType(defaultValue)).getFloat();
+}
+
+/**
+ * Sets the value of an item. Creates it if doesn't exits.
+ * @param section name of the section
+ * @param name name of the item
+ * @param value value
+ */
+void Preferences::setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified)
+{
+  std::list<prefSection>::iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    if ( it->sectionName == section )
+    {
+      std::list<prefItem>::iterator it2 = it->items.begin();
+
+      for ( ; it2!=it->items.end(); it2++)
+      {
+        if ( it2->name == name )
+        {
+          if (!dontSetModified)
+            it2->modified = value.getString() != it2->value.getString();
+
+          it2->value = value;
+
+          return;
+        }
+      }
+      prefItem item;
+      item.value = value;
+      item.modified = !dontSetModified;
+      item.name = name;
+      it->items.push_back(item);
+      return;
+    }
+  }
+
+  prefItem item;
+  item.value = value;
+  item.modified = !dontSetModified;
+  item.name = name;
+
+  prefSection sec;
+  sec.items.push_back(item);
+  sec.sectionName = section;
+  data.push_back( sec );
+}
+
+/**
+ * Get the value of an item
+ * @param section name of the section
+ * @param name name of the item to check
+ * @param defaultValue value to return if item doesn't exist
+ * @return value of the item if found. defaultValue else
+ */
+MultiType Preferences::getMultiType(const std::string& section, const std::string& name,const MultiType& defaultValue)
+{
+  std::list<prefSection>::const_iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    if ( it->sectionName == section )
+    {
+      std::list<prefItem>::const_iterator it2 = it->items.begin();
+
+      for ( ; it2!=it->items.end(); it2++)
+      {
+        if ( it2->name == name )
+        {
+          return it2->value;
+        }
+      }
+
+      break;
+    }
+  }
+
+  return defaultValue;
+}
+
+void Preferences::setUserIni(const std::string& fileName)
+{
+  this->fileName = fileName;
+}
+
+bool Preferences::save()
+{
+  if ( this->fileName == "" )
+  {
+    PRINTF(1)("You must call setUserIni before you can call save()\n");
+    return false;
+  }
+  IniParser iniParser(this->fileName);
+
+  std::list<prefSection>::iterator it = data.begin();
+  bool didChanges = false;
+  for ( ; it!=data.end(); it++)
+  {
+    std::list<prefItem>::iterator it2 = it->items.begin();
+
+    for ( ; it2!=it->items.end(); it2++)
+    {
+      if ( it2->modified )
+      {
+        iniParser.editVar(it2->name, it2->value.getString(), it->sectionName);
+        didChanges = true;
+      }
+    }
+  }
+  /// HACK DO WE HAVE TO CHECK THIS??
+  //if ( didChanges )
+  {
+    iniParser.writeFile( this->fileName );
+  }
+
+  return true;
+}
+
+/**
+ * prints out all section with its items and values
+ */
+void Preferences::debug()
+{
+  std::list<prefSection>::iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    PRINTF(0)("%s\n", it->sectionName.c_str());
+    std::list<prefItem>::iterator it2 = it->items.begin();
+
+    for ( ; it2!=it->items.end(); it2++)
+    {
+      PRINTF(0)("--> %s = '%s'%s\n", it2->name.c_str(), it2->value.getString().c_str(), ((!it2->modified)?"":" <modified>"));
+    }
+  }
+}
+
+/**
+ * list all keys in section
+ * @param section section
+ * @return list of keys
+ */
+std::list< std::string > Preferences::listKeys( const std::string section )
+{
+  std::list<std::string> lst;
+
+  std::list<prefSection>::const_iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    if ( it->sectionName == section )
+    {
+      std::list<prefItem>::const_iterator it2 = it->items.begin();
+
+      for ( ; it2!=it->items.end(); it2++)
+      {
+        lst.push_back( it2->name );
+      }
+
+      break;
+    }
+  }
+
+  return lst;
+}
+
+
Index: trunk/src/lib/parser/preferences/preferences.h
===================================================================
--- trunk/src/lib/parser/preferences/preferences.h	(revision 9869)
+++ trunk/src/lib/parser/preferences/preferences.h	(revision 9869)
@@ -0,0 +1,72 @@
+/*!
+ * @file proto_singleton.h
+ * @brief Definition of the ... singleton Class
+*/
+
+#ifndef _PREFERENCES_H
+#define _PREFERENCES_H
+
+#include "base_object.h"
+#include "multi_type.h"
+#include <list>
+
+// FORWARD DECLARATION
+
+class IniFilePrefsReader;
+
+typedef struct {
+  std::string name;
+  MultiType value;
+  bool modified;
+} prefItem;
+
+typedef struct {
+  std::string sectionName;
+  std::list<prefItem> items;
+} prefSection ;
+
+
+//! A default singleton class.
+class Preferences : public BaseObject {
+  ObjectListDeclaration(Preferences);
+ public:
+   virtual ~Preferences(void);
+  /** @returns a Pointer to the only object of this Class */
+   inline static Preferences* getInstance(void) { if (!singletonRef) singletonRef = new Preferences();  return singletonRef; };
+
+   //check if this entry exists
+   bool sectionExists(const std::string& section );
+   bool exists(const std::string& section, const std::string& name);
+
+   void setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified = false);
+   void setInt(const std::string& section, const std::string& name, int value, bool dontSetModified = false);
+   void setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified = false);
+   void setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified = false);
+
+   std::string getString(const std::string& section, const std::string& name, const std::string& defaultValue);
+   int getInt(const std::string& section, const std::string& name, int defaultValue);
+   float getFloat(const std::string& section, const std::string& name, float defaultValue);
+   MultiType getMultiType(const std::string& section, const std::string& name, const MultiType& defaultValue);
+
+   void setUserIni(const std::string& fileName);
+
+   bool save();
+
+   void debug();
+
+   std::list<std::string> listKeys( const std::string section );
+
+
+ private:
+   Preferences(void);
+   static Preferences* singletonRef;
+
+   std::list<prefSection> data;
+
+   std::list<IniFilePrefsReader*> iniFilePrefsReaders;
+
+   std::string fileName;
+
+};
+
+#endif /* _PREFERENCES_H */
Index: trunk/src/lib/physics/fields/field.cc
===================================================================
--- trunk/src/lib/physics/fields/field.cc	(revision 9682)
+++ trunk/src/lib/physics/fields/field.cc	(revision 9869)
@@ -23,7 +23,8 @@
 #include "util/loading/load_param.h"
 
+ObjectListDefinition(Field);
 
 /**
- *  standard constructor
+ * @brief standard constructor
 */
 Field::Field ()
@@ -33,7 +34,6 @@
 
 /**
- *  standard deconstructor
-
-*/
+ * @brief standard deconstructor
+ */
 Field::~Field ()
 {
@@ -42,9 +42,9 @@
 
 /**
-  \brief initializes a Field
-*/
+  * @brief initializes a Field
+ */
 void Field::init()
 {
-  this->setClassID(CL_FIELD, "Field");
+  this->registerObject(this, Field::_objectList);
   this->setMagnitude(1);
   this->setAttenuation(0);
@@ -54,5 +54,5 @@
 
 /**
-* @param root The XML-element to load settings from
+ * @param root The XML-element to load settings from
  */
 void Field::loadParams(const TiXmlElement* root)
Index: trunk/src/lib/physics/fields/field.h
===================================================================
--- trunk/src/lib/physics/fields/field.h	(revision 9682)
+++ trunk/src/lib/physics/fields/field.h	(revision 9869)
@@ -16,9 +16,9 @@
 /*!
  * @file field.h
-  *  abstract definition of a Physical Field
-
-    This is a totally abstract class, that only enables different Physical Fields to
-    exist on a common Level.
-*/
+ * abstract definition of a Physical Field
+ *
+ * This is a totally abstract class, that only enables different Physical Fields to
+ * exist on a common Level.
+ */
 
 #ifndef _FIELD_H
@@ -34,4 +34,5 @@
 class Field : public PNode
 {
+  ObjectListDeclaration(Field);
  public:
   Field();
Index: trunk/src/lib/physics/fields/gravity.cc
===================================================================
--- trunk/src/lib/physics/fields/gravity.cc	(revision 9682)
+++ trunk/src/lib/physics/fields/gravity.cc	(revision 9869)
@@ -21,11 +21,12 @@
 #include "util/loading/factory.h"
 
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Gravity, CL_FIELD_GRAVITY);
 
-
-CREATE_FACTORY(Gravity, CL_FIELD_GRAVITY);
+CREATE_FACTORY(Gravity);
 
 Gravity::Gravity(const TiXmlElement* root)
 {
-  this->setClassID(CL_FIELD_GRAVITY, "Gravity");
+  this->registerObject(this, Gravity::_objectList);
 
   if (root != NULL)
Index: trunk/src/lib/physics/fields/gravity.h
===================================================================
--- trunk/src/lib/physics/fields/gravity.h	(revision 9682)
+++ trunk/src/lib/physics/fields/gravity.h	(revision 9869)
@@ -16,4 +16,5 @@
 //! A class for ...
 class Gravity : public Field {
+  ObjectListDeclaration(Gravity);
 
  public:
Index: trunk/src/lib/physics/fields/point_gravity.cc
===================================================================
--- trunk/src/lib/physics/fields/point_gravity.cc	(revision 9682)
+++ trunk/src/lib/physics/fields/point_gravity.cc	(revision 9869)
@@ -20,4 +20,7 @@
 
 
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(PointGravity, CL_FIELD_POINT_GRAVITY);
+
 
 /**
@@ -27,5 +30,5 @@
 PointGravity::PointGravity ()
 {
-   this->setClassID(CL_FIELD_POINT_GRAVITY, "PointGravity");
+  this->registerObject(this, PointGravity::_objectList);
 }
 
Index: trunk/src/lib/physics/fields/point_gravity.h
===================================================================
--- trunk/src/lib/physics/fields/point_gravity.h	(revision 9682)
+++ trunk/src/lib/physics/fields/point_gravity.h	(revision 9869)
@@ -1,3 +1,3 @@
-/*! 
+/*!
  * @file point_gravity.h
   *  Definition of ...
@@ -16,4 +16,5 @@
 //! A class for ...
 class PointGravity : public Field {
+  ObjectListDeclaration(PointGravity);
 
  public:
Index: trunk/src/lib/physics/fields/twirl.cc
===================================================================
--- trunk/src/lib/physics/fields/twirl.cc	(revision 9682)
+++ trunk/src/lib/physics/fields/twirl.cc	(revision 9869)
@@ -20,4 +20,7 @@
 
 
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Twirl, CL_FIELD_TWIRL);
+
 
 /**
@@ -27,5 +30,5 @@
 Twirl::Twirl ()
 {
-   this->setClassID(CL_FIELD_TWIRL, "Twirl");
+  this->registerObject(this, Twirl::_objectList);
 }
 
Index: trunk/src/lib/physics/fields/twirl.h
===================================================================
--- trunk/src/lib/physics/fields/twirl.h	(revision 9682)
+++ trunk/src/lib/physics/fields/twirl.h	(revision 9869)
@@ -1,3 +1,3 @@
-/*! 
+/*!
  * @file twirl.h
   *  Definition of ...
@@ -16,4 +16,5 @@
 //! A class for ...
 class Twirl : public Field {
+  ObjectListDeclaration(Twirl);
 
  public:
Index: trunk/src/lib/physics/physics_connection.cc
===================================================================
--- trunk/src/lib/physics/physics_connection.cc	(revision 9682)
+++ trunk/src/lib/physics/physics_connection.cc	(revision 9869)
@@ -19,7 +19,8 @@
 
 #include "physics_engine.h"
+#include "debug.h"
 
-#include "field.h"
-#include "particle_system.h"
+#include "fields/field.h"
+#include "particles/particle_system.h"
 #include "physics_interface.h"
 
@@ -27,8 +28,7 @@
 #include "util/loading/load_param.h"
 
-
-
-CREATE_FACTORY(PhysicsConnection, CL_PHYSICS_CONNECTION);
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinition(PhysicsConnection);
+CREATE_FACTORY(PhysicsConnection);
 /**
  *  creates a PhysicsConnection
@@ -36,5 +36,5 @@
 PhysicsConnection::PhysicsConnection(PhysicsInterface* subject, Field* field)
 {
-  this->setClassID(CL_PHYSICS_CONNECTION, "PhysicsConnection");
+  this->registerObject(this, PhysicsConnection::_objectList);
   this->type = PCON_PhysIField;
 
@@ -47,5 +47,5 @@
 PhysicsConnection::PhysicsConnection(const TiXmlElement* root)
 {
-  this->setClassID(CL_PHYSICS_CONNECTION, "PhysicsConnection");
+  this->registerObject(this, PhysicsConnection::_objectList);
   this->type = PCON_PhysIField;
 
Index: trunk/src/lib/physics/physics_connection.h
===================================================================
--- trunk/src/lib/physics/physics_connection.h	(revision 9682)
+++ trunk/src/lib/physics/physics_connection.h	(revision 9869)
@@ -27,5 +27,5 @@
 class PhysicsConnection : public BaseObject
 {
-
+  ObjectListDeclaration(PhysicsConnection);
  public:
   PhysicsConnection(PhysicsInterface* subject, Field* field);
Index: trunk/src/lib/physics/physics_engine.cc
===================================================================
--- trunk/src/lib/physics/physics_engine.cc	(revision 9682)
+++ trunk/src/lib/physics/physics_engine.cc	(revision 9869)
@@ -18,18 +18,16 @@
 #include "physics_engine.h"
 
-#include "class_list.h"
-#include "parser/tinyxml/tinyxml.h"
 #include "util/loading/factory.h"
-#include "util/loading/load_param.h"
-
-
-
-
-/**
- *  standard constructor
-*/
+#include "util/loading/load_param_xml.h"
+
+
+
+ObjectListDefinition(PhysicsEngine);
+/**
+ * @brief standard constructor
+ */
 PhysicsEngine::PhysicsEngine()
 {
-  this->setClassID(CL_PHYSICS_ENGINE, "PhysicsEngine");
+  this->registerObject(this, PhysicsEngine::_objectList);
   this->setName("PhysicsEngine");
   this->interfaces = NULL;
@@ -130,6 +128,5 @@
 PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const std::string& physicsInterfaceName) const
 {
-  BaseObject* interface = ClassList::getObject(physicsInterfaceName, CL_PHYSICS_INTERFACE);
-  return (interface != NULL)?  dynamic_cast<PhysicsInterface*>(interface) : NULL;
+  return PhysicsInterface::objectList().getObject(physicsInterfaceName);
 }
 
@@ -223,10 +220,10 @@
 
   /* actually tick all the PhysicsInterfaces. Move the objects around */
-  if (this->interfaces != NULL || (this->interfaces = ClassList::getList(CL_PHYSICS_INTERFACE)) != NULL)
-  {
-    std::list<BaseObject*>::const_iterator tickPhys;
-    for (tickPhys = this->interfaces->begin(); tickPhys != this->interfaces->end(); tickPhys++)
-      dynamic_cast<PhysicsInterface*>(*tickPhys)->tickPhys(dt);
-  }
+
+  ObjectList<PhysicsInterface>::const_iterator it;
+  for (it = PhysicsInterface::objectList().begin();
+       it != PhysicsInterface::objectList().end();
+       ++it)
+      (*it)->tickPhys(dt);
 }
 
Index: trunk/src/lib/physics/physics_engine.h
===================================================================
--- trunk/src/lib/physics/physics_engine.h	(revision 9682)
+++ trunk/src/lib/physics/physics_engine.h	(revision 9869)
@@ -12,5 +12,5 @@
 #include "physics_connection.h"
 #include "physics_interface.h"
-#include "field.h"
+#include "fields/field.h"
 #include <list>
 
@@ -20,7 +20,8 @@
 
 //! A class, that brings things into motion through Physics.
-class PhysicsEngine : public BaseObject {
-
- public:
+class PhysicsEngine : public BaseObject
+{
+  ObjectListDeclaration(PhysicsEngine);
+public:
   virtual ~PhysicsEngine();
   /** @returns a Pointer to the only object of this Class */
@@ -46,8 +47,8 @@
   void                   debug() const;
 
- private:
+private:
   PhysicsEngine();
 
- private:
+private:
   static PhysicsEngine*         singletonRef;         //!< the singleton reference of the PhysicsEngine
 
Index: trunk/src/lib/physics/physics_interface.cc
===================================================================
--- trunk/src/lib/physics/physics_interface.cc	(revision 9682)
+++ trunk/src/lib/physics/physics_interface.cc	(revision 9869)
@@ -23,5 +23,5 @@
 #include "physics_engine.h"
 
-#include "field.h"
+#include "fields/field.h"
 #include "p_node.h"
 
@@ -31,11 +31,11 @@
 
 
-
+ObjectListDefinition(PhysicsInterface);
 /**
- *  standard constructor
+ * @brief standard constructor
  */
 PhysicsInterface::PhysicsInterface ()
 {
-  this->setClassID(CL_PHYSICS_INTERFACE, "PhysicsInterface");
+  this->registerObject(this, PhysicsInterface::_objectList);
 
   this->mass = 1;
Index: trunk/src/lib/physics/physics_interface.h
===================================================================
--- trunk/src/lib/physics/physics_interface.h	(revision 9682)
+++ trunk/src/lib/physics/physics_interface.h	(revision 9869)
@@ -29,4 +29,5 @@
 class PhysicsInterface : virtual public BaseObject
 {
+  ObjectListDeclaration(PhysicsInterface);
  public:
   PhysicsInterface();
Index: trunk/src/lib/script_engine/Makefile.am
===================================================================
--- trunk/src/lib/script_engine/Makefile.am	(revision 9682)
+++ trunk/src/lib/script_engine/Makefile.am	(revision 9869)
@@ -16,6 +16,7 @@
                 script_manager.cc \
 		script_class.cc \
-		script_method.cc
-		
+		script_method.cc \
+		executor_lua_state.cc
+
 AM_CPPFLAGS= @LUA_INCLUDES@
 
@@ -25,5 +26,6 @@
                 script_manager.h \
 		script_class.h \
-		script_method.h
+		script_method.h \
+		executor_lua_state.h
 
 
Index: trunk/src/lib/script_engine/executor_lua_state.cc
===================================================================
--- trunk/src/lib/script_engine/executor_lua_state.cc	(revision 9869)
+++ trunk/src/lib/script_engine/executor_lua_state.cc	(revision 9869)
@@ -0,0 +1,28 @@
+/*
+   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 "executor_lua_state.h"
+
+#include "lunar.h"
+
+std::string temp[7];
+
+
+template<typename type> type fromLua(lua_State* state, int index) { type *obj = Lunar<type>::check(state, 1); lua_remove(state, 1); return obj; };
+template<typename type> void toLua(lua_State* state, type value) { Lunar<type>::push(state, value, false); };
+
+template<> const std::string& fromLua<const std::string&>(lua_State* state, int index) { temp[index] = lua_tostring(state, index); return temp[index]; };
Index: trunk/src/lib/script_engine/executor_lua_state.h
===================================================================
--- trunk/src/lib/script_engine/executor_lua_state.h	(revision 9869)
+++ trunk/src/lib/script_engine/executor_lua_state.h	(revision 9869)
@@ -0,0 +1,105 @@
+/*!
+ * @file executor_lua_state.h
+ * Definition of a Executor that takes lua_State* as input.
+ */
+
+/*
+   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: ...
+*/
+
+
+
+#ifndef __EXECUTOR_LUA_STATE_H_
+#define __EXECUTOR_LUA_STATE_H_
+
+
+#include "executor/executor_generic.h"
+
+#include "luaincl.h"
+
+#ifdef FUNCTOR_CALL_TYPE
+ #undef FUNCTOR_CALL_TYPE
+#endif
+//! Define the Functor call type as lua_State*.
+#define FUNCTOR_CALL_TYPE lua_State*
+
+/**
+ * @brief Converts a lua_State into any type.
+ * @param state the State to get the value from.
+ * @param index the position inside of the lua_State to get the value from.
+ * @returns The value if found.
+ */
+template<typename type> type fromLua(lua_State* state, int index);
+/** @see template<typename type> inline type fromLua(lua_State* state, int index) */
+template<> inline bool fromLua<bool>(lua_State* state, int index) { return lua_toboolean(state, index); };
+/** @see template<typename type> inline type fromLua(lua_State* state, int index) */
+template<> inline int fromLua<int>(lua_State* state, int index) { return (int)lua_tonumber(state, index); };
+/** @see template<typename type> inline type fromLua(lua_State* state, int index) */
+template<> inline unsigned int fromLua<unsigned int>(lua_State* state, int index) { return (unsigned int)lua_tonumber(state, index); };
+/** @see template<typename type> inline type fromLua(lua_State* state, int index) */
+template<> inline float fromLua<float>(lua_State* state, int index) { return (float)lua_tonumber(state, index); };
+/** @see template<typename type> inline type fromLua(lua_State* state, int index) */
+template<> inline char fromLua<char>(lua_State* state, int index) { return (char)lua_tonumber(state, index); };
+/** @see template<typename type> inline type fromLua(lua_State* state, int index) */
+template<> const std::string& fromLua<const std::string&>(lua_State* state, int index);
+
+
+/**
+ * @brief writes a value into a lua_State.
+ * @param state the state to write into.
+ * @param value the Value of type to write into the State.
+ */
+template<typename type> void toLua(lua_State* state, type value);
+/** @see template<typename type> void toLua(lua_State* state, type value) */
+template<> inline void toLua<bool>(lua_State* state, bool value) { lua_pushboolean(state, (int) value); };
+/** @see template<typename type> void toLua(lua_State* state, type value) */
+template<> inline void toLua<int>(lua_State* state, int value)  { lua_pushnumber(state, (lua_Number) value); };
+/** @see template<typename type> void toLua(lua_State* state, type value) */
+template<> inline void toLua<unsigned int>(lua_State* state, unsigned int value){ lua_pushnumber(state, (lua_Number) value); };
+/** @see template<typename type> void toLua(lua_State* state, type value) */
+template<> inline void toLua<float>(lua_State* state, float value) { lua_pushnumber(state, (lua_Number) value); };
+/** @see template<typename type> void toLua(lua_State* state, type value) */
+template<> inline void toLua<char>(lua_State* state, char value) { lua_pushnumber(state, (lua_Number) value); };
+/** @see template<typename type> void toLua(lua_State* state, type value) */
+template<> inline void toLua<const std::string&>(lua_State* state, const std::string& value) { lua_pushstring (state, value.c_str()); }
+
+
+
+//! A Class, that evaluates a lua_State and converts indices into different Types.
+template<> class ExecutorEvaluater <lua_State*>
+{
+public:
+  /** @brief Executes the Evaluater
+   * @param CallValue the Value that should be converted
+   * @param defaults the default Values.
+   */
+  template <typename ToType, int index>
+  static ToType getValue(lua_State*& CallValue, const MultiType* const defaults)
+  {
+    return (fromLua<ToType>(CallValue, index+1));
+  }
+  /**
+   * @param state the state to write into
+   * @param value the Value to write there.
+   */
+  template <typename FromType>
+  static void storeRet(lua_State*& state, FromType value)
+  {
+    toLua<FromType>(state, value);
+  }
+  /** @returns the Null Value of a lua_State*, namely (pointer-type) NULL */
+  static lua_State*& defaultValue() { static lua_State* nullState; return nullState; };
+};
+
+#endif /* __EXECUTOR_LUA_STATE_H_ */
Index: trunk/src/lib/script_engine/lunar.h
===================================================================
--- trunk/src/lib/script_engine/lunar.h	(revision 9682)
+++ trunk/src/lib/script_engine/lunar.h	(revision 9869)
@@ -16,5 +16,5 @@
   userdataType;
 public:
-  typedef Executor* mfp;
+  typedef Executor<lua_State*>* mfp;
   typedef struct { const char *name; mfp mfunc; }
   RegType;
@@ -184,8 +184,7 @@
     lua_remove(L, 1);  // remove self so member function args start at index 1
     // get member function from upvalue
-    Executor *l = static_cast<Executor*>(lua_touserdata(L, lua_upvalueindex(1)));
-    int value;
-    (*l)(obj, value, L);  // call member function
-    return value;
+    mfp l = static_cast<mfp>(lua_touserdata(L, lua_upvalueindex(1)));
+    (*l)(obj, L);  // call member function
+    return l->hasRetVal()? 1 : 0;
   }
 
Index: trunk/src/lib/script_engine/script.cc
===================================================================
--- trunk/src/lib/script_engine/script.cc	(revision 9682)
+++ trunk/src/lib/script_engine/script.cc	(revision 9869)
@@ -18,20 +18,22 @@
 #include "luaincl.h"
 #include "debug.h"
-#include "util/loading/resource_manager.h"
-
+
+#include "loading/resource_manager.h"
 #include "loading/load_param.h"
 #include "parser/tinyxml/tinyxml.h"
 
-#include "class_list.h"
-CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT,
-                    addMethod("addObject", ExecutorLua2<Script,const std::string&, const std::string& >(&Script::addObject))
-                    ->addMethod("registerClass", ExecutorLua1<Script,const std::string&>(&Script::registerClass))
-                    ->addMethod("selectFunction", ExecutorLua2ret<Script, bool, const std::string&, int >(&Script::selectFunction))
-                    ->addMethod("executeFunction", ExecutorLua0ret<Script,bool >(&Script::executeFunction))
+ObjectListDefinition(Script);
+
+CREATE_SCRIPTABLE_CLASS(Script,
+                    addMethod("addObject", Executor2<Script, lua_State*,const std::string&, const std::string& >(&Script::addObject))
+                    ->addMethod("registerClass", Executor1<Script, lua_State*,const std::string&>(&Script::registerClass))
+                    ->addMethod("selectFunction", Executor2ret<Script, lua_State*, bool, const std::string&, int >(&Script::selectFunction))
+                    ->addMethod("executeFunction", Executor0ret<Script, lua_State*,bool >(&Script::executeFunction))
                      );
+
 
 Script::Script(const TiXmlElement* root)
 {
-  this->setClassID(CL_SCRIPT, "Script");
+  this->registerObject(this, Script::_objectList);
 
   returnCount = argumentCount = 0;
@@ -52,5 +54,5 @@
 Script::Script(const std::string& filename)
 {
-  this->setClassID(CL_SCRIPT, "Script");
+  this->registerObject(this, Script::_objectList);
 
   returnCount = argumentCount = 0;
@@ -64,5 +66,5 @@
   luaopen_math(luaState);
   luaopen_debug(luaState);
-  
+
   this->loadFile(filename);
 
@@ -98,10 +100,10 @@
 bool Script::loadFile(const std::string& filename)
  {
-   std::string filedest(ResourceManager::getInstance()->getDataDir());
-   filedest += "scripts/" + filename;
-   
+   std::string filedest(Resources::ResourceManager::getInstance()->mainGlobalPath().name());
+   filedest += "/scripts/" + filename;
+
    this->addThisScript();
    this->registerStandartClasses();
-   
+
    if(currentFile.length() != 0)
    {
@@ -142,5 +144,5 @@
    //printf(("Script %s: I am about to add %s of class %s\n",this->getName(),objectName.c_str(),className.c_str());
 
-   BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
+   ScriptClass* scriptClass = ScriptClass::objectList().getObject(className);
   // printf(("The script class for %s is at %p \n",className.c_str(),scriptClass);
    WorldObject tmpObj;
@@ -150,12 +152,12 @@
      if( !classIsRegistered(className) )
      {
-     static_cast<ScriptClass*>(scriptClass)->registerClass(this);
-     }
-
-     BaseObject* object = ClassList::getObject(objectName, className);
+       scriptClass->registerClass(this);
+     }
+
+     BaseObject* object = ObjectListBase::getBaseObject(className, objectName);
     // printf(("%s is at %p \n",objectName.c_str(),object);
      if (object != NULL && !objectIsAdded(objectName))
      {
-        static_cast<ScriptClass*>(scriptClass)->insertObject(this, object, false);
+        scriptClass->insertObject(this, object, false);
         tmpObj.name = objectName;
         registeredObjects.push_back(tmpObj);
@@ -169,5 +171,5 @@
  bool Script::executeFile()
  {
-   PRINT(2)("WARNING: script.executeFile is not implemented yet\n");
+   PRINTF(2)("script.executeFile is not implemented yet\n");
    /*if(currentFile.length() != 0)
    {
@@ -214,5 +216,5 @@
     if(error != 0)
     {
-      printf("SCRIPT %s : ERROR: Failed to execute function %s: \n",currentFile.c_str(),currentFunction.c_str());
+      PRINTF(1)("Script '%s' : Failed to execute function '%s': \n",currentFile.c_str(),currentFunction.c_str());
      reportError(error);
      //clean up
@@ -229,5 +231,5 @@
    }
    else
-     printf("SCRIPT %s : ERROR: no function selected.\n",currentFile.c_str());
+     PRINTF(1)("SCRIPT '%s' : no function selected.\n",currentFile.c_str());
 
    return false;
@@ -295,5 +297,5 @@
        lua_remove(luaState,-1*returnCount);
        returnCount--;
-       
+
      }
    }
@@ -352,9 +354,10 @@
 void Script::addThisScript()
 {
-  BaseObject* scriptClass = ClassList::getObject("Script", CL_SCRIPT_CLASS);
-   if (scriptClass != NULL)
-   {
-     static_cast<ScriptClass*>(scriptClass)->registerClass(this);
-     static_cast<ScriptClass*>(scriptClass)->insertObject(this, this,"thisscript", false);
+  ScriptClass* scriptClass = ScriptClass::objectList().getObject("Script");
+
+  if (scriptClass != NULL)
+   {
+     scriptClass->registerClass(this);
+     scriptClass->insertObject(this, this,"thisscript", false);
    }
 }
@@ -375,5 +378,5 @@
  {
    bool success = false;
-   
+
    //this->registerClass(std::string("Vector"));
     this->registerClass("ScriptTrigger");
@@ -382,10 +385,11 @@
    return success;
  }
- 
- 
+
+
  void Script::registerClass( const std::string& className)
  {
-   BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
+   ScriptClass* scriptClass = ScriptClass::objectList().getObject(className);
    //printf(("The script class for %s is at %p \n",className.c_str(),scriptClass);
+
    WorldObject tmpObj;
    if (scriptClass != NULL)
@@ -400,5 +404,5 @@
      }
    }
- 
+
  }
 
Index: trunk/src/lib/script_engine/script.h
===================================================================
--- trunk/src/lib/script_engine/script.h	(revision 9682)
+++ trunk/src/lib/script_engine/script.h	(revision 9869)
@@ -22,4 +22,5 @@
 class Script : public BaseObject
 {
+  ObjectListDeclaration(Script);
   public:
     Script(const TiXmlElement* root = NULL);
@@ -33,5 +34,5 @@
     bool loadFile(const std::string& filename);
     void addObject( const std::string& className,const std::string& objectName);
-    void registerClass(const std::string& className);                           //!< Register a class but dont add any instances 
+    void registerClass(const std::string& className);                           //!< Register a class but dont add any instances
 
     /// QUERRYING
Index: trunk/src/lib/script_engine/script_class.cc
===================================================================
--- trunk/src/lib/script_engine/script_class.cc	(revision 9682)
+++ trunk/src/lib/script_engine/script_class.cc	(revision 9869)
@@ -19,13 +19,14 @@
 #include <cassert>
 
+ObjectListDefinition(ScriptClass);
 /**
  * @brief standard constructor
  * @todo this constructor is not jet implemented - do it
 */
-ScriptClass::ScriptClass(const std::string& name, ClassID classID, ScriptMethod* scriptMethods)
-    : BaseObject(name)
+ScriptClass::ScriptClass(const std::string& name, const ClassID& classID, ScriptMethod* scriptMethods)
+    : BaseObject(name), _classID(classID)
 {
   assert(scriptMethods != NULL);
-  this->setClassID(CL_SCRIPT_CLASS, "ScriptClass");
+  this->registerObject(this, ScriptClass::_objectList);
 
   this->_classID = classID;
Index: trunk/src/lib/script_engine/script_class.h
===================================================================
--- trunk/src/lib/script_engine/script_class.h	(revision 9682)
+++ trunk/src/lib/script_engine/script_class.h	(revision 9869)
@@ -18,26 +18,24 @@
  * this should be used at the beginning of all the Classes that should be loadable (in the cc-file)
  */
-#define CREATE_SCRIPTABLE_CLASS(CLASS_NAME, CLASS_ID, SCRIPT_METHODS) \
-    tScriptClass<CLASS_NAME> global_##CLASS_NAME##_ScriptableClass(#CLASS_NAME, CLASS_ID, (new ScriptMethod)->SCRIPT_METHODS)
+#define CREATE_SCRIPTABLE_CLASS(CLASS_NAME, SCRIPT_METHODS) \
+    tScriptClass<CLASS_NAME> global_##CLASS_NAME##_ScriptableClass(#CLASS_NAME, CLASS_NAME::staticClassID(), (new ScriptMethod)->SCRIPT_METHODS)
 
 
 //! A class for ...
-class ScriptClass : protected BaseObject
+class ScriptClass : public BaseObject
 {
+  ObjectListDeclaration(ScriptClass);
 
 public:
   virtual ~ScriptClass();
 
-  bool operator==(const std::string& name) { return (this->getName() == name); }
-  bool operator==(ClassID classID) { return (this->_classID == classID); }
-
   virtual void registerClass(Script* script) = 0;
   virtual int insertObject(Script* L, BaseObject* obj, bool gc=false) = 0;
-  virtual int insertObject(Script* L, BaseObject* obj, const std::string& name, bool gc=false) = 0; 
+  virtual int insertObject(Script* L, BaseObject* obj, const std::string& name, bool gc=false) = 0;
 
   const ScriptMethod* scriptMethods() const { return this->_scriptMethods; }
 
 protected:
-  ScriptClass(const std::string& name, ClassID classID, ScriptMethod* scriptMethods);
+  ScriptClass(const std::string& name, const ClassID& classID, ScriptMethod* scriptMethods);
 
 private:
Index: trunk/src/lib/script_engine/script_manager.cc
===================================================================
--- trunk/src/lib/script_engine/script_manager.cc	(revision 9682)
+++ trunk/src/lib/script_engine/script_manager.cc	(revision 9869)
@@ -24,11 +24,8 @@
 #include "lunar.h"
 
-#include "class_list.h"
-
 #include "script.h"
 #include "script_trigger.h"
 #include "luaincl.h"
-#include "loading/load_param.h"
-#include "parser/tinyxml/tinyxml.h"
+#include "loading/load_param_xml.h"
 
 
@@ -37,6 +34,4 @@
 {
   this->setName("ScriptManager");
-  this->scripts = NULL;
-  this->triggers = NULL;
 
   if (root != NULL)
@@ -62,6 +57,4 @@
 
   // fill the scripts and triggers (doing that on runtime is very slow!)
-  getTriggers();
-  getScripts();
 }
 
@@ -71,12 +64,10 @@
 {
   //Delete all scripts as they aren't deleted automatically
-  if(this->getScripts())
-    while(!scripts->empty())
-      delete scripts->front();
+  while(!Script::objectList().empty())
+    delete Script::objectList().front();
   //Delete all triggers
-  if(this->getTriggers())
-    while(!triggers->empty())
-      delete triggers->front();
-  
+  while(!ScriptTrigger::objectList().empty())
+    delete ScriptTrigger::objectList().front();
+
 }
 
@@ -105,28 +96,11 @@
 Script* ScriptManager::getScriptByFile(const std::string& file)
 {
-  if(getScripts())
-    for(std::list<BaseObject*>::const_iterator it = scripts->begin(); it != scripts->end(); it++ )
-    {
-      if( (dynamic_cast<Script*>(*it))->getFileName().compare(file) == 0)
-      {
-        return dynamic_cast<Script*>(*it);
-      }
-    }
+  for (ObjectList<Script>::const_iterator it = Script::objectList().begin();
+       it != Script::objectList().end();
+       ++it)
+    if( ((*it))->getFileName().compare(file) == 0)
+      return (*it);
 
   return NULL;
 
 }
-
-
-bool ScriptManager::getScripts()
-{
-  return (this->scripts != NULL || (this->scripts = ClassList::getList(CL_SCRIPT)) != NULL);
-}
-
-bool ScriptManager::getTriggers()
-{
-  return (this->triggers != NULL || (this->triggers = ClassList::getList(CL_SCRIPT_TRIGGER)) != NULL);
-}
-
-
-
Index: trunk/src/lib/script_engine/script_manager.h
===================================================================
--- trunk/src/lib/script_engine/script_manager.h	(revision 9682)
+++ trunk/src/lib/script_engine/script_manager.h	(revision 9869)
@@ -34,14 +34,5 @@
    void  createTriggers(const TiXmlElement* triggers);
 
-   bool getTriggers();
-   bool getScripts();
-
    static ScriptManager*             singletonRef;   //!< Reference to this class
-
-   const std::list<BaseObject*>*     triggers;       //!< A list of all the triggers in the world
-
-   const std::list<BaseObject*>*     scripts;        //!< A list of all the scripts in the world
-
-
 };
 #endif
Index: trunk/src/lib/script_engine/script_method.cc
===================================================================
--- trunk/src/lib/script_engine/script_method.cc	(revision 9682)
+++ trunk/src/lib/script_engine/script_method.cc	(revision 9869)
@@ -25,5 +25,5 @@
 { }
 
-ScriptMethod* ScriptMethod::addMethod(const std::string& methodName, const Executor& executor)
+ScriptMethod* ScriptMethod::addMethod(const std::string& methodName, const Executor<lua_State*>& executor)
 {
   this->methods.push_back(ScriptMethod::Method(methodName, executor));
@@ -32,5 +32,5 @@
 }
 
-ScriptMethod::Method::Method(const std::string& name, const Executor& executor)
+ScriptMethod::Method::Method(const std::string& name, const Executor<lua_State*>& executor)
 {
   this->name = name;
Index: trunk/src/lib/script_engine/script_method.h
===================================================================
--- trunk/src/lib/script_engine/script_method.h	(revision 9682)
+++ trunk/src/lib/script_engine/script_method.h	(revision 9869)
@@ -9,6 +9,6 @@
 #include <vector>
 
-#include "executor/executor_lua.h"
-
+#include "executor_lua_state.h"
+#include "executor/executor_member.h"
 
 class ScriptMethod
@@ -18,10 +18,10 @@
   ~ScriptMethod();
 
-  ScriptMethod* addMethod(const std::string& methodName, const Executor& executor);
+  ScriptMethod* addMethod(const std::string& methodName, const Executor<lua_State*>& executor);
 
   unsigned int size() const { return methods.size(); };
 
   const std::string& name(unsigned int methodNumber) const { return methods[methodNumber].name; };
-  const Executor* executor(unsigned int methodNumber) const { return methods[methodNumber].executor; };
+  const Executor<lua_State*>* executor(unsigned int methodNumber) const { return methods[methodNumber].executor; };
 
 
@@ -29,7 +29,7 @@
   struct Method
   {
-    Method(const std::string& name, const Executor& executor);
-    std::string    name;
-    Executor*      executor;
+    Method(const std::string& name, const Executor<lua_State*>& executor);
+    std::string             name;
+    Executor<lua_State*>*   executor;
   };
 
Index: trunk/src/lib/shell/Makefile.am
===================================================================
--- trunk/src/lib/shell/Makefile.am	(revision 9682)
+++ trunk/src/lib/shell/Makefile.am	(revision 9869)
@@ -6,5 +6,4 @@
 libORXshell_a_SOURCES = \
 		shell.cc \
-		shell_buffer.cc \
 		shell_input.cc \
 		shell_command.cc \
@@ -16,8 +15,7 @@
 noinst_HEADERS= \
 		shell.h \
-		shell_buffer.h \
 		shell_input.h \
+		shell_command_class.h \
 		shell_command.h \
-		shell_command_class.h \
 		shell_completion.h \
 		shell_completion_plugin.h
Index: trunk/src/lib/shell/shell.cc
===================================================================
--- trunk/src/lib/shell/shell.cc	(revision 9682)
+++ trunk/src/lib/shell/shell.cc	(revision 9869)
@@ -18,5 +18,5 @@
 #include "shell.h"
 #include "shell_command.h"
-#include "shell_buffer.h"
+#include "debug_buffer.h"
 #include "shell_input.h"
 
@@ -54,4 +54,5 @@
   ->completionPlugin(0, OrxShell::CompletorFileSystem(".ttf", "fonts/"));
 
+  ObjectListDefinition(Shell);
 
   /**
@@ -60,8 +61,9 @@
   Shell::Shell ()
   {
-    this->setClassID(CL_SHELL, "Shell");
+    this->registerObject(this, Shell::_objectList);
+
     this->setName("Shell");
 
-    this->shellBuffer = ShellBuffer::getInstance();
+    this->shellBuffer = DebugBuffer::getInstance();
 
     // EVENT-Handler subscription of '`' to all States.
@@ -246,7 +248,5 @@
     this->setSizeX2D(width);
     for (std::list<MultiLineText*>::iterator textIt = this->bufferText.begin(); textIt != this->bufferText.end(); ++textIt)
-    {
       (*textIt)->setLineWidth(width);
-    }
   }
 
@@ -444,5 +444,5 @@
   {
     this->flush();
-    ShellBuffer::addBufferLineStatic("orxonox - shell\n ==================== \n", NULL);
+    DebugBuffer::addBufferLineStatic("orxonox - shell\n ==================== \n", NULL);
   }
 
@@ -470,9 +470,9 @@
         this->moveDisplayBuffer(-this->bufferDisplaySize+1);
       }
-      else if (event.type == EV_VIDEO_RESIZE)
-      {
-        this->updateResolution(event.resize.w);
-        this->repositionText();
-      }
+    }
+    else if (event.type == EV_VIDEO_RESIZE)
+    {
+      this->updateResolution(event.resize.w);
+      this->repositionText();
     }
   }
Index: trunk/src/lib/shell/shell.h
===================================================================
--- trunk/src/lib/shell/shell.h	(revision 9682)
+++ trunk/src/lib/shell/shell.h	(revision 9869)
@@ -14,5 +14,5 @@
 
 #include "shell_input.h"
-#include "shell_buffer.h"
+#include "debug_buffer.h"
 #include "material.h"
 
@@ -48,5 +48,5 @@
   class Shell : public Element2D, public EventListener
   {
-
+    ObjectListDeclaration(Shell);
   public:
     Shell();
@@ -93,5 +93,5 @@
   private:
     // GENERAL
-    ShellBuffer*                shellBuffer;            //!< The local ShellBuffer.
+    DebugBuffer*                shellBuffer;            //!< The local ShellBuffer.
 
     bool                        bActive;                //!< If the shell is active.
Index: trunk/src/lib/shell/shell_buffer.cc
===================================================================
--- trunk/src/lib/shell/shell_buffer.cc	(revision 9682)
+++ 	(revision )
@@ -1,139 +1,0 @@
-/*
-   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_SHELL
-
-#include "shell_buffer.h"
-
-#include <stdarg.h>
-
-#include "debug.h"
-#include "shell.h"
-#include "lib/util/threading.h"
-
-namespace OrxShell
-{
-  /**
-   * @brief standard constructor
-   */
-  ShellBuffer::ShellBuffer ()
-  {
-    ShellBuffer::singletonRef = this;
-
-    this->lineCount = 0;
-    this->bufferArray[0] = '\0';
-
-    this->setMaxBufferSize(100);
-  }
-
-  ShellBuffer* ShellBuffer::singletonRef = NULL;
-  std::list<std::string> ShellBuffer::buffer;
-  char ShellBuffer::bufferArray[SHELL_BUFFER_SIZE] = "";
-
-
-  /**
-   * @brief standard deconstructor
-   */
-  ShellBuffer::~ShellBuffer ()
-  {
-    ShellBuffer::singletonRef = NULL;
-  }
-
-  /**
-   * @brief deletes all the Buffers
-   */
-  void ShellBuffer::flush()
-  {
-    this->buffer.clear();
-  }
-
-  /**
-   * @brief adds a new Line to the List of Buffers
-   * @param line the Line as in the first argument in printf
-   */
-  void ShellBuffer::addBufferLineStatic(const char* line, ...)
-  {
-    static OrxThread::Mutex ShellBuffer__bufferMutex;
-
-    OrxThread::MutexLock bufferLock(&ShellBuffer__bufferMutex);
-
-    va_list arguments;
-    va_start(arguments, line);
-    vsnprintf(ShellBuffer::bufferArray, SHELL_BUFFER_SIZE, line, arguments);
-    va_end(arguments);
-
-#if DEBUG_LEVEL < 3
-    if (ShellBuffer::singletonRef == NULL)
-#endif
-      printf(ShellBuffer::bufferArray);
-#if DEBUG_LEVEL < 3
-    else
-#else
-    if (ShellBuffer::singletonRef != NULL)
-#endif
-      ShellBuffer::singletonRef->addBufferLine(ShellBuffer::bufferArray);
-  }
-
-  /**
-   * @brief add a Line to the List of Buffers
-   * @param line
-   * @param arguments
-   *
-   * This function Adds one line to the buffer.
-   * and displays the line as the First Line of the display-buffer
-   */
-  void ShellBuffer::addBufferLine(const char* line)
-  {
-    std::string inputBuffer = this->keepBuffer + line;
-
-    unsigned int lineBegin = 0;
-    unsigned int lineEnd = 0;
-    // adding all the new Lines
-    while (lineEnd < inputBuffer.size())
-    {
-      lineBegin = lineEnd;
-      lineEnd = inputBuffer.find('\n', (lineBegin == 0) ? 0: ++lineBegin);
-      if (likely(lineEnd != std::string::npos ))
-      {
-        this->lineCount++;
-        this->buffer.push_front(inputBuffer.substr(lineBegin, lineEnd - lineBegin));
-      }
-      else      // No end of Line reached.
-      {
-        this->keepBuffer = inputBuffer.substr(lineBegin, inputBuffer.size() - lineBegin);
-        break;
-      }
-
-      if (inputBuffer[lineBegin] == '\n')
-        lineBegin++, lineEnd++;
-
-      if (this->buffer.size() > this->maxBufferSize)
-        this->buffer.pop_back();
-    }
-  }
-
-  /**
-   * @brief displays some nice output from the Shell
-   */
-  void ShellBuffer::debug() const
-  {
-    PRINT(3)("Debugging output to console (not this shell)\n");
-
-    std::list<std::string>::const_iterator bufferLine;
-    for (bufferLine = --this->buffer.end(); bufferLine != this->buffer.begin(); --bufferLine)
-      printf((*bufferLine).c_str());
-  }
-
-}
Index: trunk/src/lib/shell/shell_buffer.h
===================================================================
--- trunk/src/lib/shell/shell_buffer.h	(revision 9682)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*!
- * @file shell_buffer.h
- * @brief The Shell buffer Tasks
- * @see debug.h
-*/
-
-#ifndef _SHELL_BUFFER_H
-#define _SHELL_BUFFER_H
-
-#include <string>
-#include <list>
-#include <stdarg.h>
-
-#define      SHELL_BUFFER_SIZE       16384         //!< The Size of the input-buffers (should be large enough to carry any kind of input)
-
-namespace OrxShell
-{
-  //! A class handling output from orxonox via debug.h
-  /**
-   * the ShellBuffer redirects output from PRINTF(x) to the Shell and STDOUT
-   * the ShellBuffer is a front-filling queue of limited length, that has the
-   * youngest added Entry at the beginning, and the oldest at the end.
-   */
-  class ShellBuffer
-  {
-
-  public:
-    virtual ~ShellBuffer();
-    /** @returns a Pointer to the only object of this Class */
-    inline static ShellBuffer* getInstance() { if (!ShellBuffer::singletonRef) ShellBuffer::singletonRef = new ShellBuffer();  return ShellBuffer::singletonRef; };
-    /** @returns true if this class is instanciated, false otherwise */
-    inline static bool isInstanciated() { return (ShellBuffer::singletonRef == NULL)?false:true; };
-
-    static void addBufferLineStatic(const char* line, ...);
-    void addBufferLine(const char* line);
-
-    /// BUFFER
-    /** @param bufferSize the new Buffer-Size */
-    void setMaxBufferSize(unsigned int maxBufferSize) { this->maxBufferSize = maxBufferSize; };
-    void flush();
-
-    /** @returns the List of stings from the Buffer */
-    const std::list<std::string>& getBuffer() const { return this->buffer; };
-    /** @returns the Count of lines processed by the Shell. */
-    inline unsigned long getLineCount() const { return this->lineCount; };
-    /** @returns the Current Buffer Size. */
-    inline unsigned int getBufferSize() const { return this->buffer.size(); };
-
-    void debug() const;
-
-  private:
-    ShellBuffer();
-
-  private:
-    static ShellBuffer*           singletonRef;                       //!< The singleton-reference to the only memeber of this class.
-    unsigned int                  maxBufferSize;                         //!< The Size of the buffer
-
-    std::string                   keepBuffer;                         //!< a BUFFER to have multi-non-newLine commands be copied into the shell.
-
-    unsigned long                 lineCount;                          //!< how many Lines have been written out so far.
-
-    // The Beginning of buffer (buffer.front()) is the last added line.
-    static char                   bufferArray[SHELL_BUFFER_SIZE];     //!< a BUFFER for fast writing
-    static std::list<std::string> buffer;                             //!< A list of stored char-arrays(strings) to store the history
-  };
-
-}
-
-#endif /* _SHELL_BUFFER_H */
Index: trunk/src/lib/shell/shell_command.cc
===================================================================
--- trunk/src/lib/shell/shell_command.cc	(revision 9682)
+++ trunk/src/lib/shell/shell_command.cc	(revision 9869)
@@ -20,6 +20,6 @@
 
 #include "compiler.h"
+#include "helper_functions.h"
 #include "debug.h"
-#include "class_list.h"
 
 #include "key_names.h"
@@ -27,4 +27,5 @@
 namespace OrxShell
 {
+  ObjectListDefinition(ShellCommand);
   SHELL_COMMAND(debug, ShellCommandClass, help);
 
@@ -36,7 +37,7 @@
    * @param paramCount the count of parameters this command takes
    */
-  ShellCommand::ShellCommand(const std::string& commandName, const std::string& className, Executor* executor)
-  {
-    this->setClassID(CL_SHELL_COMMAND, "ShellCommand");
+  ShellCommand::ShellCommand(const std::string& commandName, const std::string& className, Executor<const SubString>* executor)
+  {
+    this->registerObject(this, ShellCommand::_objectList);
     PRINTF(4)("create shellcommand '%s' for class '%s'\n", commandName.c_str(), className.c_str());
     this->setName(commandName);
@@ -44,5 +45,4 @@
     // copy the executor:
     this->executor = executor;
-    this->executor->setName(commandName);
 
     for (unsigned int i = 0; i < this->executor->getParamCount(); i++)
@@ -75,5 +75,5 @@
    * @brief registers a new ShellCommand
    */
-  ShellCommand* ShellCommand::registerCommand(const std::string& commandName, const std::string& className, Executor* executor)
+  ShellCommand* ShellCommand::registerCommand(const std::string& commandName, const std::string& className, Executor<const SubString>* executor)
   {
     if (ShellCommand::exists(commandName, className))
@@ -94,10 +94,9 @@
   void ShellCommand::unregisterCommand(const std::string& commandName, const std::string& className)
   {
-
     ShellCommandClass* cmdClass = ShellCommandClass::acquireCommandClass(className);
     if (cmdClass != NULL)
     {
       CmdList::iterator cmd;
-      for (cmd = cmdClass->commandList.begin(); cmd != cmdClass->commandList.end(); cmd++)
+      for (cmd = cmdClass->_commandList.begin(); cmd != cmdClass->_commandList.end(); cmd++)
         if (commandName == (*cmd)->getName())
         {
@@ -119,8 +118,8 @@
 
     CmdList::const_iterator elem;
-    for (unsigned int i = 0; i < cmdClass->commandList.size(); i++)
-    {
-      if (commandName == cmdClass->commandList[i]->getName())
-        return (cmdClass->commandList[i]);
+    for (unsigned int i = 0; i < cmdClass->_commandList.size(); i++)
+    {
+      if (commandName == cmdClass->_commandList[i]->getName())
+        return (cmdClass->_commandList[i]);
     }
     return NULL;
@@ -242,21 +241,23 @@
       return false;
 
-    const std::list<BaseObject*>* objectList = ClassList::getList(cmd->shellClass->getName());
+    const ObjectListBase* const objectList = ObjectListBase::getObjectList(cmd->shellClass->getName());
     if (objectList != NULL)
     {
-      std::list<BaseObject*>::const_iterator bo;
+      ObjectListBase::base_list list;
+      objectList->getBaseObjectList(&list);
+      ObjectListBase::base_iterator it;
 
       // No Description given (only for speedup)
       if (objectDescriptor.empty())
       {
-        for (bo = objectList->begin(); bo != objectList->end(); bo++)
-          boList->push_back(*bo);
+        for (it = list.begin(); it != list.end(); it++)
+          boList->push_back(*it);
       }
       // some description
       else
       {
-        for (bo = objectList->begin(); bo != objectList->end(); bo++)
-          if (!nocaseCmp(objectDescriptor, (*bo)->getName(), objectDescriptor.size()))
-            boList->push_back(*bo);
+        for (it = list.begin(); it != list.end(); it++)
+          if (!nocaseCmp(objectDescriptor, (*it)->getName(), objectDescriptor.size()))
+            boList->push_back(*it);
       }
     }
@@ -299,9 +300,16 @@
     if (sc != NULL)
     {
-      for(std::vector<BaseObject*>::const_iterator bo = boList.begin(); bo != boList.end(); ++bo)
-      {
-        PRINT(0)("Command '%s' on '%s::%s'\n", sc->getCName(), (*bo)->getClassCName(), (*bo)->getCName());
-        (*sc->executor)((*bo), inputSplits.subSet(paramBegin));
-      }
+
+      if(sc->executor->getType() == Executor<const SubString>::FunctionStatic )
+      {
+	PRINT(0)("Static Command '%s' of Class '%s' with parameters\n", sc->getCName(), sc->shellClass->getCName());
+	(*sc->executor)(NULL, inputSplits.subSet(paramBegin));
+      }
+      else
+        for(std::vector<BaseObject*>::const_iterator bo = boList.begin(); bo != boList.end(); ++bo)
+        {
+          PRINT(0)("Command '%s' on '%s::%s'\n", sc->getCName(), (*bo)->getClassCName(), (*bo)->getCName());
+          (*sc->executor)((*bo), inputSplits.subSet(paramBegin));
+        }
       return true;
     }
@@ -376,7 +384,7 @@
     else
     {
-//       if(this->completors[parameter] == NULL)
-//       delete this->completors[parameter];
-//       this->completors[parameter] = completorPlugin.clone();
+      //       if(this->completors[parameter] == NULL)
+      //       delete this->completors[parameter];
+      //       this->completors[parameter] = completorPlugin.clone();
     }
     return this;
Index: trunk/src/lib/shell/shell_command.h
===================================================================
--- trunk/src/lib/shell/shell_command.h	(revision 9682)
+++ trunk/src/lib/shell/shell_command.h	(revision 9869)
@@ -9,5 +9,10 @@
 #include "base_object.h"
 
-#include "executor/executor.h"
+/// THIS IS USED TO LOAD CONSTANT AND STATIC FUNCTIONS EASILY.
+#include "executor/executor_substring.h"
+#include "executor/functor_member.h"
+#include "executor/functor_const_member.h"
+#include "executor/functor_static.h"
+
 #include "shell_completion_plugin.h"
 
@@ -35,5 +40,5 @@
    */
 #define SHELL_COMMAND(command, class, function) \
-           OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, createExecutor<class>(&class::function))
+           OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, createExecutor<class, BaseObject>(&class::function))
 
   /**
@@ -51,5 +56,5 @@
    */
 #define SHELL_COMMAND_STATIC(command, class, function) \
-           OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, createExecutor<class>(function))
+           OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, createExecutor<class, BaseObject>(function))
 
 
@@ -58,4 +63,6 @@
   class ShellCommand : public BaseObject
   {
+    ObjectListDeclaration(ShellCommand);
+
     friend class ShellCommandClass;
   public:
@@ -69,5 +76,5 @@
     ShellCommand* completionPlugin(unsigned int parameter, const CompletorPlugin& completorPlugin);
 
-    static ShellCommand* registerCommand(const std::string& commandName, const std::string& className, Executor* executor);
+    static ShellCommand* registerCommand(const std::string& commandName, const std::string& className, Executor<const SubString>* executor);
     static void unregisterCommand(const std::string& commandName, const std::string& className);
     static const ShellCommand* const getCommand(const std::string& commandName, const std::string& className);
@@ -85,5 +92,5 @@
 
   protected:
-    ShellCommand(const std::string& commandName, const std::string& className, Executor* executor);
+    ShellCommand(const std::string& commandName, const std::string& className, Executor<const SubString>* executor);
     virtual ~ShellCommand();
 
@@ -97,5 +104,5 @@
     std::string                      description;           //!< A description for this commnand. (initially ""). Assigned with (create)->describe("blablabla");
     std::vector<CompletorPlugin*>    completors;            //!< Completors for the Parameters
-    Executor*                        executor;              //!< The Executor, that really executes the Function.
+    Executor<const SubString>*       executor;              //!< The Executor, that really executes the Function.
   };
 
Index: trunk/src/lib/shell/shell_command_class.cc
===================================================================
--- trunk/src/lib/shell/shell_command_class.cc	(revision 9682)
+++ trunk/src/lib/shell/shell_command_class.cc	(revision 9869)
@@ -21,5 +21,4 @@
 
 #include "debug.h"
-#include "class_list.h"
 #include "compiler.h"
 
@@ -28,5 +27,7 @@
 namespace OrxShell
 {
-  CmdClassList* ShellCommandClass::commandClassList = NULL;
+  ObjectListDefinition(ShellCommandClass);
+
+  CmdClassList* ShellCommandClass::_commandClassList = NULL;
 
   /**
@@ -35,14 +36,12 @@
    */
   ShellCommandClass::ShellCommandClass(const std::string& className)
-      : className(className)
-  {
-    this->setClassID(CL_SHELL_COMMAND_CLASS, "ShellCommandClass");
+      : _className(className)
+  {
+    this->registerObject(this, ShellCommandClass::_objectList);
     this->setName(className);
 
-    this->classID = CL_NULL;
-
-    if (ShellCommandClass::commandClassList == NULL)
-      ShellCommandClass::commandClassList = new CmdClassList;
-    ShellCommandClass::commandClassList->push_back(this);
+    if (ShellCommandClass::_commandClassList == NULL)
+      ShellCommandClass::_commandClassList = new CmdClassList;
+    ShellCommandClass::_commandClassList->push_back(this);
   }
 
@@ -52,12 +51,12 @@
   ShellCommandClass::~ShellCommandClass()
   {
-    while(!this->commandList.empty())
-      delete this->commandList.back();
-
-    if (ShellCommandClass::commandClassList != NULL)
-    {
-      CmdClassList::iterator delClass = std::find(ShellCommandClass::commandClassList->begin(), ShellCommandClass::commandClassList->end(), this);
-      if (delClass != ShellCommandClass::commandClassList->end())
-        ShellCommandClass::commandClassList->erase(delClass);
+    while(!this->_commandList.empty())
+      delete this->_commandList.back();
+
+    if (ShellCommandClass::_commandClassList != NULL)
+    {
+      CmdClassList::iterator delClass = std::find(ShellCommandClass::_commandClassList->begin(), ShellCommandClass::_commandClassList->end(), this);
+      if (delClass != ShellCommandClass::_commandClassList->end())
+        ShellCommandClass::_commandClassList->erase(delClass);
     }
   }
@@ -68,5 +67,5 @@
   void ShellCommandClass::registerCommand(ShellCommand* command)
   {
-    this->commandList.push_back(command);
+    this->_commandList.push_back(command);
   }
 
@@ -77,7 +76,7 @@
   void ShellCommandClass::unregisterCommand(ShellCommand* command)
   {
-    CmdList::iterator delC = std::find(this->commandList.begin(), this->commandList.end(), command);
-    if (delC != this->commandList.end())
-      this->commandList.erase(delC);
+    CmdList::iterator delC = std::find(this->_commandList.begin(), this->_commandList.end(), command);
+    if (delC != this->_commandList.end())
+      this->_commandList.erase(delC);
   }
 
@@ -89,11 +88,11 @@
     // unregister all commands and Classes
     CmdClassList::iterator classIT;
-    if (ShellCommandClass::commandClassList == NULL)
+    if (ShellCommandClass::_commandClassList == NULL)
       return;
 
-    while (!ShellCommandClass::commandClassList->empty())
-      delete ShellCommandClass::commandClassList->back();
-    delete ShellCommandClass::commandClassList;
-    ShellCommandClass::commandClassList = NULL;
+    while (!ShellCommandClass::_commandClassList->empty())
+      delete ShellCommandClass::_commandClassList->back();
+    delete ShellCommandClass::_commandClassList;
+    ShellCommandClass::_commandClassList = NULL;
   }
 
@@ -107,15 +106,15 @@
   bool ShellCommandClass::getCommandListOfClass(const std::string& className, std::list<std::string>& stringList)
   {
-    if (ShellCommandClass::commandClassList == NULL)
+    if (ShellCommandClass::_commandClassList == NULL)
       return false;
 
 
     CmdClassList::const_iterator elem;
-    for(elem = ShellCommandClass::commandClassList->begin(); elem != ShellCommandClass::commandClassList->end(); elem++)
+    for(elem = ShellCommandClass::_commandClassList->begin(); elem != ShellCommandClass::_commandClassList->end(); elem++)
     {
       if (className == (*elem)->getName())
       {
         CmdList::iterator command;
-        for(command = (*elem)->commandList.begin(); command != (*elem)->commandList.end(); command++)
+        for(command = (*elem)->_commandList.begin(); command != (*elem)->_commandList.end(); command++)
           stringList.push_back((*command)->getName());
         return true;
@@ -133,11 +132,11 @@
   ShellCommandClass* ShellCommandClass::getCommandClass(const std::string& className)
   {
-    if (ShellCommandClass::commandClassList == NULL)
+    if (ShellCommandClass::_commandClassList == NULL)
       return false;
 
 
     CmdClassList::const_iterator classIT;
-    for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
-      if (className == (*classIT)->className)
+    for (classIT = ShellCommandClass::_commandClassList->begin(); classIT != ShellCommandClass::_commandClassList->end(); classIT++)
+      if (className == (*classIT)->_className)
         return (*classIT);
     return NULL;
@@ -152,11 +151,4 @@
   {
     return (ShellCommandClass::getCommandClass(className) != NULL);
-  }
-
-  ClassID ShellCommandClass::getClassID()
-  {
-    if (this->classID == CL_NULL)
-      this->classID = ClassList::StringToID(this->className);
-    return this->classID;
   }
 
@@ -181,5 +173,5 @@
   void ShellCommandClass::help(const std::string& className)
   {
-    if (ShellCommandClass::commandClassList == NULL)
+    if (ShellCommandClass::_commandClassList == NULL)
     {
       PRINT(0)("No Commands Registered\n");
@@ -187,15 +179,15 @@
     }
     if (className.empty())
-      PRINT(0)("===== Displaying %d registered Classes:\n", ShellCommandClass::commandClassList->size());
+      PRINT(0)("===== Displaying %d registered Classes:\n", ShellCommandClass::_commandClassList->size());
 
 
     CmdClassList::iterator classIT;
-    for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
-    {
-      if (className.empty() || className == (*classIT)->className)
+    for (classIT = ShellCommandClass::_commandClassList->begin(); classIT != ShellCommandClass::_commandClassList->end(); classIT++)
+    {
+      if (className.empty() || className == (*classIT)->_className)
       {
-        PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className.c_str(), (*classIT)->commandList.size());
+        PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->_className.c_str(), (*classIT)->_commandList.size());
         CmdList::const_iterator cmdIT;
-        for (cmdIT = (*classIT)->commandList.begin(); cmdIT != (*classIT)->commandList.end(); cmdIT++)
+        for (cmdIT = (*classIT)->_commandList.begin(); cmdIT != (*classIT)->_commandList.end(); cmdIT++)
         {
           PRINT(0)("  command:'%s' : params:%d: ", (*cmdIT)->getCName(), (*cmdIT)->executor->getParamCount());
Index: trunk/src/lib/shell/shell_command_class.h
===================================================================
--- trunk/src/lib/shell/shell_command_class.h	(revision 9682)
+++ trunk/src/lib/shell/shell_command_class.h	(revision 9869)
@@ -25,8 +25,10 @@
   class ShellCommandClass : public BaseObject
   {
+    ObjectListDeclaration(ShellCommandClass);
+
     friend class ShellCommand;
   public:
     /** @returns the CommandClassList */
-    static const CmdClassList& getCommandClassList() { return *ShellCommandClass::commandClassList; };
+    static const CmdClassList& getCommandClassList() { return *ShellCommandClass::_commandClassList; };
 
     static bool getCommandListOfClass(const std::string& className, std::list<std::string>& stringList);
@@ -51,9 +53,8 @@
 
   private:
-    const std::string                      className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
-    ClassID                                classID;                   //!< The classID of this Class
-    CmdList                                commandList;               //!< A list of Commands from this Class
+    const std::string                      _className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
+    CmdList                                _commandList;               //!< A list of Commands from this Class
 
-    static CmdClassList*                   commandClassList;          //!< A list of Classes
+    static CmdClassList*                   _commandClassList;          //!< A list of Classes
   };
 }
Index: trunk/src/lib/shell/shell_completion.cc
===================================================================
--- trunk/src/lib/shell/shell_completion.cc	(revision 9682)
+++ trunk/src/lib/shell/shell_completion.cc	(revision 9869)
@@ -22,6 +22,5 @@
 #include "shell_command.h"
 
-#include "substring.h"
-#include "class_list.h"
+#include "helper_functions.h"
 #include "debug.h"
 
@@ -51,6 +50,6 @@
   bool ShellCompletion::autoComplete(std::string& input)
   {
-    long classID = CL_NULL;                          //< the classID retrieved from the Class.
-    const std::list<BaseObject*>* objectList = NULL; //< the list of Objects stored in classID's ClassList
+    ClassID classID;
+    const ObjectListBase* objectList = NULL;      //< the list of Objects stored in classID's ClassList
     bool emptyComplete = false;                      //< if the completion input is empty string. e.g ""
     long completeType = NullCompletion;              //< the Type we'd like to complete.
@@ -85,7 +84,8 @@
              (!emptyComplete && inputSplits.size() == 2))
     {
-      classID = ClassList::StringToID(inputSplits.getString(0));
-      objectList = ClassList::getList((ClassID)classID);
-      if (classID != CL_NULL)
+      objectList = ObjectListBase::getObjectList(inputSplits[0]);
+      if (objectList != NULL)
+        classID = objectList->identity();
+      if (classID != NullClass::staticClassID())
         completeType |= ObjectCompletion;
       completeType |= FunctionCompletion;
@@ -95,5 +95,5 @@
              (!emptyComplete && inputSplits.size() == 3))
     {
-      if (ClassList::exists(inputSplits[0], inputSplits[1]))
+      if (ObjectListBase::getBaseObject(inputSplits[0], inputSplits[1]))
         completeType |= FunctionCompletion;
     }
@@ -113,7 +113,7 @@
 
     if (completeType & ClassCompletion)
-      this->objectComplete(completeString, CL_SHELL_COMMAND_CLASS);
+      this->objectComplete(completeString, &ShellCommandClass::objectList());
     if (completeType & ObjectCompletion)
-      this->objectComplete(completeString, classID);
+      this->objectComplete(completeString, objectList);
     if (completeType & FunctionCompletion)
       this->commandComplete(completeString, inputSplits[0]);
@@ -133,17 +133,18 @@
    * @return true on success, false otherwise
    */
-  bool ShellCompletion::objectComplete(const std::string& objectBegin, long classID)
-  {
-    const std::list<BaseObject*>* boList = ClassList::getList((ClassID)classID);
-    if (boList != NULL)
-    {
-      CompletionType type = ObjectCompletion;
-      if (classID == CL_SHELL_COMMAND_CLASS)
-        type = ClassCompletion;
-      if (!this->addToCompleteList(*boList, objectBegin, type))
-        return false;
-    }
-    else
-      return false;
+  bool ShellCompletion::objectComplete(const std::string& objectBegin, const ObjectListBase* objectList)
+  {
+    assert (objectList != NULL);
+
+    CompletionType type = ObjectCompletion;
+    if (objectList == &ShellCommandClass::objectList())
+      type = ClassCompletion;
+
+    ObjectListBase::base_list list;
+    objectList->getBaseObjectList(&list);
+
+    if (!this->addToCompleteList(list, objectBegin, type))
+     return false;
+
     return true;
   }
@@ -321,16 +322,16 @@
     switch (type)
     {
-        default:// SHELLC_NONE
-        return typeNames[0];
-        case  ClassCompletion:
-        return typeNames[1];
-        case ObjectCompletion:
-        return typeNames[2];
-        case FunctionCompletion:
-        return typeNames[3];
-        case AliasCompletion:
-        return typeNames[4];
-        case ParamCompletion:
-        return typeNames[5];
+      default:// SHELLC_NONE
+      return typeNames[0];
+      case  ClassCompletion:
+      return typeNames[1];
+      case ObjectCompletion:
+      return typeNames[2];
+      case FunctionCompletion:
+      return typeNames[3];
+      case AliasCompletion:
+      return typeNames[4];
+      case ParamCompletion:
+      return typeNames[5];
     }
   }
Index: trunk/src/lib/shell/shell_completion.h
===================================================================
--- trunk/src/lib/shell/shell_completion.h	(revision 9682)
+++ trunk/src/lib/shell/shell_completion.h	(revision 9869)
@@ -16,4 +16,5 @@
 // FORWARD DECLARATION
 class BaseObject;
+class ObjectListBase;
 
 namespace OrxShell
@@ -50,8 +51,8 @@
       bool autoComplete(std::string& input);
 
-      static const std::string& ShellCompletion::typeToString(ShellCompletion::CompletionType type);
+      static const std::string& typeToString(ShellCompletion::CompletionType type);
 
     private:
-      bool objectComplete(const std::string& objectBegin, long classID);
+      bool objectComplete(const std::string& objectBegin, const ObjectListBase* const objectList);
       bool commandComplete(const std::string& commandBegin, const std::string& className);
       bool aliasComplete(const std::string& aliasBegin);
Index: trunk/src/lib/shell/shell_completion_plugin.cc
===================================================================
--- trunk/src/lib/shell/shell_completion_plugin.cc	(revision 9682)
+++ trunk/src/lib/shell/shell_completion_plugin.cc	(revision 9869)
@@ -21,6 +21,5 @@
 #include "shell_command.h"
 
-#include "substring.h"
-#include "class_list.h"
+#include "helper_functions.h"
 #include "loading/resource_manager.h"
 
@@ -98,5 +97,5 @@
     if (completionBegin.empty()) // if we do not yet have the beginning of the line, start with the chosen startDir.
     {
-      dir.setFileName(ResourceManager::getInstance()->getDataDir() + this->_subDir);
+      dir.setFileName(Resources::ResourceManager::getInstance()->mainGlobalPath().name() + this->_subDir);
       dir.open();
       for(unsigned int i = 0; i < dir.fileCount(); i++ )
@@ -113,5 +112,5 @@
         directoryName = completionBegin.substr(0, pos);
 
-      dir.setFileName(ResourceManager::getInstance()->getDataDir() + directoryName);
+      dir.setFileName(Resources::ResourceManager::getInstance()->mainGlobalPath().name() + directoryName);
       dir.open();
 
@@ -136,7 +135,7 @@
           continue;
         }
-        printf("%s\n", (ResourceManager::getInstance()->getDataDir() + fileName).c_str());
+	printf("%s\n", (Resources::ResourceManager::getInstance()->mainGlobalPath().name() + fileName).c_str());
         if (!nocaseCmp(completionBegin, fileName, completionBegin.size()) &&
-             ResourceManager::isInDataDir(fileName))
+	     Resources::ResourceManager::getInstance()->checkFileInMainPath(fileName))
         {
           printf("Dir %s\n", fileName.c_str());
Index: trunk/src/lib/shell/shell_input.cc
===================================================================
--- trunk/src/lib/shell/shell_input.cc	(revision 9682)
+++ trunk/src/lib/shell/shell_input.cc	(revision 9869)
@@ -24,4 +24,5 @@
 #include "compiler.h"
 #include "key_names.h"
+
 
 namespace OrxShell
@@ -31,4 +32,5 @@
   ->setAlias("help");
 
+  ObjectListDefinition(ShellInput);
 
   /**
@@ -39,8 +41,8 @@
       : Text ("")
   {
+    this->registerObject(this, ShellInput::_objectList);
+
     this->pressedKey = SDLK_FIRST;
-    this->setClassID(CL_SHELL_INPUT, "ShellInput");
-
-    this->inputLine = "";
+
     this->historyIT = ShellInput::history.begin();
     this->setHistoryLength(50);
@@ -53,5 +55,5 @@
     {
       //if (!this->isEventSubscribed(ES_SHELL, i))
-        this->subscribeEvent(ES_SHELL, i);
+      this->subscribeEvent(ES_SHELL, i);
     }
     // unsubscribe unused TODO improve.
@@ -60,5 +62,4 @@
     this->unsubscribeEvent(ES_SHELL, SDLK_PAGEUP);
     this->unsubscribeEvent(ES_SHELL, SDLK_PAGEDOWN);
-
   }
 
@@ -87,6 +88,7 @@
   void ShellInput::flush()
   {
-    this->inputLine.clear();
-    this->setText(this->inputLine);
+    this->inputLineBegin.clear();
+    this->inputLineEnd.clear();
+    this->clear();
   }
 
@@ -97,6 +99,7 @@
   void ShellInput::setInputText(const std::string& text)
   {
-    this->inputLine = text;
-    this->setText(this->inputLine);
+    this->inputLineBegin = text;
+    this->inputLineEnd.clear();
+    this->setText(text);
   }
 
@@ -114,6 +117,6 @@
     }
 
-    this->inputLine += character;
-    this->setText(this->inputLine);
+    this->inputLineBegin += character;
+    this->setText(this->inputLineBegin + this->inputLineEnd);
   }
 
@@ -130,6 +133,6 @@
     }
 
-    this->inputLine += characters;
-    this->setText(this->inputLine);
+    this->inputLineBegin += characters;
+    this->setText(this->inputLineBegin + this->inputLineEnd);
   }
 
@@ -145,9 +148,9 @@
       this->historyScrolling = false;
     }
-    if (this->inputLine.size() < characterCount)
-      characterCount = this->inputLine.size();
-
-    this->inputLine.erase(this->inputLine.size() - characterCount, this->inputLine.size());
-    this->setText(this->inputLine);
+    if (this->inputLineBegin.size() < characterCount)
+      characterCount = this->inputLineBegin.size();
+
+    this->inputLineBegin.erase(this->inputLineBegin.size() - characterCount, this->inputLineBegin.size());
+    this->setText(this->inputLineBegin + this->inputLineEnd);
   }
 
@@ -158,10 +161,9 @@
   bool ShellInput::executeCommand()
   {
-    ShellBuffer::addBufferLineStatic("Execute Command: %s\n", this->inputLine.c_str());
-
-    if (this->inputLine.empty())
+    if (this->getInput().empty())
       return false;
-
-    ShellCommand::execute(this->inputLine);
+    DebugBuffer::addBufferLineStatic("Execute Command: %s\n", this->getInput().c_str());
+
+    ShellCommand::execute(this->getInput());
 
     // removing the eventually added Entry (from scrolling) to the List
@@ -173,6 +175,6 @@
 
     // adding the new Command to the History
-    if (history.empty() || history.back() != this->inputLine)
-      this->history.push_back(this->inputLine);
+    if (history.empty() || history.back() != this->getInput())
+      this->history.push_back(this->getInput());
     if (this->history.size() > this->historyLength)
     {
@@ -193,5 +195,5 @@
     if (!this->historyScrolling)
     {
-      this->history.push_back(this->inputLine);
+      this->history.push_back(this->getInput());
       this->historyScrolling = true;
       this->historyIT = --this->history.end();
@@ -231,4 +233,30 @@
   }
 
+  /**
+   * @brief moves the cursor chars Characters to the right.
+   * @param chars how much to move the cursor.
+   */
+  void ShellInput::moveCursor(int chars)
+  {
+    if (chars > 0)
+    {
+      PRINTF(5)("move cursor %d to the right\n", chars);
+      if (chars >= (int) this->inputLineEnd.size())
+        chars = inputLineEnd.size();
+      this->inputLineBegin += this->inputLineEnd.substr(0, chars);
+      this->inputLineEnd.erase(0, chars);
+    }
+    else if (chars < 0)
+    {
+      chars = -chars;
+      PRINTF(5)("move cursor %d to the left\n", chars);
+
+      if (chars >= (int) this->inputLineBegin.size())
+	chars = inputLineBegin.size();
+      this->inputLineEnd = this->inputLineBegin.substr(this->inputLineBegin.size() - chars) + this->inputLineEnd;
+      this->inputLineBegin.erase(this->inputLineBegin.size() - chars);
+    }
+  }
+
 
   /**
@@ -237,14 +265,12 @@
   void ShellInput::help(const std::string& className, const std::string& functionName)
   {
-    printf("%s::%s\n", className.c_str(), functionName.c_str());
-
     if (className.empty())
     {
-      PRINT(0)("Help for the most important Shell-commands\n");
-      PRINT(0)("F1 - HELP; F2 - DEBUG; '`' - open/close shell\n");
-      PRINT(0)("input order:\n");
-      PRINT(0)("ClassName [objectName] function [parameter1, [parameter2 ...]]  or\n");
-      PRINT(0)("Alias [parameter]\n");
-      PRINT(0)("- Also try 'help className'");
+      PRINT(0)("== Help for the most important Shell-commands\n");
+      PRINT(0)("  F1 - HELP; F2 - DEBUG; '`' - open/close shell\n");
+      PRINT(0)("  input order:\n");
+      PRINT(0)("   ClassName [objectName] function [parameter1, [parameter2 ...]]  or\n");
+      PRINT(0)("   Alias [parameter]\n");
+      PRINT(0)("- Also try 'help className' or pushing 'TAB'\n");
     }
     else if (!className.empty() && functionName.empty())
@@ -269,17 +295,17 @@
       {
         case SDLK_BACKSPACE:
-          this->removeCharacters(1);
-          break;
+        this->removeCharacters(1);
+        break;
         case SDLK_UP:
-          this->historyMoveUp();
-          break;
+        this->historyMoveUp();
+        break;
         case SDLK_DOWN:
-          this->historyMoveDown();
-          break;
+        this->historyMoveDown();
+        break;
         default:
-          {
-            if (likely(pressedKey < 127))
-              this->addCharacter(this->pressedKey);
-          }
+        {
+          if (likely(pressedKey < 127))
+            this->addCharacter(this->pressedKey);
+        }
       }
     }
@@ -313,8 +339,20 @@
         this->pressedEvent = event.type;
       }
+      else if (event.type == SDLK_LEFT)
+      {
+        this->moveCursor(-1);
+        this->pressedKey = event.type;
+        this->pressedEvent = event.type;
+      }
+      else if (event.type == SDLK_RIGHT)
+      {
+        this->moveCursor(+1);
+        this->pressedKey = event.type;
+        this->pressedEvent = event.type;
+      }
       else if (event.type == SDLK_TAB)
       {
-        this->completion.autoComplete(this->inputLine);
-        this->setText(this->inputLine);
+        this->completion.autoComplete(this->inputLineBegin);
+        this->setText(this->getInput());
       }
       else if (event.type == SDLK_BACKSPACE)
@@ -325,4 +363,12 @@
         this->removeCharacters(1);
       }
+      else if (event.type == SDLK_DELETE)
+      {
+	if (!this->inputLineEnd.empty())
+	{
+	  this->inputLineEnd.erase(0, 1);
+	  this->setText(this->getInput());
+	}
+      }
       else if (event.type == SDLK_RETURN)
       {
Index: trunk/src/lib/shell/shell_input.h
===================================================================
--- trunk/src/lib/shell/shell_input.h	(revision 9682)
+++ trunk/src/lib/shell/shell_input.h	(revision 9869)
@@ -30,4 +30,5 @@
   class ShellInput : public Text,  public EventListener
   {
+    ObjectListDeclaration(ShellInput);
 
   public:
@@ -36,5 +37,5 @@
 
     /** @returns the inputLine */
-    const std::string& getInput() const { return this->inputLine; };
+    std::string getInput() const { return this->inputLineBegin + this->inputLineEnd; };
 
     // InputLine
@@ -54,4 +55,6 @@
     void historyMoveDown();
 
+    void moveCursor(int chars);
+
     void help(const std::string& className = "", const std::string& function = "");
 
@@ -63,5 +66,7 @@
     ShellCompletion                   completion;       //!< The Completion Interface.
 
-    std::string                       inputLine;        //!< the Char-Array of the Buffer
+    std::string                       inputLineBegin;   //!< The Line up to the cursor.
+    std::string                       inputLineEnd;     //!< The Line from the cursor on
+
     float                             repeatRate;       //!< The Repeat-Delay.
     float                             repeatDelay;      //!< The delay of the first Character of a given Character.
Index: trunk/src/lib/shell/some_shell_commands.cc
===================================================================
--- trunk/src/lib/shell/some_shell_commands.cc	(revision 9682)
+++ trunk/src/lib/shell/some_shell_commands.cc	(revision 9869)
@@ -29,25 +29,45 @@
 
 #include "network_game_rules.h"
-  SHELL_COMMAND(say, NetworkGameRules, shellSay)->setAlias("say");
+SHELL_COMMAND(say, NetworkGameRules, shellSay)->setAlias("say");
 
 #include "player_stats.h"
-  SHELL_COMMAND(nick, PlayerStats, shellNick)->setAlias("nick");
+SHELL_COMMAND(nick, PlayerStats, shellNick)->setAlias("nick");
 
-#include "class_list.h"
-  SHELL_COMMAND(debug, ClassList, ClassList::debugS)
-      ->describe("Shows all registered classes, if param1: is a valid ClassName only values of this class are shown. param2: how much output")
-      ->defaultValues(MT_NULL, 1);
+// #include "class_list.h"
+//   SHELL_COMMAND(debug, ClassList, ClassList::debugS)
+//       ->describe("Shows all registered classes, if param1: is a valid ClassName only values of this class are shown. param2: how much output")
+//       ->defaultValues(MT_NULL, 1);
 
 #include "p_node.h"
-  SHELL_COMMAND(debugNode, PNode, debugNode);
-  SHELL_COMMAND(setPosition, PNode, setAbsCoor);
+SHELL_COMMAND(debugNode, PNode, debugNode);
+SHELL_COMMAND(setPosition, PNode, setAbsCoor);
 
 #include "render_2d.h"
-  SHELL_COMMAND(toggleNodeVisibility, Render2D, toggleNodesVisibility);
+SHELL_COMMAND(toggleNodeVisibility, Render2D, toggleNodesVisibility);
 
 
 #include "material.h"
-  SHELL_COMMAND(setDiffuseTexture, Material, setDiffuseMap)
-      ->defaultValues(MT_NULL, (int)GL_TEXTURE_2D)
-      ->completionPlugin(0, CompletorFileSystem());
+SHELL_COMMAND(setDiffuseTexture, Material, setDiffuseMap)
+->defaultValues(MT_NULL, (int)GL_TEXTURE_2D)
+->completionPlugin(0, CompletorFileSystem());
 
+#include "loading/resource_manager.h"
+namespace Resources {
+  SHELL_COMMAND(debug, ResourceManager, debug);
+  SHELL_COMMAND(load, ResourceManager, loadFromLoadStringHACK);
+  SHELL_COMMAND(unload, ResourceManager, unloadAllBelowKeepLevelINT);
+}
+
+#include "loading/load_param_class_description.h"
+SHELL_COMMAND_STATIC(printAll, LoadParamClassDescription, &LoadParamClassDescription::printAll)
+->defaultValues(MT_NULL, true);
+SHELL_COMMAND_STATIC(capture, LoadParamClassDescription, &LoadParamClassDescription::captureDescriptions)
+    ->defaultValues(true);
+
+#include "loading/game_loader.h"
+SHELL_COMMAND(quit, GameLoader, stop)
+    ->describe("quits the game")
+    ->setAlias("orxoquit");
+
+#include "object_list.h"
+SHELL_COMMAND_STATIC(debugAll, ObjectListBase, &ObjectListBase::debugAll);
Index: trunk/src/lib/sound/Makefile.am
===================================================================
--- trunk/src/lib/sound/Makefile.am	(revision 9682)
+++ trunk/src/lib/sound/Makefile.am	(revision 9869)
@@ -7,4 +7,6 @@
 			sound_source.cc \
 			sound_buffer.cc \
+			sound_buffer_data.cc \
+			resource_sound_buffer.cc \
                         ogg_player.cc
 
@@ -12,3 +14,5 @@
 		 sound_source.h \
 		 sound_buffer.h \
+		 sound_buffer_data.h \
+		 resource_sound_buffer.h \
                  ogg_player.h
Index: trunk/src/lib/sound/ogg_player.cc
===================================================================
--- trunk/src/lib/sound/ogg_player.cc	(revision 9682)
+++ trunk/src/lib/sound/ogg_player.cc	(revision 9869)
@@ -34,19 +34,9 @@
 
 #include "helper_functions.h"
-
-#ifdef HAVE_SDL_SDL_H
-
-#include <SDL/SDL.h>
-#include <SDL/SDL_endian.h>
-
-#else
-
-#include <SDL.h>
-#include <SDL_endian.h>
-
-#endif
+#include "sdlincl.h"
 
 namespace OrxSound
 {
+  ObjectListDefinition(OggPlayer);
   /**
    * initializes an Ogg-player from a file
@@ -55,5 +45,5 @@
   OggPlayer::OggPlayer(const std::string& fileName)
   {
-    this->setClassID(CL_SOUND_OGG_PLAYER, "OggPlayer");
+    this->registerObject(this, OggPlayer::_objectList);
 
     this->state = OggPlayer::None;
@@ -276,5 +266,5 @@
         ogg->update();
       }
-      SDL_Delay(10);
+      SDL_Delay(1);
     }
     PRINTF(4)("End the AudioThread\n");
Index: trunk/src/lib/sound/ogg_player.h
===================================================================
--- trunk/src/lib/sound/ogg_player.h	(revision 9682)
+++ trunk/src/lib/sound/ogg_player.h	(revision 9869)
@@ -13,5 +13,5 @@
 #include <ogg/ogg.h>
 #include <vorbis/vorbisfile.h>
-#include "threading.h"
+#include "util/threading.h"
 
 struct File;
@@ -25,4 +25,6 @@
   class OggPlayer : public BaseObject
   {
+    ObjectListDeclaration(OggPlayer);
+
   public:
     /**
@@ -98,8 +100,8 @@
 
 
-    std::string         _title;
-    std::string         _artist;
-    std::string         _album;
-    std::string         _vendor;
+    std::string         _title;               //!< Song Title.
+    std::string         _artist;              //!< Artist Name of the current song.
+    std::string         _album;               //!< Album Name of the current song.
+    std::string         _vendor;              //!< Vendor Name of the current song.
   };
 
Index: trunk/src/lib/sound/resource_sound_buffer.cc
===================================================================
--- trunk/src/lib/sound/resource_sound_buffer.cc	(revision 9869)
+++ trunk/src/lib/sound/resource_sound_buffer.cc	(revision 9869)
@@ -0,0 +1,36 @@
+
+#include "resource_sound_buffer.h"
+#include "debug.h"
+
+
+namespace OrxSound
+{
+  ObjectListDefinition(ResourceSoundBuffer);
+
+  ResourceSoundBuffer::ResourceSoundBuffer(const std::string& soundName, const Resources::KeepLevel& keepLevel)
+      : SoundBuffer(), Resource(&ResourceSoundBuffer::type)
+  {
+    this->registerObject(this, ResourceSoundBuffer::_objectList);
+    Resources::StorePointer* ptr = this->acquireResource(soundName);
+
+    if (ptr)
+    {
+      assert(!static_cast<ResourceSoundBuffer::SoundBufferResourcePointer*>(ptr)->ptr().isNull());
+      PRINTF(5)("FOUND SOUND: %s\n", soundName.c_str());
+      this->acquireData(static_cast<ResourceSoundBuffer::SoundBufferResourcePointer*>(ptr)->ptr());
+    }
+    else
+    {
+      PRINTF(5)("SOUND NOT FOUND: %s\n", soundName.c_str());
+      std::string fileName = this->Resource::locateFile(soundName);
+      this->SoundBuffer::load(fileName);
+      this->Resource::addResource(new ResourceSoundBuffer::SoundBufferResourcePointer(soundName, keepLevel, this->SoundBuffer::dataPointer()));
+    }
+  }
+
+
+  Resources::tType<ResourceSoundBuffer> ResourceSoundBuffer::type("SoundBuffer");
+
+  ResourceSoundBuffer::SoundBufferResourcePointer::SoundBufferResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const SoundBufferData::Pointer& data)
+      : Resources::StorePointer(loadString, keepLevel) , pointer(data)
+{}}
Index: trunk/src/lib/sound/resource_sound_buffer.h
===================================================================
--- trunk/src/lib/sound/resource_sound_buffer.h	(revision 9869)
+++ trunk/src/lib/sound/resource_sound_buffer.h	(revision 9869)
@@ -0,0 +1,41 @@
+/*!
+ * @file resource_sound_buffer.h
+ * @brief Contains the ResourceSoundBuffer class, that handles the Resource-specific loading part of the SoundBuffer.
+ *
+ */
+
+#ifndef _RESOURCE_SOUND_BUFFER_H
+#define _RESOURCE_SOUND_BUFFER_H
+
+#include "util/loading/resource.h"
+#include "sound_buffer.h"
+
+namespace OrxSound
+{
+  class ResourceSoundBuffer : public SoundBuffer, public Resources::Resource
+  {
+    ObjectListDeclaration(ResourceSoundBuffer);
+  public:
+    ResourceSoundBuffer(const std::string& soundName,
+			const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
+    static ResourceSoundBuffer createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel = Resources::KeepLevel())
+    { return ResourceSoundBuffer(loadString, keepLevel); };
+
+  private:
+  class SoundBufferResourcePointer : public Resources::StorePointer
+    {
+    public:
+      SoundBufferResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const SoundBufferData::Pointer& data);
+      inline const SoundBufferData::Pointer& ptr() const { return pointer; }
+      virtual bool last() const { return pointer.count() == 1; }
+    private:
+      SoundBufferData::Pointer pointer;
+    };
+
+  private:
+    static Resources::tType<ResourceSoundBuffer> type;
+  };
+}
+
+
+#endif /* _RESOURCE_SOUND_BUFFER_H */
Index: trunk/src/lib/sound/sound_buffer.cc
===================================================================
--- trunk/src/lib/sound/sound_buffer.cc	(revision 9682)
+++ trunk/src/lib/sound/sound_buffer.cc	(revision 9869)
@@ -18,159 +18,42 @@
 #include "sound_buffer.h"
 
-#include "sound_engine.h"
 
-#include "sdlincl.h"
-#include <cassert>
-#include "debug.h"
-#include "sys/stat.h"
-#include "helper_functions.h"
-
-#ifdef HAVE_SDL_SDL_H
-#include <SDL/SDL.h>
-#include <SDL/SDL_endian.h>
-#else
-#include <SDL.h>
-#include <SDL_endian.h>
-#endif
 namespace OrxSound
 {
+  ObjectListDefinition(SoundBuffer);
   //////////////////
   /* SOUND-BUFFER */
   //////////////////
+  SoundBuffer::SoundBuffer()
+      : data(new SoundBufferData)
+  {
+    this->registerObject(this, SoundBuffer::_objectList);
+  }
   /**
-   *  Creates a Soundbuffer out of an inputfile
+   * @brief Creates a Soundbuffer out of an inputfile
    * @param fileName The name of the File
    */
   SoundBuffer::SoundBuffer(const std::string& fileName)
+      : data(new SoundBufferData)
   {
-    this->setClassID(CL_SOUND_BUFFER, "SoundBuffer");
-    this->setName(fileName);
+    this->registerObject(this, SoundBuffer::_objectList);
+    this->load(fileName);
+  }
 
-    // generate a Buffer
-    alGenBuffers(1, &this->bufferID);
-    SoundEngine::checkError("Generate Buffer", __LINE__);
-    if (!nocaseCmp(fileName.substr(fileName.size() - 3), "WAV"))
-    {
-      this->loadWAV(fileName);
-    }
-    else if (!nocaseCmp(fileName.substr(fileName.size() - 3), "OGG"))
-      this->loadOGG(fileName);
+  SoundBuffer::SoundBuffer(const SoundBuffer& buffer)
+      : data(buffer.data)
+  {
+    this->registerObject(this, SoundBuffer::_objectList);
+  }
 
-  }
+  SoundBuffer::SoundBuffer(const SoundBufferData::Pointer& dataPointer)
+      : data(dataPointer)
+  {
+    this->registerObject(this, SoundBuffer::_objectList);
+  };
 
   SoundBuffer::~SoundBuffer()
   {
-    //  SoundEngine::getInstance()->removeBuffer(this);
-    alDeleteBuffers(1, &this->bufferID);
-    SoundEngine::checkError("SoundBuffer: Delete Buffer", __LINE__);
   }
 
-  /**
-   * @brief loads a Waveform from the local fileSystem into this Source.
-   * @param fileName the Name of the File to Load.
-   * @returns true on success.
-   */
-  bool SoundBuffer::loadWAV(const std::string& fileName)
-  {
-    SDL_AudioSpec wavSpec;
-    Uint32 wavLength;
-    Uint8 *wavBuffer;
-
-    /* Load the WAV */
-    if( SDL_LoadWAV(fileName.c_str(), &wavSpec, &wavBuffer, &wavLength) == NULL)
-    {
-      PRINTF(2)("Could not open %s: %s\n", fileName.c_str(), SDL_GetError());
-      return false;
-    }
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-    if ( !( wavSpec.format == AUDIO_U8 || wavSpec.format == AUDIO_S8 ) )
-    {
-      int cnt = wavLength/2;
-      Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer;
-      for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts )
-        *wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts );
-    }
-#endif
-    alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec),
-                 wavBuffer, wavLength, wavSpec.freq);
-
-    SDL_FreeWAV(wavBuffer);
-    if (SoundEngine::checkError("Could not load Wave file", __LINE__))
-      return true;
-    else
-      return false;
-  }
-
-
-#ifndef AL_FORMAT_VORBIS_EXT
-#define AL_FORMAT_VORBIS_EXT 0x100030
-#endif
-  /**
-   * @brief loads an OGG-file into a SOundBuffer
-   * @param fileName the Name of the File to load.
-   * @returns true on success (file exists and is fully loaded), false otherwise.
-   */
-  bool SoundBuffer::loadOGG(const std::string& fileName)
-  {
-    void*     ovdata;
-    FILE*     fh;
-
-    fh = fopen( fileName.c_str() , "rb") ;
-    if( fh != NULL )
-    {
-      struct stat sbuf ;
-
-      if(stat( fileName.c_str(), &sbuf ) != -1)
-      {
-        ovdata = malloc(sbuf.st_size);
-        if(ovdata != NULL)
-        {
-          fread( ovdata, 1, sbuf.st_size, fh);
-
-          alBufferData( this->bufferID,
-                        AL_FORMAT_VORBIS_EXT,
-                        ovdata,
-                        sbuf.st_size,
-                        1) ;
-          SoundEngine::checkError("Could not load OGG file", __LINE__);
-
-          free(ovdata);
-        }
-        fclose(fh);
-      }
-      else
-        return false;
-    }
-    else
-      return false;
-
-    return true ;
-
-  }
-
-
-  /**
-   * @brief converts an SDL_AudioSpec into a valid OpenAL AUDIO_FORMAT enumerator
-   * @param audiospec the AudioSpec to convert.
-   * @returns the AL_FORMAT
-   */
-  ALenum SoundBuffer::sdlAudioSpecToAlFormat(const SDL_AudioSpec* audiospec)
-  {
-    assert (audiospec != NULL);
-    bool stereo = true;
-    bool is16Bit = true;
-    if (audiospec->format == AUDIO_U8 || audiospec->format == AUDIO_S8)
-      is16Bit = false;
-    if (audiospec->channels == 1)
-      stereo = false;
-
-    if (!stereo && !is16Bit)
-      return AL_FORMAT_MONO8;
-    else if (!stereo && is16Bit)
-      return AL_FORMAT_MONO16;
-    else if (stereo && !is16Bit)
-      return AL_FORMAT_STEREO8;
-    else /* if (stereo && is16Bit) */
-      return AL_FORMAT_STEREO16;
-  }
 }
Index: trunk/src/lib/sound/sound_buffer.h
===================================================================
--- trunk/src/lib/sound/sound_buffer.h	(revision 9682)
+++ trunk/src/lib/sound/sound_buffer.h	(revision 9869)
@@ -8,32 +8,41 @@
 
 #include "base_object.h"
-#include "alincl.h"
-
-// FORWARD DECLARATION
-typedef struct SDL_AudioSpec;
+#include "sound_buffer_data.h"
 
 namespace OrxSound
 {
   //! A class that represents a datastructure to play Sounds.
-  class SoundBuffer : public BaseObject
+  class SoundBuffer : virtual public BaseObject
   {
+    ObjectListDeclaration(SoundBuffer);
   public:
+    SoundBuffer();
+    SoundBuffer(const SoundBuffer& buffer);
+    SoundBuffer(const SoundBufferData::Pointer& dataPointer);
     SoundBuffer(const std::string& fileName);
     virtual ~SoundBuffer();
 
-    bool loadWAV(const std::string& fileName);
-    bool loadOGG(const std::string& fileName);
+    /** @brief assignment operator */
+    SoundBuffer& operator=(const SoundBuffer& buffer) { this->data = buffer.data; return *this; };
+    bool operator==(const SoundBuffer& buffer) const {return this->data == buffer.data; };
+
+    /** @see SoundBufferData::load */
+    inline bool load(const std::string& fileName) { return this->data->load(fileName); };
+    /** @see SoundBufferData::loadWav */
+    inline bool loadWAV(const std::string& fileName) { return this->data->loadWAV(fileName); };
+    /** @see SoundBufferData::loadOgg */
+    inline bool loadOGG(const std::string& fileName) { return this->data->loadOGG(fileName); };
 
     /** @returns the ID of the buffer used in this SoundBuffer */
-    inline ALuint getID() const { return this->bufferID; }
+    inline ALuint getID() const { return this->data->getID(); }
+    inline bool loaded() const { return this->data->loaded(); }
+
+    /** @returns the DataPointer */
+    const SoundBufferData::Pointer& dataPointer() const { return data; }
+    /** @param dataPointer the data to acquire @brief Buffer shall acquire dataPointers data */
+    void acquireData(const SoundBufferData::Pointer& dataPointer)  { data = dataPointer; };
 
   private:
-    ALenum sdlAudioSpecToAlFormat(const SDL_AudioSpec* audiospec);
-
-  private:
-    ALuint        bufferID;             //!< The address of the Buffer.
-
-    ALsizei       size;                 //!< The size of the Buffer.
-    ALboolean     loop;                 //!< loop information.
+    SoundBufferData::Pointer    data;                //!< Pointer to the Stored Data
   };
 }
Index: trunk/src/lib/sound/sound_buffer_data.cc
===================================================================
--- trunk/src/lib/sound/sound_buffer_data.cc	(revision 9869)
+++ trunk/src/lib/sound/sound_buffer_data.cc	(revision 9869)
@@ -0,0 +1,193 @@
+/*
+   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_SOUND
+
+#include "sound_buffer_data.h"
+
+#include "sound_engine.h"
+
+#include "sdlincl.h"
+#include <cassert>
+#include "debug.h"
+#include "sys/stat.h"
+#include "helper_functions.h"
+
+/*#ifdef HAVE_SDL_SDL_H
+ #include <SDL/SDL.h>
+ // #include <SDL/SDL_endian.h>
+#else
+ #include <SDL.h>
+ //#include <SDL_endian.h>
+#endif*/
+namespace OrxSound
+{
+  ObjectListDefinition(SoundBufferData);
+  //////////////////
+  /* SOUND-BUFFER */
+  //////////////////
+  /**
+   * @brief Creates a SoundbufferData out of an inputfile
+   * @param fileName The name of the File
+   */
+  SoundBufferData::SoundBufferData()
+  {
+    this->registerObject(this, SoundBufferData::_objectList);
+    this->bufferID = 0;
+
+    this->size = 0;
+    this->loop = AL_FALSE;
+    this->bLoaded = false;
+  }
+
+  SoundBufferData::~SoundBufferData()
+  {
+    //  SoundEngine::getInstance()->removeBuffer(this);
+    alDeleteBuffers(1, &this->bufferID);
+    SoundEngine::checkError("SoundBuffer: Delete Buffer", __LINE__);
+  }
+
+  /**
+   * @brief check the File-extension and loads either Wav of Ogg
+   * @param fileName the Name of the File to load.
+   * @returns true on success (file found, and loaded.)
+   */
+  bool SoundBufferData::load(const std::string& fileName)
+  {
+    // generate a Buffer
+    alGenBuffers(1, &this->bufferID);
+    SoundEngine::checkError("Generate Buffer", __LINE__);
+    if (!nocaseCmp(fileName.substr(fileName.size() - 3), "WAV"))
+    {
+      return this->loadWAV(fileName);
+    }
+    else if (!nocaseCmp(fileName.substr(fileName.size() - 3), "OGG"))
+      return this->loadOGG(fileName);
+    else
+      return false;
+  }
+
+  /**
+   * @brief loads a Waveform from the local fileSystem into this Source.
+   * @param fileName the Name of the File to Load.
+   * @returns true on success.
+   */
+  bool SoundBufferData::loadWAV(const std::string& fileName)
+  {
+    SDL_AudioSpec wavSpec;
+    Uint32 wavLength;
+    Uint8 *wavBuffer;
+
+    /* Load the WAV */
+    if( SDL_LoadWAV(fileName.c_str(), &wavSpec, &wavBuffer, &wavLength) == NULL)
+    {
+      PRINTF(2)("Could not open %s: %s\n", fileName.c_str(), SDL_GetError());
+      return false;
+    }
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+    if ( !( wavSpec.format == AUDIO_U8 || wavSpec.format == AUDIO_S8 ) )
+    {
+      int cnt = wavLength/2;
+      Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer;
+      for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts )
+        *wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts );
+    }
+#endif
+    alBufferData(this->bufferID, SoundBufferData::sdlAudioSpecToAlFormat(&wavSpec),
+                 wavBuffer, wavLength, wavSpec.freq);
+
+    SDL_FreeWAV(wavBuffer);
+    if (SoundEngine::checkError("Could not load Wave file", __LINE__))
+    {
+      this->bLoaded = true;
+      return true;
+    }
+    else
+      return false;
+  }
+
+
+#ifndef AL_FORMAT_VORBIS_EXT
+#define AL_FORMAT_VORBIS_EXT 0x100030
+#endif
+  /**
+   * @brief loads an OGG-file into a SOundBuffer
+   * @param fileName the Name of the File to load.
+   * @returns true on success (file exists and is fully loaded), false otherwise.
+   */
+  bool SoundBufferData::loadOGG(const std::string& fileName)
+  {
+    void*     ovdata;
+    FILE*     fh;
+
+    fh = fopen( fileName.c_str() , "rb") ;
+    if( fh != NULL )
+    {
+      struct stat sbuf ;
+
+      if(stat( fileName.c_str(), &sbuf ) != -1)
+      {
+        ovdata = malloc(sbuf.st_size);
+        if(ovdata != NULL)
+        {
+          fread( ovdata, 1, sbuf.st_size, fh);
+
+          alBufferData( this->bufferID,
+                        AL_FORMAT_VORBIS_EXT,
+                        ovdata,
+                        sbuf.st_size,
+                        1) ;
+          SoundEngine::checkError("Could not load OGG file", __LINE__);
+
+          free(ovdata);
+        }
+        fclose(fh);
+      }
+      else
+        return false;
+    }
+    else
+      return false;
+
+    this->bLoaded = true;
+    return true ;
+  }
+
+
+  /**
+   * @brief converts an SDL_AudioSpec into a valid OpenAL AUDIO_FORMAT enumerator
+   * @param audiospec the AudioSpec to convert.
+   * @returns the AL_FORMAT
+   */
+  ALenum SoundBufferData::sdlAudioSpecToAlFormat(const SDL_AudioSpec* audiospec)
+  {
+    assert (audiospec != NULL);
+    bool stereo = true;
+    bool is16Bit = true;
+    if (audiospec->format == AUDIO_U8 || audiospec->format == AUDIO_S8)
+      is16Bit = false;
+    if (audiospec->channels == 1)
+      stereo = false;
+
+    if (!stereo && !is16Bit)
+      return AL_FORMAT_MONO8;
+    else if (!stereo && is16Bit)
+      return AL_FORMAT_MONO16;
+    else if (stereo && !is16Bit)
+      return AL_FORMAT_STEREO8;
+    else /* if (stereo && is16Bit) */
+      return AL_FORMAT_STEREO16;
+  }
+}
Index: trunk/src/lib/sound/sound_buffer_data.h
===================================================================
--- trunk/src/lib/sound/sound_buffer_data.h	(revision 9869)
+++ trunk/src/lib/sound/sound_buffer_data.h	(revision 9869)
@@ -0,0 +1,48 @@
+/*!
+ * @file sound_buffer_data.h
+ * @brief Definition of the sound-buffer-datacontainer-class
+*/
+
+#ifndef _SOUND_BUFFER_DATA_H
+#define _SOUND_BUFFER_DATA_H
+
+#include "base_object.h"
+#include "alincl.h"
+#include "util/count_pointer.h"
+
+// FORWARD DECLARATION
+typedef struct SDL_AudioSpec;
+
+namespace OrxSound
+{
+  //! A class that represents a datastructure to play Sounds.
+  class SoundBufferData : public BaseObject
+  {
+    ObjectListDeclaration(SoundBufferData);
+  public:
+    typedef CountPointer<SoundBufferData> Pointer;
+
+  public:
+    SoundBufferData();
+    virtual ~SoundBufferData();
+
+    bool load(const std::string& fileName);
+    bool loadWAV(const std::string& fileName);
+    bool loadOGG(const std::string& fileName);
+
+    /** @returns the ID of the buffer used in this SoundBuffer */
+    inline ALuint getID() const { return this->bufferID; }
+    inline bool loaded() const { return bLoaded; };
+
+  private:
+    ALenum sdlAudioSpecToAlFormat(const SDL_AudioSpec* audiospec);
+
+  private:
+    ALuint        bufferID;             //!< The address of the Buffer.
+
+    ALsizei       size;                 //!< The size of the Buffer.
+    ALboolean     loop;                 //!< loop information.
+    bool          bLoaded;               //!< If the Sound was loaded this is true.
+  };
+}
+#endif /* _SOUND_BUFFER_DATA_H */
Index: trunk/src/lib/sound/sound_engine.cc
===================================================================
--- trunk/src/lib/sound/sound_engine.cc	(revision 9682)
+++ trunk/src/lib/sound/sound_engine.cc	(revision 9869)
@@ -21,15 +21,13 @@
 #include "sound_engine.h"
 
-#include "class_list.h"
-
 #include "p_node.h"
-#include "util/loading/resource_manager.h"
 #include "debug.h"
-#include "util/preferences.h"
+#include "parser/preferences/preferences.h"
 #include "globals.h"
+#include "resource_sound_buffer.h"
 
 namespace OrxSound
 {
-
+  ObjectListDefinition(SoundEngine);
   //////////////////
   /* SOUND-ENGINE */
@@ -40,10 +38,8 @@
   SoundEngine::SoundEngine ()
   {
-    this->setClassID(CL_SOUND_ENGINE, "SoundEngine");
+    this->registerObject(this, SoundEngine::_objectList);
     this->setName("SoundEngine");
 
     this->listener = NULL;
-    this->bufferList = NULL;
-    this->sourceList = NULL;
 
     this->device = NULL;
@@ -69,9 +65,6 @@
   {
     // deleting all the SoundSources
-    if(this->sourceList != NULL)
-    {
-      while (this->sourceList->size() > 0)
-        delete static_cast<SoundSource*>(this->sourceList->front());
-    }
+    while (!SoundSource::objectList().empty())
+      delete (SoundSource::objectList().front());
 
     while(!this->ALSources.empty())
@@ -89,9 +82,6 @@
 
     // deleting all the SoundBuffers
-    if (this->bufferList != NULL)
-    {
-      while(this->bufferList->size() > 0)
-        ResourceManager::getInstance()->unload(static_cast<SoundBuffer*>(this->bufferList->front()));
-    }
+    //    while(!SoundBuffer::objectList().empty())
+    //ResourceManager::getInstance()->unload(SoundBuffer::objectList().front());
 
     // removing openAL from AudioResource
@@ -129,9 +119,9 @@
   SoundSource* SoundEngine::createSource(const std::string& fileName, PNode* sourceNode)
   {
-    SoundBuffer* buffer = NULL;
+    SoundBuffer buffer;
     if (!fileName.empty())
     {
-      buffer= (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL);
-      if (buffer == NULL)
+      buffer = ResourceSoundBuffer(fileName);
+      if (!buffer.loaded())
         PRINTF(2)("Wav-Sound %s could not be loaded onto new Source\n", fileName.c_str());
     }
@@ -212,39 +202,36 @@
 
     // updating all the Sources positions
-    if (likely(this->sourceList != NULL || (this->sourceList = ClassList::getList(CL_SOUND_SOURCE)) != NULL))
-    {
-      std::list<BaseObject*>::const_iterator sourceIT;
-      SoundSource* source;
-      for (sourceIT = this->sourceList->begin(); sourceIT != this->sourceList->end(); sourceIT++)
+    ObjectList<SoundSource>::const_iterator sourceIT;
+    for (sourceIT = SoundSource::objectList().begin();
+         sourceIT != SoundSource::objectList().end();
+         sourceIT++)
+    {
+      if ((*sourceIT)->isPlaying())
       {
-        source = static_cast<SoundSource*>(*sourceIT);
-        if (source->isPlaying())
+        int play = 0x000;
+        alGetSourcei((*sourceIT)->getID(), AL_SOURCE_STATE, &play);
+        if (DEBUG_LEVEL > 2)
+          SoundEngine::checkError("SoundEngine::update() Play", __LINE__);
+        if(play == AL_PLAYING)
         {
-          int play = 0x000;
-          alGetSourcei(source->getID(), AL_SOURCE_STATE, &play);
-          if (DEBUG_LEVEL > 2)
-            SoundEngine::checkError("SoundEngine::update() Play", __LINE__);
-          if(play == AL_PLAYING)
+          if (likely((*sourceIT)->getNode() != NULL))
           {
-            if (likely(source->getNode() != NULL))
-            {
-              alSource3f(source->getID(), AL_POSITION,
-                         source->getNode()->getAbsCoor().x,
-                         source->getNode()->getAbsCoor().y,
-                         source->getNode()->getAbsCoor().z);
-              if (DEBUG_LEVEL > 2)
-                SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__);
-              alSource3f(source->getID(), AL_VELOCITY,
-                         source->getNode()->getVelocity().x,
-                         source->getNode()->getVelocity().y,
-                         source->getNode()->getVelocity().z);
-              if (DEBUG_LEVEL > 2)
-                SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__);
-            }
+            alSource3f((*sourceIT)->getID(), AL_POSITION,
+                       (*sourceIT)->getNode()->getAbsCoor().x,
+                       (*sourceIT)->getNode()->getAbsCoor().y,
+                       (*sourceIT)->getNode()->getAbsCoor().z);
+            if (DEBUG_LEVEL > 2)
+              SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__);
+            alSource3f((*sourceIT)->getID(), AL_VELOCITY,
+                       (*sourceIT)->getNode()->getVelocity().x,
+                       (*sourceIT)->getNode()->getVelocity().y,
+                       (*sourceIT)->getNode()->getVelocity().z);
+            if (DEBUG_LEVEL > 2)
+              SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__);
           }
-          else
-          {
-            source->stop();
-          }
+        }
+        else
+        {
+          (*sourceIT)->stop();
         }
       }
@@ -393,15 +380,15 @@
       default:
       case AL_NO_ERROR:
-        return ("AL_NO_ERROR");
+      return ("AL_NO_ERROR");
       case AL_INVALID_NAME:
-        return ("AL_INVALID_NAME");
+      return ("AL_INVALID_NAME");
       case AL_INVALID_ENUM:
-        return ("AL_INVALID_ENUM");
+      return ("AL_INVALID_ENUM");
       case AL_INVALID_VALUE:
-        return ("AL_INVALID_VALUE");
+      return ("AL_INVALID_VALUE");
       case AL_INVALID_OPERATION:
-        return ("AL_INVALID_OPERATION");
+      return ("AL_INVALID_OPERATION");
       case AL_OUT_OF_MEMORY:
-        return ("AL_OUT_OF_MEMORY");
+      return ("AL_OUT_OF_MEMORY");
     };
   }
@@ -414,15 +401,15 @@
       default:
       case ALC_NO_ERROR:
-        return ("AL_NO_ERROR");
+      return ("AL_NO_ERROR");
       case ALC_INVALID_DEVICE:
-        return ("ALC_INVALID_DEVICE");
+      return ("ALC_INVALID_DEVICE");
       case ALC_INVALID_CONTEXT:
-        return("ALC_INVALID_CONTEXT");
+      return("ALC_INVALID_CONTEXT");
       case ALC_INVALID_ENUM:
-        return("ALC_INVALID_ENUM");
+      return("ALC_INVALID_ENUM");
       case ALC_INVALID_VALUE:
-        return ("ALC_INVALID_VALUE");
+      return ("ALC_INVALID_VALUE");
       case ALC_OUT_OF_MEMORY:
-        return("ALC_OUT_OF_MEMORY");
+      return("ALC_OUT_OF_MEMORY");
     };
   }
Index: trunk/src/lib/sound/sound_engine.h
===================================================================
--- trunk/src/lib/sound/sound_engine.h	(revision 9682)
+++ trunk/src/lib/sound/sound_engine.h	(revision 9869)
@@ -27,5 +27,6 @@
   class SoundEngine : public BaseObject
   {
-  public:
+    ObjectListDeclaration(SoundEngine);
+    public:
     virtual ~SoundEngine();
     /** @returns a Pointer to the only object of this Class */
@@ -75,7 +76,4 @@
     const PNode*                   listener;                 //!< The listener of the Scene
 
-    const std::list<BaseObject*>*  bufferList;               //!< A list of buffers
-    const std::list<BaseObject*>*  sourceList;               //!< A list for all the sources in the scene.
-
     unsigned int                   maxSourceCount;           //!< How many Sources is the Maximum
     std::stack<ALuint>             ALSources;                //!< A list of real openAL-Sources, the engine allocates, and stores for reuse.
Index: trunk/src/lib/sound/sound_source.cc
===================================================================
--- trunk/src/lib/sound/sound_source.cc	(revision 9682)
+++ trunk/src/lib/sound/sound_source.cc	(revision 9869)
@@ -19,5 +19,4 @@
 #include "sound_engine.h"
 
-#include "alincl.h"
 #include "compiler.h"
 #include "debug.h"
@@ -25,11 +24,11 @@
 namespace OrxSound
 {
+  ObjectListDefinition(SoundSource);
   /**
   * @brief creates a SoundSource at position sourceNode with the SoundBuffer buffer
   */
-  SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer* buffer)
-  {
-    this->setClassID(CL_SOUND_SOURCE, "SoundSource");
-
+  SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer& buffer)
+  {
+    this->registerObject(this, SoundSource::_objectList);
     // adding the Source to the SourcesList of the SoundEngine
     this->buffer = buffer;
@@ -51,5 +50,5 @@
   SoundSource::SoundSource(const SoundSource& source)
   {
-    this->setClassID(CL_SOUND_SOURCE, "SoundSource");
+    this->registerObject(this, SoundSource::_objectList);
 
     // adding the Source to the SourcesList of the SoundEngine
@@ -120,10 +119,10 @@
   void SoundSource::play()
   {
-    if (this->buffer && this->retrieveSource())
+    if (this->retrieveSource())
     {
       if (this->bPlay)
         alSourceStop(this->sourceID);
 
-      alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
+      alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID());
       alSourcei (this->sourceID, AL_LOOPING,  AL_FALSE);
       alSourcef (this->sourceID, AL_GAIN, 1);
@@ -141,5 +140,5 @@
   * @param buffer the buffer to play back on this Source
   */
-  void SoundSource::play(const SoundBuffer* buffer)
+  void SoundSource::play(const SoundBuffer& buffer)
   {
     if (!this->retrieveSource())
@@ -150,5 +149,5 @@
 
     alSourceStop(this->sourceID);
-    alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
+    alSourcei (this->sourceID, AL_BUFFER, buffer.getID());
     alSourcei (this->sourceID, AL_LOOPING,  AL_FALSE);
     alSourcef (this->sourceID, AL_GAIN, 1);
@@ -156,6 +155,6 @@
     alSourcePlay(this->sourceID);
 
-    if (unlikely(this->buffer != NULL))
-      alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
+    if (unlikely(this->buffer.getID() != 0))
+      alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID());
     this->bPlay = true;
 
@@ -170,5 +169,5 @@
    * @param gain the gain of the sound buffer
   */
-  void SoundSource::play(const SoundBuffer* buffer, float gain)
+  void SoundSource::play(const SoundBuffer& buffer, float gain)
   {
     if (!this->retrieveSource())
@@ -179,5 +178,5 @@
 
     alSourceStop(this->sourceID);
-    alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
+    alSourcei (this->sourceID, AL_BUFFER, buffer.getID());
     alSourcei (this->sourceID, AL_LOOPING,  AL_FALSE);
     alSourcef (this->sourceID, AL_GAIN, gain);
@@ -185,6 +184,6 @@
     alSourcePlay(this->sourceID);
 
-    if (unlikely(this->buffer != NULL))
-      alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
+    if (unlikely(this->buffer.getID() != 0))
+      alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID());
     this->bPlay = true;
 
@@ -199,5 +198,5 @@
    * @param loop if true, sound gets looped
    */
-  void SoundSource::play(const SoundBuffer* buffer, float gain, bool loop)
+  void SoundSource::play(const SoundBuffer& buffer, float gain, bool loop)
   {
     if (!this->retrieveSource())
@@ -208,5 +207,5 @@
 
     alSourceStop(this->sourceID);
-    alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
+    alSourcei (this->sourceID, AL_BUFFER, buffer.getID());
 
     if (loop)
@@ -219,6 +218,6 @@
     alSourcePlay(this->sourceID);
 
-    if (unlikely(this->buffer != NULL))
-      alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
+    if (unlikely(this->buffer.getID() != 0))
+      alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID());
     this->bPlay = true;
 
@@ -232,5 +231,5 @@
    * @param gain the new gain value
    */
-  void SoundSource::gain(const SoundBuffer* buffer, float gain)
+  void SoundSource::gain(const SoundBuffer& buffer, float gain)
   {
     // alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
@@ -347,5 +346,5 @@
   * @param duration time perios to fade in
   */
-  void SoundSource::fadein(const SoundBuffer* buffer, ALfloat duration)
+  void SoundSource::fadein(const SoundBuffer& buffer, ALfloat duration)
   {
     //if (this->buffer && this->retrieveSource())
Index: trunk/src/lib/sound/sound_source.h
===================================================================
--- trunk/src/lib/sound/sound_source.h	(revision 9682)
+++ trunk/src/lib/sound/sound_source.h	(revision 9869)
@@ -8,4 +8,5 @@
 
 #include "base_object.h"
+#include "sound_buffer.h"
 #include "alincl.h"
 
@@ -14,10 +15,10 @@
 namespace OrxSound
 {
-  class SoundBuffer;
   //! A class that represents a SoundSource
   class SoundSource : public BaseObject
   {
+    ObjectListDeclaration(SoundSource);
   public:
-    SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL);
+    SoundSource(const PNode* sourceNode = NULL, const SoundBuffer& buffer = SoundBuffer());
     SoundSource(const SoundSource& source);
     SoundSource& operator=(const SoundSource& source);
@@ -28,14 +29,14 @@
     // user interaction
     void play();
-    void play(const SoundBuffer* buffer);
-    void play(const SoundBuffer* buffer, float gain);
-    void play(const SoundBuffer* buffer, float gain, bool loop);
+    void play(const SoundBuffer& buffer);
+    void play(const SoundBuffer& buffer, float gain);
+    void play(const SoundBuffer& buffer, float gain, bool loop);
 
-    void gain(const SoundBuffer* buffer, float gain);
+    void gain(const SoundBuffer& buffer, float gain);
 
     void stop();
     void pause();
     void rewind();
-    void fadein(const SoundBuffer* buffer, ALfloat duration);
+    void fadein(const SoundBuffer& buffer, ALfloat duration);
 
     // development functions
@@ -46,5 +47,5 @@
     void setSourceNode(const PNode* sourceNode);
     /** @returns the SoundBuffer of this Source */
-    inline const SoundBuffer* getBuffer() const { return this->buffer; };
+    inline const SoundBuffer& getBuffer() const { return this->buffer; };
     /** @returns the SourceNode of this Source */
     inline const PNode* getNode() const { return this->sourceNode; };
@@ -65,5 +66,5 @@
     bool                   resident;    //!< If the alSource should be resident (if true, the alSource will be returned on deletion).
     ALuint                 sourceID;    //!< The ID of the Source
-    const SoundBuffer*     buffer;      //!< The buffer to play in this source.
+    SoundBuffer            buffer;      //!< The buffer to play in this source.
     const PNode*           sourceNode;  //!< The SourceNode representing the position/velocity... of this source.
   };
Index: trunk/src/lib/util/Makefile.am
===================================================================
--- trunk/src/lib/util/Makefile.am	(revision 9682)
+++ trunk/src/lib/util/Makefile.am	(revision 9869)
@@ -2,5 +2,10 @@
 include $(MAINSRCDIR)/defs/include_paths.am
 
-noinst_LIBRARIES = libORXlibutil.a
+noinst_LIBRARIES = \
+		libORXlibutil.a \
+		libORXexecutor.a
+
+libORXexecutor_a_SOURCES = \
+		executor/executor_substring.cc
 
 libORXlibutil_a_SOURCES = \
@@ -9,7 +14,5 @@
 		helper_functions.cc \
 		multi_type.cc \
-		executor/executor.cc \
-		executor/executor_functional.cc \
-		executor/executor_lua.cc \
+		debug_buffer.cc \
 		\
 		loading/resource_manager.cc \
@@ -18,6 +21,7 @@
 		loading/load_param.cc \
 		loading/load_param_description.cc \
+		loading/load_param_class_description.cc \
 		loading/factory.cc \
-		loading/dynamic_loader.cc \
+		loading/fast_factory.cc \
 		\
 		filesys/file.cc \
@@ -25,7 +29,8 @@
 		filesys/net_link.cc \
 		\
-		preferences.cc \
 		threading.cc \
 		timer.cc
+
+#		loading/dynamic_loader.cc
 
 
@@ -35,9 +40,22 @@
 		color.h \
 		helper_functions.h \
+		debug.h \
+		debug_buffer.h \
+		\
+		\
 		executor/executor.h \
-		executor/executor_functional.h \
 		executor/executor_xml.h \
-		executor/executor_lua.h \
+		executor/executor_substring.h \
+		executor/executor_generic.h \
+		executor/executor_member.h \
+		executor/executor_const_member.h \
+		executor/executor_static.h \
+		\
 		executor/functor_list.h \
+		executor/functor_generic.h \
+		executor/functor_member.h \
+		executor/functor_const_member.h \
+		executor/functor_static.h \
+		\
 		\
 		filesys/file.h \
@@ -45,5 +63,4 @@
 		filesys/net_link.h \
 		\
-		preferences.h \
 		threading.h \
 		timer.h \
@@ -53,6 +70,9 @@
 		loading/game_loader.h \
 		loading/load_param.h \
+		loading/load_param_xml.h \
 		loading/load_param_description.h \
+		loading/load_param_class_description.h \
 		loading/factory.h \
+		loading/fast_factory.h \
 		loading/dynamic_loader.h \
 		\
Index: trunk/src/lib/util/color.cc
===================================================================
--- trunk/src/lib/util/color.cc	(revision 9682)
+++ trunk/src/lib/util/color.cc	(revision 9869)
@@ -30,8 +30,10 @@
 //! Black Color
 const Color Color::black(0,0,0,1);
-//! Orx Color
-const Color Color::orx(.2, .5, .7, .8);  //!< TODO Define the ORX-color :)
-
-
+
+/**
+ * @brief slerps the Color in the HSV color space into the direction of c
+ * @param c the Color to slerp to
+ * @param v the Value to slerp 0 means stay at *this, 1 means at c.
+ */
 void Color::slerpHSV(const Color& c, float v)
 {
@@ -52,4 +54,11 @@
 }
 
+/**
+ * @brief simple slerp wrapper.
+ * @param from from this color
+ * @param to to this one
+ * @param v how much
+ * @see void Color::slerpHSV(const Color& c, float v)
+ */
 Color Color::slerpHSVColor(const Color& from, const Color& to, float v)
 {
@@ -59,5 +68,7 @@
 }
 
-
+/**
+ * @brief nice and simple debug output for the colors (colorless :) )
+ */
 void Color::debug() const
 {
@@ -214,5 +225,10 @@
 
 
-// Needed by rgb2hsv()
+/**
+ * @returns the maximum of r g and a.
+ * @param r Red.
+ * @param g Green
+ * @param b Blue
+ */
 float Color::maxrgb(float r, float g, float b)
 {
@@ -227,6 +243,10 @@
 }
 
-
-// Needed by rgb2hsv()
+/**
+ * @returns the minimum of r g and a.
+ * @param r Red.
+ * @param g Green
+ * @param b Blue
+ */
 float Color::minrgb(float r,float g,float b)
 {
Index: trunk/src/lib/util/color.h
===================================================================
--- trunk/src/lib/util/color.h	(revision 9682)
+++ trunk/src/lib/util/color.h	(revision 9869)
@@ -14,44 +14,78 @@
 #include "vector.h"
 
-//! a very abstract Class that helps transforming Colors into different Systems
+//! A Class that handles Colors.
+/**
+ * A Color is a collection of 4 values:
+ * <ul>
+ *  <li>Red</li>
+ *  <li>Green</li>
+ *  <li>Blue</li>
+ *  <li>Alpha</li>
+ * </ul>
+ * With these four values any color of the entire spectrum can be defined.
+ *
+ * By default a Color lies between 0 and 1 for each component.
+ * for example [1,0,0,.5] means red and half visible.
+ */
 class Color
 {
 public:
+  /** @param r red, @param g green @param b blue @param a alpha @brief constructs a Color. */
   Color(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f) { _rgba[0] = r; _rgba[1] = g; _rgba[2] = b; _rgba[3] = a; };
+  /** @param c Color @brief copy constructor */
   Color(const Color& c) { _rgba[0] = c.r(); _rgba[1] = c.g(); _rgba[2] = c.b(); _rgba[3] = c.a(); }
 
+  /** @param c the Color to set to this color @returns the copied color */
   inline const Color& operator=(const Color& c) { _rgba[0] = c.r(); _rgba[1] = c.g(); _rgba[2] = c.b(); _rgba[3] = c.a(); return *this; };
+  /** @param c the color to compare @returns true on match. @brief compares two colors */
   inline bool operator==(const Color& c) const { return (r() == c.r() && g() == c.g() && b() == c.b() && a() == c.a()); };
 
+  /** @returns the i'th Value of the Color @param i part of the color 0:r, 1:g, 2:b, 3:a */
   inline float& operator[](unsigned int i) { return _rgba[i]; }
+  /** @returns a Constant Value of the color. @param i part of the color 0:r, 1:g, 2:b, 3:a */
   inline const float& operator[](unsigned int i) const { return _rgba[i]; }
 
+  /** @returns the red part. */
   inline float r() const { return _rgba[0]; }
+  /** @returns the reference to the red part */
   inline float& r() { return _rgba[0]; }
+  /** @returns the green part. */
   inline float g() const { return _rgba[1]; }
+  /** @returns the reference to the green part */
   inline float& g() { return _rgba[1]; }
+  /** @returns the blue part */
   inline float b() const { return _rgba[2]; }
+  /** @returns the reference to the blue part */
   inline float& b() { return _rgba[2]; }
+  /** @returns the alpha part */
   inline float a() const { return _rgba[3]; }
+  /** @returns the reference to the alpha part */
   inline float& a() { return _rgba[3]; }
 
 
-
-
+  /** @param r red, @param g green @param b blue @param a alpha @brief sets the color. */
   void setColor(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f) { _rgba[0] = r; _rgba[1] = g; _rgba[2] = b; _rgba[3] = a; };
+  /** @param c the color to set. @brief sets the color. */
   void setColor(const Color& c) { r() = c.r();  g()= c.g(); b() = c.b(); a() = c.a(); };
 
+  /** @returns the distance to the color @param c the color to calculate the distance to. */
   inline float dist(const Color& c) const { return (sqrt((r()-c.r())*(r()-c.r()) + (g()-c.g())*(g()-c.g()) + (b()-c.b())*(b()-c.b()) + (a()-c.a())*(a()-c.a()))); }
   /// Maths
+  /** @param c the color to add to this one @returns the two added colors */
   inline const Color& operator+=(const Color& c) { r()+=c.r(); g()+=c.g(); b()+=c.b(); a()+=c.a(); return *this; };
+  /** @returns the result of the added colors @param c the color to add */
   inline Color operator+(const Color& c) const { return Color(r()+c.r(), g()+c.g(), b()+c.b(), a()+c.a()); };
+  /** @param c the color to substract to this one @returns the two substracted colors */
   inline const Color& operator-=(const Color& c) { r()-=c.r(); g()-=c.g(); b()-=c.b(); a()-=c.a(); return *this; };
+  /** @returns the result of the substracted colors @param c the color to substract */
   inline Color operator-(const Color& c) const { return Color(r()-c.r(), g()-c.g(), b()-c.b(), a()-c.a()); };
+  /** @param v the multiplier @returns the Color multiplied by v */
   inline const Color& operator*=(float v) { r()*=v, g()*=v, b()*=v, a()*=v; return *this; };
+  /** @param v the multiplier @returns a multiplied color */
   inline Color operator*(float v) const { return Color(r()*v, g()*v, b()*v, a()*v); };
 
+  /** @param c the color to slerp to @param v how much to slerp [0:1] @brief moves the color into the direction of another color */
   void slerp(const Color& c, float v) { *this += (c - *this) * v; };
   void slerpHSV(const Color& c, float v);
-
   static Color slerpHSVColor(const Color& from, const Color& to, float v);
 
@@ -75,13 +109,7 @@
   static const Color white;
   static const Color black;
-  static const Color orx;
 
 private:
-  float       _rgba[4]; //!< Color Values
-
-  /*  float       _r;     //!< Red Value.
-  float       _g;     //!< Green Value.
-  float       _b;     //!< Blue Value.
-  float       _a;     //!< Alpha Value.*/
+  float       _rgba[4]; //!< Color Values [r,g,b,a] (red green blue alpha)
 };
 
Index: trunk/src/lib/util/count_pointer.h
===================================================================
--- trunk/src/lib/util/count_pointer.h	(revision 9682)
+++ trunk/src/lib/util/count_pointer.h	(revision 9869)
@@ -9,48 +9,54 @@
 {
 public:
-    explicit CountPointer(X* p = 0) // allocate a new counter
-        : itsCounter(0) { if (p) itsCounter = new counter(p); }
-    virtual ~CountPointer() { release(); }
-    CountPointer(const CountPointer& r) { acquire(r.itsCounter); }
-    CountPointer& operator=(const CountPointer& r)
+  explicit CountPointer(X* p = NULL) // allocate a new counter
+      : itsCounter(NULL) { if (p) itsCounter = new counter(p); }
+  ~CountPointer() { release(); }
+  CountPointer(const CountPointer& r) { acquire(r.itsCounter); }
+  CountPointer& operator=(const CountPointer& r)
+  {
+    if (this != &r)
     {
-        if (this != &r) {
-            release();
-            acquire(r.itsCounter);
-        }
-        return *this;
+      release();
+      acquire(r.itsCounter);
     }
-    bool operator==(const CountPointer& r) const { return this->itsCounter->ptr == r.itsCounter->ptr; };
-    X& operator*()  const { return *itsCounter->ptr; }
-    X* operator->() const { return itsCounter->ptr; }
-    X* get()        const { return itsCounter ? itsCounter->ptr : 0; }
-    bool unique()   const { return (itsCounter ? itsCounter->count == 1 : true); }
-    virtual unsigned int count() const { return (this->itsCounter ? itsCounter->count : 0); }
+    return *this;
+  }
+  bool operator==(const CountPointer& r) const { return this->itsCounter->ptr == r.itsCounter->ptr; };
+  inline X& operator*()  const { return *itsCounter->ptr; }
+  inline X* operator->() const { return itsCounter->ptr; }
+  inline bool unique()   const { return (itsCounter ? itsCounter->count == 1 : true); }
+  inline bool isNull()   const { return (!itsCounter); }
+
+  unsigned int count() const { return (this->itsCounter ? itsCounter->count : 0); }
 private:
 
-    struct counter {
-        counter(X* p = 0, unsigned c = 1) : ptr(p), count(c) {}
-        X*          ptr;
-        unsigned    count;
-    }* itsCounter;
+  struct counter
+  {
+    counter(X* p = NULL, unsigned c = 1) : ptr(p), count(c) {}
+    X*          ptr;
+    unsigned    count;
+  }
+  * itsCounter;
 
-    void acquire(counter* c)
+  void acquire(counter* c)
+  {
+    // increment the count
+    itsCounter = c;
+    if (c) ++c->count;
+  }
+
+  void release()
+  {
+    // decrement the count, delete if it is 0
+    if (itsCounter)
     {
-      // increment the count
-        itsCounter = c;
-        if (c) ++c->count;
+      if (--itsCounter->count == 0)
+      {
+        delete itsCounter->ptr;
+        delete itsCounter;
+      }
+      itsCounter = NULL;
     }
-
-    void release()
-    {
-      // decrement the count, delete if it is 0
-        if (itsCounter) {
-            if (--itsCounter->count == 0) {
-                delete itsCounter->ptr;
-                delete itsCounter;
-            }
-            itsCounter = 0;
-        }
-    }
+  }
 };
 
Index: trunk/src/lib/util/debug.h
===================================================================
--- trunk/src/lib/util/debug.h	(revision 9869)
+++ trunk/src/lib/util/debug.h	(revision 9869)
@@ -0,0 +1,313 @@
+/*
+   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 debug.h
+ * @briefHandles output to console for different Verbose-Modes.
+ *
+ * There are two main modes HARD and SOFT. HARD is precessed during compileTime where SOFT is for runtime.
+ * @li HARD: One can choose between different modes. see: // DEFINE_MODULES
+ * @li SOFT: If you want each module can have its own variable for processing. just pass it to DEBUG_MODULE_SOFT
+ */
+
+#ifndef _DEBUG_H
+#define _DEBUG_H
+
+#include "defs/confincl.h"
+#ifndef NO_BUFFER
+#include "debug_buffer.h"
+#endif /* NO_BUFFER */
+
+#include <stdio.h>
+
+// DEFINE ERROR MODES
+#define ORX_NONE            0
+#define ORX_ERR             1
+#define ORX_WARN            2
+#define ORX_INFO            3
+#define ORX_DEBUG           4
+#define ORX_vDEBUG          5
+
+extern int verbose;
+
+//definitions
+#ifndef MODULAR_DEBUG
+ #define HARD_DEBUG_LEVEL ORX_DEBUG
+ #define SOFT_DEBUG_LEVEL verbose
+#else /* MODULAR_DEBUG */
+ #ifndef DEBUG_MODULE_SOFT
+  #define SOFT_DEBUG_LEVEL verbose
+ #else /* DEBUG_MODULE_SOFT */
+  #define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT
+ #endif /* DEBUG_MODULE_SOFT */
+
+ #ifndef DEBUG_SPECIAL_MODULE
+  #define HARD_DEBUG_LEVEL DEBUG
+ #else /* DEBUG_SPECIAL_MODULE */
+  ////////////////////
+  // DEFINE MODULES //
+  ////////////////////
+  // FRAMEWORK
+  #define DEBUG_MODULE_BASE                  2
+  #define DEBUG_MODULE_ORXONOX               2
+  #define DEBUG_MODULE_WORLD                 2
+  #define DEBUG_MODULE_NETWORK               2
+
+  // LOADING
+  #define DEBUG_MODULE_LOAD                  2
+  #define DEBUG_MODULE_IMPORTER              2
+
+  // ENGINES
+  #define DEBUG_MODULE_GRAPHICS              2
+  #define DEBUG_MODULE_EVENT                 2
+  #define DEBUG_MODULE_PHYSICS               2
+  #define DEBUG_MODULE_GARBAGE_COLLECTOR     2
+  #define DEBUG_MODULE_OBJECT_MANAGER        2
+  #define DEBUG_MODULE_ANIM                  2
+  #define DEBUG_MODULE_COLLISION_DETECTION   2
+  #define DEBUG_MODULE_COLLISION_REACTION    2
+  #define DEBUG_MODULE_SPATIAL_SEPARATION    2
+  #define DEBUG_MODULE_GUI                   2
+  #define DEBUG_MODULE_SOUND                 2
+
+  // MISC
+  #define DEBUG_MODULE_TRACK_MANAGER         2
+  #define DEBUG_MODULE_MATH                  2
+
+  #define DEBUG_MODULE_PNODE                 2
+  #define DEBUG_MODULE_WORLD_ENTITY          2
+
+  #define DEBUG_MODULE_STORY_ENTITY          2
+  #define DEBUG_MODULE_GAME_RULES            2
+
+  #define DEBUG_MODULE_WEAPON                2
+
+  #define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
+
+ #endif /* DEBUG_SPECIAL_MODULE */
+#endif /* MODULAR_DEBUG */
+
+///////////////////////////////////////////////////
+/// PRINTF: prints with filename and linenumber ///
+///////////////////////////////////////////////////
+#define PRINTFORX_NONE    PRINTF0
+#define PRINTFORX_ERR     PRINTF1
+#define PRINTFORX_WARN    PRINTF2
+#define PRINTFORX_INFO    PRINTF3
+#define PRINTFORX_DEBUG   PRINTF4
+#define PRINTFORX_VDEBUG  PRINTF5
+
+#if DEBUG_LEVEL <= 3
+#define PRINTF(x)        PRINT(x)
+#endif
+#ifndef NO_SHELL
+#define PRINT_EXEC       DebugBuffer::addBufferLineStatic
+#define COUT_EXEC        std::cout
+#else /* NO_SHELL */
+#define PRINT_EXEC       printf
+#define COUT_EXEC        std::cout
+#endif
+
+#ifndef PRINTF
+#ifdef ORX_DEBUG
+
+#define PRINTF(x) \
+           PRINTF ## x
+
+#if HARD_DEBUG_LEVEL >= ORX_ERR
+#define PRINTF1 \
+    if (SOFT_DEBUG_LEVEL >= ORX_ERR) \
+      printf("(EE)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
+#else
+#define PRINTF1 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_WARN
+#define PRINTF2 \
+     if (SOFT_DEBUG_LEVEL >= ORX_WARN) \
+       printf("(WW)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
+
+#else
+#define PRINTF2 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_INFO
+#define PRINTF3 \
+     if (SOFT_DEBUG_LEVEL >= ORX_INFO) \
+       printf("(II)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
+#else
+#define PRINTF3 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_DEBUG
+#define PRINTF4 \
+     if (SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
+       printf("(DD)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
+#else
+#define PRINTF4 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_vDEBUG
+#define PRINTF5 \
+     if (SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
+       printf("(VD)::%s:%d:", __FILE__, __LINE__), PRINT_EXEC
+#else
+#define PRINTF5 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#else
+#define PRINTF(x) if (ORX_NONE) PRINT_EXEC
+#endif
+
+#define PRINTF0 \
+    printf("%s:%d::", __FILE__, __LINE__), PRINT_EXEC
+#endif
+
+///////////////////////////////////////////////////
+///  PRINT: just prints output as is            ///
+///////////////////////////////////////////////////
+#define PRINTORX_NONE    PRINT0
+#define PRINTORX_ERR     PRINT1
+#define PRINTORX_WARN    PRINT2
+#define PRINTORX_INFO    PRINT3
+#define PRINTORX_DEBUG   PRINT4
+#define PRINTORX_vDEBUG  PRINT5
+
+#ifdef  DEBUG_LEVEL
+#define PRINT(x) \
+  PRINT ## x
+
+#if HARD_DEBUG_LEVEL >= ORX_ERR
+#define PRINT1  \
+  if (SOFT_DEBUG_LEVEL >= ORX_ERR)  \
+    PRINT_EXEC
+#else
+#define PRINT1 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_WARN
+#define PRINT2 \
+  if (SOFT_DEBUG_LEVEL >= ORX_WARN) \
+    PRINT_EXEC
+
+#else
+#define PRINT2 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_INFO
+#define PRINT3 \
+  if (SOFT_DEBUG_LEVEL >= ORX_INFO) \
+    PRINT_EXEC
+#else
+#define PRINT3 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_DEBUG
+#define PRINT4 \
+  if (SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
+    PRINT_EXEC
+#else
+#define PRINT4 if (ORX_NONE) PRINT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_vDEBUG
+#define PRINT5 \
+     if (SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
+       PRINT_EXEC
+#else
+#define PRINT5 if (ORX_NONE) PRINT_EXEC
+#endif
+
+
+#else
+#define PRINT(x) if (ORX_NONE) PRINT_EXEC
+#endif
+
+#define PRINT0 \
+  PRINT_EXEC
+
+
+
+////////////////////////////////////////////////////////
+///  COUT: just prints output as is with std::cout   ///
+////////////////////////////////////////////////////////
+#define COUTORX_NONE    COUT0
+#define COUTORX_ERR     COUT1
+#define COUTORX_WARN    COUT2
+#define COUTORX_INFO    COUT3
+#define COUTORX_DEBUG   COUT4
+#define COUTORX_vDEBUG  COUT5
+
+#ifdef  DEBUG_LEVEL
+#define COUT(x) \
+  COUT ## x
+
+#if HARD_DEBUG_LEVEL >= ORX_ERR
+#define COUT1  \
+  if (SOFT_DEBUG_LEVEL >= ORX_ERR)  \
+    COUT_EXEC
+#else
+#define COUT1 if (ORX_NONE)\
+    COUT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_WARN
+#define COUT2 \
+  if (SOFT_DEBUG_LEVEL >= ORX_WARN) \
+    COUT_EXEC
+
+#else
+#define COUT2 if (ORX_NONE) \
+    COUT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_INFO
+#define COUT3 \
+  if (SOFT_DEBUG_LEVEL >= ORX_INFO) \
+    COUT_EXEC
+#else
+#define COUT3 if (ORX_NONE) \
+    COUT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_DEBUG
+#define COUT4 \
+  if (SOFT_DEBUG_LEVEL >= ORX_DEBUG) \
+    COUT_EXEC
+#else
+#define COUT4 if (ORX_NONE) \
+    COUT_EXEC
+#endif
+
+#if HARD_DEBUG_LEVEL >= ORX_vDEBUG
+#define COUT5 \
+     if (SOFT_DEBUG_LEVEL >= ORX_vDEBUG) \
+       COUT_EXEC
+#else
+#define COUT5 if (ORX_NONE) \
+    COUT_EXEC
+#endif
+
+
+#else
+#define COUT(x) if (ORX_NONE) \
+    COUT_EXEC
+#endif
+
+#define COUT0 \
+  COUT_EXEC
+
+
+#endif /* _DEBUG_H */
Index: trunk/src/lib/util/debug_buffer.cc
===================================================================
--- trunk/src/lib/util/debug_buffer.cc	(revision 9869)
+++ trunk/src/lib/util/debug_buffer.cc	(revision 9869)
@@ -0,0 +1,133 @@
+/*
+   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 "debug_buffer.h"
+
+#include <stdarg.h>
+
+#include "debug.h"
+#include "compiler.h"
+#include "threading.h"
+
+/**
+ * @brief standard constructor
+ */
+DebugBuffer::DebugBuffer ()
+{
+  DebugBuffer::singletonRef = this;
+
+  this->lineCount = 0;
+  this->bufferArray[0] = '\0';
+
+  this->setMaxBufferSize(100);
+}
+
+DebugBuffer* DebugBuffer::singletonRef = NULL;
+std::list<std::string> DebugBuffer::buffer;
+char DebugBuffer::bufferArray[DEBUG_BUFFER_SIZE] = "";
+
+
+/**
+ * @brief standard deconstructor
+ */
+DebugBuffer::~DebugBuffer ()
+{
+  DebugBuffer::singletonRef = NULL;
+}
+
+/**
+ * @brief deletes all the Buffers
+ */
+void DebugBuffer::flush()
+{
+  this->buffer.clear();
+}
+
+/**
+ * @brief adds a new Line to the List of Buffers
+ * @param line the Line as in the first argument in printf
+ */
+void DebugBuffer::addBufferLineStatic(const char* line, ...)
+{
+  static OrxThread::Mutex DebugBuffer__bufferMutex;
+
+  OrxThread::MutexLock bufferLock(&DebugBuffer__bufferMutex);
+
+  va_list arguments;
+  va_start(arguments, line);
+  vsnprintf(DebugBuffer::bufferArray, DEBUG_BUFFER_SIZE, line, arguments);
+  va_end(arguments);
+
+#if DEBUG_LEVEL < 3
+  if (DebugBuffer::singletonRef == NULL)
+#endif
+    printf(DebugBuffer::bufferArray);
+#if DEBUG_LEVEL < 3
+  else
+#else
+  if (DebugBuffer::singletonRef != NULL)
+#endif
+    DebugBuffer::singletonRef->addBufferLine(DebugBuffer::bufferArray);
+}
+
+/**
+ * @brief add a Line to the List of Buffers
+ * @param line
+ * @param arguments
+ *
+ * This function Adds one line to the buffer.
+ * and displays the line as the First Line of the display-buffer
+ */
+void DebugBuffer::addBufferLine(const char* line)
+{
+  std::string inputBuffer = this->keepBuffer + line;
+
+  unsigned int lineBegin = 0;
+  unsigned int lineEnd = 0;
+  // adding all the new Lines
+  while (lineEnd < inputBuffer.size())
+  {
+    lineBegin = lineEnd;
+    lineEnd = inputBuffer.find('\n', (lineBegin == 0) ? 0: ++lineBegin);
+    if (likely(lineEnd != std::string::npos ))
+    {
+      this->lineCount++;
+      this->buffer.push_front(inputBuffer.substr(lineBegin, lineEnd - lineBegin));
+    }
+    else      // No end of Line reached.
+    {
+      this->keepBuffer = inputBuffer.substr(lineBegin, inputBuffer.size() - lineBegin);
+      break;
+    }
+
+    if (inputBuffer[lineBegin] == '\n')
+      lineBegin++, lineEnd++;
+
+    if (this->buffer.size() > this->maxBufferSize)
+      this->buffer.pop_back();
+  }
+}
+
+/**
+ * @brief displays some nice output from the Debug
+ */
+void DebugBuffer::debug() const
+{
+  PRINT(3)("Debugging output to console (not this debug)\n");
+
+  std::list<std::string>::const_iterator bufferLine;
+  for (bufferLine = --this->buffer.end(); bufferLine != this->buffer.begin(); --bufferLine)
+    printf((*bufferLine).c_str());
+}
Index: trunk/src/lib/util/debug_buffer.h
===================================================================
--- trunk/src/lib/util/debug_buffer.h	(revision 9869)
+++ trunk/src/lib/util/debug_buffer.h	(revision 9869)
@@ -0,0 +1,63 @@
+/*!
+ * @file debug_buffer.h
+ * @brief The Debug buffer Tasks
+ * @see debug.h
+*/
+
+#ifndef _DEBUG_BUFFER_H
+#define _DEBUG_BUFFER_H
+
+#include <string>
+#include <list>
+
+#define      DEBUG_BUFFER_SIZE       16384         //!< The Size of the input-buffers (should be large enough to carry any kind of input)
+
+  //! A class handling output from orxonox via debug.h
+  /**
+   * the DebugBuffer redirects output from PRINTF(x) to the Debug and STDOUT
+   * the DebugBuffer is a front-filling queue of limited length, that has the
+   * youngest added Entry at the beginning, and the oldest at the end.
+   */
+  class DebugBuffer
+  {
+  public:
+    virtual ~DebugBuffer();
+    /** @returns a Pointer to the only object of this Class */
+    inline static DebugBuffer* getInstance() { if (!DebugBuffer::singletonRef) DebugBuffer::singletonRef = new DebugBuffer();  return DebugBuffer::singletonRef; };
+    /** @returns true if this class is instanciated, false otherwise */
+    inline static bool isInstanciated() { return (DebugBuffer::singletonRef == NULL)?false:true; };
+
+    static void addBufferLineStatic(const char* line, ...);
+    void addBufferLine(const char* line);
+
+    /// BUFFER
+    /** @param bufferSize the new Buffer-Size */
+    void setMaxBufferSize(unsigned int maxBufferSize) { this->maxBufferSize = maxBufferSize; };
+    void flush();
+
+    /** @returns the List of stings from the Buffer */
+    const std::list<std::string>& getBuffer() const { return this->buffer; };
+    /** @returns the Count of lines processed by the Debug. */
+    inline unsigned long getLineCount() const { return this->lineCount; };
+    /** @returns the Current Buffer Size. */
+    inline unsigned int getBufferSize() const { return this->buffer.size(); };
+
+    void debug() const;
+
+  private:
+    DebugBuffer();
+
+  private:
+    static DebugBuffer*           singletonRef;                       //!< The singleton-reference to the only memeber of this class.
+    unsigned int                  maxBufferSize;                      //!< The Size of the buffer
+
+    std::string                   keepBuffer;                         //!< a BUFFER to have multi-non-newLine commands be copied into the debug.
+
+    unsigned long                 lineCount;                          //!< how many Lines have been written out so far.
+
+    // The Beginning of buffer (buffer.front()) is the last added line.
+    static char                   bufferArray[DEBUG_BUFFER_SIZE];     //!< a BUFFER for fast writing
+    static std::list<std::string> buffer;                             //!< A list of stored char-arrays(strings) to store the history
+  };
+
+#endif /* _DEBUG_BUFFER_H */
Index: trunk/src/lib/util/executor/executor.cc
===================================================================
--- trunk/src/lib/util/executor/executor.cc	(revision 9682)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
-   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_
-
-#include "executor.h"
-
-////////////////////////
-// SHELL COMMAND BASE //
-////////////////////////
-/**
- * @brief constructs and registers a new Command
- * @param commandName the name of the Command
- * @param className the name of the class to apply this command to
- * @param paramCount the count of parameters this command takes
- */
-Executor::Executor(const MultiType& param0,
-                   const MultiType& param1,
-                   const MultiType& param2,
-                   const MultiType& param3,
-                   const MultiType& param4,
-                   const MultiType& param5,
-                   const MultiType& param6)
-{
-  this->setClassID(CL_EXECUTOR, "Executor");
-
-  // What Parameters have we got
-  this->defaultValue[0] = param0;
-  this->defaultValue[1] = param1;
-  this->defaultValue[2] = param2;
-  this->defaultValue[3] = param3;
-  this->defaultValue[4] = param4;
-  this->defaultValue[5] = param5;
-  this->defaultValue[6] = param6;
-
-  this->paramCount = 0;
-  for (unsigned int i = 0; i <= FUNCTOR_MAX_ARGUMENTS; i++)
-  {
-    if (this->defaultValue[i] == MT_NULL || i == FUNCTOR_MAX_ARGUMENTS)
-    {
-      this->paramCount = i;
-      break;
-    }
-  }
-}
-
-/**
- * deconstructs a Executor
- */
-Executor::~Executor()
-{}
-
-/**
- * clones this element into executor.
- */
-void Executor::cloning(Executor* executor) const
-{
-  executor->functorType  = this->functorType;
-  executor->paramCount   = this->paramCount;
-  for (unsigned int i = 0; i < this->paramCount; i++)
-    executor->defaultValue[i] =  this->defaultValue[i];
-}
-
-/**
- * @brief set the default values of the executor
- * @param value0 the first default value
- * @param value1 the second default value
- * @param value2 the third default value
- * @param value3 the fourth default value
- * @param value4 the fifth default value
- * @returns itself
- */
-Executor* Executor::defaultValues(const MultiType& value0,
-                                  const MultiType& value1,
-                                  const MultiType& value2,
-                                  const MultiType& value3,
-                                  const MultiType& value4,
-                                  const MultiType& value5,
-                                  const MultiType& value6)
-{
-  if (this == NULL)
-    return NULL;
-
-  const MultiType* value[5];
-  value[0] = &value0;
-  value[1] = &value1;
-  value[2] = &value2;
-  value[3] = &value3;
-  value[4] = &value4;
-  value[5] = &value5;
-  value[6] = &value6;
-  for (unsigned int i = 0; i < this->paramCount; i++)
-  {
-    if (*value[i] != MT_NULL)
-    {
-      this->defaultValue[i].setValueOf(*value[i]);
-    }
-  }
-  return this;
-}
-
-/**
- * @brief prints out nice information about the Executor
- */
-void Executor::debug()
-{
-
-}
Index: trunk/src/lib/util/executor/executor.h
===================================================================
--- trunk/src/lib/util/executor/executor.h	(revision 9682)
+++ trunk/src/lib/util/executor/executor.h	(revision 9869)
@@ -9,16 +9,25 @@
 #include "base_object.h"
 
-#include "helper_functions.h"
 #include "multi_type.h"
-#include "substring.h"
-#include "functor_list.h" //< MUST BE INCLUDED HERE AT LEAST ONCE.
-
-//! an enumerator for the definition of the Type.
-typedef enum {
-  Executor_Objective         = 1,
-  Executor_Static            = 2,
-
-  Executor_NoLoadString      = 8,
-} Executor_Type;
+
+//! The maximum Count of Arguments of the Executor
+/** This is Hardcoded, for each Executor. */
+#define EXECUTOR_MAX_ARGUMENTS                7
+
+
+/** @returns the Type of an Argument taken by the Executor */
+template<typename type> inline MT_Type ExecutorParamType() { return MT_EXT1; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_BOOL */
+template<> inline MT_Type ExecutorParamType<bool>() { return MT_BOOL; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_INT*/
+template<> inline MT_Type ExecutorParamType<int>() { return MT_INT; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_UINT*/
+template<> inline MT_Type ExecutorParamType<unsigned int>() { return MT_UINT; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_FLOAT*/
+template<> inline MT_Type ExecutorParamType<float>() { return MT_FLOAT; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_CHAR*/
+template<> inline MT_Type ExecutorParamType<char>() { return MT_CHAR; };
+/** @returns the Type of an Argument taken by the Executor in this case MT_STRING*/
+template<> inline MT_Type ExecutorParamType<const std::string&>() { return MT_STRING; };
 
 ////////////////
@@ -36,53 +45,174 @@
  *  Functions with many types (@see functor_list.h)
  */
-class Executor : public BaseObject
+template <typename CallType, class BaseClass = BaseObject> class Executor
 {
-  public:
-    virtual ~Executor();
-
-    virtual Executor* clone () const = 0;
-//    virtual bool operator==(const Executor* executor) const = 0;
-
-    // SETTING up the EXECUTOR
-    Executor* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
-                            const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
-                            const MultiType& value4 = MT_NULL, const MultiType& param5 = MT_NULL,
-                            const MultiType& param6 = MT_NULL);
-    /** @param i the i'th defaultValue, @returns reference to the MultiType */
-    inline MultiType& getDefaultValue(unsigned int i) { return defaultValue[i]; };
-
-    // EXECUTE
-    /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-    virtual void operator()(BaseObject* object, int& count, void* values) const = 0;
-    /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */
-    virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const = 0;
-
-    // RETRIEVE INFORMATION
-    /** @returns the Type of this Function (either static or objective) */
-    inline long getType() const { return this->functorType; };
-    /** @returns the Count of Parameters this Executor takes */
-    inline unsigned int getParamCount() const { return this->paramCount; };
-
-    static void debug();
-
-  protected:
-    Executor(const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL,
-             const MultiType& param2 = MT_NULL, const MultiType& param3 = MT_NULL,
-             const MultiType& param4 = MT_NULL, const MultiType& param5 = MT_NULL,
-             const MultiType& param6 = MT_NULL);
-
-    void cloning(Executor* executor) const;
-
-  protected:
-    short                       functorType;      //!< The type of Function we've got (either static or objective).
-    unsigned int                paramCount;       //!< the count of parameters.
-    MultiType                   defaultValue[7];  //!< Default Values.
+public:
+  //! an enumerator for the definition of the Type.
+  typedef enum {
+    FunctionMember,      //!< The function is neither Static nor Constant
+    FunctionStatic,      //!< The Function is Static and pointing to either a Static Member or a C-style function.
+    FunctionConstMember, //!< The Function is Constant and pointing to a Member that does not change the Object.
+  } FunctionType;
+
+public:
+  virtual ~Executor() {};
+
+  // RETRIEVE INFORMATION
+  /** @param i the i'th defaultValue, @returns reference to the MultiType */
+  inline MultiType& getDefaultValue(unsigned int i) { return defaultValue[i]; };
+  /** @returns the default Values as a List */
+  inline const MultiType* const getDefaultValues() { return defaultValue; };
+
+  /** @returns the Type of this Function (either static or objective) */
+  inline FunctionType getType() const { return this->functionType; };
+
+  /** @returns the Count of Parameters this Executor takes */
+  inline unsigned int getParamCount() const { return this->paramCount; };
+  /** @returns true if the Executor has a return Value. */
+  inline bool hasRetVal() const { return bRetVal; };
+
+  /** executes a Command. @param object the Object, @param values The Value of type CallType to pass to the Executor. */
+  virtual void operator()(BaseClass* object, CallType& values) const = 0;
+
+  /**
+   * @brief set the default values of the executor
+   * @param value0 the first default value
+   * @param value1 the second default value
+   * @param value2 the third default value
+   * @param value3 the fourth default value
+   * @param value4 the fifth default value
+   * @param value5 the sixth default value
+   * @param value6 the seventh default value
+   * @returns itself
+   * @note: THIS FUNCTION WILL BE REPLACED BY A CONFIGURATOR (most probably).
+  */
+  Executor* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
+                          const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
+                          const MultiType& value4 = MT_NULL, const MultiType& value5 = MT_NULL,
+                          const MultiType& value6 = MT_NULL)
+  {
+    const MultiType* value[5];
+    value[0] = &value0;
+    value[1] = &value1;
+    value[2] = &value2;
+    value[3] = &value3;
+    value[4] = &value4;
+    value[5] = &value5;
+    value[6] = &value6;
+    for (unsigned int i = 0; i < this->paramCount; i++)
+    {
+      if (*value[i] != MT_NULL)
+      {
+        this->defaultValue[i].setValueOf(*value[i]);
+        this->defaultValue[i].storeString();
+      }
+    }
+    return this;
+  }
+
+  /** @returns the Clone as a new Copy of the Executor. */
+  virtual Executor<CallType, BaseClass>* clone () const = 0;
+
+
+protected:
+  //! Now follows a List of Executor Constructors, to be fast in creating.
+  //! Creates an Executor with no Argument.
+  Executor(bool hasRetVal, FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(0), functionType(functionType)
+  { };
+
+  //! Creates an Executor with 1 Argument.
+  Executor(bool hasRetVal, const MultiType& param0,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(1), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+  };
+
+  //! Creates an Executor with 2 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(2), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+  };
+
+  //! Creates an Executor with 3 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   const MultiType& param2,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(3), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+    this->defaultValue[2] = param2;
+  };
+
+  //! Creates an Executor with 4 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   const MultiType& param2, const MultiType& param3,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(4), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+    this->defaultValue[2] = param2;
+    this->defaultValue[3] = param3;
+  };
+
+  //! Creates an Executor with 5 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   const MultiType& param2, const MultiType& param3,
+	   const MultiType& param4,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(5), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+    this->defaultValue[2] = param2;
+    this->defaultValue[3] = param3;
+    this->defaultValue[4] = param4;
+  };
+
+  //! Creates an Executor with 6 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   const MultiType& param2, const MultiType& param3,
+	   const MultiType& param4, const MultiType& param5,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(6), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+    this->defaultValue[2] = param2;
+    this->defaultValue[3] = param3;
+    this->defaultValue[4] = param4;
+    this->defaultValue[5] = param5;
+  };
+
+  //! Creates an Executor with 7 Arguments.
+  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
+	   const MultiType& param2, const MultiType& param3,
+	   const MultiType& param4, const MultiType& param5,
+	   const MultiType& param6,
+	   FunctionType functionType = FunctionMember)
+  : bRetVal(hasRetVal), paramCount(7), functionType(functionType)
+  {
+    this->defaultValue[0] = param0;
+    this->defaultValue[1] = param1;
+    this->defaultValue[2] = param2;
+    this->defaultValue[3] = param3;
+    this->defaultValue[4] = param4;
+    this->defaultValue[5] = param5;
+    this->defaultValue[6] = param6;
+  };
+
+protected:
+  const bool                  bRetVal;          //!< True if the Executor has a return Value.
+  const unsigned int          paramCount;       //!< the count of parameters.
+  MultiType                   defaultValue[7];  //!< Default Values.
+
+  const FunctionType          functionType;     //!< What Type of Function it is.
 };
 
-#include "executor/executor_functional.h"
-#define EXECUTOR_FUNCTIONAL_USE_CONST
-#include "executor/executor_functional.h"
-#define EXECUTOR_FUNCTIONAL_USE_STATIC
-#include "executor/executor_functional.h"
-
 #endif /* _EXECUTOR_H */
Index: trunk/src/lib/util/executor/executor_const_member.h
===================================================================
--- trunk/src/lib/util/executor/executor_const_member.h	(revision 9869)
+++ trunk/src/lib/util/executor/executor_const_member.h	(revision 9869)
@@ -0,0 +1,49 @@
+/*!
+ * @file executor_const_member.h
+ * Definition of an Executor to Member Functions
+ */
+/*
+   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: ...
+*/
+
+
+#ifndef __EXECUTOR_CONST_MEMBER_H_
+#define __EXECUTOR_CONST_MEMBER_H_
+
+/// Define all Constructs, that define an Executor.
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext##_const
+
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST              const
+//! The Execution-mode (either static or objective)
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC      dynamic_cast<T*>(object)->*(functionPointer)
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionConstMember
+
+
+/// We want to include __EXECUTOR_GENERIC_H again, with current settings.
+
+#include "executor_generic.h"
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+#endif /* __EXECUTOR_CONST_MEMBER_H_ */
Index: trunk/src/lib/util/executor/executor_functional.cc
===================================================================
--- trunk/src/lib/util/executor/executor_functional.cc	(revision 9682)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
-   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 "executor.h"
-std::string ExecutorFunctional_returningString_from[7];
-
-
-template<> MT_Type ExecutorParamType<bool>() { return MT_BOOL; };
-template<> MT_Type ExecutorParamType<int>() { return MT_INT; };
-template<> MT_Type ExecutorParamType<unsigned int>() { return MT_UINT; };
-template<> MT_Type ExecutorParamType<float>() { return MT_FLOAT; };
-template<> MT_Type ExecutorParamType<char>() { return MT_CHAR; };
-template<> MT_Type ExecutorParamType<const std::string&>() { return MT_STRING; };
-
-template<> bool fromString<bool>(const std::string& input, bool defaultValue) { return isBool(input, defaultValue); };
-template<> int fromString<int>(const std::string& input, int defaultValue) { return isInt(input, defaultValue); };
-template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue) { return isInt(input, defaultValue); };
-template<> float fromString<float>(const std::string& input, float defaultValue) { return isFloat(input, defaultValue); };
-template<> char fromString<char>(const std::string& input, char defaultValue) { return isInt(input, defaultValue); };
-template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue) { return (input.size() > 0) ? input : defaultValue; };
-
-
-template<> bool fromMulti<bool>(const MultiType& multi) { return multi.getBool(); };
-template<> int fromMulti<int>(const MultiType& multi) { return multi.getInt(); }
-template<> unsigned int fromMulti<unsigned int>(const MultiType& multi) { return multi.getInt(); };
-template<> float fromMulti<float>(const MultiType& multi) { return multi.getFloat(); };
-template<> char fromMulti<char>(const MultiType& multi) { return multi.getChar(); };
-template<> const std::string& fromMulti<const std::string&>(const MultiType& multi) { return multi.getConstString(); };
-
-
-template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getBool(); };
-template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getInt(); };
-template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getInt(); };
-template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getFloat(); };
-template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getChar(); };
-template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { return ExecutorFunctional_returningString_from[i] = defaultValues[i].getString(); };
-
-
-
-
-
-
-
-/**
- * A LITTLE TESTING SUITE FOR THE EXECUTOR.
- *
-#include "executor/executor_functional.h"
-
-#define EXECUTOR_FUNCTIONAL_USE_STATIC
-#include "executor/executor_functional.h"
-
-class TestClass : public BaseObject
-{
-  public:
-    TestClass() {};
-
-    void printTest() { printf ("TEST\n"); };
-    void printTestInt(int i) { printf ("%d\n", i); };
-    void printTestBool(bool b) { printf("%d\n", (int)b); };
-    void printTwoVals(int b, int i) { printf ("%d %d\n", b, i); };
-    void printStrings(const std::string& name) { printf("String:: '%s'\n", name.c_str()); };
-    static void printStatic() { printf("STATIC\n");};
-};
-
-void TEST()
-{
-  TestClass test;
-  SubString testStrings("1 SCHEISSE, 2, 3", ",", SubString::WhiteSpaces, false);
-  (*createExecutor<TestClass>(&TestClass::printTest))(&test, testStrings);
-  (*createExecutor<TestClass>(&TestClass::printTestInt))(&test, testStrings);
-  (*createExecutor<TestClass>(&TestClass::printTestBool))(&test, testStrings);
-  (*createExecutor<TestClass>(&TestClass::printTwoVals))(&test, testStrings);
-  (*createExecutor<TestClass>(&TestClass::printStatic))(&test, testStrings);
-  (*createExecutor<TestClass>(&TestClass::printStrings))(&test, testStrings);
-
-}
-*/
Index: trunk/src/lib/util/executor/executor_functional.h
===================================================================
--- trunk/src/lib/util/executor/executor_functional.h	(revision 9682)
+++ 	(revision )
@@ -1,514 +1,0 @@
-/*!
- * @file executor_functional.h
- * Definition of an Executor
- */
-
-/*
-   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: ...
-*/
-
-
-#ifndef __EXECUTOR_FUNCTIONAL_H_
-#define __EXECUTOR_FUNCTIONAL_H_
-
-#include "executor.h"
-
-template<typename type> MT_Type ExecutorParamType() { return MT_EXT1; };
-template<> MT_Type ExecutorParamType<bool>();
-template<> MT_Type ExecutorParamType<int>();
-template<> MT_Type ExecutorParamType<unsigned int>();
-template<> MT_Type ExecutorParamType<float>();
-template<> MT_Type ExecutorParamType<char>();
-template<> MT_Type ExecutorParamType<const std::string&>();
-
-template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; };
-template<> bool fromString<bool>(const std::string& input, bool defaultValue);
-template<> int fromString<int>(const std::string& input, int defaultValue);
-template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue);
-template<> float fromString<float>(const std::string& input, float defaultValue);
-template<> char fromString<char>(const std::string& input, char defaultValue);
-template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue);
-
-template<typename type> type fromMulti(const MultiType& multi) { /* return defaultValue; */ };
-template<> bool fromMulti<bool>(const MultiType& multi);
-template<> int fromMulti<int>(const MultiType& multi);
-template<> unsigned int fromMulti<unsigned int>(const MultiType& multi);
-template<> float fromMulti<float>(const MultiType& multi);
-template<> char fromMulti<char>(const MultiType& multi);
-template<> const std::string& fromMulti<const std::string&>(const MultiType& multi);
-
-
-template<typename type> type getDefault(const MultiType* const defaultValues, unsigned int i) { return (type)0; };
-template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i);
-template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i);
-template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i);
-template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i);
-template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i);
-template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i);
-
-#endif /* __EXECUTOR_FUNCTIONAL_H_ */
-
-//! if Functional is constant calling
-#define __EXECUTOR_FUNCTIONAL_CONST
-//! The Name to be attached to the functional (for normal, static, and const modes)
-#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount)   Executor##ParamCount##Params
-//! The Execution-mode (either static or objective)
-#define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC      dynamic_cast<T*>(object)->*(functionPointer)
-//! The Function-Pointer, and how to save it internally.
-#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
-
-#ifdef EXECUTOR_FUNCTIONAL_USE_CONST
- #undef __EXECUTOR_FUNCTIONAL_CONST
- #define __EXECUTOR_FUNCTIONAL_CONST const
- #undef __EXECUTOR_FUNCTIONAL_NAME
- #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount) Executor##ParamCount##Params_const
-#endif
-
-#ifdef EXECUTOR_FUNCTIONAL_USE_STATIC
- #ifdef EXECUTOR_FUNCTIONAL_USE_CONST
-  #error you obviously do not know what you are doing !! ask the bensch
- #endif /* EXECUTOR_FUNCTIONAL_USE_CONST */
-
-#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
- #define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC       functionPointer
- #undef __EXECUTOR_FUNCTIONAL_NAME
- #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount)    Executor##ParamCount##Params_static
- #undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
- #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER    *functionPointer
-
-#endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */
-
-///////////
-//// 0 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions without any parameters.
-template<class T> class __EXECUTOR_FUNCTIONAL_NAME(0) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(0) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST )
-      : Executor()
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /**
-   * @brief executes the Functional
-   * @param object the Object the action should be executed on.
-   * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
-  }
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(this->functionPointer);
-  };
-};
-
-
-
-///////////
-//// 1 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions with one parameter.
-template<class T, typename type0> class __EXECUTOR_FUNCTIONAL_NAME(1) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(1) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST)
-      : Executor(ExecutorParamType<type0>())
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    const MultiType* mt = (const MultiType*)values;
-    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-             fromMulti<type0>((count > 0)? mt[0] : this->defaultValue[0]) );
-  }
-
-
-  /**
-   * @brief executes the Functional
-   * @param object the Object the action should be executed on.
-   * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])));
-  };
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return  new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0>(this->functionPointer);
-  };
-};
-
-///////////
-//// 2 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions with two parameters.
-template<class T, typename type0, typename type1> class __EXECUTOR_FUNCTIONAL_NAME(2) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(2) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST)
-      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /**
-   * @brief executes the Functional
-   * @param object the Object the action should be executed on.
-   * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
-      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])));
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    const MultiType* mt = (const MultiType*)values;
-    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
-             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]) );
-  }
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0, type1>(this->functionPointer);
-  };
-};
-
-
-///////////
-//// 3 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions with three parameters.
-template<class T, typename type0, typename type1, typename type2> class __EXECUTOR_FUNCTIONAL_NAME(3) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(3) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST)
-      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /**
-   * @brief executes the Functional
-   * @param object the Object the action should be executed on.
-   * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
-      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
-      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])));
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    const MultiType* mt = (const MultiType*)values;
-    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
-             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
-             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]) );
-  }
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0, type1, type2>(this->functionPointer);
-  };
-};
-
-
-
-///////////
-//// 4 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions with four parameters.
-template<class T, typename type0, typename type1, typename type2, typename type3> class __EXECUTOR_FUNCTIONAL_NAME(4) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(4) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST)
-      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /**
-  * @brief executes the Functional
-  * @param object the Object the action should be executed on.
-  * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
-      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
-      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),
-      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])));
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    const MultiType* mt = (const MultiType*)values;
-    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
-             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
-             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),
-             fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]) );
-  }
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0, type1, type2, type3>(this->functionPointer);
-  };
-};
-
-
-
-///////////
-//// 5 ////
-///////////
-//! @brief ExecutorClass, that can execute Functions with five parameters.
-template<class T, typename type0, typename type1, typename type2, typename type3, typename type4> class __EXECUTOR_FUNCTIONAL_NAME(5) : public Executor
-{
-private:
-  /** @brief the FunctioPointer. */
-  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST;
-
-public:
-  /**
-   * @brief constructs the Executor.
-   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
-   */
-  __EXECUTOR_FUNCTIONAL_NAME(5) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST)
-      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())
-  {
-    this->functorType = Executor_Objective;
-    this->functionPointer = functionPointer;
-  };
-
-  /**
-  * @brief executes the Functional
-  * @param object the Object the action should be executed on.
-  * @param sub the SubString to get the Parameters from.
-   */
-  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
-  {
-    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
-      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
-      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),
-      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])),
-      (sub.size() > 4) ? fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4)) : (fromMulti<type4>(this->defaultValue[4])));
-  };
-
-  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
-  virtual void operator()(BaseObject* object, int& count, void* values) const
-  {
-    const MultiType* mt = (const MultiType*)values;
-    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
-             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
-             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
-             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),
-             fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]),
-             fromMulti<type4>((count > 4) ? mt[4] : this->defaultValue[4]) );
-  }
-
-  /**
-   * @brief copies the Executor
-   * @returns a new Executor that's a copy of this one.
-   */
-  virtual Executor* clone() const
-  {
-    return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0, type1, type2, type3, type4>(this->functionPointer);
-  };
-};
-
-
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR0() \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-  return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(functionPointer); \
-}
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- * @param type0 for internal usage: the first Argument
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR1(type0) \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-  return new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0##_TYPE>(functionPointer); \
-}
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- * @param type0 for internal usage: the first Argument
- * @param type1 for internal usage: the second Argument
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR2(type0, type1) \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-  return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0##_TYPE, type1##_TYPE>(functionPointer); \
-}
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- * @param type0 for internal usage: the first Argument
- * @param type1 for internal usage: the second Argument
- * @param type2 for internal usage: the third Argument
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR3(type0, type1, type2) \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-  return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE>(functionPointer); \
-}
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- * @param type0 for internal usage: the first Argument
- * @param type1 for internal usage: the second Argument
- * @param type2 for internal usage: the third Argument
- * @param type3 for internal usage: the fourth Argument
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR4(type0, type1, type2, type3) \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-  return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE>(functionPointer); \
-}
-
-/**
- * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
- * @param type0 for internal usage: the first Argument
- * @param type1 for internal usage: the second Argument
- * @param type2 for internal usage: the third Argument
- * @param type3 for internal usage: the fourth Argument
- * @param type4 for internal usage: the fifth Argument
- */
-#define EXECUTOR_FUNCTIONAL_CREATOR5(type0, type1, type2, type3, type4) \
-template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
-{ \
-    return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE>(functionPointer); \
-}
-
-
-/**
- * Creates the FunctionCallers
- */
-#define FUNCTOR_LIST(x) EXECUTOR_FUNCTIONAL_CREATOR ## x
-#include "functor_list.h"
-#undef FUNCTOR_LIST
-
-
-
-#undef __EXECUTOR_FUNCTIONAL_CONST
-#undef __EXECUTOR_FUNCTIONAL_NAME
-#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
-#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
-
-#ifdef EXECUTOR_FUNCTIONAL_USE_CONST
- #undef EXECUTOR_FUNCTIONAL_USE_CONST
-#endif
-#ifdef EXECUTOR_FUNCTIONAL_USE_STATIC
- #undef EXECUTOR_FUNCTIONAL_USE_STATIC
-#endif
Index: trunk/src/lib/util/executor/executor_generic.h
===================================================================
--- trunk/src/lib/util/executor/executor_generic.h	(revision 9869)
+++ trunk/src/lib/util/executor/executor_generic.h	(revision 9869)
@@ -0,0 +1,456 @@
+/*!
+ * @file executor_generic.h
+ * Definition of a Generic Executor
+ */
+
+/*
+   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: ...
+*/
+
+
+
+#ifndef __EXECUTOR_GENERIC_H_
+#define __EXECUTOR_GENERIC_H_
+
+
+#include "executor.h"
+/**
+ * @brief this is a Template Class used as an evaluater.
+ *
+ * Trait to determine a default Value for any Type,
+ * and to define the Convertible, and how it is transformed into the
+ * corresponding SubTypes over the operator().
+ *
+ * This Class must be reimplemented for each Convertible and all of its
+ *  conversion-members.
+ *
+ * e.g: Convertible SubSting, that splits up into many Stings
+ *      conversion-members: (int) can be transformed from a String.
+ */
+template<typename FromType> class ExecutorEvaluater
+{
+public:
+  /** @brief Executes the Evaluater
+   * @param CallValue the Value that should be converted
+   * @param defaults the default Values.
+   */
+  template <typename ToType, int index>
+  static ToType getValue(FromType& CallValue, const MultiType* const defaults)
+  {
+    assert(0 && "Might want to extend the ExecutorEvaluater::getValue function in an 'Explicit Specialized Template Class'");
+    return defaultValue;
+  }
+  /** @param @storeTo Stores the returned value here. @param value The Value to Store. @note invers of getValue */
+  static void storeRet(FromType& storeTo, FromType value)
+  {
+    assert (0 && "Might want to extend the ExecutorEvaluater::storeRet function in an 'Explicit Specialized Template Class'");
+  }
+  /** @returns the Default Value of ToType */
+  static FromType& defaultValue() { static FromType defaultValue; return defaultValue; };
+};
+#endif /* __EXECUTOR_GENERIC_H_ */
+
+
+#ifdef __EXECUTOR_FUNCTIONAL_NAME
+///////////
+//// 0 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions without any parameters.
+template<class T, typename CallType, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(0,) :public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(0,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST )
+      : Executor<CallType, BaseClass>(false, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+   * @brief executes the Functional
+   * @param object the Object the action should be executed on.
+   * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return new __EXECUTOR_FUNCTIONAL_NAME(0,)<T, CallType, BaseClass>(this->functionPointer);
+  };
+};
+
+
+
+///////////
+//// 1 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions with one parameter.
+template<class T, typename CallType, typename type0, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(1,) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(1,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+   * @brief executes the Functional
+   * @param object the Object the action should be executed on.
+   * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+	Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue));
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return  new __EXECUTOR_FUNCTIONAL_NAME(1,)<T, CallType, type0, BaseClass>(this->functionPointer);
+  };
+};
+
+
+
+///////////
+//// 2 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions with two parameters.
+template<class T, typename CallType, typename type0, typename type1, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(2,) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(2,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+   * @brief executes the Functional
+   * @param object the Object the action should be executed on.
+   * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+      Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue));
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return new __EXECUTOR_FUNCTIONAL_NAME(2,)<T, CallType, type0, type1, BaseClass>(this->functionPointer);
+  };
+};
+
+
+
+///////////
+//// 3 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions with three parameters.
+template<class T, typename CallType, typename type0, typename type1, typename type2, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(3,) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(3,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+   * @brief executes the Functional
+   * @param object the Object the action should be executed on.
+   * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+      Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue));
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return new __EXECUTOR_FUNCTIONAL_NAME(3,)<T, CallType, type0, type1, type2, BaseClass>(this->functionPointer);
+  };
+};
+
+
+
+///////////
+//// 4 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions with four parameters.
+template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(4,) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(4,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+  * @brief executes the Functional
+  * @param object the Object the action should be executed on.
+  * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+      Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type3, 3>(eval, this->defaultValue));
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return new __EXECUTOR_FUNCTIONAL_NAME(4,)<T, CallType, type0, type1, type2, type3, BaseClass>(this->functionPointer);
+  };
+};
+
+
+
+///////////
+//// 5 ////
+///////////
+//! @brief ExecutorClass, that can execute Functions with five parameters.
+template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, typename type4, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(5,) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(5,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+  * @brief executes the Functional
+  * @param object the Object the action should be executed on.
+  * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+      Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type3, 3>(eval, this->defaultValue),
+      Evaluater<CallType>::template getValue<type4, 4>(eval, this->defaultValue));
+  };
+
+  /**
+   * @brief copies the Executor
+   * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return new __EXECUTOR_FUNCTIONAL_NAME(5,)<T, CallType, type0, type1, type2, type3, type4, BaseClass>(this->functionPointer);
+  };
+};
+
+
+////////////////////
+//// 0 & RETURN ////
+////////////////////
+//! @brief ExecutorClass, that can execute Functions with one parameter.
+template<class T, typename CallType, typename ReturnType, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(0,ret) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(0,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(true, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+     * @brief executes the Functional
+     * @param object the Object the action should be executed on.
+     * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)());
+  };
+
+  /**
+     * @brief copies the Executor
+     * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return  new __EXECUTOR_FUNCTIONAL_NAME(0,ret)<T, CallType, ReturnType, BaseClass>(this->functionPointer);
+  };
+};
+
+////////////////////
+//// 1 & RETURN ////
+////////////////////
+//! @brief ExecutorClass, that can execute Functions with one parameter.
+template<class T, typename CallType, typename ReturnType, typename type0, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(1,ret) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(1,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+     * @brief executes the Functional
+     * @param object the Object the action should be executed on.
+     * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+          Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue)));
+  };
+
+  /**
+     * @brief copies the Executor
+     * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return  new __EXECUTOR_FUNCTIONAL_NAME(1,ret)<T, CallType, ReturnType, type0, BaseClass>(this->functionPointer);
+  };
+};
+
+
+////////////////////
+//// 2 & RETURN ////
+////////////////////
+//! @brief ExecutorClass, that can execute Functions with one parameter.
+template<class T, typename CallType, typename ReturnType, typename type0, typename type1, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater>
+class __EXECUTOR_FUNCTIONAL_NAME(2,ret) : public Executor<CallType, BaseClass>
+{
+private:
+  /** @brief the FunctioPointer. */
+  ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST;
+
+public:
+  /**
+   * @brief constructs the Executor.
+   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
+   */
+  __EXECUTOR_FUNCTIONAL_NAME(2,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST)
+      : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
+  {};
+
+  /**
+     * @brief executes the Functional
+     * @param object the Object the action should be executed on.
+     * @param eval the CallType to get the Parameters from.
+   */
+  virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
+  {
+    Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
+          Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue),
+          Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue)));
+  };
+
+  /**
+     * @brief copies the Executor
+     * @returns a new Executor that's a copy of this one.
+   */
+  virtual Executor<CallType, BaseClass>* clone() const
+  {
+    return  new __EXECUTOR_FUNCTIONAL_NAME(2,ret)<T, CallType, ReturnType, type0, type1, BaseClass>(this->functionPointer);
+  };
+};
+
+#endif /* __EXECUTOR_FUNCTIONAL_NAME */
Index: trunk/src/lib/util/executor/executor_lua.cc
===================================================================
--- trunk/src/lib/util/executor/executor_lua.cc	(revision 9682)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
-   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 "executor_lua.h"
-
-#include "lunar.h"
-
-std::string temp[7];
-
-template<typename type> type fromLua(lua_State* state, int index) { type *obj = Lunar<type>::check(state, 1); lua_remove(state, 1); return obj;};
-template<> bool fromLua<bool>(lua_State* state, int index) { return lua_toboolean(state, index); };
-template<> int fromLua<int>(lua_State* state, int index) { return (int)lua_tonumber(state, index); };
-template<> unsigned int fromLua<unsigned int>(lua_State* state, int index) { return (unsigned int)lua_tonumber(state, index); };
-template<> float fromLua<float>(lua_State* state, int index) { return (float)lua_tonumber(state, index); };
-template<> char fromLua<char>(lua_State* state, int index) { return (char)lua_tonumber(state, index); };
-template<> const std::string& fromLua<const std::string&>(lua_State* state, int index) { temp[index] = lua_tostring(state, index); return temp[index]; };
-
-
-template<typename type> void toLua(lua_State* state, type value) { Lunar<type>::push(state, value, false); };
-template<> void toLua<bool>(lua_State* state, bool value) { lua_pushboolean(state, (int) value); };
-template<> void toLua<int>(lua_State* state, int value)  { lua_pushnumber(state, (lua_Number) value); };
-template<> void toLua<unsigned int>(lua_State* state, unsigned int value){ lua_pushnumber(state, (lua_Number) value); };
-template<> void toLua<float>(lua_State* state, float value) { lua_pushnumber(state, (lua_Number) value); };
-template<> void toLua<char>(lua_State* state, char value) { lua_pushnumber(state, (lua_Number) value); };
-template<> void toLua<const std::string&>(lua_State* state, const std::string& value) { lua_pushstring (state, value.c_str()); }
Index: trunk/src/lib/util/executor/executor_lua.h
===================================================================
--- trunk/src/lib/util/executor/executor_lua.h	(revision 9682)
+++ 	(revision )
@@ -1,708 +1,0 @@
-/*!
- * @file executor.h
- * Definition of a on-screen-shell
- */
-
-#ifndef _EXECUTOR_LUA_H
-#define _EXECUTOR_LUA_H
-
-#include "executor.h"
-#include "compiler.h"
-#include "debug.h"
-#include "luaincl.h"
-
-
-
-template<typename type> type fromLua(lua_State* state, int index);
-template<> bool fromLua<bool>(lua_State* state, int index);
-template<> int fromLua<int>(lua_State* state, int index);
-template<> unsigned int fromLua<unsigned int>(lua_State* state, int index);
-template<> float fromLua<float>(lua_State* state, int index);
-template<> char fromLua<char>(lua_State* state, int index);
-template<> const std::string& fromLua<const std::string&>(lua_State* state, int index);
-
-template<typename type> void toLua(lua_State* state, type value);
-template<> void toLua<bool>(lua_State* state, bool value);
-template<> void toLua<int>(lua_State* state, int value);
-template<> void toLua<unsigned int>(lua_State* state, unsigned int value);
-template<> void toLua<float>(lua_State* state, float value);
-template<> void toLua<char>(lua_State* state, char value);
-template<> void toLua<const std::string&>(lua_State* state, const std::string& value);
-
-// FORWARD DECLARATION
-
-///////////////////////
-///// WITHOUT RET /////
-///////////////////////
-
-///////////
-//// 0 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T> class ExecutorLua0 : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua0(void(T::*function)())
-  : Executor()
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      (dynamic_cast<T*>(object)->*(functionPointer))();
-      count = 0;
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua0<T>(ExecutorLua0<T>(this->functionPointer));
-    }
-  private:
-    void          (T::*functionPointer)();
-};
-
-
-
-///////////
-//// 1 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename type0> class ExecutorLua1 : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua1(void(T::*function)(type0))
-  : Executor(ExecutorParamType<type0>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 0;
-
-      (dynamic_cast<T*>(object)->*(functionPointer))(fromLua<type0>(state, 1));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua1<T, type0>((this->functionPointer));
-    }
-  private:
-    void          (T::*functionPointer)(type0);
-};
-
-
-
-///////////
-//// 2 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename type0, typename type1> class ExecutorLua2 : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua2(void(T::*function)(type0, type1))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 0;
-
-      (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-      fromLua<type1>(state, 2) );
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua2<T, type0, type1>(this->functionPointer);
-    }
-  private:
-    void          (T::*functionPointer)(type0, type1);
-};
-
-
-///////////
-//// 3 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename type0, typename type1, typename type2> class ExecutorLua3 : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua3(void(T::*function)(type0, type1, type2))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 0;
-
-      (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-      fromLua<type1>(state, 2),
-      fromLua<type2>(state, 3) );
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua3<T, type0, type1, type2>(this->functionPointer);
-    }
-  private:
-    void          (T::*functionPointer)(type0, type1, type2);
-};
-
-
-///////////
-//// 4 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4 : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua4(void(T::*function)(type0, type1, type2, type3))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 0;
-
-      (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-      fromLua<type1>(state, 2),
-      fromLua<type2>(state, 3),
-      fromLua<type3>(state, 4) );
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua4<T, type0, type1, type2, type3>(this->functionPointer);
-    }
-  private:
-    void          (T::*functionPointer)(type0, type1, type2, type3);
-};
-
-
-
-
-////////////////////
-///// WITH RET /////
-////////////////////
-
-
-///////////
-//// 0 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret> class ExecutorLua0ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua0ret(ret (T::*function)())
-  : Executor()
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-    
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))());
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua0ret<T, ret>(this->functionPointer);
-    }
-  private:
-    ret           (T::*functionPointer)();
-};
-
-
-
-///////////
-//// 1 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0> class ExecutorLua1ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua1ret(ret (T::*function)(type0))
-  : Executor(ExecutorParamType<type0>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1)));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua1ret<T, ret, type0>(this->functionPointer);
-    }
-  private:
-    ret           (T::*functionPointer)(type0);
-};
-
-///////////
-//// 2 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1> class ExecutorLua2ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua2ret(ret (T::*function)(type0, type1))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2) ));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua2ret<T, ret, type0, type1>(this->functionPointer);
-    }
-  private:
-    ret           (T::*functionPointer)(type0, type1);
-};
-
-
-///////////
-//// 3 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1, typename type2> class ExecutorLua3ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua3ret(ret (T::*function)(type0, type1, type2))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2),
-          fromLua<type2>(state, 3) ));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua3ret<T, ret, type0, type1, type2>(this->functionPointer);
-    }
-  private:
-    ret          (T::*functionPointer)(type0, type1, type2);
-};
-
-
-///////////
-//// 4 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua4ret(ret (T::*function)(type0, type1, type2, type3))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2),
-          fromLua<type2>(state, 3),
-          fromLua<type3>(state, 4) ));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua4ret<T, ret, type0, type1, type2, type3>(this->functionPointer);
-    }
-  private:
-    ret          (T::*functionPointer)(type0, type1, type2, type3);
-};
-
-///////////
-//// 5 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4> class ExecutorLua5ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua5ret(ret (T::*function)(type0, type1, type2, type3, type4))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2),
-          fromLua<type2>(state, 3),
-          fromLua<type3>(state, 4),
-          fromLua<type4>(state, 5) ));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua5ret<T, ret, type0, type1, type2, type3, type4>(this->functionPointer);
-    }
-  private:
-    ret          (T::*functionPointer)(type0, type1, type2, type3, type4);
-};
-
-///////////
-//// 6 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4, typename type5> class ExecutorLua6ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua6ret(ret (T::*function)(type0, type1, type2, type3, type4, type5))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(),
-             ExecutorParamType<type2>(), ExecutorParamType<type3>(),
-             ExecutorParamType<type4>(), ExecutorParamType<type5>())
-             {
-               this->functionPointer = function;
-               this->functorType = Executor_Objective | Executor_NoLoadString;
-             }
-
-    /**
-              * @brief executes the Command on BaseObject
-              * @param object the BaseObject to execute this Executor on
-              * @param loadString ignored in this case
-     */
-             virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-             {
-               PRINTF(1)("no usefull executor\n");
-             }
-
-             virtual void operator()(BaseObject* object, int& count, void* values) const
-             {
-               lua_State* state = (lua_State*)values;
-               count = 1;
-
-               toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-                   fromLua<type0>(state, 1),
-                   fromLua<type1>(state, 2),
-                   fromLua<type2>(state, 3),
-                   fromLua<type3>(state, 4),
-                   fromLua<type4>(state, 5),
-                   fromLua<type5>(state, 6) ));
-             }
-
-    /**
-              * @returns a _new_ Copy of this Executor
-     */
-             virtual Executor* clone () const
-             {
-               return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer);
-             }
-  private:
-    ret           (T::*functionPointer)(type0, type1, type2, type3, type4, type5);
-};
-
-///////////
-//// 7 ////
-///////////
-//! Executes a Function with a lua_State* parameter.
-template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4, typename type5, typename type6> class ExecutorLua7ret : public Executor
-{
-  public:
-    /**
-   * @brief Constructor of a ExecutorXML
-   * @param function a Function to call
-     */
-    ExecutorLua7ret(ret (T::*function)(type0, type1, type2, type3, type4, type5, type6))
-  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(),
-             ExecutorParamType<type2>(), ExecutorParamType<type3>(),
-             ExecutorParamType<type4>(), ExecutorParamType<type5>(),
-             ExecutorParamType<type6>())
-             {
-               this->functionPointer = function;
-               this->functorType = Executor_Objective | Executor_NoLoadString;
-             }
-
-    /**
-              * @brief executes the Command on BaseObject
-              * @param object the BaseObject to execute this Executor on
-              * @param loadString ignored in this case
-     */
-             virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-             {
-               PRINTF(1)("no usefull executor\n");
-             }
-
-             virtual void operator()(BaseObject* object, int& count, void* values) const
-             {
-               lua_State* state = (lua_State*)values;
-               count = 1;
-
-               toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-                   fromLua<type0>(state, 1),
-                   fromLua<type1>(state, 2),
-                   fromLua<type2>(state, 3),
-                   fromLua<type3>(state, 4),
-                   fromLua<type4>(state, 5),
-                   fromLua<type5>(state, 6),
-                   fromLua<type6>(state, 7) ));
-             }
-
-    /**
-              * @returns a _new_ Copy of this Executor
-     */
-             virtual Executor* clone () const
-             {
-               return new ExecutorLua7ret<T, ret, type0, type1, type2, type3, type4, type5, type6>(this->functionPointer);
-             }
-  private:
-    ret           (T::*functionPointer)(type0, type1, type2, type3, type4, type5, type6);
-};
-
-
-#endif /* _EXECUTOR_LUA_H */
Index: trunk/src/lib/util/executor/executor_member.h
===================================================================
--- trunk/src/lib/util/executor/executor_member.h	(revision 9869)
+++ trunk/src/lib/util/executor/executor_member.h	(revision 9869)
@@ -0,0 +1,47 @@
+/*!
+ * @file executor_member.h
+ * Definition of an Executor to Member Functions
+ */
+/*
+   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: ...
+*/
+
+
+#ifndef __EXECUTOR_MEMBER_H_
+#define __EXECUTOR_MEMBER_H_
+
+/// Define all Constructs, that define an Executor.
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST
+//! The Execution-mode (either static or objective)
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC      dynamic_cast<T*>(object)->*(functionPointer)
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionMember
+
+
+/// We want to include __EXECUTOR_GENERIC_H again, with current settings.
+#include "executor_generic.h"
+
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+#endif /* __EXECUTOR_MEMBER_H_ */
Index: trunk/src/lib/util/executor/executor_static.h
===================================================================
--- trunk/src/lib/util/executor/executor_static.h	(revision 9869)
+++ trunk/src/lib/util/executor/executor_static.h	(revision 9869)
@@ -0,0 +1,49 @@
+/*!
+ * @file executor_static.h
+ * Definition of an Executor to Static Functions (either Static-Class or C-Style)
+ */
+/*
+   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: ...
+*/
+
+
+#ifndef __EXECUTOR_STATIC_H_
+#define __EXECUTOR_STATIC_H_
+
+/// Define all Constructs, that define an Executor.
+
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext##_static
+
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST
+//! The Execution-mode (either static or objective)
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC      functionPointer
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   *functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionStatic
+
+
+/// We want to include __EXECUTOR_GENERIC_H again, with current settings.
+#include "executor_generic.h"
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+#endif /* __EXECUTOR_STATIC_H_ */
Index: trunk/src/lib/util/executor/executor_substring.cc
===================================================================
--- trunk/src/lib/util/executor/executor_substring.cc	(revision 9869)
+++ trunk/src/lib/util/executor/executor_substring.cc	(revision 9869)
@@ -0,0 +1,142 @@
+/*
+   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 "executor_substring.h"
+#include "helper_functions.h"
+
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> bool fromString<bool>(const std::string& input, bool defaultValue) { return isBool(input, defaultValue); };
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> int fromString<int>(const std::string& input, int defaultValue) { return isInt(input, defaultValue); };
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue) { return isInt(input, defaultValue); };
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> float fromString<float>(const std::string& input, float defaultValue) { return isFloat(input, defaultValue); };
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> char fromString<char>(const std::string& input, char defaultValue) { return isInt(input, defaultValue); };
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue) { return (input.size() > 0) ? input : defaultValue; };
+
+
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> bool fromMulti<bool>(const MultiType& multi) { return multi.getBool(); };
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> int fromMulti<int>(const MultiType& multi) { return multi.getInt(); }
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> unsigned int fromMulti<unsigned int>(const MultiType& multi) { return multi.getInt(); };
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> float fromMulti<float>(const MultiType& multi) { return multi.getFloat(); };
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> char fromMulti<char>(const MultiType& multi) { return multi.getChar(); };
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<> const std::string& fromMulti<const std::string&>(const MultiType& multi) { return multi.getConstString(); };
+
+
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getBool(); };
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getInt(); };
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getInt(); };
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getFloat(); };
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getChar(); };
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getStoredString(); };
Index: trunk/src/lib/util/executor/executor_substring.h
===================================================================
--- trunk/src/lib/util/executor/executor_substring.h	(revision 9869)
+++ trunk/src/lib/util/executor/executor_substring.h	(revision 9869)
@@ -0,0 +1,100 @@
+/*!
+ * @file executor_substring.h
+ * Definition of a Generic Executor
+ */
+
+/*
+   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: ...
+*/
+
+
+
+#ifndef __EXECUTOR_SUBSTRING_H_
+#define __EXECUTOR_SUBSTRING_H_
+
+
+#include "executor_generic.h"
+#include "substring.h"
+#ifdef FUNCTOR_CALL_TYPE
+ #undef FUNCTOR_CALL_TYPE
+#endif
+//! Use SubString as the FUNCTION_CALL_TYPE so that we can easily extend the Engine.
+#define FUNCTOR_CALL_TYPE const SubString
+
+/**
+ * @brief converts an input string into a value, if no value was converted, uses defaultValue.
+ * @param input the input as a String.
+ * @param defaultValue the Default Value set, if the input could not be converted into type.
+ * @returns either the converted value or defaultValue.
+ */
+template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; };
+template<> bool fromString<bool>(const std::string& input, bool defaultValue);
+template<> int fromString<int>(const std::string& input, int defaultValue);
+template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue);
+template<> float fromString<float>(const std::string& input, float defaultValue);
+template<> char fromString<char>(const std::string& input, char defaultValue);
+template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue);
+
+/**
+ * @brief converts to any type from a MultiType
+ * @param multi the MultiType to convert.
+ * @returns the converted Value.
+ */
+template<typename type> type fromMulti(const MultiType& multi) { /* return defaultValue; */ };
+template<> bool fromMulti<bool>(const MultiType& multi);
+template<> int fromMulti<int>(const MultiType& multi);
+template<> unsigned int fromMulti<unsigned int>(const MultiType& multi);
+template<> float fromMulti<float>(const MultiType& multi);
+template<> char fromMulti<char>(const MultiType& multi);
+template<> const std::string& fromMulti<const std::string&>(const MultiType& multi);
+
+/**
+ * @brief retrieves a default value from an array of default values, at possition i.
+ * @param defaultValues the Array of default values.
+ * @param i the index.
+ * @returns the Default Value at Position i
+ */
+template<typename type> type getDefault(const MultiType* const defaultValues, unsigned int i) { return (type)0; };
+template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i);
+template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i);
+template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i);
+template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i);
+template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i);
+template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i);
+
+
+/**
+ * @brief to remove writing errors, this function is Used.
+ * @param sub The SubString to use
+ * @param default The default Values.
+ */
+template<> class ExecutorEvaluater <const SubString>
+{
+public:
+  /** @brief Executes the Evaluater
+   * @param CallValue the Value that should be converted
+   * @param defaults the default Values.
+   */
+  template <typename ToType, int index>
+  static ToType getValue(const SubString& CallValue, const MultiType* const defaults)
+  {
+    return (CallValue.size() > index) ?
+           fromString<ToType>(CallValue[index], getDefault<ToType>(defaults, index)) :
+           fromMulti<ToType>(defaults[index]);
+  }
+  /** @returns the default Value of a SubString, namely NullSubString or SubString() */
+  static const SubString& defaultValue() { return SubString::NullSubString; };
+};
+
+#endif /* __EXECUTOR_SUBSTRING_H_ */
Index: trunk/src/lib/util/executor/executor_xml.h
===================================================================
--- trunk/src/lib/util/executor/executor_xml.h	(revision 9682)
+++ trunk/src/lib/util/executor/executor_xml.h	(revision 9869)
@@ -19,66 +19,52 @@
  * What must be defined is a XML-root to search the ParameterName under an  a Function to call.
  */
-template<class T> class ExecutorXML : public Executor
+template<class T, class BaseClass = BaseObject> class ExecutorXML : public Executor<const TiXmlElement*>
 {
-  public:
-    /**
+public:
+  /**
    * @brief Constructor of a ExecutorXML
-     * @param function a Function to call
-     * @param root The XML root to search paramName under
-     * @param paramName the ParameterName the search in root, and lookup the TiXmlElement from
-     */
-    ExecutorXML(void(T::*function)(const TiXmlElement*), const TiXmlElement* root, const char* paramName)
-      : Executor(MT_EXT1)
-    {
-      PRINTF(4)("Loading %s from XML-element %p\n", paramName, root);
+   * @param function a Function to call
+   * @param root The XML root to search paramName under
+   * @param paramName the ParameterName the search in root, and lookup the TiXmlElement from
+   */
+  ExecutorXML(void(T::*function)(const TiXmlElement*), const TiXmlElement* root, const std::string& paramName)
+      : Executor<const TiXmlElement*>(false, MT_EXT1)
+  {
+    PRINTF(4)("Loading %s from XML-element %p\n", paramName.c_str(), root);
 
-      if (likely(root != NULL && paramName != NULL))
-        this->element = root->FirstChildElement(paramName);
-      else
-        this->element = NULL;
+    if (likely(root != NULL))
+      this->element = root->FirstChildElement(paramName);
+    else
+      this->element = NULL;
 
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
+    this->paramName = paramName;
+    this->functionPointer = function;
+  }
 
-    /**
-     * @brief clones an ExecutorXML, used to copy this Element.
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      ExecutorXML<T>* executor = new ExecutorXML<T>();
-      this->cloning(executor);
-      executor->functionPointer = this->functionPointer;
-      executor->element = this->element;
-      return executor;
-    }
+  /**
+   * @brief clones an ExecutorXML, used to copy this Element.
+   * @returns a _new_ Copy of this Executor
+   */
+  virtual Executor<const TiXmlElement*>* clone () const
+  {
+    return new ExecutorXML<T>(functionPointer, element, paramName);
+  }
 
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      if (object != NULL && this->element != NULL)
-        (dynamic_cast<T*>(object)->*(functionPointer))(this->element);
-    }
+  /**
+   * @brief executes the Command on BaseObject
+   * @param object the BaseObject to execute this Executor on
+   * @param element ignored in this case
+   */
+  virtual void operator()(BaseObject* object, const TiXmlElement*& element) const
+  {
+    assert (object != NULL);
+    if (this->element != NULL)
+      (dynamic_cast<T*>(object)->*(functionPointer))(this->element);
+  }
 
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      PRINTF(1)("missuse of XML-operator, OR IMPLEMENT.\n");
-    }
-
-  private:
-    /**
-   * @brief used for the copy-(Clone)-constructor
-     */
-    ExecutorXML() : Executor() { };
-
-
-  private:
-    void    (T::*functionPointer)(const TiXmlElement*);  //!< The functionPointer to the function to be called
-    const   TiXmlElement* element;                       //!< The XML-element to call.
+private:
+  void    (T::*functionPointer)(const TiXmlElement*);  //!< The functionPointer to the function to be called.
+  const   TiXmlElement* element;                       //!< The XML-element to call.
+  std::string           paramName;                     //!< The Name of the Parameter this Executor should call.
 };
 
Index: trunk/src/lib/util/executor/functor_const_member.h
===================================================================
--- trunk/src/lib/util/executor/functor_const_member.h	(revision 9869)
+++ trunk/src/lib/util/executor/functor_const_member.h	(revision 9869)
@@ -0,0 +1,47 @@
+/*!
+ * @file functor_const_member.h
+ * Definition of an Functor
+ */
+
+/*
+   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: ...
+*/
+
+
+#ifndef __FUNCTOR_CONST_MEMBER_H_
+#define __FUNCTOR_CONST_MEMBER_H_
+
+#include "executor_const_member.h"
+
+/// Define all Constructs, that define an Executor.
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext##_const
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST              const
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionMember
+
+/// Now we include The generic Functor, that generate the functions.
+#include "functor_generic.h"
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+
+
+#endif /* __FUNCTOR_CONST_MEMBER_H_ */
Index: trunk/src/lib/util/executor/functor_generic.h
===================================================================
--- trunk/src/lib/util/executor/functor_generic.h	(revision 9869)
+++ trunk/src/lib/util/executor/functor_generic.h	(revision 9869)
@@ -0,0 +1,105 @@
+/*!
+ * @file functor_generic.h
+ * Definition of an Executor
+ */
+
+/*
+   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: ...
+*/
+
+// // // // // // // // // // // // //
+//// EXTENSION TO HIDE CONSTRUCT /////
+// // // // // // // // // // // // //
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR0(CallType) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+  return new __EXECUTOR_FUNCTIONAL_NAME(0,)<T, CallType, BaseClass>(functionPointer); \
+}
+
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ * @param type0 for internal usage: the first Argument
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR1(CallType, type0) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+  return new __EXECUTOR_FUNCTIONAL_NAME(1,)<T, CallType, type0, BaseClass>(functionPointer); \
+}
+
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ * @param type0 for internal usage: the first Argument
+ * @param type1 for internal usage: the second Argument
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR2(CallType, type0, type1) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+  return new __EXECUTOR_FUNCTIONAL_NAME(2,)<T, CallType, type0, type1, BaseClass>(functionPointer); \
+}
+
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ * @param type0 for internal usage: the first Argument
+ * @param type1 for internal usage: the second Argument
+ * @param type2 for internal usage: the third Argument
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR3(CallType, type0, type1, type2) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+  return new __EXECUTOR_FUNCTIONAL_NAME(3,)<T, CallType, type0, type1, type2, BaseClass>(functionPointer); \
+}
+
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ * @param type0 for internal usage: the first Argument
+ * @param type1 for internal usage: the second Argument
+ * @param type2 for internal usage: the third Argument
+ * @param type3 for internal usage: the fourth Argument
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR4(CallType, type0, type1, type2, type3) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+  return new __EXECUTOR_FUNCTIONAL_NAME(4,)<T, CallType, type0, type1, type2, type3, BaseClass>(functionPointer); \
+}
+
+/**
+ * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
+ * @param CallType the Type of Executor to generate
+ * @param type0 for internal usage: the first Argument
+ * @param type1 for internal usage: the second Argument
+ * @param type2 for internal usage: the third Argument
+ * @param type3 for internal usage: the fourth Argument
+ * @param type4 for internal usage: the fifth Argument
+ */
+#define EXECUTOR_FUNCTIONAL_CREATOR5(CallType, type0, type1, type2, type3, type4) \
+template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) \
+{ \
+    return new __EXECUTOR_FUNCTIONAL_NAME(5,)<T, CallType, type0, type1, type2, type3, type4, BaseClass>(functionPointer); \
+}
+
+/**
+ * Creates the FunctionCallers imediately
+ */
+#define FUNCTOR_LIST(x) EXECUTOR_FUNCTIONAL_CREATOR ## x
+#include "functor_list.h"
+#undef FUNCTOR_LIST
+
Index: trunk/src/lib/util/executor/functor_list.h
===================================================================
--- trunk/src/lib/util/executor/functor_list.h	(revision 9682)
+++ trunk/src/lib/util/executor/functor_list.h	(revision 9869)
@@ -1,2 +1,7 @@
+/*!
+ * @file functor_list.h
+ * all the Different types of Functions one can include by using a simple createExecutor call
+ * with a FunctionPointer as Argument
+ */
 /*
    orxonox - the future of 3D-vertical-scrollers
@@ -8,142 +13,65 @@
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
-   */
-
-/*!
- * @file functors_list.h
- * all the Different types of Functions one can include
 */
-
-/**
-   useable FunctionParameters are:
-   l_INT:       int
-   l_LONG:      long
-   l_SHORT:     short
-   l_FLOAT:     float
-   l_STRING:    const std::string&
-   l_XML_ELEM:  TiXmlElement*
- */
-
-#ifndef __FUNCTOR_PARAMETERS__
-#define __FUNCTOR_PARAMETERS__
-
-//! defines the maximum count of arguments function pointers might have
-#define FUNCTOR_MAX_ARGUMENTS                7
-#include "multi_type.h"
-
-
-#define l_BOOL_TYPE        bool                 //!< The type of an BOOL
-#define l_BOOL_FUNC        isBool               //!< The function to call to parse BOOL
-#define l_BOOL_PARAM       MT_BOOL              //!< the type of the parameter BOOL
-#define l_BOOL_DEFAULT     false                //!< a default Value for an BOOL
-#define l_BOOL_DEFGRAB(i)  this->defaultValue[i].getBool()
-
-#define l_INT_TYPE         int                  //!< The type of an INT
-#define l_INT_FUNC         isInt                //!< The function to call to parse INT
-#define l_INT_PARAM        MT_INT               //!< the type of the parameter INT
-#define l_INT_DEFAULT      0                    //!< a default Value for an INT
-#define l_INT_DEFGRAB(i)   this->defaultValue[i].getInt()
-
-#define l_UINT_TYPE        unsigned int         //!< The type of an UINT
-#define l_UINT_FUNC        isInt                //!< The function to call to parse UINT
-#define l_UINT_PARAM       MT_INT        //!< the type of the parameter UINT
-#define l_UINT_DEFAULT     0                    //!< a default Value for an UINT
-#define l_UINT_DEFGRAB(i)  (unsigned int)this->defaultValue[i].getInt()
-
-#define l_LONG_TYPE        long                 //!< The type of a LONG
-#define l_LONG_FUNC        isInt                //!< The function to parse a LONG
-#define l_LONG_PARAM       MT_INT //!< the type of the parameter LONG
-#define l_LONG_DEFAULT     0                    //!< a default Value for a LONG
-#define l_LONG_DEFGRAB(i)  (long)this->defaultValue[i].getInt()
-
-// #define l_SHORT_TYPE       short                //!< The type of a SHORT
-// #define l_SHORT_FUNC       atoi                 //!< The function to parse a SHORT
-// #define l_SHORT_NAME       "short"              //!< The name of a SHORT
-// #define l_SHORT_PARAM      ParameterShort       //!< the type of the parameter SHORT
-// #define l_SHORT_DEFAULT    0                    //!< a default Value for a SHORT
-
-#define l_FLOAT_TYPE       float                //!< The type of a FLOAT
-#define l_FLOAT_FUNC       isFloat              //!< The function to parse a FLOAT
-#define l_FLOAT_PARAM      MT_FLOAT             //!< the type of the parameter FLOAT
-#define l_FLOAT_DEFAULT    0.0                  //!< a default Value for a FLOAT
-#define l_FLOAT_DEFGRAB(i) this->defaultValue[i].getFloat()
-
-//#define l_VECTOR_TYPE      const Vector&        //!< The type of a VECTOR
-//#define l_VECTOR_FUNC      isVector             //!< The function to parse a VECTOR
-//#define l_VECTOR_NAME      "Vector[x/y/z]"      //!< The name of a VECTOR
-//#define l_VECTOR_DEFAULT   Vector(0,0,0)        //!< Default value for a VECTOR
-
-#define l_STRING_TYPE      const std::string&   //!< The type of a STRING
-#define l_STRING_FUNC      isString             //!< The function to parse a STRING
-#define l_STRING_PARAM     MT_STRING            //!< the type of the parameter STRING
-#define l_STRING_DEFAULT   ""                   //!< a default Value for an STRING
-#define l_STRING_DEFGRAB(i) this->defaultValue[i].getString()
-
-#define l_XML_ELEM_TYPE    const TiXmlElement*  //!< The type of an XML_ELEM
-#define l_XML_ELEM_FUNC                         //!< The function to parse an XML_ELEM
-//#define l_XML_ELEM_PARAM   Parameter            //!< the type of the parameter XML_ELEM
-#define l_XML_ELEM_DEFAULT NULL                 //!< The dafault Value for an XML_ELEM
-
-#endif /* __FUNCTOR_PARAMETERS__ */
 
 
 #ifdef FUNCTOR_LIST
-
-  FUNCTOR_LIST(0)();
+  FUNCTOR_LIST(0)(FUNCTOR_CALL_TYPE);
   //! makes functions with one string
-  FUNCTOR_LIST(1)(l_STRING);
+  FUNCTOR_LIST(1)(FUNCTOR_CALL_TYPE, const std::string&);
   //! makes functions with two strings
-  FUNCTOR_LIST(2)(l_STRING, l_STRING);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, const std::string&, const std::string&);
   //! makes functions with three strings
-  FUNCTOR_LIST(3)(l_STRING, l_STRING, l_STRING);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, const std::string&, const std::string&, const std::string&);
   //! makes functions with four strings
-  FUNCTOR_LIST(4)(l_STRING, l_STRING, l_STRING, l_STRING);
+  FUNCTOR_LIST(4)(FUNCTOR_CALL_TYPE, const std::string&, const std::string&, const std::string&, const std::string&);
 
 
   //! makes functions with one bool
-  FUNCTOR_LIST(1)(l_BOOL);
+  FUNCTOR_LIST(1)(FUNCTOR_CALL_TYPE, bool);
 
   //! makes functions with one int
-  FUNCTOR_LIST(1)(l_INT);
+  FUNCTOR_LIST(1)(FUNCTOR_CALL_TYPE, int);
   //! makes functions with two ints
-  FUNCTOR_LIST(2)(l_INT, l_INT);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, int, int);
   //! makes functions with three ints
-  FUNCTOR_LIST(3)(l_INT, l_INT, l_INT);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, int, int, int);
   //! makes functions with four ints
-  FUNCTOR_LIST(4)(l_INT, l_INT, l_INT, l_INT);
+  FUNCTOR_LIST(4)(FUNCTOR_CALL_TYPE, int, int, int, int);
 
 
   //! makes functions with one unsigned int
-  FUNCTOR_LIST(1)(l_UINT);
+  FUNCTOR_LIST(1)(FUNCTOR_CALL_TYPE, unsigned int);
   //! makes functions with two unsigned ints
-  FUNCTOR_LIST(2)(l_UINT, l_UINT);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, unsigned int, unsigned int);
   //! makes functions with three unsigned ints
-  FUNCTOR_LIST(3)(l_UINT, l_UINT, l_UINT);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, unsigned int, unsigned int, unsigned int);
   //! makes functions with four unsigned ints
-  FUNCTOR_LIST(4)(l_UINT, l_UINT, l_UINT, l_UINT);
+  FUNCTOR_LIST(4)(FUNCTOR_CALL_TYPE, unsigned int, unsigned int, unsigned int, unsigned int);
 
   //! makes functions with one float
-  FUNCTOR_LIST(1)(l_FLOAT);
+  FUNCTOR_LIST(1)(FUNCTOR_CALL_TYPE, float);
   //! makes functions with two floats
-  FUNCTOR_LIST(2)(l_FLOAT, l_FLOAT);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, float, float);
   //! makes functions with three floats
-  FUNCTOR_LIST(3)(l_FLOAT, l_FLOAT, l_FLOAT);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, float, float, float);
   //! makes functions with four floats
-  FUNCTOR_LIST(4)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);
+  FUNCTOR_LIST(4)(FUNCTOR_CALL_TYPE, float, float, float, float);
   //! makes functions with four floats
-  FUNCTOR_LIST(5)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);
+  FUNCTOR_LIST(5)(FUNCTOR_CALL_TYPE, float, float, float, float, float);
 
   //! mixed values:
-  FUNCTOR_LIST(2)(l_STRING, l_INT);
-  FUNCTOR_LIST(2)(l_STRING, l_FLOAT);
-  FUNCTOR_LIST(2)(l_UINT, l_LONG);
-  FUNCTOR_LIST(2)(l_STRING, l_UINT);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, const std::string&, bool);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, const std::string&, int);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, const std::string&, float);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, unsigned int, long);
+  FUNCTOR_LIST(2)(FUNCTOR_CALL_TYPE, const std::string&, unsigned int);
 
-  FUNCTOR_LIST(3)(l_STRING, l_FLOAT, l_UINT);
-  FUNCTOR_LIST(4)(l_STRING, l_FLOAT, l_UINT, l_UINT);
-  FUNCTOR_LIST(3)(l_STRING, l_INT, l_UINT);
-  FUNCTOR_LIST(3)(l_STRING, l_UINT, l_UINT);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, const std::string&, float, unsigned int);
+  FUNCTOR_LIST(4)(FUNCTOR_CALL_TYPE, const std::string&, float, unsigned int, unsigned int);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, const std::string&, int, unsigned int);
+  FUNCTOR_LIST(3)(FUNCTOR_CALL_TYPE, const std::string&, unsigned int, unsigned int);
 
-  FUNCTOR_LIST(5)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_STRING);
+  FUNCTOR_LIST(5)(FUNCTOR_CALL_TYPE, float, float, float, float, const std::string&);
 
 #endif /* FUNCTOR_LIST */
Index: trunk/src/lib/util/executor/functor_member.h
===================================================================
--- trunk/src/lib/util/executor/functor_member.h	(revision 9869)
+++ trunk/src/lib/util/executor/functor_member.h	(revision 9869)
@@ -0,0 +1,49 @@
+/*!
+ * @file functor_member.h
+ * Definition of an Functor
+ */
+
+/*
+   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: ...
+*/
+
+
+#ifndef __FUNCTOR_MEMBER_H_
+#define __FUNCTOR_MEMBER_H_
+
+#include "executor_member.h"
+
+/// Define all Constructs, that define an Executor.
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionMember
+
+
+/// Now we include The generic Functor, that generate the functions.
+#include "functor_generic.h"
+
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+
+
+#endif /* __FUNCTOR_MEMBER_H_ */
Index: trunk/src/lib/util/executor/functor_static.h
===================================================================
--- trunk/src/lib/util/executor/functor_static.h	(revision 9869)
+++ trunk/src/lib/util/executor/functor_static.h	(revision 9869)
@@ -0,0 +1,48 @@
+/*!
+ * @file functor_static.h
+ * Definition of Functors to Functions of Static Type
+ */
+
+/*
+   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: ...
+*/
+
+
+#ifndef __FUNCTOR_STATIC_H_
+#define __FUNCTOR_STATIC_H_
+
+#include "executor_static.h"
+
+/// Define all Constructs, that define an Executor.
+//! The Name to be attached to the functional (for normal, static, and const modes)
+#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount, Ext)   Executor##ParamCount##Ext##_static
+//! if Functional is constant calling
+#define __EXECUTOR_FUNCTIONAL_CONST
+//! The Function-Pointer, and how to save it internally.
+#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   *functionPointer
+//! The Type of Function
+#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionStatic
+
+/// Now we include The generic Functor, that generate the functions.
+#include "functor_generic.h"
+
+
+#undef __EXECUTOR_FUNCTIONAL_NAME
+#undef __EXECUTOR_FUNCTIONAL_CONST
+#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
+#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
+
+
+
+#endif /* __FUNCTOR_STATIC_H_ */
Index: trunk/src/lib/util/filesys/directory.cc
===================================================================
--- trunk/src/lib/util/filesys/directory.cc	(revision 9682)
+++ trunk/src/lib/util/filesys/directory.cc	(revision 9869)
@@ -41,7 +41,9 @@
 #include <sys/stat.h>
 #include <dirent.h>
+const char Directory::delimiter = '/';
 #else
 #include <windows.h>
 #include <winbase.h>
+const char Direcotry::delimiter = '\\';
 #endif
 
@@ -63,5 +65,5 @@
  */
 Directory::Directory(const Directory& directory)
-  : File(directory)
+    : File(directory)
 {
   this->_opened = directory._opened;
@@ -166,2 +168,51 @@
 #endif
 }
+
+
+Directory Directory::operator+(const Directory& dir) const
+{
+  return Directory(*this) += dir;
+}
+
+/**
+ * @param dir the Directory to append to this one (say this one is "/var", then dir can be "log")
+ * @returns The Directory appended by dir.
+ *
+ * @note the Directoy will again be closed even if it was opened previously!
+ */
+Directory& Directory::operator+=(const Directory& dir)
+{
+  this->setFileName(this->name() + Directory::delimiter + dir.name());
+  return *this;
+}
+
+/**
+ * @brief Traverses the Directory tree one step up. (Parent Directory)
+ * @returns a Reference to the Directory.
+ */
+Directory& Directory::operator--()
+{
+}
+
+
+/**
+ * @brief Traverses the Directory tree one step up. (Parent Directory)
+ * @param int the PostFix iterator
+ * @returns a Reference to the Directory.
+ */
+Directory& Directory::operator--(int)
+{
+}
+
+/**
+ * @returns The Parent Directory.
+ */
+Directory Directory::parentDir() const
+{
+
+}
+
+File operator+(const Directory& dir, const File& file)
+{
+  return File(dir.name() + Directory::delimiter + file.name());
+}
Index: trunk/src/lib/util/filesys/directory.h
===================================================================
--- trunk/src/lib/util/filesys/directory.h	(revision 9682)
+++ trunk/src/lib/util/filesys/directory.h	(revision 9869)
@@ -29,4 +29,12 @@
 #include <vector>
 
+//! A Directory is a Special file, that contains multiple Files.
+/**
+ * @example Correct usage
+ * Directory dir("/var/log");
+ * dir.open();
+ * if (dir.fileNameInDir("emerge.log"))
+ *  { // do stuff; }
+ */
 class Directory : public File
 {
@@ -41,4 +49,11 @@
   bool create();
 
+  Directory operator+(const Directory& dir) const;
+  Directory& operator+=(const Directory& dir);
+  Directory& operator--();
+  Directory& operator--(int);
+  Directory parentDir() const;
+
+
   /** @returns if the Directory was opened */
   bool isOpen() const { return this->_opened; }
@@ -50,7 +65,10 @@
   const std::string& operator[](unsigned int fileNumber) const { return this->_fileNames[fileNumber]; };
   /** @returns a formated string containing the FileName, prepended with the directory-Name */
-  std::string fileNameInDir(unsigned int fileNumber) const { return this->name() + "/" + _fileNames[fileNumber]; };
+  std::string fileNameInDir(unsigned int fileNumber) const { return this->name() + Directory::delimiter + _fileNames[fileNumber]; };
   /** @returns a File pointing to the File @param fileNumber the fileNumber (must not bigger than fileCount()) */
   File getFile(unsigned int fileNumber) const { return File(fileNameInDir(fileNumber)); };
+
+public:
+  static const char           delimiter;        //!< A Delimiter (*nix: '/', windows: '\\')
 
 private:
@@ -58,4 +76,6 @@
   std::vector<std::string>    _fileNames;       //!< The List of Files contained in the directory. (will be filled when open was called.)
 };
+
+File operator+(const Directory& dir, const File& file);
 
 #endif /* __DIRECTORY_H_ */
Index: trunk/src/lib/util/filesys/file.cc
===================================================================
--- trunk/src/lib/util/filesys/file.cc	(revision 9682)
+++ trunk/src/lib/util/filesys/file.cc	(revision 9869)
@@ -326,4 +326,8 @@
 }
 
+/**
+ * @brief converts an Absolute Filename to a Relative one
+ * @param absFileName the FileName to convert. The Relative path will be stored in absFileName.
+ */
 void File::absToRel(std::string& absFileName)
 {
Index: trunk/src/lib/util/loading/dynamic_loader.cc
===================================================================
--- trunk/src/lib/util/loading/dynamic_loader.cc	(revision 9682)
+++ trunk/src/lib/util/loading/dynamic_loader.cc	(revision 9869)
@@ -24,5 +24,5 @@
 
 
-
+ObjectListDefinition(DynamicLoader);
 
 /**
@@ -31,7 +31,7 @@
 */
 DynamicLoader::DynamicLoader (const std::string& libName)
-    : Factory(NULL, CL_NULL)
+    : Factory(libName)
 {
-  this->setClassID(CL_DYNAMIC_LOADER, "DynamicLoader");
+  this->registerObject(this, DynamicLoader::_objectList);
 
   this->handle = NULL;
Index: trunk/src/lib/util/loading/dynamic_loader.h
===================================================================
--- trunk/src/lib/util/loading/dynamic_loader.h	(revision 9682)
+++ trunk/src/lib/util/loading/dynamic_loader.h	(revision 9869)
@@ -19,4 +19,5 @@
 class DynamicLoader : public Factory
 {
+  ObjectListDeclaration(DynamicLoader);
 
 public:
Index: trunk/src/lib/util/loading/factory.cc
===================================================================
--- trunk/src/lib/util/loading/factory.cc	(revision 9682)
+++ trunk/src/lib/util/loading/factory.cc	(revision 9869)
@@ -15,9 +15,9 @@
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
 
-#include "util/loading/factory.h"
+#include "factory.h"
 #include "debug.h"
 //#include "shell_command.h"
 
-
+ObjectListDefinition(Factory);
 
 //SHELL_COMMAND(create, Factory, fabricate);
@@ -28,18 +28,20 @@
  * set everything to zero and define factoryName
  */
-Factory::Factory (const std::string& factoryName, ClassID classID)
-    : classID(classID), className(factoryName)
+Factory::Factory (const ClassID& classID)
+    : _classID(classID)
 {
-  this->setClassID(CL_FACTORY, "Factory");
-  this->setName(factoryName);
+  PRINTF(4)("Factory::create(%s::%d)\n", classID.name().c_str(), classID.id());
+  //this->registerObject(this, Factory::_objectList);
+  this->setName(classID.name());
 
-  if( Factory::factoryList == NULL)
-    Factory::factoryList = new std::list<Factory*>;
-
-  Factory::factoryList->push_back(this);
+  Factory::_factoryIDMap[classID] = this;
+  Factory::_factoryStringMap[classID.name()] = this;
 }
 
-/** @brief a reference to the First Factory */
-std::list<Factory*>* Factory::factoryList = NULL;
+/** @brief A Map of all Factories ordered by ID. */
+Factory::FactoryIDMap Factory::_factoryIDMap;
+
+/** @brief A Map of all Factories ordered by Name. */
+Factory::FactoryStringMap Factory::_factoryStringMap;
 
 /**
@@ -48,24 +50,11 @@
 Factory::~Factory ()
 {
-  //  printf("%s\n", this->factoryName);
-  //  Factory* tmpDel = this->next;
-  //  this->next = NULL;
-}
+  FactoryIDMap::iterator it = Factory::_factoryIDMap.find(this->_classID);
+  if (it != Factory::_factoryIDMap.end() && (*it).second == this)
+    Factory::_factoryIDMap.erase(it);
 
-/**
- * @brief 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;
-  }
+  FactoryStringMap::iterator stringIt = Factory::_factoryStringMap.find(this->_classID.name());
+  if (stringIt != Factory::_factoryStringMap.end() && (*stringIt).second == this)
+    Factory::_factoryStringMap.erase(stringIt);
 }
 
@@ -74,18 +63,9 @@
  * @returns true on match, false otherwise
  */
-bool Factory::operator==(ClassID classID) const
+bool Factory::operator==(int classID) const
 {
-  return (this->classID == classID);
+  return (this->_classID == classID);
 }
 
-/**
- * @brief 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 && this->className == className);
-}
 
 /**
@@ -96,5 +76,5 @@
 bool Factory::operator==(const std::string& className) const
 {
-  return (this->className == className);
+  return (this->_classID.name() == className);
 }
 
@@ -107,16 +87,15 @@
 BaseObject* Factory::fabricate(const TiXmlElement* root)
 {
-  assert (root != NULL && Factory::factoryList != NULL);
-
-  std::list<Factory*>::const_iterator factory;
-  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
-    if (*(*factory) == root->Value())
-    {
-      PRINTF(2)("Create a new Object of type %s\n", (*factory)->getCName());
-      return (*factory)->fabricateObject(root);
-    }
-
-  PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", root->Value());
-  return NULL;
+  FactoryStringMap::const_iterator it = Factory::_factoryStringMap.find(root->Value());
+  if (it != Factory::_factoryStringMap.end())
+  {
+    PRINTF(2)("Create a new Object of type %s\n", (*it).second->getCName());
+    return (*it).second->fabricateObject(root);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", root->Value());
+    return NULL;
+  }
 }
 
@@ -129,18 +108,16 @@
 BaseObject* Factory::fabricate(const std::string& className)
 {
-  if (Factory::factoryList == NULL)
+  FactoryStringMap::const_iterator it = Factory::_factoryStringMap.find(className);
+  if (it != Factory::_factoryStringMap.end())
+  {
+    PRINTF(2)("Create a new Object of type %s\n", (*it).second->getCName());
+    return (*it).second->fabricateObject(NULL);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", className.c_str());
     return NULL;
-
-  std::list<Factory*>::const_iterator factory;
-  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
-    if (*(*factory) == className)
-    {
-      PRINTF(4)("Create a new Object of type %s\n", (*factory)->getCName());
-      return (*factory)->fabricateObject(NULL);
-    }
-  PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", className.c_str());
-  return NULL;
+  }
 }
-
 
 /**
@@ -149,18 +126,36 @@
  * @returns a new Object of Type classID on match, NULL otherwise
  */
-BaseObject* Factory::fabricate(ClassID classID)
+BaseObject* Factory::fabricate(const ClassID& classID)
 {
-  if (Factory::factoryList == NULL)
+  FactoryIDMap::const_iterator it = Factory::_factoryIDMap.find(classID);
+  if (it != Factory::_factoryIDMap.end())
+  {
+    PRINTF(4)("Create a new Object of type %s\n", (*it).second->getCName());
+    return (*it).second->fabricateObject(NULL);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of ClassID '%d'\n", classID.id());
     return NULL;
+  }
+}
 
-  std::list<Factory*>::const_iterator factory;
-  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
-    if (*(*factory) == classID)
-    {
-      PRINTF(4)("Create a new Object of type %s\n", (*factory)->getCName());
-      return (*factory)->fabricateObject(NULL);
 
-    }
-  PRINTF(2)("Could not Fabricate an Object of ClassID '0x%h'\n", classID);
-  return NULL;
+/**
+ * @brief print out some nice litte debug information about the Factory.
+ */
+void Factory::debug() const
+{
+  PRINTF(0)("Factory of class '%s' with ClassID: %d\n", this->_classID.name().c_str(), this->_classID.id());
 }
+
+/**
+ * @brief Prints out some nice Debug information about all factories
+ */
+void Factory::debugAll()
+{
+  PRINTF(0)("Debugging all %d Factories\n", Factory::_factoryStringMap.size());
+  Factory::FactoryStringMap::const_iterator it;
+  for (it = Factory::_factoryStringMap.begin(); it != Factory::_factoryStringMap.end(); ++it)
+    (*it).second->debug();
+}
Index: trunk/src/lib/util/loading/factory.h
===================================================================
--- trunk/src/lib/util/loading/factory.h	(revision 9682)
+++ trunk/src/lib/util/loading/factory.h	(revision 9869)
@@ -20,6 +20,6 @@
 
 
-#ifndef _FACTORY_H
-#define _FACTORY_H
+#ifndef __FACTORY_H
+#define __FACTORY_H
 
 class BaseObject;
@@ -27,6 +27,5 @@
 #include "parser/tinyxml/tinyxml.h"
 #include "base_object.h"
-#include <vector>
-#include <list>
+#include <map>
 
 /**
@@ -34,32 +33,50 @@
  * 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_FACTORY(CLASS_NAME) \
+    tFactory<CLASS_NAME> global_##CLASS_NAME##_Factory = tFactory<CLASS_NAME>(CLASS_NAME::staticClassID())
 
 //! The Factory is a loadable object handler
-class Factory : public BaseObject {
-
- public:
+class Factory : public BaseObject
+{
+  //! Declare the ObjectList at the BaseObject List
+  ObjectListDeclaration(Factory);
+public:
   virtual ~Factory ();
 
-  static void deleteFactories();
+  static  BaseObject* fabricate(const std::string& className);
+  static  BaseObject* fabricate(const ClassID& classID);
+  static  BaseObject* fabricate(const TiXmlElement* root);
 
-  static  BaseObject* fabricate(const std::string& className);
-  static  BaseObject* fabricate(ClassID classID);
-  static  BaseObject* fabricate(const TiXmlElement* root = NULL);
+  bool operator==(int classID) const;
+  bool operator==(const std::string& className) const;
+  /** @param classID the ID to compare @returns true if the ID's match */
+  bool operator==(const ClassID& classID) const { return _classID == classID; };
 
 
-  bool operator==(ClassID classID) const;
-  bool operator==(const char* className) const;
-  bool operator==(const std::string& className) const;
+  void debug() const;
+  static void debugAll();
 
-  protected:
-    Factory (const std::string& factoryName, ClassID classID);
-    virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const = 0;
+protected:
+  Factory (const ClassID& id);
+  /**
+   * @brief The core function of the Factory. Creates objects of the Factories Type.
+   * @param root The TiXmlElement of the Factory.
+   * @returns the created Object in BaseType* format.
+   */
+  virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const = 0;
 
-  protected:
-    const ClassID                 classID;              //!< The Class-Identifyer of the Factory.
-    const std::string             className;            //!< The name of the Class.
-    static std::list<Factory*>*   factoryList;          //!< List of Registered Factories
+private:
+  //! Copy Constructor is hidden.
+  Factory (const Factory&) {};
+
+protected:
+  /** The Type of the FactoryMap that is sorted by ID */
+  typedef std::map<const ClassID, Factory*>  FactoryIDMap;
+  /** The Type of the FactoryMap that is sorted by Name */
+  typedef std::map<std::string, Factory*>    FactoryStringMap;
+
+  const ClassID                 _classID;              //!< The Class-Identifyer of the Factory.
+  static FactoryIDMap           _factoryIDMap;         //!< List of Registered Factories
+  static FactoryStringMap       _factoryStringMap;     //!< List of Registered Factories
 };
 
@@ -70,24 +87,27 @@
 template<class T> class tFactory : public Factory
 {
- public:
- /**
-  * @brief 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)
+public:
+  /**
+   * @brief creates a new type Factory to enable the loading of T
+   * @param classID the ID of the Class to be created.
+   */
+  tFactory (const ClassID& classID)
+      : Factory(classID)
   {  }
+  /**
+   * @brief copy constructor
+   * @param factory the Factory to copy
+   */
+  tFactory (const tFactory& factory) : Factory(factory._classID) {};
 
-  private:
-   /**
-    * @brief 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);
-    }
+  /**
+   * @brief 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);
+  }
 };
 
Index: trunk/src/lib/util/loading/fast_factory.cc
===================================================================
--- trunk/src/lib/util/loading/fast_factory.cc	(revision 9869)
+++ trunk/src/lib/util/loading/fast_factory.cc	(revision 9869)
@@ -0,0 +1,281 @@
+/*
+   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
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
+
+#include "fast_factory.h"
+
+#include "compiler.h"
+#include "debug.h"
+
+
+ObjectListDefinition(FastFactory);
+
+/**
+ * @brief Initializes a FastFactory
+ * @param classID the ClassID this Class belongs to (the top-most)
+ * @param fastFactoryName the Name of the ObjectClass-handled here
+ * @return a new FastFactory
+ */
+FastFactory::FastFactory (const ClassID& classID, const std::string& fastFactoryName)
+{
+  this->registerObject(this, FastFactory::_objectList);
+  this->setName(fastFactoryName);
+
+  this->storedClassID = classID;
+  this->next = NULL;
+
+  this->deadList = NULL;
+  this->unusedContainers = NULL;
+
+  this->storedDeadObjects = 0;
+
+  FastFactory::registerFastFactory(this);
+}
+
+/** a reference to the First FastFactory */
+FastFactory* FastFactory::first = NULL;
+
+/**
+ *  destructor
+ * deletes all the Instances of the FastFactory.
+ */
+FastFactory::~FastFactory ()
+{
+  if (this == first)
+    this->first = NULL;
+  this->flush();
+
+  if (this->next)
+    delete this->next;
+}
+
+/**
+ * deletes all FastFactories
+ */
+void FastFactory::deleteAll()
+{
+  if (FastFactory::first)
+    delete FastFactory::first;
+}
+
+/**
+ * registers a Factory to the List of known factories.
+ * @param fastFactory The factory to add
+ *
+ * needed, to step through all the FastFactories.
+ */
+void FastFactory::registerFastFactory(FastFactory* fastFactory)
+{
+  PRINTF(4)("Registered FastFactory for '%s'\n", fastFactory->getCName());
+
+  if( FastFactory::first == NULL)
+    FastFactory::first = fastFactory;
+  else
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while( tmpFac->next != NULL)
+      tmpFac = tmpFac->next;
+    tmpFac->setNext(fastFactory);
+  }
+}
+
+/**
+ * searches for a FastFactory
+ * @param classID the ClassID of the FastFactory to search for
+ * @returns true if found, false otherwise.
+ */
+FastFactory* FastFactory::searchFastFactory(const ClassID& classID)
+{
+  if (FastFactory::first == NULL)
+    return NULL;
+  else
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while (tmpFac != NULL)
+    {
+      if (tmpFac->storedClassID == classID)
+        return tmpFac;
+      tmpFac = tmpFac->next;
+    }
+  }
+  return NULL;
+}
+
+/**
+ * searches for a FastFactory
+ * @param classID the ClassID of the FastFactory to search for
+ * @returns true if found, false otherwise.
+ */
+FastFactory* FastFactory::searchFastFactory(const std::string& fastFactoryName)
+{
+  if (FastFactory::first == NULL)
+    return NULL;
+  else
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while (tmpFac != NULL)
+    {
+      if (fastFactoryName == tmpFac->getCName())
+        return tmpFac;
+      tmpFac = tmpFac->next;
+    }
+  }
+  return NULL;
+}
+
+/**
+ * Removes all the stored Containers, and sets the Lists back to emptienes.
+ * @param hardFLUSH if true the containing Objects will also be deleted !! THIS IS DANGEROUS !!
+ */
+void FastFactory::flushAll(bool hardFLUSH)
+{
+  FastFactory* tmpFac = FastFactory::first;
+  while (tmpFac != NULL)
+  {
+    PRINTF(4)("DELETEING ALL OF %s\n",tmpFac->getCName());
+    tmpFac->flush(hardFLUSH);
+    tmpFac = tmpFac->next;
+  }
+}
+
+/**
+ * ereases all the remaining containers, without deleting the stored Objects inside of them.
+ * @param hardFLUSH if the the containing Objects will also be deleted !! THIS IS DANGEROUS !!
+ */
+void FastFactory::flush(bool hardFLUSH)
+{
+  FastObjectMember* tmpMember = this->deadList, *delMember = NULL;
+  while (tmpMember != NULL)
+  {
+    delMember = tmpMember;
+    tmpMember = tmpMember->next;
+    if (hardFLUSH)
+      delete delMember->objectPointer;
+    delete delMember;
+  }
+  this->deadList = NULL;
+
+  tmpMember = this->unusedContainers;
+  while (tmpMember != NULL)
+  {
+    delMember = tmpMember;
+    tmpMember = tmpMember->next;
+    delete delMember;
+  }
+  this->unusedContainers = NULL;
+}
+
+/**
+ * generates count new Object of the Corresponding class. (precaching)
+ * @param count How many instances of the class should be generated.
+ */
+void FastFactory::prepare(unsigned int count)
+{
+/*  if (this->storedDeadObjects + this->storedLivingObjects >= count)
+  {
+  PRINTF(3)("not creating new Objects for class %s, because the requested count already exists\n", this->getClassCName());
+}*/
+  for (unsigned int i = this->storedDeadObjects; i < count; i++)
+  {
+    this->fabricate();
+  }
+}
+
+/**
+ * gives back live to one Object.
+ * @return the Object to resurrect.
+ */
+BaseObject* FastFactory::resurrect()
+{
+  PRINTF(4)("Resurecting Object of type %s\n", this->getCName());
+  if (unlikely(this->deadList == NULL))
+  {
+    PRINTF(3)("The deadList of Class %s is empty, this may be either because it has not been filled yet, or the cache is to small.\n" \
+        "  Developer: try increasing the count with FastFactory::prepare(contHigher than actual)\n" \
+        "    Fabricating a new %s\n", this->getCName(), this->getCName());
+    this->fabricate();
+    return this->resurrect();
+  }
+  else
+  {
+    FastObjectMember* tmpC = this->deadList;
+    this->deadList = this->deadList->next;
+
+    tmpC->next = this->unusedContainers;
+    this->unusedContainers = tmpC;
+
+    return tmpC->objectPointer;
+  }
+}
+
+/**
+ * gives back live to one Object.
+ * @param classID the class From which to resurrect an Object.
+ * @return the Object to resurrect, NULL if classID is not found.
+ */
+BaseObject* FastFactory::resurrect(const ClassID& classID)
+{
+  FastFactory* tmpFac = FastFactory::getFirst();
+
+  while (tmpFac != NULL)
+  {
+    if (classID == tmpFac->storedClassID)
+      return tmpFac->resurrect();
+    tmpFac = tmpFac->next;
+  }
+  return NULL;
+}
+
+/**
+ * kills Object object, meaning, that it will be stored in the deadList of the FastFactory, and waiting for resurrection
+ * @param object the Object to kill.
+ *
+ * synony that would be really grate would be abolish, but this is more like exterminate than pause-mode.
+ */
+void FastFactory::kill(BaseObject* object)
+{
+  FastObjectMember* tmpC;
+  if (unlikely(this->unusedContainers == NULL))
+  {
+    tmpC = new FastObjectMember;
+  }
+  else
+  {
+    tmpC = this->unusedContainers;
+    this->unusedContainers = this->unusedContainers->next;
+  }
+
+  tmpC->next = this->deadList;
+  tmpC->objectPointer = object;
+  this->deadList = tmpC;
+}
+
+
+void FastFactory::kill(BaseObject* object, bool searchForFastFactory)
+{
+  if (likely(searchForFastFactory == true))
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while (tmpFac != NULL)
+    {
+      if (object->isA(tmpFac->storedClassID))
+      {
+        tmpFac->kill(object);
+        return;
+      }
+      tmpFac = tmpFac->next;
+    }
+  }
+}
Index: trunk/src/lib/util/loading/fast_factory.h
===================================================================
--- trunk/src/lib/util/loading/fast_factory.h	(revision 9869)
+++ trunk/src/lib/util/loading/fast_factory.h	(revision 9869)
@@ -0,0 +1,176 @@
+/*!
+ * @file fast_factory.h
+ * The ObjectManager (FastFactory) is designed, to automatically generate and remove
+ * (without to much overhead) many instances of different classes.
+ *
+ * It is especially usefull for objects, that come only for a short time into existence,
+ * and get killed after a small amount of time (like shots).
+ *
+ * The Creation of an Object is usually done in the Weapon Class, where one subscribes
+ * a Projectile with:
+ * this->bulletFactory = tFastFactory<TestBullet>::getFastFactory(CL_TEST_BULLET, "TestBullet");
+ * (this might change over time).
+ * Then you can at loading time initialize an amount of the class with something like:
+ * this->bulletFactory->prepare(100); // creates 100 entities of TestBullet (dead ones)
+ * afterwards one can just retrieve an Object form the Class with
+ * this->bulletFactory->resurrect();  // this returns a BaseObject an Object of the class.
+ *
+ * The big difference to the FastFactory-class is, that this one is used more for the purpose
+ * of fast game-interaction than for loading. althought one can also load FastFactorized classes
+ * it is not the main topic.
+ */
+
+#ifndef _FAST_FACTORY_H
+#define _FAST_FACTORY_H
+
+#include "base_object.h"
+/**
+ * Creates a FastFactory to a Createable FastFactory.
+ */
+#define CREATE_FAST_FACTORY(CLASS_NAME, CLASS_ID) \
+  FastFactory* global_##CLASS_NAME##_FastFactory = tFastFactory<CLASS_NAME>::getFastFactory(CLASS_ID, #CLASS_NAME)
+/**
+ * Creates a FastFactory for a Class' static function named ClassName::fastFactory.
+ * @param CLASS_NAME the name of the Class to create the fast-factory for.
+ * @param CLASS_ID the ID of the class to create the fast-factory for @see "class_id_DEPRECATED.h"
+ *
+ * notice, that the Class to be called, must implement:
+ * static FastFactory*         fastFactory;
+ */
+#define CREATE_FAST_FACTORY_STATIC(CLASS_NAME) \
+  FastFactory* CLASS_NAME::fastFactory = tFastFactory<CLASS_NAME>::getFastFactory(CLASS_NAME::staticClassID(), #CLASS_NAME)
+
+//! A struct, that holds Lists of Objects of a certain type.
+typedef struct FastObjectMember
+{
+  BaseObject*          objectPointer;      //!< Pointer to the Object Stored in this Class (if it is the DeadList, else it is bork)
+
+  FastObjectMember*    next;               //!< the next stored FastObjectMember. (or NULL if this is the last one stored in either the deadList or the unusedContainers)
+};
+
+//! The FastFactory is a fast loadable object creator, and Dynamic List of dead object handler.
+/**
+ * The ObjectManager (FastFactory) is designed, to automatically generate and remove
+ * (without to much overhead) many instances of different classes.
+ *
+ * FastFactory is needed to glue all the tFastFactories together.
+ * It is also the general class that implements the necessary functions
+ * to generate, resurrect kill and stuff...
+ */
+class FastFactory : public BaseObject
+{
+  ObjectListDeclaration(FastFactory);
+
+public:
+  virtual ~FastFactory ();
+  static void deleteAll();
+
+  // functions to push and pop elements of this class
+  BaseObject* resurrect();
+  static BaseObject* resurrect(const ClassID& classID);
+  void kill(BaseObject* object);
+  static void kill(BaseObject* object, bool searchForFastFactory);
+
+  void prepare(unsigned int count);
+
+  static void flushAll(bool hardFLUSH = false);
+  void flush(bool hardFLUSH = false);
+
+  /** @returns the first FastFactory */
+  inline static FastFactory* getFirst() { return FastFactory::first; };
+
+  static FastFactory* searchFastFactory(const ClassID& classID);
+  static FastFactory* searchFastFactory(const std::string& fastFactoryName);
+
+  const ClassID& getStoredID() const { return this->storedClassID; };
+
+protected:
+  FastFactory (const ClassID& classID, const std::string& fastFactoryName = "");
+
+  /** sets the Next factory in the list @param nextFactory the next factory */
+  inline void setNext( FastFactory* nextFastFactory) { this->next = nextFastFactory; };
+  /** @returns the next FastFactory */
+  FastFactory* getNext() const { return this->next; };
+
+  /** generates a new Object of the Class T */
+  virtual void fabricate() = 0;
+
+private:
+  static void registerFastFactory(FastFactory* fastFactory);
+
+protected:
+  ClassID            storedClassID;        //!< The classID of the specified class.
+  unsigned int          storedDeadObjects;    //!< How many dead objects are stored in this class
+
+  FastObjectMember*     deadList;             //!< A List of all stored dead Objects of this class.
+  FastObjectMember*     unusedContainers;     //!< This is a List of unused containers, that will be reused by kill.
+
+private:
+  static FastFactory*   first;                //!< A pointer to the first FastFactory.
+
+  FastFactory*          next;                 //!< pointer to the next FastFactory.
+};
+
+
+
+/**
+ *  a FastFactory that is able to load any kind of Object from a ClassID
+ * (this is a Functor)
+ */
+template<class T>
+class tFastFactory : public FastFactory
+{
+public:
+  static tFastFactory<T>* getFastFactory(const ClassID& classID, const std::string& fastFactoryName);
+
+private:
+  tFastFactory(const ClassID& classID, const std::string& fastFactoryName);
+
+  virtual void fabricate();
+};
+
+/**
+ * construnts a FastFactory with
+ * @param fastFactoryName the name of the FastFactory
+ * @param fastFactory the ID of the class
+ * @todo (can this be written in another form??)
+ */
+template<class T>
+tFastFactory<T>::tFastFactory(const ClassID& classID, const std::string& fastFactoryName)
+    : FastFactory(classID, fastFactoryName)
+{}
+
+/**
+ * creates (if not existent) a Factory of Class T, and assigns some values to it
+ * @param classID the ClassID to assign to this class
+ * @param fastFactoryName the name to assign
+ * @returns The FastFactory if existent a new Factory if not.
+ */
+template<class T>
+tFastFactory<T>* tFastFactory<T>::getFastFactory(const ClassID& classID, const std::string& fastFactoryName)
+{
+  tFastFactory<T>* tmpFac = NULL;
+  if (FastFactory::getFirst() != NULL)
+    tmpFac = static_cast<tFastFactory<T>*>(FastFactory::getFirst()->searchFastFactory(classID));
+
+  if (tmpFac != NULL)
+    return tmpFac;
+  else
+    return new tFastFactory<T>(classID, fastFactoryName);
+}
+
+/**
+ * fabricates an Object of Class T, that corresponds to classID.
+ */
+template<class T>
+void tFastFactory<T>::fabricate()
+{
+  FastObjectMember* tmpFirstDead = new FastObjectMember;
+  tmpFirstDead->objectPointer = new T();
+  tmpFirstDead->next = this->deadList;
+  ++this->storedDeadObjects;
+
+  this->deadList = tmpFirstDead;
+}
+
+#endif /* _FAST_FACTORY_H */
Index: trunk/src/lib/util/loading/game_loader.cc
===================================================================
--- trunk/src/lib/util/loading/game_loader.cc	(revision 9682)
+++ trunk/src/lib/util/loading/game_loader.cc	(revision 9869)
@@ -20,18 +20,11 @@
 #include "game_loader.h"
 #include "util/loading/load_param.h"
-
-#include "shell_command.h"
+#include "util/loading/resource_manager.h"
+#include "debug.h"
 #include "campaign.h"
 
-#include "util/loading/resource_manager.h"
-
 #include "key_mapper.h"
 
-
-
-SHELL_COMMAND(quit, GameLoader, stop)
-->describe("quits the game")
-->setAlias("orxoquit");
-
+ObjectListDefinition(GameLoader);
 
 GameLoader* GameLoader::singletonRef = NULL;
@@ -43,5 +36,5 @@
 GameLoader::GameLoader ()
 {
-  this->setClassID(CL_GAME_LOADER, "GameLoader");
+  this->registerObject(this, GameLoader::_objectList);
   this->setName("GameLoader");
   this->bRun = true;
@@ -57,5 +50,5 @@
     delete this->currentCampaign;
   this->currentCampaign = NULL;
-  
+
   GameLoader::singletonRef = NULL;
 }
@@ -90,5 +83,5 @@
 {
   ErrorMessage errorCode;
-  std::string campaignName = ResourceManager::getFullName(fileName);
+  std::string campaignName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
   if (!campaignName.empty())
   {
@@ -110,5 +103,5 @@
 {
   ErrorMessage errorCode;
-  std::string campaignName = ResourceManager::getFullName(fileName);
+  std::string campaignName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(fileName);
   if (!campaignName.empty())
   {
Index: trunk/src/lib/util/loading/game_loader.h
===================================================================
--- trunk/src/lib/util/loading/game_loader.h	(revision 9682)
+++ trunk/src/lib/util/loading/game_loader.h	(revision 9869)
@@ -38,5 +38,6 @@
 class GameLoader : public EventListener
 {
- public:
+  ObjectListDeclaration(GameLoader);
+  public:
   virtual ~GameLoader ();
   /**  this class is a singleton class @returns an instance of itself  */
Index: trunk/src/lib/util/loading/load_param.cc
===================================================================
--- trunk/src/lib/util/loading/load_param.cc	(revision 9682)
+++ trunk/src/lib/util/loading/load_param.cc	(revision 9869)
@@ -16,21 +16,17 @@
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
 
-#include "util/loading/load_param.h"
-#include "load_param_description.h"
-
-#include <stdarg.h>
-
+#include "load_param.h"
+#include "load_param_class_description.h"
+#include "compiler.h"
+#include "debug.h"
 /**
- * Constructs a new LoadParameter
+ * @brief 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.
+ * @param inLoadCycle If we are in a LoadCycle (loading differs.).
  */
-CLoadParam::CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle)
-  :  object(object), paramName(paramName)
+LoadParamBase::LoadParamBase(const TiXmlElement* root, const std::string& paramName, bool inLoadCycle)
+    :  paramName(paramName), inLoadCycle(inLoadCycle)
 {
-  this->inLoadCycle = inLoadCycle;
-
   // determin the LoadString.
   if (likely(!inLoadCycle))
@@ -40,181 +36,29 @@
   else
     this->loadElem = NULL;
+}
 
-  // set the Executor.
-  this->executor = executor;
 
-  //if (this->executor)
-  //  this->executor->setName(paramName);
+/**
+ * @param classID the ID of the class. This is needed to identify into what class this Parameter belongs.
+ * @param descriptionText The text to set as a description for this Parameter
+ * @returns a pointer to itself.
+ */
+void LoadParamBase::describe(const ClassID& classID, const std::string& descriptionText)
+{
+  PRINTF(5)("Describing Class '%s'(id:%d) Parameter '%s': description '%s'\n",
+            classID.name().c_str(), classID.id(), paramName.c_str(), descriptionText.c_str());
+
+  if (LoadParamClassDescription::descriptionsCaptured())
+    LoadParamClassDescription::describeClass(classID, paramName, descriptionText);
 }
 
 /**
- * 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.
+ * @brief sets the Values of the Description to a usefull text.
  */
-CLoadParam::~CLoadParam()
+void LoadParamBase::setDescriptionValues(const ClassID& classID, unsigned int paramCount, const MultiType* const defaultValues, bool retVal)
 {
-  if (likely(this->executor != NULL))
-  {
-    std::string loadString = "";
-    if (this->loadElem != NULL &&  this->loadElem->ToText())
-      loadString = this->loadElem->Value();
-    if (likely(this->object != NULL) &&
-        ( !loadString.empty() ||
-          ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString)))
-    {
-      PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName());
-      (*this->executor)(this->object, SubString(loadString, ",", SubString::WhiteSpaces, false, '\\'));
-    }
-    delete this->executor;
-  }
+  if(LoadParamClassDescription::descriptionsCaptured())
+    LoadParamClassDescription::setValuesOf(classID, paramName, paramCount, defaultValues, retVal);
 }
-
-/**
- * @brief set the default values of the executor
- * @param value0 the first default value
- * @param value1 the second default value
- * @param value2 the third default value
- * @param value3 the fourth default value
- * @param value4 the fifth default value
- */
-CLoadParam& CLoadParam::defaultValues(const MultiType& value0, const MultiType& value1,
-                                      const MultiType& value2, const MultiType& value3,
-                                      const MultiType& value4)
-{
-  assert(this->executor != NULL);
-  this->executor->defaultValues(value0, value1, value2, value3, value4);
-
-  return *this;
-}
-
-
-
-/**
- * @param descriptionText The text to set as a description for this Parameter
- * @returns a pointer to itself.
-*/
-CLoadParam& CLoadParam::describe(const std::string& descriptionText)
-{
-  if (LoadClassDescription::parametersDescription && this->paramDesc && this->paramDesc->getDescription().empty())
-  {
-    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->getClassCName());
-
-    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;
-}
-}
-}*/
-
-
-
-
-
-
-
-
 
 
@@ -227,22 +71,14 @@
  * @returns the Value of the parameter if found, NULL otherwise
 */
-std::string grabParameter(const TiXmlElement* root, const std::string& parameterName)
+std::string LoadParamBase::grabParameter(const TiXmlElement* root, const std::string& parameterName)
 {
-  const TiXmlElement* element;
-  const TiXmlNode* node;
-
-  if (root == NULL)
-    return "";
-
-  element = root->FirstChildElement( parameterName);
-  if( element == NULL) return "";
-
-  node = element->FirstChild();
-  while( node != NULL)
+  const TiXmlElement* const element = grabParameterElement(root, parameterName);
+  if (element != NULL)
+    return element->Value();
+  else
   {
-    if( node->ToText()) return node->Value();
-    node = node->NextSibling();
+    static std::string empty("");
+    return empty;
   }
-  return "";
 }
 
@@ -252,5 +88,5 @@
  * @returns the Element of the parameter if found, NULL otherwise
  */
-const TiXmlElement* grabParameterElement(const TiXmlElement* root, const std::string& parameterName)
+const TiXmlElement* LoadParamBase::grabParameterElement(const TiXmlElement* root, const std::string& parameterName)
 {
   const TiXmlElement* element;
@@ -271,5 +107,2 @@
   return NULL;
 }
-
-
-
Index: trunk/src/lib/util/loading/load_param.h
===================================================================
--- trunk/src/lib/util/loading/load_param.h	(revision 9682)
+++ trunk/src/lib/util/loading/load_param.h	(revision 9869)
@@ -22,18 +22,18 @@
 #define _LOAD_PARAM_H
 
-#include "base_object.h"
+#include "util/executor/executor_substring.h"
+#include "util/executor/executor_member.h"
+#include "util/executor/functor_member.h"
 
-#include "executor/executor.h"
-#include "executor/executor_xml.h"
+#include "parser/tinyxml/tinyxml.h"
 
 // Forward Declaration //
 class LoadClassDescription;
 class LoadParamDescription;
-class MultiType;
-
+class TiXmlElement;
 
 /**
  * Loads a Parameter from ROOT named PARAMETER_NAME
- * onto OBJECT of CLASS, trough the FUNCTION
+ * onto OBJECT of CLASS, trough FUNCTION
  * @param ROOT the TiXmlElement to load the Parameter from
  * @param PARAMETER_NAME the Name of the Parameter to load
@@ -43,15 +43,16 @@
  */
 #define LoadParam(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
-         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS>(&CLASS::FUNCTION), false)
+         CLoadParam<CLASS>(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS, CLASS>(&CLASS::FUNCTION), false)
 
+/**
+ * @brief Does essentially the same as LoadParam, but within a Cycle in an ordered fashion.
+ *
+ * This Function looks in each Element, if the PARAMETER_NAME matches, and loads onto OBJECT
+ * of CLASS the ROOT through FUNCTION
+ *
+ * @see LoadParam(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION)
+ */
 #define LoadParam_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
-         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS>(&CLASS::FUNCTION), true)
-
-#define LoadParamXML(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
-         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), false)
-
-#define LoadParamXML_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
-         CLoadParam(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), true)
-
+         CLoadParam<CLASS>(ROOT, PARAMETER_NAME, OBJECT, createExecutor<CLASS, CLASS>(&CLASS::FUNCTION), true)
 
 /**
@@ -78,39 +79,81 @@
 }
 
+
 /**************************
 **** REAL DECLARATIONS ****
 **************************/
-//! abstract Base class for a Loadable parameter
-class CLoadParam : public BaseObject
+//!< A BaseClass for all LoadParam's.
+class LoadParamBase
 {
-  public:
-    CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle = false);
-    virtual ~CLoadParam();
+protected:
+  LoadParamBase(const TiXmlElement* root, const std::string& paramName, bool inLoadCycle = false);
 
-    CLoadParam& describe(const std::string& descriptionText);
-    CLoadParam& defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
-                              const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
-                              const MultiType& value4 = MT_NULL);
-    CLoadParam& attribute(const std::string& attributeName, const Executor& executor);
+protected:
+  void describe(const ClassID& classID, const std::string& descriptionText);
+  void setDescriptionValues(const ClassID& classID, unsigned int paramCount, const MultiType* const defaultValues, bool retVal = false);
+
+public:
+  static std::string grabParameter(const TiXmlElement* root, const std::string& parameterName);
+  static const TiXmlElement* grabParameterElement(const TiXmlElement* root, const std::string& parameterName);
+
+protected:
+  const std::string        paramName;            //!< The Name of the Parameter this LoadParams applies to.
+  bool                     inLoadCycle;          //!< If the Parameter is in a LoadCycle.
+
+  const TiXmlElement*      loadElem;             //!< The Element to load.
+};
 
 
-  private:
-    bool                     inLoadCycle;
-    Executor*                executor;
-    BaseObject*              object;
-    const std::string        paramName;
+//! The Loading Class of the LoadParam, that acctually executes the loading process.
+template <class OperateClass> class CLoadParam : public LoadParamBase
+{
+public:
+  /**
+   * @brief generates a LoadParam based on:
+   * @param root the Root Element to load onto the object. @param paramName the Parameter name that is loaded.
+   * @param object the Object to apply the changes on. @param executor the Functional Object, that actually executes the function Call.
+   * @param inLoadCycle If we are inside of a loading cycle. (Loading will be different here)
+   */
+  CLoadParam(const TiXmlElement* root, const std::string& paramName, OperateClass* object, Executor<const SubString, OperateClass>* executor, bool inLoadCycle = false)
+      : LoadParamBase(root, paramName, inLoadCycle)
+  {
+    assert (executor != NULL);
+    this->object = object;
+    this->executor = executor;
+  }
+  virtual ~CLoadParam()
+  {
+    std::string loadString;
+    if (this->loadElem != NULL &&  this->loadElem->ToText())
+    {
+      loadString = this->loadElem->Value();
+      if (!loadString.empty())
+      {
+        /*	PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n",
+        	this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName());*/
+        (*this->executor)(this->object, SubString(loadString, ",", SubString::WhiteSpaces, false, '\\'));
+      }
+    }
+    this->setDescriptionValues(OperateClass::staticClassID(), executor->getParamCount(), executor->getDefaultValues(), executor->hasRetVal());
+    delete this->executor;
+  }
+  /**
+   * @brief set the default values of the executor
+   * @param value0 the first default value   @param value1 the second default value
+   * @param value2 the third default value   @param value3 the fourth default value
+   * @param value4 the fifth default value
+   */
+  CLoadParam& defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
+                            const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
+                            const MultiType& value4 = MT_NULL)
+  { this->executor->defaultValues(value0, value1, value2, value3, value4); return *this;  };
+  //! Describes a LoadParam
+  CLoadParam& describe(const std::string& descriptionText) { LoadParamBase::describe(OperateClass::staticClassID(), descriptionText); return *this; };
+  //     CLoadParam& attribute(const std::string& attributeName, const Executor<SubString>& executor);
 
-    LoadClassDescription*    classDesc;            //!< The LoadClassDescription of this CLoadParameter
-    LoadParamDescription*    paramDesc;            //!< The LoadParameterDescription of this LoadParameter
-    const TiXmlElement*      loadElem;             //!< The Element to load.
-    const void*              pointerToParam;       //!< A Pointer to a Parameter.
-
-    MultiType*               defaultValue;
+private:
+  Executor<const SubString, OperateClass>*         executor;            //!< The Executor, that actually executes the Loading process.
+  OperateClass*                                    object;              //!< The Object this LoadParam operates on.
 };
 
-// helper function
-
-std::string grabParameter(const TiXmlElement* root, const std::string& parameterName);
-const TiXmlElement* grabParameterElement(const TiXmlElement* root, const std::string& parameterName);
-
 #endif /* _LOAD_PARAM_H */
Index: trunk/src/lib/util/loading/load_param_class_description.cc
===================================================================
--- trunk/src/lib/util/loading/load_param_class_description.cc	(revision 9869)
+++ trunk/src/lib/util/loading/load_param_class_description.cc	(revision 9869)
@@ -0,0 +1,171 @@
+/*
+   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_class_description.h"
+
+#include "multi_type.h"
+#include "debug.h"
+#include <cassert>
+
+/**
+ * @brief A list, that holds all the classes that are loadable (classes not objects!!)
+ */
+LoadParamClassDescription::ClassDescriptionMap LoadParamClassDescription::_classList;
+
+/**
+ * @brief if the description of Parameters should be executed
+ */
+bool LoadParamClassDescription::_captureDescriptions = false;
+
+/**
+ * @param className the name of the class to be loadable
+ */
+LoadParamClassDescription::LoadParamClassDescription(const std::string& className)
+    : _className(className)
+{ }
+
+
+/**
+ * @brief clears all LoadParamDescriptions.
+ */
+void LoadParamClassDescription::deleteAllDescriptions()
+{
+  LoadParamClassDescription::_classList.clear();
+}
+
+
+/**
+ * @brief describes a LoadParam-parameter.
+ * @param classID the ID of the class.
+ * @param paramName the Name of the Parameter.
+ * @param descriptionText the Test to set.
+ */
+void LoadParamClassDescription::describeClass(const ClassID& classID,
+    const std::string& paramName,
+    const std::string& descriptionText)
+{
+  ParamDescriptionMap::iterator it = LoadParamClassDescription::getParamDescription(classID, paramName);
+
+  (*it).second.setDescription(descriptionText);
+}
+
+/**
+ * @brief sets Values of the specified LoadParam-parameter.
+ * @param classID the ID of the class.
+ * @param paramName the name of the Parameter.
+ * @param paramCount the count of Parameters this LoadParam takes.
+ * @param defaultValues the default Values.
+ * @param retVal if the Parameter takes return Values.
+ */
+void LoadParamClassDescription::setValuesOf(const ClassID& classID,
+    const std::string& paramName,
+    unsigned int paramCount,
+    const MultiType* const defaultValues,
+    bool retVal)
+{
+  ParamDescriptionMap::iterator it = LoadParamClassDescription::getParamDescription(classID, paramName);
+  (*it).second.setValues(paramCount, defaultValues, retVal);
+}
+
+
+/**
+ * @brief finds the Iterator to the ParameterDescription paramName matching classID
+ * @param classID the ClassID to match.
+ * @param paramName the name of the parameter in the Class.
+ * @returns the iterator on match.
+ *
+ * @note this function creates the Element classID.name()::paramName on the go if it does not exist.
+ */
+LoadParamClassDescription::ParamDescriptionMap::iterator
+LoadParamClassDescription::getParamDescription(const ClassID& classID, const std::string& paramName)
+{
+  /// Locate the ClassDescription first
+  ClassDescriptionMap::iterator classIt = LoadParamClassDescription::_classList.find(classID);
+  if (classIt == LoadParamClassDescription::_classList.end())
+  {
+    LoadParamClassDescription::_classList[classID] = LoadParamClassDescription(classID.name());
+    classIt = LoadParamClassDescription::_classList.find(classID);
+  }
+  // At this position the class-iterator should point to a valid usefull position.
+  assert(classIt != LoadParamClassDescription::_classList.end());
+
+  /// Now locate the description with paramName.
+  ParamDescriptionMap::iterator paramIt = (*classIt).second._parameters.find(paramName);
+  if (paramIt == (*classIt).second._parameters.end())
+  {
+    (*classIt).second._parameters[paramName] = LoadParamDescription(paramName);
+    paramIt = (*classIt).second._parameters.find(paramName);
+  }
+  // at this position the param-iterator should
+  assert (paramIt != (*classIt).second._parameters.end());
+
+  return (paramIt);
+}
+
+/**
+ * @brief prints out a nice output about this Classes Loading, and their parameters
+ * @param stream the stream to write to.
+ * @param withComments if Comments should be included.
+ */
+void LoadParamClassDescription::print(FILE* stream, bool withComments) const
+{
+  fprintf(stream, "<%s>\n", this->_className.c_str());
+  for (ParamDescriptionMap::const_iterator param = this->_parameters.begin();
+       param != this->_parameters.end();
+       ++param)
+  {
+    (*param).second.print(stream, withComments);
+  }
+  fprintf(stream, "</%s>\n\n", this->_className.c_str());
+}
+
+
+/**
+ * @brief prints out all loadable Classes, and their parameters
+ * @param fileName prints the output to a File
+ * @param withComments if Comments should be included.
+ */
+void LoadParamClassDescription::printAll(const std::string& fileName, bool withComments)
+{
+  FILE* stream;
+  if( (stream = fopen (fileName.c_str(), "w")) == NULL)
+  {
+    PRINTF(2)("File '%s' could not be opened for writing\n Printing to stdout\n", fileName.c_str());
+    LoadParamClassDescription::printAllTo(stdout, withComments);
+    return;
+  }
+  else
+    LoadParamClassDescription::printAllTo(stream, withComments);
+
+  fclose (stream);
+}
+
+/**
+ * @brief prints out all loadable Classes, and their parameters to a stream
+ * @param stream the stream to print to.
+ * @param withComments if Comments should be included.
+ */
+void LoadParamClassDescription::printAllTo(FILE* stream, bool withComments)
+{
+  fprintf(stream, "===============================================================\n");
+  fprintf(stream, " Listing all the Loadable Options (loaded since Game started).\n\n");
+  for (ClassDescriptionMap::const_iterator classIt = LoadParamClassDescription::_classList.begin();
+       classIt != LoadParamClassDescription::_classList.end();
+       classIt ++)
+  {
+    (*classIt).second.print(stream, withComments);
+  }
+  fprintf(stream, "===============================================================\n");
+}
Index: trunk/src/lib/util/loading/load_param_class_description.h
===================================================================
--- trunk/src/lib/util/loading/load_param_class_description.h	(revision 9869)
+++ trunk/src/lib/util/loading/load_param_class_description.h	(revision 9869)
@@ -0,0 +1,84 @@
+/*
+   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_class_description.h
+ * A Class and macro-functions, that makes our lives easy to load-in parameters
+ */
+
+#ifndef _LOAD_PARAM_CLASS_DESCRIPTION_H
+#define _LOAD_PARAM_CLASS_DESCRIPTION_H
+
+#include "load_param_description.h"
+#include "class_id.h"
+#include <map>
+// Forward Declaration //
+class MultiType;
+
+//! A class for descriptions of a loadable module
+class LoadParamClassDescription
+{
+public:
+  LoadParamClassDescription(const std::string& className = "");
+
+  //! Compares a LoadParamClassDescription with a String.
+  bool operator==(const std::string& className) const { return this->_className == className; };
+  //! Compares two LoadParamClassDescription with each other
+  bool operator==(const LoadParamClassDescription& classDescr) const { return this->_className == classDescr._className; };
+  //! Compares two LoadParamClassDescription with each other, using the less operator
+  bool operator<(const LoadParamClassDescription& classDescr) const { return this->_className < classDescr._className; }
+
+
+  static void describeClass(const ClassID& classID,
+                            const std::string& paramName,
+                            const std::string& descriptionText);
+  static void setValuesOf(const ClassID& classID,
+                          const std::string& paramName,
+                          unsigned int paramCount,
+                          const MultiType* const defaultValues,
+                          bool retVal = false);
+
+  /** @param createThem: if the Parameters should be created/stored. */
+  static void captureDescriptions(bool createThem) { _captureDescriptions = createThem; };
+  /** @returns if the Parameters are created/stored. */
+  static bool descriptionsCaptured() { return _captureDescriptions; };
+
+  static void deleteAllDescriptions();
+
+  void print(FILE* stream = stdout, bool withComments = true) const;
+  static void printAll(const std::string& fileName = "", bool withComments = true);
+  static void printAllTo(FILE* stream = stdout, bool withComments = true);
+
+private:
+  //! A Type definition for the Map of Class Descriptions
+  typedef std::map<ClassID, LoadParamClassDescription>  ClassDescriptionMap;
+  //! A type definition for the Map of Parameter Descriptions inside of Class-descriptions.
+  typedef std::map<std::string, LoadParamDescription>   ParamDescriptionMap;
+
+private:
+  static ParamDescriptionMap::iterator getParamDescription(const ClassID& classID, const std::string& paramName);
+
+private:
+
+  static bool                                  _captureDescriptions;    //!< if parameter-description should be enabled globally.
+
+  static ClassDescriptionMap                   _classList;              //!< a list, that stores all the loadable classes. (after one instance has been loaded)
+
+private:
+  std::string                                  _className;              //!< name of the class
+  ParamDescriptionMap                          _parameters;             //!< List of parameters this class knows.
+};
+
+#endif /* _LOAD_PARAM_CLASS_DESCRIPTION_H */
Index: trunk/src/lib/util/loading/load_param_description.cc
===================================================================
--- trunk/src/lib/util/loading/load_param_description.cc	(revision 9682)
+++ trunk/src/lib/util/loading/load_param_description.cc	(revision 9869)
@@ -17,33 +17,13 @@
 
 #include "multi_type.h"
-#include <stdarg.h>
 #include "debug.h"
 
 /**
+ * @brief Creates a Description of a LoadParam
  * @param paramName the name of the parameter to load
  */
 LoadParamDescription::LoadParamDescription(const std::string& paramName)
-{
-  this->types = NULL;
-  this->defaultValues = NULL;
-  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;
-}
+    : _name(paramName), _parameterCount(0)
+{ }
 
 /**
@@ -52,229 +32,71 @@
 void LoadParamDescription::setDescription(const std::string& descriptionText)
 {
-  this->description = descriptionText;
+  this->_description = descriptionText;
 }
 
 /**
- *  prints out this parameter, its input method and the description (if availiable)
+ * @brief sets the Values of the LoadParam in the Description.
+ * @param paramCount the count of arguments the underlying paramDescription takes.
+ * @param defaultValues the default Values the underlying parameter takes.
+ * @param retVal if the underlying parameter has a return value
  */
-void LoadParamDescription::print() const
+void LoadParamDescription::setValues(unsigned int paramCount,
+                                     const MultiType* const defaultValues,
+                                     bool retVal)
 {
-  PRINT(3)(" <%s>", this->paramName.c_str());
-  for (int i = 0; i < this->paramCount; i++)
+  this->_parameterCount = paramCount;
+  for (unsigned int i = 0; i < 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;
-//     }
+    this->_defaultValues.push_back(defaultValues[i].getString());
+    this->_types.push_back(MultiType::MultiTypeToString(defaultValues[i].getType()));
   }
-  PRINT(3)("</%s>", this->paramName.c_str());
-  if (!this->description.empty())
-    PRINT(3)(" -- %s", this->description.c_str());
-  // 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 std::string& className)
-{
-  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();
-  }
-}
-
-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
+ * @brief prints out this parameter, its input method and the description (if availiable)
+ * @param stream the stream to print to.
+ * @param withComments if the comments should be appended.
  */
-LoadClassDescription* LoadClassDescription::addClass(const std::string& className)
+void LoadParamDescription::print(FILE* stream, bool withComments) const
 {
-  if (LoadClassDescription::classList != NULL)
+  fprintf(stream, " <%s>", this->_name.c_str());
+  for (unsigned int i = 0; i < this->_parameterCount; i++)
   {
-    std::list<LoadClassDescription*>::iterator it = LoadClassDescription::classList->begin();
-    while (it != LoadClassDescription::classList->end())
+    if (i > 0)
+      fprintf(stream, ",");
+    fprintf(stream, "%s", this->_types[i].c_str());
+  }
+  fprintf(stream, "</%s>", this->_name.c_str());
+  // here the comments are printed out.
+  if (withComments)
+  {
+    if (!this->_description.empty())
+      fprintf(stream, " <!-- %s", this->_description.c_str());
+    // default values
+    if (this->_parameterCount > 0)
     {
-      if ((*it)->className == className)
+      fprintf(stream, " (Default: ");
+      for (unsigned int i = 0; i < this->_parameterCount; i++)
       {
-        return (*it);
+        if (i > 0)
+          fprintf(stream, ", ");
+        if (this->_types[i] == "string")
+        { // leave brackets !!
+          fprintf(stream, "\"%s\"", this->_defaultValues[i].c_str());
+        }
+        else
+        {
+          fprintf(stream, "%s", this->_defaultValues[i].c_str());
+        }
       }
-      it++;
+      fprintf(stream, ")");
     }
+    if (!this->_description.empty() || this->_parameterCount > 0)
+      fprintf(stream, " -->");
   }
-  return new LoadClassDescription(className);
+  fprintf(stream, "\n");
 }
 
-/**
- *  does the same as addClass(const std::string& className), but with params
- * @param paramName the name of the parameter to add.
- */
-LoadParamDescription* LoadClassDescription::addParam(const std::string& paramName)
-{
-  std::list<LoadParamDescription*>::iterator it = this->paramList.begin();
-  while (it != this->paramList.end())
-  {
-    if ((*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 std::string& 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.c_str());
-      std::list<LoadParamDescription*>::iterator param = (*classDesc)->paramList.begin();
-      while (param != (*classDesc)->paramList.end())
-      {
-        (*param)->print();
-        param++;
-      }
-      PRINT(3)("</%s>\n\n", (*classDesc)->className.c_str());
-      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<std::string> LoadClassDescription::searchClassWithShort(const std::string& classNameBegin)
-{
-  /// FIXME
-  // NOT USED
-/*  unsigned int searchLength = strlen(classNameBegin);
-  std::list<const std::string&> 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;*/
-  std::list<std::string> a;
-  return a;
-}
Index: trunk/src/lib/util/loading/load_param_description.h
===================================================================
--- trunk/src/lib/util/loading/load_param_description.h	(revision 9682)
+++ trunk/src/lib/util/loading/load_param_description.h	(revision 9869)
@@ -15,5 +15,5 @@
 
 /*!
- * @file load_param.h
+ * @file load_param_description.h
  * A Class and macro-functions, that makes our lives easy to load-in parameters
  */
@@ -22,6 +22,6 @@
 #define _LOAD_PARAM_DESCRIPTION_H
 
-#include "base_object.h"
-#include <list>
+#include <vector>
+#include <string>
 
 // Forward Declaration //
@@ -34,47 +34,31 @@
 class LoadParamDescription
 {
-  friend class LoadParam;
-  friend class LoadClassDescription;
 public:
-  LoadParamDescription(const std::string& paramName);
-  ~LoadParamDescription();
+  LoadParamDescription(const std::string& paramName = "");
+
+  //! Compares a LoadParamDescription with a String.
+  bool operator==(const std::string& paramName) const { return this->_name == paramName; };
+  //! Compares two LoadParamDescription
+  bool operator==(const LoadParamDescription& paramDescr) const { return this->_name == paramDescr._name; };
+  //! Compares two LoadParamDescription with the less operator
+  bool operator<(const LoadParamDescription& paramDescr) const { return this->_name < paramDescr._name; };
 
   void setDescription(const std::string& descriptionText);
+  void setValues(unsigned int paramCount,
+                 const MultiType* const defaultValues,
+                 bool retVal = false);
+
   /** @returns the descriptionString */
-  const std::string& getDescription() { return this->description; };
+  const std::string& description() { return this->_description; };
 
-  void print() const;
+  void print(FILE* stream = stdout, bool withComments = true) const;
 
 private:
-  std::string   paramName;             //!< The name of the parameter.
-  int           paramCount;            //!< The count of parameters.
-  int*          types;                 //!< What kind of parameters does this function take ??
-  std::string   description;           //!< A longer description about this function.
-  char**        defaultValues;         //!< The 'Default Values'. @TODO MAKE THIS A MULTITYPE
-};
+  std::string                _name;                  //!< The Name of the Parameter.
+  unsigned int               _parameterCount;        //!< The Count of parameters.
+  std::string                _description;           //!< A longer description about this function.
 
-//! A class for descriptions of a loadable module
-class LoadClassDescription
-{
-  friend class CLoadParam;
-public:
-  LoadClassDescription(const std::string& className);
-  ~LoadClassDescription();
-
-  static LoadClassDescription* addClass(const std::string& className);
-  LoadParamDescription* addParam(const std::string& paramName);
-
-  static void deleteAllDescriptions();
-
-  static void printAll(const std::string& fileName = "");
-  static std::list<std::string> searchClassWithShort(const std::string& classNameBegin);
-  //  static const LoadParamDescription* getClass(const std::string& 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)
-  std::string                              className;              //!< name of the class
-
-  std::list<LoadParamDescription*>         paramList;              //!< List of parameters this class knows.
+  std::vector<std::string>   _types;                 //!< A Vector of types of this Parameter.
+  std::vector<std::string>   _defaultValues;         //!< A Vector of defaultValues of this Parameter.
 };
 
Index: trunk/src/lib/util/loading/load_param_xml.h
===================================================================
--- trunk/src/lib/util/loading/load_param_xml.h	(revision 9869)
+++ trunk/src/lib/util/loading/load_param_xml.h	(revision 9869)
@@ -0,0 +1,86 @@
+/*
+   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_xml.h
+ * A Class and macro-functions, that makes our lives easy to load-in parameters from XML
+ */
+
+#ifndef _LOAD_PARAM_XML_H
+#define _LOAD_PARAM_XML_H
+
+#include "load_param.h"
+#include "executor/executor_xml.h"
+
+/**
+ * @brief Loads a Parameter from ROOT named PARAMETER_NAME
+ * onto OBJECT of CLASS, trough 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 LoadParamXML(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
+         XmlLoadParam<CLASS>(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS, CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), false)
+
+
+/**
+ * @brief Does essentially the same as LoadParamXML, but within a Cycle in an ordered fashion.
+ *
+ * This Function looks in each Element, if the PARAMETER_NAME matches, and loads onto OBJECT
+ * of CLASS the ROOT through FUNCTION
+ *
+ * @see LoadParamXML(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION)
+ */
+#define LoadParamXML_CYCLE(ROOT, PARAMETER_NAME, OBJECT, CLASS, FUNCTION) \
+         XmlLoadParam<CLASS>(ROOT, PARAMETER_NAME, OBJECT, new ExecutorXML<CLASS, CLASS>(&CLASS::FUNCTION, ROOT, PARAMETER_NAME), true)
+
+//! A Class that can load XML tags onto an Object.
+template <class OperateClass = BaseObject> class XmlLoadParam : public LoadParamBase
+{
+public:
+  /**
+   * @brief generates a LoadParam based on
+   * @param root the Root Element to load onto the object.
+   * @param paramName the Parameter name that is loaded.
+   * @param object the Object to apply the changes on.
+   * @param executor the Functional Object, that actually executes the function Call.
+   * @param inLoadCycle If we are inside of a loading cycle. (Loading will be different here)
+   */
+  XmlLoadParam(const TiXmlElement* root, const std::string& paramName, OperateClass* object, Executor<const TiXmlElement*>* executor, bool inLoadCycle = false)
+      : LoadParamBase(root, paramName, inLoadCycle), object(object) , executor(executor)
+  {
+    assert(this->object != NULL);
+    assert(this->executor != NULL);
+  }
+
+  /** @brief executes and destroys the executor */
+  virtual ~XmlLoadParam()
+  {
+    this->setDescriptionValues(OperateClass::staticClassID(), executor->getParamCount(), executor->getDefaultValues(), executor->hasRetVal());
+    (*this->executor)(this->object, this->loadElem);
+    delete this->executor;
+  }
+
+  /** @param descriptionText the description @returns self @brief describes the Loading parameter. */
+  XmlLoadParam& describe(const std::string& descriptionText) { LoadParamBase::describe(OperateClass::staticClassID(), descriptionText); return *this; };
+
+private:
+  OperateClass*                        object;         //!< The Object to apply this to.
+  Executor<const TiXmlElement*>*    executor;       //!< The Executor, that does the actual loading process.
+};
+
+#endif /* _LOAD_PARAM_XML_H */
Index: trunk/src/lib/util/loading/resource.cc
===================================================================
--- trunk/src/lib/util/loading/resource.cc	(revision 9682)
+++ trunk/src/lib/util/loading/resource.cc	(revision 9869)
@@ -14,25 +14,279 @@
 */
 
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
 
 #include "resource.h"
-
-
-
-
-/**
- * standard constructor
-*/
-Resource::Resource (const std::string& fileName)
+#include "resource_manager.h"
+
+#include "debug.h"
+
+
+namespace Resources
 {
-//   this->setClassID(CL_RESOURCE, "Resource");
-
+  //! Define an ObjectList for the Resources
+  ObjectListDefinition(Resource);
+
+
+  /**
+   * @brief standard constructor
+   * @param type the Type this resource belongs to.
+   */
+  Resource::Resource (Type* type)
+      : _pointer(NULL), _type(type)
+  {
+    this->registerObject(this, Resource::_objectList);
+  }
+
+  /**
+   * @brief standard deconstructor
+   */
+  Resource::~Resource ()
+  {
+    // delete what has to be deleted here
+  }
+
+  /**
+   * @brief Locates a File inside of the Resources Paths and returns the appended path.
+   *
+   * @param fileName the Name of the file to look for.
+   * @returns the Name of the File prepended with the PAth it is in, if found, empty String ("") otherwise.
+   *
+   * This Function searches in (ordered):
+   * 1. mainGlobalPath (from ResourceManger)
+   * 2. all of the global Paths (from ResourceManger)
+   * 3. all of the Resources Paths (from Resources::Type)
+   *
+   * in each of these directory, first "./" is searched, and afterwards all of the subDirs (from Resources::Type) are searched.
+   *
+   * @todo finish it!!
+   */
+  std::string Resource::locateFile(const std::string& fileName) const
+  {
+    if ((ResourceManager::getInstance()->mainGlobalPath() + File(fileName)).exists() )
+      return (ResourceManager::getInstance()->mainGlobalPath() + File(fileName)).name();
+
+    std::string locatedFile;
+    locatedFile = locateFileInSubDir(ResourceManager::getInstance()->mainGlobalPath(), fileName);
+    if (!locatedFile.empty())
+    {
+      return locatedFile;
+    }
+
+    if (File(fileName).exists())
+      return fileName;
+
+    return (ResourceManager::getInstance()->mainGlobalPath() + File(fileName)).name();
+  }
+
+  /**
+   * @brief tests in all the SubDirectories defined in Resource under Directory if the fileName exists.
+   * @param directory the directory to in what to search for all subdirectories for.
+   * @param fileName the Name of the File to query for
+   * @return true on success.
+   */
+  std::string Resource::locateFileInSubDir(const Directory& directory, const std::string& fileName) const
+  {
+    std::vector<Directory>::const_iterator it;
+    for (it = this->_type->resourceSubPaths().begin(); it != this->_type->resourceSubPaths().end(); ++it)
+    {
+      Directory dir = directory + (*it);
+      File file = dir + File(fileName);
+      if ((dir+ File(fileName)).exists())
+        return (dir+File(fileName)).name();
+    }
+    return "";
+  }
+
+
+  /**
+   * @param loadString the Identifier of the Resource.
+   * @returns a Store-Pointer to the Resource if found, NULL otherwise
+   */
+  StorePointer* Resource::acquireResource(const std::string& loadString)
+  {
+    //const Type* const type = _resourceTypes[this->_type->id()];
+
+    for (unsigned int i = 0; i < _type->storedResources().size(); ++i)
+    {
+      if (_type->storedResources()[i]->loadString() == loadString)
+        return _type->storedResources()[i];
+    }
+
+    return NULL;
+  }
+
+  /**
+   * @brief registers a StorePointer to a Resource's Type.
+   * @param pointer the StorePointer to register.
+   */
+  void Resource::addResource(StorePointer* pointer)
+  {
+    assert(pointer != NULL);
+    this->_type->addResource(pointer);
+  }
+
+
+
+
+
+
+  ///////////////////
+  //// KEEPLEVEL ////
+  ///////////////////
+
+  //! Constructs a default KeepLevel as Set in the ResourceManager via setDefaultKeepLevel.
+  KeepLevel::KeepLevel()
+  {
+    this->_keepLevel = ResourceManager::getInstance()->defaultKeepLevel().keepLevel();
+  }
+  /**
+   * @param keepLevel the level to set.
+   */
+  KeepLevel::KeepLevel(unsigned int keepLevel)
+  {
+    _keepLevel = keepLevel;
+  }
+
+  /**
+   * @brief constructor of a KeepLevel.
+   * @param keepLevelName the Name of the KeepLevel. Must be one Name of the defined Names in the ResourceManager.
+   *
+   * @note the Name is transformed into an Integer for fast interpretation.
+   */
+  KeepLevel::KeepLevel(const std::string& keepLevelName)
+  {
+    this->_keepLevel = ResourceManager::getInstance()->getKeepLevelID(keepLevelName);
+  }
+
+  /**
+   * @returns the name of the KeepLevel.
+   */
+  const std::string& KeepLevel::name() const
+  {
+    return ResourceManager::getInstance()->getKeepLevelName(this->_keepLevel);
+  }
+
+
+
+  ///////////////////////
+  //// STORE POINTER ////
+  ///////////////////////
+  /**
+   * @brief allocates a StorePointer.
+   * @param loadString An identifier String that is unique between all resources of this type.
+   * @param keepLevel the KeepLevel at wich to keep this resource.
+   */
+  StorePointer::StorePointer(const std::string& loadString, const KeepLevel& keeplevel)
+      : _loadString(loadString), _keepLevel(keeplevel)
+  {
+    PRINTF(4)("Acquired a Resource with LoadString '%s' and KeepLevel '%s'\n", _loadString.c_str(), _keepLevel.name().c_str());
+  }
+
+  StorePointer::~StorePointer()
+  {
+    PRINTF(4)("Deleting Stored Resource '%s' from KeepLevel '%s'\n", _loadString.c_str(), _keepLevel.name().c_str());
+  };
+
+
+
+  //////////////
+  //// TYPE ////
+  //////////////
+  /**
+   * @brief allocates a Type.
+   * @param typeName the Name of the Type to be stored in this Container.
+   */
+  Type::Type(const std::string& typeName)
+      : _typeName(typeName)
+  {
+    ResourceManager::getInstance()->registerType(this);
+    PRINTF(4)("Created ResourceType '%s'\n", typeName.c_str());
+  }
+
+  //! Destructs a Type.
+  Type::~Type()
+  {
+    ResourceManager::getInstance()->unregisterType(this);
+  }
+
+  /**
+   * @brief adds a Resource to this Resource's type.
+   * @param resource the Resource to add.
+   */
+  void Type::addResource(StorePointer* resource)
+  {
+    this->_storedResources.push_back(resource);
+  }
+
+  /**
+   * @brief adds a Path to the Type's resource-paths.
+   * @param path the path-name to add.
+   */
+  bool Type::addResourcePath(const std::string& path)
+  {
+    std::vector<Directory>::const_iterator it;
+    for (it = this->_resourcePaths.begin(); it != this->_resourcePaths.end(); ++it)
+      if ((*it) == path)
+        return false;
+    this->_resourcePaths.push_back(path);
+    return true;
+
+  }
+
+  /**
+   * @brief Adds a SubPath to the Type's resource-subpaths.
+   * @param subPath the subpath to add.
+   */
+  bool Type::addResourceSubPath(const std::string& subPath)
+  {
+    std::vector<Directory>::const_iterator it;
+    for (it = this->_resourceSubPaths.begin(); it != this->_resourceSubPaths.end(); ++it)
+      if ((*it) == subPath)
+        return false;
+    this->_resourceSubPaths.push_back(subPath);
+    return true;
+  }
+
+  /**
+   * @brief Unloads all Resources below a certain Level.
+   * @param keepLevel the KeepLevel at what to remove the Resources from.
+   */
+  void Type::unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel)
+  {
+    std::vector<Resources::StorePointer*>::iterator it, it2;
+    bool finished = false;
+
+    while (!finished)
+    {
+      finished = true;
+      for (it = this->_storedResources.begin(); it != this->_storedResources.end();++it)
+        if((*it)->keepLevel() < keepLevel && (*it)->last())
+        {
+          delete (*it);
+          this->_storedResources.erase(it);
+          finished = false;
+          break;
+        }
+    }
+  }
+
+  /**
+   * @brief print out some nice Debug information in a beatifully designed style
+   */
+  void Type::debug() const
+  {
+    PRINT(0)(" ResourceType '%s' stores %d Resources\n", this->_typeName.c_str(), this->_storedResources.size());
+    PRINT(0)("  Paths:\n");
+    for (unsigned int i = 0; i < this->_resourcePaths.size(); ++i)
+      PRINT(0)("    %s\n", this->_resourcePaths[i].name().c_str());
+    PRINT(0)("  Sub-Paths:");
+    for (unsigned int i = 0; i < this->_resourceSubPaths.size(); ++i)
+      PRINT(0)(" '%s'", this->_resourceSubPaths[i].name().c_str());
+    PRINT(0)("\n");
+
+    PRINT(0)("  Loaded Resources:\n");
+    std::vector<Resources::StorePointer*>::const_iterator it;
+    for (it = this->_storedResources.begin(); it != this->_storedResources.end(); ++it)
+      PRINT(0)("    '%s' : KeepLevel '%s'\n", (*it)->loadString().c_str(), (*it)->keepLevel().name().c_str());
+  }
 }
-
-/**
- * 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 9682)
+++ trunk/src/lib/util/loading/resource.h	(revision 9869)
@@ -8,51 +8,188 @@
 
 #include "base_object.h"
-#include "multi_type.h"
 #include <string>
+#include <vector>
+#include <set>
 
-// FORWARD DECLARATION
+#include "filesys/directory.h"
+
+//! A Namespace Resources and ResourceHandling is defined in.
+namespace Resources
+{
+  //! The KeepLevel handles the unloading of Resources.
+  /**
+   * Allocating a Resource also appends a KeepLevel to the Resource.
+   * When the Resource is not used anymore it is decided on the grounds of the KeepLevel,
+   * if the Resource should be deleted. (e.g. at the end of a Level, Campaign, or something like this).
+   */
+  class KeepLevel
+  {
+  public:
+    KeepLevel();
+    KeepLevel(unsigned int keepLevel);
+    KeepLevel(const std::string& keepLevelName);
+
+    //! Compare equality
+    inline bool operator==(const KeepLevel& keepLevel) const { return this->_keepLevel == keepLevel._keepLevel; };
+    //! Compares inequality
+    inline bool operator!=(const KeepLevel& keepLevel) const { return this->_keepLevel != keepLevel._keepLevel; };
+    //! Compares less/equal than
+    inline bool operator<=(const KeepLevel& keepLevel) const { return this->_keepLevel <= keepLevel._keepLevel; };
+    //! Compares less than
+    inline bool operator<(const KeepLevel& keepLevel) const { return this->_keepLevel < keepLevel._keepLevel; };
+
+    /** @returns the KeepLevel as a number */
+    inline unsigned int keepLevel() const { return _keepLevel; };
+    const std::string& name() const;
+  private:
+    unsigned int                _keepLevel;              //!< The KeepLevel a Resource is in.
+  };
+
+
+  ///////////////////
+  // STORE POINTER //
+  ///////////////////
+  //! Stores a Resource-Pointer, the LoadString and it's keepLevel.
+  class StorePointer
+  {
+  public:
+    //! Virtual Destructor, that removes the Stored information-pointer.
+    virtual ~StorePointer();
+
+    /** @returns the LoadString this resource was loaded with */
+    const std::string& loadString() const { return _loadString; };
+    /** @returns the KeepLevel of this resource */
+    const Resources::KeepLevel& keepLevel() const { return _keepLevel; };
+
+    virtual bool last() const = 0;
+
+    protected:
+      StorePointer(const std::string& loadString, const Resources::KeepLevel& keeplevel);
+
+    private:
+      StorePointer(const StorePointer&) : _keepLevel(0) {};
+
+  private:
+    std::string                 _loadString;             //!< An identifier, to match when loading a File.
+    Resources::KeepLevel        _keepLevel;              //!< The Priority of this resource. (can only be increased, so none else will delete this)
+  };
 
 
 
-//! An enumerator for different (UN)LOAD-types.
-/**
- * RP_NO:        will be unloaded on request
- * RP_LEVEL:     will be unloaded at the end of a Level
- * RP_CAMPAIGN:  will be unloaded at the end of a Campaign
- * RP_GAME:      will be unloaded at the end of the whole Game (when closing orxonox)
- */
-typedef enum ResourcePriority
-{
-  RP_NO        =   0,
-  RP_LEVEL     =   1,
-  RP_CAMPAIGN  =   2,
-  RP_GAME      =   3
-};
+  ///////////////////
+  // RESOURCE TYPE //
+  ///////////////////
+  //! A Type of Resources.
+  /**
+   * The Type is used to store the Pointers to already loaded Resources,
+   * and also to store type-specific properties.
+   * These are the Loading Paths, the subpaths and so on.
+   */
+  class Type
+  {
+  public:
+    virtual ~Type();
+    /** @returns true if the names match @param typeName the Name to compare. @brief compare the Type with a Name */
+    bool operator==(const std::string& typeName) const { return this->_typeName == typeName; };
+
+    ////////////////////
+    //// EXTENSIONS ////
+    void addExtension(const std::string& extension);
+
+    ///////////////
+    //// PATHS ////
+    bool addResourcePath(const std::string& path);
+    bool addResourceSubPath(const std::string& subPath);
+
+    /// Retrieve Functions
+    /** @returns the name of the stored Class this Type loads Resources for */
+    const std::string& storedClassName() const { return _typeName; };
+    /** @returns the ID of the Type != ClassID */
+    /** @returns the type-specific paths this Resource searches in. */
+    const std::vector<Directory>& resourcePaths() const { return _resourcePaths; };
+    /** @returns the Type specific SubPaths this Resource Searches in @see std::vector<std::string>  _resourceSubPaths */
+    const std::vector<Directory>& resourceSubPaths() const { return _resourceSubPaths; };
+    /** @returns the Pointers to the Stored resources. @note do not use this, for more than some lookup */
+    const std::vector<Resources::StorePointer*>& storedResources() const { return _storedResources; };
+
+    ///////////////////////////////
+    //// LOADING AND UNLOADING ////
+    virtual void createFromString(const std::string& loadString, const KeepLevel& keepLevel = KeepLevel()) = 0;
+    void unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel);
+
+    ///////////////////
+    //// INTERNALS ////
+    void addResource(Resources::StorePointer* resource);
+
+    ///////////////
+    //// DEBUG ////
+    void debug() const;
+
+  protected:
+    Type(const std::string& typeName);
+
+  private:
+    Type(const Type& type) {};
+  private:
+    const std::string                     _typeName;          //!< Name of the Type. (Name of the Resource this loads.)
+    std::vector<Directory>                _resourcePaths;     //!< The Paths to search for files in this type
+    std::vector<Directory>                _resourceSubPaths;  //!< The subpaths that will be searched under all the _resourcePaths.
+    std::vector<std::string>              _fileExtensions;    //!< File Extensions, this Resource supports.
+
+    std::vector<Resources::StorePointer*> _storedResources;   //!< An array of all the stored Resources.
+  };
+
+  /**
+   * @brief A Type Definition Class for any Object that is resourceable.
+   *
+   * This Class's main reason of Existence is, that resources can be dynamically
+   * created over a loadString. For this the Type of Resource is required, and the Resource must
+   * itself support the 'void createFromString(const std::string&)' function.
+   */
+  template<class T> class tType : public Type
+  {
+  public:
+    /** Create the ResourceType @see Type(const std::string&) */
+    tType(const std::string& typeName) : Type(typeName) {};
+    /** @param loadString the String to load a Resource with @brief tries to create a Resource of Type T with a loadString */
+    virtual void createFromString(const std::string& loadString, const KeepLevel& keepLevel = KeepLevel()) { T::createFromString(loadString, keepLevel); }
+  };
 
 
 
-//! A Resource is an Object, that can be loaded from Disk
-/**
- *
- */
-class Resource : virtual public BaseObject {
+  /////////////////////
+  // RESOURCE ITSELF //
+  /////////////////////
+  //! A Resource is an Object, that can be loaded from Disk
+  /**
+   * The Resource Hanldes the location and stores pointers to data that can be retrieved.
+   */
+  class Resource : virtual public BaseObject
+  {
+    ObjectListDeclaration(Resource);
 
- public:
-   Resource(const std::string& fileName);
-  virtual ~Resource();
+  public:
+    Resource(Resources::Type* type);
+    virtual ~Resource();
 
-  virtual bool load(std::string& fileName, const MultiType& param1, const MultiType& param2);
-  virtual bool reload();
-  virtual bool unload();
+    /** @brief reloads the underlying resource */
+    virtual bool reload() { return false; };
+    /** @brief unloads the underlying Resource */
+    virtual bool unload() { return false; };
 
- private:
-   std::string       fileName;
+    std::string locateFile(const std::string& fileName) const;
 
-   unsigned int      referenceCount;    //!< How many times this Resource has been loaded.
-/// TODO REMOVE THIS:   ResourceType      type;              //!< ResourceType of this Resource.
-   ResourcePriority  prio;              //!< The Priority of this resource. (can only be increased, so noone else will delete this)
+  protected:
+    Resources::StorePointer* acquireResource(const std::string& loadString);
+    void addResource(Resources::StorePointer* pointer);
 
-   MultiType         param[3];          //!< The Parameters given to this Resource.
-};
+  private:
+    std::string locateFileInSubDir(const Directory& directory, const std::string& fileName) const;
+
+  private:
+    Resources::StorePointer*       _pointer;                         //!< Virtual Pointer to the ResourceData.
+    Resources::Type*               _type;                            //!< Type of the Resource.
+  };
+}
 
 #endif /* _RESOURCE_H */
Index: trunk/src/lib/util/loading/resource_manager.cc
===================================================================
--- trunk/src/lib/util/loading/resource_manager.cc	(revision 9682)
+++ trunk/src/lib/util/loading/resource_manager.cc	(revision 9869)
@@ -16,903 +16,241 @@
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
 
-#include "util/loading/resource_manager.h"
-#include "substring.h"
+#include "resource_manager.h"
 #include "debug.h"
 
 #include <algorithm>
-#include <assert.h>
-
-// different resource Types
-#ifndef NO_MODEL
-#include "objModel.h"
-#include "primitive_model.h"
-#include "md2/md2Model.h"
-#include "md3/md3_data.h"
-#include "md3/md3_animation_cfg.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>
-
-
-
-/**
- * @brief standard constructor
-*/
-ResourceManager::ResourceManager ()
+#include <cassert>
+
+
+namespace Resources
 {
-  this->setClassID(CL_RESOURCE_MANAGER, "ResourceManager");
-  this->setName("ResourceManager");
-
-  this->dataDir = "./";
-  this->tryDataDir("./data");
+  /// Definition of the ResourceManager's ObjectList.
+  ObjectListDefinition(ResourceManager);
+  //! Singleton Reference to the ResourceManager
+  ResourceManager* ResourceManager::_singletonRef = NULL;
+
+
+  /**
+   * @brief standard constructor
+  */
+  ResourceManager::ResourceManager ()
+  : _defaultKeepLevel(0)
+  {
+    this->registerObject(this, ResourceManager::_objectList);
+    this->setName("ResourceManager");
+    this->_mainGlobalPath = Directory("./");
+  }
+
+
+  /**
+   * @brief standard destructor
+  */
+  ResourceManager::~ResourceManager ()
+  {
+    this->unloadAllBelowKeepLevel(this->_keepLevelNames.size());
+    ResourceManager::_singletonRef = NULL;
+  }
+
+  /**
+   * @brief Registers a new Type to the ResourceManager.
+   * @param type the Type to register.
+   */
+  void ResourceManager::registerType(Resources::Type* type)
+  {
+    this->_resourceTypes.push_back(type);
+    PRINTF(5)("ResourceType '%s' added\n", type->storedClassName().c_str());
+  }
+
+  /**
+   * @brief Unregisters a new Type to the ResourceManager.
+   * @param type the Type to unregister.
+   */
+  void ResourceManager::unregisterType(Resources::Type* type)
+  {
+    std::vector<Resources::Type*>::iterator it = std::find (this->_resourceTypes.begin(), this->_resourceTypes.end(), type);
+    if (it != this->_resourceTypes.end())
+    {
+      this->_resourceTypes.erase(it);
+      PRINTF(5)("ResourceType '%s' removed\n", type->storedClassName().c_str());
+    }
+  }
+
+  /**
+   * @brief Sets the main Global path (the main path Resources are searched for)
+   * @param directory the directory to set.
+   * @see Resource::locateFile
+   */
+  void ResourceManager::setMainGlobalPath(const Directory& directory)
+  {
+    this->_mainGlobalPath = directory;
+    this->_mainGlobalPath.open();
+  }
+
+  /**
+   * @brief add a Global search path. (global paths besided the main path.)
+   * @param directory a directory to add.
+   */
+  void ResourceManager::addGlobalPath(const Directory& directory)
+  {
+    std::vector<Directory>::const_iterator it = std::find(this->_globalPaths.begin(), this->_globalPaths.end(), directory);
+    if (it == this->_globalPaths.end())
+      this->_globalPaths.push_back(directory);
+  }
+
+  /**
+   * @brief add a ResourcePath to a Type's Paths.
+   * @param resourceName the Type's name of Resource to add the path to.
+   * @param pathName pathName the Name of the path to add.
+   * @return true on success. (if a path was added (no duplicate, and resourceName existed).
+   */
+  bool ResourceManager::addResourcePath(const std::string& resourceName, const std::string& pathName)
+  {
+    std::vector<Resources::Type*>::iterator it;
+    for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it)
+      if (*(*it) == resourceName)
+        return (*it)->addResourcePath(pathName);
+    PRINTF(2)("ResourcePath %s could not be added to the ResourceType %s\n", pathName.c_str(), resourceName.c_str());
+    return false;
+  }
+
+  /**
+   * @brief add a ResourcePath to a Type's SubPaths.
+   * @param resourceName the Type's name of Resource to add the subpath to.
+   * @param pathName pathName the Name of the path to add.
+   * @return true on success. (if a path was added (no duplicate, and resourceName existed).
+   */
+  bool ResourceManager::addResourceSubPath(const std::string& resourceName, const std::string& pathName)
+  {
+    std::vector<Resources::Type*>::iterator it;
+    for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it)
+      if (*(*it) == resourceName)
+        return (*it)->addResourceSubPath(pathName);
+    PRINTF(2)("ResourceSubPath %s could not be added to the ResourceType %s\n", pathName.c_str(), resourceName.c_str());
+    return false;
+  }
+
+  /**
+   * @brief checks wether a File is inside of the MainPath.
+   * @param fileInside the file to check
+   * @return true if the file is inside.
+   */
+  bool ResourceManager::checkFileInMainPath(const File& fileInside)
+  {
+    return (this->_mainGlobalPath + fileInside).exists();
+  }
+
+  /**
+   * @brief prepends the fileName by the MainGlobalPath (same as mainGlobalPath + '/' + fileName).
+   * @param fileName The FileName to prepend
+   * @returns the prepended file-name
+   */
+  std::string ResourceManager::prependAbsoluteMainPath(const std::string& fileName)
+  {
+    return (this->_mainGlobalPath + File(fileName)).name();
+  }
+
+  /**
+   * @brief add a KeepLevelName (this function just counts upwards).
+   * @param keepLevelName the Name of the KeepLevel to set.
+   * @returns the Level the Name was set to.
+   */
+  unsigned int ResourceManager::addKeepLevelName(const std::string& keepLevelName)
+  {
+    this->_keepLevelNames.push_back(keepLevelName);
+    return _keepLevelNames.size()-1;
+  }
+
+  /**
+   * @param keepLevelName the Name of the KeepLevel.
+   * @returns the ID of the KeepLevel named keepLevelName
+   */
+  unsigned int ResourceManager::getKeepLevelID(const std::string& keepLevelName) const
+  {
+    for (unsigned int i = 0; i < this->_keepLevelNames.size(); ++i)
+      if (this->_keepLevelNames[i] == keepLevelName)
+        return i;
+
+    PRINTF(2)("KeepLevel '%s' not found. Using 0 instead\n", keepLevelName.c_str());
+    return 0;
+  }
+
+  /**
+   * @param keepLevelID the ID to check.
+   * @return the name of the KeepLevel.
+   */
+  const std::string& ResourceManager::getKeepLevelName(unsigned int keepLevelID) const
+  {
+    assert(keepLevelID < this->_keepLevelNames.size());
+    return this->_keepLevelNames[keepLevelID];
+  }
+
+
+  /**
+   * @brief loads a Resource from a TypeName and a loadString.
+   * @param resourceTypeName The Name of the Type to what to load a Resource from.
+   * @param loadString the loadString to load in the Type.
+   */
+  void ResourceManager::loadFromLoadString(const std::string& resourceTypeName, const std::string& loadString, const KeepLevel& keepLevel)
+  {
+    std::vector<Resources::Type*>::const_iterator it;
+    for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it)
+    {
+      if (*(*it) == resourceTypeName)
+      {
+	(*it)->createFromString(loadString, keepLevel);
+	/// TODO check if the resource was allocated!!
+	return ;
+      }
+    }
+    return ;
+  }
+
+  /**
+   * @brief unloads all Resources below a certain threshhold.
+   * @param keepLevel the KeepLevel below which to erase.
+   *
+   * @not Resources will only be erased, if th keepLevel is below, and the resources are not
+   * referenced anymore.
+   */
+  void ResourceManager::unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel)
+  {
+    std::vector<Resources::Type*>::const_iterator it;
+    for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it)
+    {
+      (*it)->unloadAllBelowKeepLevel(keepLevel);
+    }
+  }
+
+
+  /**
+   * @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");
+    PRINT(0)(" MainGlobal search path is %s\n", this->_mainGlobalPath.name().c_str());
+    if(!this->_globalPaths.empty())
+    {
+      PRINT(0)(" Additional Global search Paths are: ");
+      for (unsigned int i = 0; i < this->_globalPaths.size(); ++i)
+        PRINT(0)("'%s' ", this->_globalPaths[i].name().c_str());
+      PRINT(0)("\n");
+    }
+    PRINT(0)(" Listing %d Types: \n", this->_resourceTypes.size());
+    std::vector<Resources::Type*>::const_iterator it;
+    for (it = this->_resourceTypes.begin(); it != this->_resourceTypes.end(); ++it)
+    {
+      (*it)->debug();
+      if (it != --this->_resourceTypes.end())
+        PRINT(0)(" ------------------------------------\n ");
+    }
+
+    PRINT(0)("KeepLevels are: ");
+    for (unsigned int i = 0; i < this->_keepLevelNames.size(); ++i)
+      PRINT(0)("%d:'%s'  ", i, this->_keepLevelNames[i].c_str());
+    PRINT(0)("\n");
+    PRINT(0)("=================================RM==/\n");
+  }
 }
-
-//! 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());
-
-  ResourceManager::singletonRef = NULL;
-}
-
-/**
- * @brief sets the data main directory
- * @param dataDir the DataDirectory.
- */
-bool ResourceManager::setDataDir(const std::string& dataDir)
-{
-  File dataDirectory(dataDir);
-  if (dataDirectory.isDirectory())
-  {
-    this->dataDir = dataDirectory.name();
-
-    if (dataDir[dataDir.size()-1] != '/' && dataDir[dataDir.size()-1] != '\\')
-    {
-      this->dataDir += '/';
-    }
-    return true;
-  }
-  else
-  {
-    PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", dataDir.c_str(), this->dataDir.c_str());
-    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 std::string& dataDir)
-{
-  File dataDirectory(dataDir);
-  if (dataDirectory.isDirectory())
-  {
-    this->dataDir = dataDirectory.name();
-
-    if (dataDir[dataDir.size()-1] != '/' && dataDir[dataDir.size()-1] != '\\')
-    {
-      this->dataDir += '/';
-    }
-    return true;
-  }
-  return false;
-}
-
-
-/**
- * @brief checks for the DataDirectory, by looking if
- * @param fileInside is iniside of the given directory.
-*/
-bool ResourceManager::verifyDataDir(const std::string& fileInside)
-{
-  File dataDirectory(this->dataDir);
-  if (!dataDirectory.isDirectory())
-  {
-    PRINTF(1)("'%s' is not a directory\n", this->dataDir.c_str());
-    return false;
-  }
-
-  File testFile(this->dataDir + fileInside);
-  return testFile.isFile();
-}
-
-#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 std::string& imageDir)
-{
-  std::string newDir = imageDir;
-  if (imageDir[imageDir.size()-1] != '/' && imageDir[imageDir.size()-1] != '\\')
-  {
-    newDir += '/';
-  }
-  // check if the param is a Directory
-  if (File(newDir).isDirectory())
-  {
-    // check if the Directory has been added before
-    std::vector<std::string>::const_iterator imageDir;
-    for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
-    {
-      if (*imageDir == newDir)
-      {
-        PRINTF(3)("Path %s already loaded\n", newDir.c_str());
-        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.c_str());
-    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 std::string& fileName, ResourcePriority prio,
-                                  const MultiType& param0, const MultiType& param1, const MultiType& param2)
-{
-  ResourceType tmpType;
-#ifndef NO_MODEL
-#define __IF_OK
-  if (!strncasecmp(fileName.c_str()+(fileName.size()-4), ".obj", 4))
-    tmpType = OBJ;
-  else if (!strncmp(fileName.c_str()+(fileName.size()-4), ".md2", 4))
-    tmpType = MD2;
-  else if (!strncmp(fileName.c_str()+(fileName.size()-4), ".md3", 4))
-    tmpType = MD3;
-  else if (!strncmp(fileName.c_str()+(fileName.size()-4), ".cfg", 4))
-    tmpType = MD3_CONFIG;
-  else if (!strcasecmp(fileName.c_str(), "cube") ||
-            !strcasecmp(fileName.c_str(), "sphere") ||
-            !strcasecmp(fileName.c_str(), "plane") ||
-            !strcasecmp(fileName.c_str(), "cylinder") ||
-            !strcasecmp(fileName.c_str(), "cone"))
-    tmpType = PRIM;
-#endif /* NO_MODEL */
-#ifndef NO_AUDIO
-#ifdef __IF_OK
-  else
-#endif
-#define __IF_OK
-    if (!strncasecmp(fileName.c_str()+(fileName.size()-4), ".wav", 4))
-      tmpType = WAV;
-    else if (!strncasecmp(fileName.c_str()+(fileName.size()-4), ".mp3", 4))
-      tmpType = MP3;
-    else if (!strncasecmp(fileName.c_str()+(fileName.size()-4), ".ogg", 4))
-      tmpType = OGG;
-#endif /* NO_AUDIO */
-#ifndef NO_TEXT
-#ifdef __IF_OK
-    else
-#endif
-#define __IF_OK
-      if (!strncasecmp(fileName.c_str()+(fileName.size()-4), ".ttf", 4))
-        tmpType = TTF;
-#endif /* NO_TEXT */
-#ifndef NO_SHADERS
-#ifdef __IF_OK
-      else
-#endif
-#define __IF_OK
-        if (!strncasecmp(fileName.c_str()+(fileName.size()-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 std::string& fileName, ResourceType type, ResourcePriority prio,
-                            const MultiType& param0, const MultiType& param1, const MultiType& param2)
-{
-  // 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 std::string& fileName, ResourceType type, ResourcePriority prio,
-                                  const MultiType& param0, const MultiType& param1, const MultiType& param2)
-{
-
-  // 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 std::string& 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 = fileName;
-
-  // creating the full name. (directoryName + FileName)
-  std::string 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(File(fullName).isFile())
-        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.c_str(), dataDir.c_str());
-        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 (tmpResource->name == "cube")
-        tmpResource->pointer = new PrimitiveModel(PRIM_CUBE, tmpResource->param[0].getFloat());
-      else if (tmpResource->name == "sphere")
-        tmpResource->pointer = new PrimitiveModel(PRIM_SPHERE, tmpResource->param[0].getFloat());
-      else if (tmpResource->name == "plane")
-        tmpResource->pointer = new PrimitiveModel(PRIM_PLANE, tmpResource->param[0].getFloat());
-      else if (tmpResource->name == "cylinder")
-        tmpResource->pointer = new PrimitiveModel(PRIM_CYLINDER, tmpResource->param[0].getFloat());
-      else if (tmpResource->name == "cone")
-        tmpResource->pointer = new PrimitiveModel(PRIM_CONE, tmpResource->param[0].getFloat());
-      break;
-    case MD2:
-      if(File(fullName).isFile())
-      {
-        tmpResource->param[0] = param0;
-        tmpResource->param[1] = param1;
-        tmpResource->pointer = new MD2Data(fullName, tmpResource->param[0].getCString(), tmpResource->param[1].getFloat());
-      }
-      break;
-    case MD3:
-      if(File(fullName).isFile())
-      {
-        tmpResource->param[0] = param0;
-        tmpResource->param[1] = param1;
-        tmpResource->pointer = new md3::MD3Data(fullName, tmpResource->param[0].getCString(), tmpResource->param[1].getFloat());
-      }
-      break;
-    case MD3_CONFIG:
-      if(File(fullName).isFile())
-      {
-        tmpResource->param[0] = param0;
-        tmpResource->param[1] = param1;
-        tmpResource->pointer = new md3::MD3AnimationCfg(fullName);
-      }
-      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(File(fullName).isFile())
-        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.c_str(), this->dataDir.c_str());
-      break;
-#endif /* NO_TEXT */
-#ifndef NO_AUDIO
-    case WAV:
-      if(File(fullName).isFile())
-        tmpResource->pointer = new OrxSound::SoundBuffer(fullName);
-      break;
-    case OGG:
-      if (File(fullName).isFile())
-        tmpResource->pointer = new OrxSound::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(File(fullName).isFile())
-      {
-        PRINTF(4)("Image %s resides to %s\n", fileName.c_str(), fullName.c_str());
-        tmpResource->pointer = new Texture(fullName, tmpResource->param[0].getInt());
-      }
-      else
-      {
-        std::vector<std::string>::iterator imageDir;
-        for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
-        {
-          std::string imgName = *imageDir + fileName;
-          if(File(imgName).isFile())
-          {
-            PRINTF(4)("Image %s resides to %s\n", fileName.c_str(), imgName.c_str());
-            tmpResource->pointer = new Texture(imgName, tmpResource->param[0].getInt());
-            break;
-          }
-        }
-      }
-      if(!tmpResource)
-        PRINTF(2)("!!Image %s not Found!!\n", fileName.c_str());
-      break;
-#endif /* NO_TEXTURES */
-#ifndef NO_SHADERS
-    case SHADER:
-      if(File(fullName).isFile())
-      {
-        if (param0 != MT_NULL)
-        {
-          MultiType param = param0; /// HACK
-          std::string secFullName = ResourceManager::getFullName(param.getCString());
-          if (File(secFullName).isFile())
-          {
-            tmpResource->param[0] = secFullName;
-            tmpResource->pointer = new Shader(fullName, secFullName);
-          }
-        }
-        else
-        {
-          tmpResource->param[0] = param0;
-          tmpResource->pointer = new Shader(fullName, "");
-        }
-      }
-      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.c_str());
-      break;
-  }
-  if (tmpResource->pointer != NULL)
-    this->resourceList.push_back(tmpResource);
-
-  if (tmpResource->pointer != NULL)
-    return tmpResource;
-  else
-  {
-    PRINTF(2)("Resource %s could not be loaded\n", fileName.c_str());
-    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.c_str());
-      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.c_str(), resource->count);
-  }
-  else
-    PRINTF(4)("not deleting resource %s because DeleteLevel to high\n", resource->name.c_str());
-  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)
-{
-  bool removedAll = true;
-  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.c_str(), this->resourceList[index]->count);
-            removedAll = false;
-          }
-          removeCount++;
-        }
-      }
-      index--;
-    }
-    if (removeCount == 0) break;
-  }
-  return removedAll;
-}
-
-
-/**
- * @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 std::string& 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 && 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;
-        case MD3:
-          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;
-        case MD3_CONFIG:
-          if (param0 == MT_NULL && ((*resource)->param[0] == ""))
-            match = true;
-          else if ((*resource)->param[0] == ((MultiType)param0).getString())
-            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;
-}
-
-std::string ResourceManager::toResourcableString(unsigned int i)
-{
-/*  int len = strlen(ResourceManager::ResourceTypeToChar(this->resourceList[i]->type));
-  len += this->resourceList[i]->name.size();
-  if (this->resourceList[i]->param[0].getCString()) len += strlen(this->resourceList[i]->param[0].getCString()) +1;
-  if (this->resourceList[i]->param[1].getCString()) len += strlen(this->resourceList[i]->param[1].getCString()) +1;
-  if (this->resourceList[i]->param[2].getCString()) len += strlen(this->resourceList[i]->param[2].getCString()) +1;
-  len += 10;
-  std::string 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].getCString() && this->resourceList[i]->param[0].getCString() != '\0')
-  {
-    strcat(tmp,",");
-    strcat( tmp, this->resourceList[i]->param[0].getCString());
-  }
-  if (this->resourceList[i]->param[1].getCString() && this->resourceList[i]->param[1].getCString() != '\0')
-  {
-    strcat(tmp,",");
-    strcat( tmp, this->resourceList[i]->param[1].getCString());
-  }
-  if (this->resourceList[i]->param[2].getCString() && this->resourceList[i]->param[2].getCString() != '\0')
-  {
-    strcat(tmp,",");
-    strcat( tmp, this->resourceList[i]->param[2].getCString());
-  }
-  return tmp;*/
-  return "";
-}
-
-/**
- * @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 std::string& 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]);*/
-  return false;
-}
-
-
-/**
- * @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!!
-*/
-std::string ResourceManager::getFullName(const std::string& fileName)
-{
-  if (fileName.empty() || ResourceManager::getInstance()->getDataDir().empty())
-    return "";
-
-  std::string retName = ResourceManager::getInstance()->getDataDir() +fileName;
-  if (File(retName).isFile() || File(retName).isDirectory())
-    return retName;
-  else
-    return "";
-}
-
-
-/**
- * @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 std::string& fileName)
-{
-  if (fileName.empty() || ResourceManager::getInstance()->getDataDir().empty())
-    return false;
-
-  bool retVal = false;
-  std::string checkFile = ResourceManager::getInstance()->getDataDir() + fileName;
-
-  if (File(checkFile).exists())
-    retVal = true;
-  else
-    retVal = false;
-  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.c_str());
-  PRINT(0)(" List of Image-Directories: ");
-  std::vector<std::string>::const_iterator imageDir;
-  for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
-    PRINT(0)("%s ", (*imageDir).c_str());
-  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.c_str(), (*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 std::string& resourceType)
-{
-  for (unsigned int i = 0; i < RESOURCE_TYPE_SIZE; i++)
-    if (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",
-    "MD3-Data",
-    "MD3-Config"
-#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 9682)
+++ trunk/src/lib/util/loading/resource_manager.h	(revision 9869)
@@ -1,157 +1,87 @@
 /*!
  * @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 "resource.h"
 #include "filesys/file.h"
+#include "filesys/directory.h"
 
-#include "multi_type.h"
-#include <vector>
+namespace Resources
+{
 
-//! 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
-  MD3,                  //!< loading md3-file
-  MD3_CONFIG,           //!< the md3 config 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
-};
+  class ResourceManager : public BaseObject
+  {
+    ObjectListDeclaration(ResourceManager);
+  public:
+    ///////////////////////
+    //// INSTANZIATION ////
+    /** @returns a Pointer to the only object of this Class */
+    inline static ResourceManager* getInstance() { if (!_singletonRef) _singletonRef = new ResourceManager();  return _singletonRef; };
+    /** @brief deletes the Instance if it exists. */
+    inline static void deleteInstance() { if (_singletonRef) delete _singletonRef; };
 
-//! 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
-};
+    ////////////////////////
+    //// RESOURCE PATHS ////
+    void setMainGlobalPath(const Directory& directory);
+    void addGlobalPath(const Directory& directory);
 
-//! 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.
+    bool addResourcePath(const std::string& resourceName, const std::string& pathName);
+    bool addResourceSubPath(const std::string& resourceName, const std::string& pathName);
+    void registerType(Resources::Type* type);
+    void unregisterType(Resources::Type* type);
 
-  std::string       name;              //!< Name of the Resource.
-  ResourceType      type;              //!< ResourceType of this Resource.
-  ResourcePriority  prio;              //!< The Priority of this resource. (This will only be increased)
+    /** @returns the main global search Path */
+    const Directory& mainGlobalPath() const { return _mainGlobalPath; };
+    /** @returns all global paths without mainGlobalPath */
+    const std::vector<Directory>& globalPaths() const { return _globalPaths; };
 
-  MultiType         param[3];          //!< The Parameters given to this Resource.
-};
+    ////////////////////
+    //// KEEPLEVELS ////
+    unsigned int addKeepLevelName(const std::string& keepLevelName);
+    unsigned int getKeepLevelID(const std::string& keepLevelName) const;
+    const std::string& getKeepLevelName(unsigned int keepLevelID) const;
+    void setDefaultKeepLevel(const KeepLevel& keepLevel) { this->_defaultKeepLevel = keepLevel; };
+    const KeepLevel& defaultKeepLevel() const { return this->_defaultKeepLevel; };
 
+    //////////////////////////
+    //// GENERAL QUERIES ////
+    /** @returns the Types of Resources */
+    const std::vector<Resources::Type*> resourceTypes() const { return _resourceTypes; };
 
-//! 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 checkFileInMainPath(const File& fileInside);
+    std::string prependAbsoluteMainPath(const std::string& fileName);
 
-  bool setDataDir(const std::string& dataDir);
-  /** @returns the Name of the data directory */
-  inline const std::string& getDataDir() const { return this->dataDir; };
+    ////////////////////////////////////////
+    //// RESOURCE LOADING AND UNLOADING ////
+    void loadFromLoadString(const std::string& resourceTypeName, const std::string& loadString, const KeepLevel& keepLevel = KeepLevel());
+    void loadFromLoadStringHACK(const std::string& resourceTypeName, const std::string& loadString) { this->loadFromLoadString(resourceTypeName, loadString); };
 
+    void unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel);
+    void unloadAllBelowKeepLevelINT(unsigned int level) { unloadAllBelowKeepLevel(level); };
 
-  bool tryDataDir(const std::string& dataDir);
-  bool verifyDataDir(const std::string& fileInside);
-  bool addImageDir(const std::string& imageDir);
+    ///////////////
+    //// DEBUG ////
+    void debug() const;
 
-  bool cache(const std::string& fileName, ResourceType type, ResourcePriority prio = RP_NO,
-             const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
-  BaseObject* copy(BaseObject* resourcePointer);
+  private:
+    ResourceManager();
+    virtual ~ResourceManager();
 
-  BaseObject* load(const std::string& fileName, ResourcePriority prio = RP_NO,
-                   const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
-  BaseObject* load(const std::string& 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);
+  private:
+    static ResourceManager*            _singletonRef;       //!< singleton Reference
 
-  Resource* locateResourceByInfo(const std::string& fileName, ResourceType type,
-                                 const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType()) const;
-  Resource* locateResourceByPointer(const void* pointer) const;
+    Directory                          _mainGlobalPath;     //!< The main include directory (default at "./")
+    std::vector<Directory>             _globalPaths;        //!< Additional Global include directories.
 
-  std::string toResourcableString(unsigned int i);
-  bool fromResourceableString(const std::string& resourceableString);
-  /** @returns the Count of Resources the ResourceManager handles */
-  unsigned int resourceCount() const { return this->resourceList.size(); }
+    std::vector<Resources::Type*>      _resourceTypes;      //!< A Vector of all the stored ResourceTypes @see Resources::Type
 
-  void debug() const;
+    std::vector<std::string>           _keepLevelNames;     //!< Names of KeepLevels @see Resources::KeepLevel
+    KeepLevel                          _defaultKeepLevel;   //!< The default KeepLevel.
+  };
 
-
-  // utility functions for handling files in and around the data-directory
-  static std::string getFullName(const std::string& fileName);
-  static bool isInDataDir(const std::string& fileName);
-
-  static const char* ResourceTypeToChar(ResourceType type);
-  static ResourceType stringToResourceType(const std::string& resourceType);
-
- private:
-  ResourceManager();
-  Resource* loadResource(const std::string& fileName, ResourceType type, ResourcePriority prio,
-                         const MultiType& param0, const MultiType& param1, const MultiType& param2);
-
- private:
-  static ResourceManager*    singletonRef;       //!< singleton Reference
-
-  std::string                dataDir;            //!< The Data Directory, where all relevant Data is stored.
-  std::vector<std::string>   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 */
Index: trunk/src/lib/util/multi_type.cc
===================================================================
--- trunk/src/lib/util/multi_type.cc	(revision 9682)
+++ trunk/src/lib/util/multi_type.cc	(revision 9869)
@@ -33,21 +33,21 @@
   {
     default:
-      this->value.Float = 0.0f;
-      break;
+    this->value.Float = 0.0f;
+    break;
     case MT_BOOL:
-      this->value.Bool = false;
-      break;
+    this->value.Bool = false;
+    break;
     case MT_INT:
-      this->value.Int = 0;
-      break;
+    this->value.Int = 0;
+    break;
     case MT_FLOAT:
-      this->value.Float = 0.0f;
-      break;
+    this->value.Float = 0.0f;
+    break;
     case MT_CHAR:
-      this->value.Char = '\0';
-      break;
+    this->value.Char = '\0';
+    break;
     case MT_STRING:
-      this->storedString = "";
-      break;
+    this->storedString = "";
+    break;
   }
 }
@@ -142,17 +142,17 @@
   {
     case MT_NULL:
-      return true;
+    return true;
     case MT_BOOL:
-      return (this->value.Bool == mt.value.Bool);
+    return (this->value.Bool == mt.value.Bool);
     case MT_INT:
-      return (this->value.Int == mt.value.Int);
+    return (this->value.Int == mt.value.Int);
     case MT_CHAR:
-      return (this->value.Char == mt.value.Char);
+    return (this->value.Char == mt.value.Char);
     case MT_FLOAT:
-      return (this->value.Float == mt.value.Float);
+    return (this->value.Float == mt.value.Float);
     case MT_STRING:
-      return (this->storedString == mt.storedString);
+    return (this->storedString == mt.storedString);
     default:
-      return false;
+    return false;
   }
 }
@@ -171,20 +171,20 @@
   {
     case MT_BOOL:
-      this->setBool(this->getBool());
-      break;
+    this->setBool(this->getBool());
+    break;
     case MT_INT:
-      this->setInt(this->getInt());
-      break;
+    this->setInt(this->getInt());
+    break;
     case MT_FLOAT:
-      this->setFloat(this->getFloat());
-      break;
+    this->setFloat(this->getFloat());
+    break;
     case MT_CHAR:
-      this->setChar(this->getChar());
-      break;
+    this->setChar(this->getChar());
+    break;
     case MT_STRING:
-      this->setString(this->getString());
-      break;
+    this->setString(this->getString());
+    break;
     default:
-      this->type = type;
+    this->type = type;
   }
 }
@@ -195,6 +195,4 @@
  *
  * This is a pure Value copy. The current type will be preserved.
- *
- * @TODO speedup
  */
 void MultiType::setValueOf(const MultiType& mt)
@@ -257,4 +255,13 @@
 }
 
+/**
+ * @brief stores any value to the string.
+ * @note this Value can be grabbed by using the getStoredString function.
+ */
+void MultiType::storeString()
+{
+  if (!(this->type & MT_STRING))
+    this->storedString = this->getString();
+}
 
 /**************************
@@ -275,5 +282,5 @@
   else if (this->type & MT_STRING) return (this->storedString == "true" ||
                                             this->storedString == "TRUE" ||
-                                            this->storedString != "0"); //! @TODO make this better...
+                                            this->storedString != "0"); // TODO make this better...
 
   return false;
@@ -381,13 +388,30 @@
  * @brief returns a Constant string (actually this is slower than getString()
  * @returns a constant string of the stored version's one.
- * @note this  could lead to a inconsistency of data
+ * @note this  could lead to a inconsistency of data AND IS HIGHLY NON_THREAD_SAFE!
+ * PLEASE THINK ABOUT USING THE getStoredString function in conjunction with storeString().
  */
 const std::string& MultiType::getConstString() const
 {
-
   MultiType::constString = this->getString();
   return MultiType::constString;
 }
 
+/**
+ * @brief returns the currently stored string.
+ * @returns the Stored string.
+ * @note Storing a string works as follows: \\
+ * MultiType a(3);  // Creates a MultiType of Type int with value 3 \\
+ * a.storeString(); // Stores the String in the internal structure. \\
+ * std::string name = a.getStoredString();
+ *
+ * This would be the same as
+ * name = a.getString();
+ * but with much more const'ness.
+ */
+const std::string& MultiType::getStoredString() const
+{
+  MultiType::constString = this->getString();
+  return MultiType::constString;
+}
 
 /**
@@ -433,23 +457,23 @@
   {
     case MT_BOOL:
-      this->setBool(false);
-      break;
+    this->setBool(false);
+    break;
     case MT_INT:
-      this->setInt(0);
-      break;
+    this->setInt(0);
+    break;
     case MT_FLOAT:
-      this->setFloat(0.0f);
-      break;
+    this->setFloat(0.0f);
+    break;
     case MT_CHAR:
-      this->setChar('\0');
-      break;
+    this->setChar('\0');
+    break;
     case MT_STRING:
-      this->setString("");
-      break;
+    this->setString("");
+    break;
     default:
 #ifdef DEBUG
-      PRINTF(2)("Unknown Type not reseting\n");
+    PRINTF(2)("Unknown Type not reseting\n");
 #endif
-      break;
+    break;
   }
 }
@@ -465,15 +489,15 @@
   {
     case MT_BOOL:
-      return MultiType::typeNames[1];
+    return MultiType::typeNames[1];
     case MT_INT:
-      return MultiType::typeNames[2];
+    return MultiType::typeNames[2];
     case MT_FLOAT:
-      return MultiType::typeNames[3];
+    return MultiType::typeNames[3];
     case MT_CHAR:
-      return MultiType::typeNames[4];
+    return MultiType::typeNames[4];
     case MT_STRING:
-      return MultiType::typeNames[5];
+    return MultiType::typeNames[5];
     default:
-      return MultiType::typeNames[0];
+    return MultiType::typeNames[0];
   }
 }
Index: trunk/src/lib/util/multi_type.h
===================================================================
--- trunk/src/lib/util/multi_type.h	(revision 9682)
+++ trunk/src/lib/util/multi_type.h	(revision 9869)
@@ -17,6 +17,6 @@
   MT_BOOL            = 1,                  //!< A bool Value.
   MT_INT             = 2,                  //!< An int Value.
-  MT_UINT            = 2,
-  MT_LONG            = 2,
+  MT_UINT            = 2,                  //!< A insigned int Value.
+  MT_LONG            = 2,                  //!< A long Value
   MT_FLOAT           = 4,                  //!< A float Value.
   MT_CHAR            = 8,                  //!< A single char.
@@ -44,17 +44,29 @@
 
     MultiType& operator=(const MultiType& mt);
+    /** @param value the value to set (here a bool) @returns the MultiType where this the bool is stored */
     MultiType& operator=(bool value) { this->setBool(value); return *this; };
+    /** @param value the value to set (here an int) @returns the MultiType where this the int is stored */
     MultiType& operator=(int value) { this->setInt(value); return *this; };
+    /** @param value the value to set (here an int) @returns the MultiType where this the float is stored */
     MultiType& operator=(float value) { this->setFloat(value); return *this; };
+    /** @param value the value to set (here a char) @returns the MultiType where this the char is stored */
     MultiType& operator=(char value) { this->setChar(value); return *this; };
+    /** @param value the value to set (here a string) @returns the MultiType where this the string is stored */
     MultiType& operator=(const std::string& value) { this->setString(value); return *this; };
 
     bool operator==(const MultiType& mt) const;
+    /** @param value the value to compare this MultiType against @returns true if comparison was io */
     bool operator==(bool value) const { return (this->getBool() == value); };
+    /** @param value the value to compare this MultiType against @returns true if comparison was io */
     bool operator==(int value) const { return (this->getInt() == value); };
+    /** @param value the value to compare this MultiType against @returns true if comparison was io */
     bool operator==(float value) const { return (this->getFloat() ==  value); };
+    /** @param value the value to compare this MultiType against @returns true if comparison was io */
     bool operator==(char value) const { return (this->getChar() == value); };
+    /** @param value the value to compare this MultiType against @returns true if comparison was io */
     bool operator==(const std::string& value) const { return (this->getString() == value); };
+    /** @param type the Type to compare this MultiType against @returns true if the types matched */
     bool operator==(MT_Type type) const { return (this->type == type); }
+    /** @param type the type to compare this MultiType against @returns true if the types do not match */
     bool operator!=(MT_Type type) const { return (this->type != type); }
 
@@ -68,9 +80,15 @@
 
     // for your convenience.
+    /** @param value the value to set. Here a bool */
     inline void setValue(bool value) { this->setBool(value); };
+    /** @param value the value to set. Here an int */
     inline void setValue(int value) { this->setInt(value); };
+    /** @param value the value to set. Here a float */
     inline void setValue(float value) { this->setFloat(value); };
+    /** @param value the value to set. Here a char */
     inline void setValue(char value) { this->setChar(value); };
+    /** @param value the value to set. Here a char array (string) */
     inline void setValue(const char* value) { this->setString(value); };
+    /** @param value the value to set. Here a string */
     inline void setValue(const std::string& value) { this->setString(value); };
     void setValueOf(const MultiType& mt);
@@ -79,4 +97,5 @@
     inline MT_Type getType() const { return this->type; };
 
+    void storeString();
 
     /* RETRIEVING FUNCTIONS */
@@ -88,4 +107,5 @@
     std::string getString() const;
     const std::string& getConstString() const;
+    const std::string& getStoredString() const;
 
     void reset();
Index: trunk/src/lib/util/preferences.cc
===================================================================
--- trunk/src/lib/util/preferences.cc	(revision 9682)
+++ 	(revision )
@@ -1,334 +1,0 @@
-/*
-   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: Christoph Renner
-   co-programmer: ...
-*/
-
-//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
-
-#include "preferences.h"
-#include "lib/parser/ini_parser/ini_parser.h"
-#include "debug.h"
-
-
-/**
- * standard constructor
- */
-Preferences::Preferences ()
-{
-   this->setClassID(CL_PREFERENCES, "Preferences");
-   this->setName("Preferences");
-   this->fileName = "";
-}
-
-/**
- *  the singleton reference to this class
- */
-Preferences* Preferences::singletonRef = NULL;
-
-/**
-   @brief standard deconstructor
- */
-Preferences::~Preferences ()
-{
-  Preferences::singletonRef = NULL;
-}
-
-/**
- * Check if this item exists
- * @param section name of the section
- * @param name name of the item to check
- * @return true if the item exists
- */
-bool Preferences::exists( const std::string& section, const std::string& name)
-{
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::const_iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        if ( it2->name == name )
-          return true;
-      }
-
-      break;
-    }
-  }
-
-  return false;
-}
-
-/**
- * Check if this section exists
- * @param section name of the section
- * @param name name of the item to check
- * @return true if the item exists
- */
-bool Preferences::sectionExists( const std::string& section )
-{
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      return true;
-    }
-  }
-
-  return false;
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified)
-{
-  MultiType t(value);
-  setMultiType(section, name, t, dontSetModified);
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setInt(const std::string& section, const std::string& name, int value, bool dontSetModified)
-{
-  MultiType t(value);
-  setMultiType(section, name, t, dontSetModified);
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified)
-{
-  MultiType t(value);
-  setMultiType(section, name, t, dontSetModified);
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-std::string Preferences::getString(const std::string& section, const std::string& name, const std::string& defaultValue)
-{
-  return getMultiType(section, name, MultiType(defaultValue)).getString();
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-int Preferences::getInt(const std::string& section, const std::string& name, int defaultValue)
-{
-  return getMultiType(section, name, MultiType(defaultValue)).getInt();
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-float Preferences::getFloat(const std::string& section, const std::string& name, float defaultValue)
-{
-  return getMultiType(section, name, MultiType(defaultValue)).getFloat();
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified)
-{
-  std::list<prefSection>::iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        if ( it2->name == name )
-        {
-          if (!dontSetModified)
-            it2->modified = value.getString() != it2->value.getString();
-
-          it2->value = value;
-
-          return;
-        }
-      }
-      prefItem item;
-      item.value = value;
-      item.modified = !dontSetModified;
-      item.name = name;
-      it->items.push_back(item);
-      return;
-    }
-  }
-
-  prefItem item;
-  item.value = value;
-  item.modified = !dontSetModified;
-  item.name = name;
-
-  prefSection sec;
-  sec.items.push_back(item);
-  sec.sectionName = section;
-  data.push_back( sec );
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-MultiType Preferences::getMultiType(const std::string& section, const std::string& name,const MultiType& defaultValue)
-{
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::const_iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        if ( it2->name == name )
-        {
-          return it2->value;
-        }
-      }
-
-      break;
-    }
-  }
-
-  return defaultValue;
-}
-
-void Preferences::setUserIni(const std::string& fileName)
-{
-  this->fileName = fileName;
-}
-
-bool Preferences::save()
-{
-  if ( this->fileName == "" )
-  {
-    PRINTF(1)("You must call setUserIni before you can call save()\n");
-    return false;
-  }
-  IniParser iniParser(this->fileName);
-
-  std::list<prefSection>::iterator it = data.begin();
-  bool didChanges = false;
-  for ( ; it!=data.end(); it++)
-  {
-    std::list<prefItem>::iterator it2 = it->items.begin();
-
-    for ( ; it2!=it->items.end(); it2++)
-    {
-      if ( it2->modified )
-      {
-        iniParser.editVar(it2->name, it2->value.getString(), it->sectionName);
-        didChanges = true;
-      }
-    }
-  }
-  /// HACK DO WE HAVE TO CHECK THIS??
-  //if ( didChanges )
-  {
-    iniParser.writeFile( this->fileName );
-  }
-
-  return true;
-}
-
-/**
- * prints out all section with its items and values
- */
-void Preferences::debug()
-{
-  std::list<prefSection>::iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    PRINTF(0)("%s\n", it->sectionName.c_str());
-    std::list<prefItem>::iterator it2 = it->items.begin();
-
-    for ( ; it2!=it->items.end(); it2++)
-    {
-      PRINTF(0)("--> %s = '%s'%s\n", it2->name.c_str(), it2->value.getString().c_str(), ((!it2->modified)?"":" <modified>"));
-    }
-  }
-}
-
-/**
- * list all keys in section
- * @param section section
- * @return list of keys
- */
-std::list< std::string > Preferences::listKeys( const std::string section )
-{
-  std::list<std::string> lst;
-
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::const_iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        lst.push_back( it2->name );
-      }
-
-      break;
-    }
-  }
-
-  return lst;
-}
-
-
Index: trunk/src/lib/util/preferences.h
===================================================================
--- trunk/src/lib/util/preferences.h	(revision 9682)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*!
- * @file proto_singleton.h
- * @brief Definition of the ... singleton Class
-*/
-
-#ifndef _PREFERENCES_H
-#define _PREFERENCES_H
-
-#include "base_object.h"
-#include "multi_type.h"
-#include <list>
-
-// FORWARD DECLARATION
-
-class IniFilePrefsReader;
-
-typedef struct {
-  std::string name;
-  MultiType value;
-  bool modified;
-} prefItem;
-
-typedef struct {
-  std::string sectionName;
-  std::list<prefItem> items;
-} prefSection ;
-
-
-//! A default singleton class.
-class Preferences : public BaseObject {
-
- public:
-   virtual ~Preferences(void);
-  /** @returns a Pointer to the only object of this Class */
-   inline static Preferences* getInstance(void) { if (!singletonRef) singletonRef = new Preferences();  return singletonRef; };
-
-   //check if this entry exists
-   bool sectionExists(const std::string& section );
-   bool exists(const std::string& section, const std::string& name);
-
-   void setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified = false);
-   void setInt(const std::string& section, const std::string& name, int value, bool dontSetModified = false);
-   void setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified = false);
-   void setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified = false);
-
-   std::string getString(const std::string& section, const std::string& name, const std::string& defaultValue);
-   int getInt(const std::string& section, const std::string& name, int defaultValue);
-   float getFloat(const std::string& section, const std::string& name, float defaultValue);
-   MultiType getMultiType(const std::string& section, const std::string& name, const MultiType& defaultValue);
-
-   void setUserIni(const std::string& fileName);
-
-   bool save();
-
-   void debug();
-
-   std::list<std::string> listKeys( const std::string section );
-
-
- private:
-   Preferences(void);
-   static Preferences* singletonRef;
-
-   std::list<prefSection> data;
-
-   std::list<IniFilePrefsReader*> iniFilePrefsReaders;
-
-   std::string fileName;
-
-};
-
-#endif /* _PREFERENCES_H */
Index: trunk/src/lib/util/sigslot/signal.h
===================================================================
--- trunk/src/lib/util/sigslot/signal.h	(revision 9682)
+++ trunk/src/lib/util/sigslot/signal.h	(revision 9869)
@@ -96,4 +96,5 @@
   {
   public:
+    virtual ~_connection_base0() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit() = 0;
@@ -106,4 +107,5 @@
   {
   public:
+    virtual ~_connection_base1() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type) = 0;
@@ -116,4 +118,5 @@
   {
   public:
+    virtual ~_connection_base2() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type) = 0;
@@ -126,4 +129,5 @@
   {
   public:
+    virtual ~_connection_base3() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type) = 0;
@@ -136,4 +140,5 @@
   {
   public:
+    virtual ~_connection_base4() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type) = 0;
@@ -147,4 +152,5 @@
   {
   public:
+    virtual ~_connection_base5() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type,
@@ -161,4 +167,5 @@
   {
   public:
+    virtual ~_connection_base6() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
@@ -175,4 +182,5 @@
   {
   public:
+    virtual ~_connection_base7() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
@@ -189,4 +197,5 @@
   {
   public:
+    virtual ~_connection_base8() {};
     virtual has_slots<mt_policy>* getdest() const = 0;
     virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
Index: trunk/src/lib/util/substring.cc
===================================================================
--- trunk/src/lib/util/substring.cc	(revision 9682)
+++ trunk/src/lib/util/substring.cc	(revision 9869)
@@ -51,4 +51,5 @@
  * @param delimiters multiple set of characters at what to split. (delimiters)
  * @param delimiterNeighbours neighbours of the delimiters, that will be erased only when near a delimiter.
+ * @param emptyEntries If empty entries should be allewed or removed.
  * @param escapeChar The Escape Character that overrides splitters commends and so on...
  * @param safemode_char within these characters splitting won't happen
@@ -109,4 +110,6 @@
 /** @brief Helper that gets you a String consisting of all WhiteSpaces and the Comma */
 const std::string SubString::WhiteSpacesWithComma = " \n\t,";
+/** An Empty SubString */
+const SubString SubString::NullSubString = SubString();
 
 /**
@@ -145,4 +148,5 @@
  * @brief comparator.
  * @param subString the SubString to compare against this one.
+ * @param length how many entries to compare. (from 0 to length)
  * @returns true if the Stored Strings match
  */
@@ -273,9 +277,8 @@
  * @brief splits line into tokens and stores them in ret.
  * @param ret the Array, where the Splitted strings will be stored in
- * @param offsets an Array of Offsets, here the distance from the inputstring
  * to the beginning of the current token is stored
  * @param line the inputLine to split
  * @param delimiters a String of Delimiters (here the input will be splitted)
- * @param delimiterNeighbour Naighbours to the Delimitter, that will be removed if they are to the left or the right of a Delimiter.
+ * @param delimiterNeighbours Naighbours to the Delimitter, that will be removed if they are to the left or the right of a Delimiter.
  * @param emptyEntries: if empty Strings are added to the List of Strings.
  * @param escape_char: Escape carater (escapes splitters)
Index: trunk/src/lib/util/substring.h
===================================================================
--- trunk/src/lib/util/substring.h	(revision 9682)
+++ trunk/src/lib/util/substring.h	(revision 9869)
@@ -33,10 +33,11 @@
 {
 public:
+  //! An enumerator for the State the Parser is in
   typedef enum {
-    SL_NORMAL,
-    SL_ESCAPE,
-    SL_SAFEMODE,
-    SL_SAFEESCAPE,
-    SL_COMMENT,
+    SL_NORMAL,            //!< Normal state
+    SL_ESCAPE,            //!< After an escape character
+    SL_SAFEMODE,          //!< In safe mode (between "" mostly).
+    SL_SAFEESCAPE,        //!< In safe mode with the internal escape character, that escapes even the savemode character.
+    SL_COMMENT,           //!< In Comment mode.
   } SPLIT_LINE_STATE;
 
@@ -48,6 +49,6 @@
             const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries=false,
             char escapeChar ='\\', char safemode_char = '"', char comment_char = '\0');
+  SubString(unsigned int argc, const char** argv);
   /** @brief create a Substring as a copy of another one. @param subString the SubString to copy. */
-  SubString(unsigned int argc, const char** argv);
   SubString(const SubString& subString) { *this = subString; };
   SubString(const SubString& subString, unsigned int subSetBegin);
@@ -110,4 +111,5 @@
   static const std::string WhiteSpaces;
   static const std::string WhiteSpacesWithComma;
+  static const SubString   NullSubString;
 
 private:
