Index: code/trunk/src/CMakeLists.txt
===================================================================
--- code/trunk/src/CMakeLists.txt	(revision 1054)
+++ code/trunk/src/CMakeLists.txt	(revision 1055)
@@ -3,5 +3,5 @@
 
 ADD_SUBDIRECTORY(util)
-ADD_SUBDIRECTORY(orxonox/core)
+ADD_SUBDIRECTORY(core)
 ADD_SUBDIRECTORY(audio)
 ADD_SUBDIRECTORY(network)
Index: code/trunk/src/core/BaseObject.cc
===================================================================
--- code/trunk/src/core/BaseObject.cc	(revision 1055)
+++ code/trunk/src/core/BaseObject.cc	(revision 1055)
@@ -0,0 +1,94 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the BaseObject class.
+*/
+
+#include "util/tinyxml/tinyxml.h"
+
+#include "core/CoreIncludes.h"
+#include "BaseObject.h"
+#include "XMLPort.h"
+#include "Level.h"
+
+namespace orxonox
+{
+    CreateFactory(BaseObject);
+
+    /**
+        @brief Constructor: Registers the object in the BaseObject-list.
+    */
+    BaseObject::BaseObject()
+    {
+        RegisterRootObject(BaseObject);
+
+        this->bActive_ = true;
+        this->bVisible_ = true;
+        this->level_ = 0;
+        this->namespace_ = 0;
+    }
+
+    /**
+        @brief Destructor
+    */
+    BaseObject::~BaseObject()
+    {
+    }
+
+    /**
+        @brief load general xml paramters
+    */
+    void BaseObject::loadParams(TiXmlElement* xmlElem)
+    {
+        if (xmlElem->Attribute("name"))
+        {
+            this->setName(xmlElem->Attribute("name"));
+        }
+    }
+
+    /**
+        @brief XML loading and saving.
+        @param xmlelement The XML-element
+        @param loading Loading (true) or saving (false)
+        @return The XML-element
+    */
+    void BaseObject::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        XMLPortParam(BaseObject, "name", setName, getName, xmlelement, mode);
+    }
+
+    /**
+        @brief Returns the levelfile that loaded this object.
+        @return The levelfile
+    */
+    const std::string& BaseObject::getLevelfile() const
+    {
+        return this->level_->getFile();
+    }
+}
Index: code/trunk/src/core/BaseObject.h
===================================================================
--- code/trunk/src/core/BaseObject.h	(revision 1055)
+++ code/trunk/src/core/BaseObject.h	(revision 1055)
@@ -0,0 +1,99 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file BaseObject.h
+    @brief Definition of the BaseObject class.
+
+    The BaseObject is the parent of all classes representing an instance in the game.
+*/
+
+#ifndef _BaseObject_H__
+#define _BaseObject_H__
+
+#include "CorePrereqs.h"
+#include "util/XMLIncludes.h"
+
+#include "OrxonoxClass.h"
+
+namespace orxonox
+{
+    //! The BaseObject is the parent of all classes representing an instance in the game.
+    class _CoreExport BaseObject : virtual public OrxonoxClass
+    {
+        public:
+            BaseObject();
+            virtual ~BaseObject();
+            virtual void loadParams(TiXmlElement* xmlElem);
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            /** @brief Sets the name of the object. @param name The name */
+            inline void setName(const std::string& name) { this->name_ = name; this->changedName(); }
+            /** @brief Returns the name of the object. @return The name */
+            inline const std::string& getName() const { return this->name_; }
+            /** @brief This function gets called if the name of the object changes. */
+            virtual void changedName() {}
+
+            /** @brief Sets the state of the objects activity. @param bActive True = active */
+            inline void setActivity(bool bActive) { this->bActive_ = bActive; this->changedActivity(); }
+            /** @brief Returns the state of the objects activity. @return The state of the activity */
+            inline const bool isActive() const { return this->bActive_; }
+            /** @brief This function gets called if the activity of the object changes. */
+            virtual void changedActivity() {}
+
+            /** @brief Sets the state of the objects visibility. @param bVisible True = visible */
+            inline void setVisibility(bool bVisible) { this->bVisible_ = bVisible; this->changedVisibility(); }
+            /** @brief Returns the state of the objects visibility. @return The state of the visibility */
+            inline const bool isVisible() const { return this->bVisible_; }
+            /** @brief This function gets called if the visibility of the object changes. */
+            virtual void changedVisibility() {}
+
+            /** @brief Sets a pointer to the level that loaded this object. @param level The pointer to the level */
+            inline void setLevel(const Level* level) { this->level_ = level; }
+            /** @brief Returns a pointer to the level that loaded this object. @return The level */
+            inline const Level* getLevel() const { return this->level_; }
+            const std::string& getLevelfile() const;
+
+            virtual inline void setNamespace(Namespace* ns) { this->namespace_ = ns; }
+            inline Namespace* getNamespace() const { return this->namespace_; }
+
+            /** @brief Sets the indentation of the debug output in the Loader. @param indentation The indentation */
+            inline void setLoaderIndentation(const std::string& indentation) { this->loaderIndentation_ = indentation; }
+            /** @brief Returns the indentation of the debug output in the Loader. @return The indentation */
+            inline const std::string& getLoaderIndentation() const { return this->loaderIndentation_; }
+
+        private:
+            std::string name_;                          //!< The name of the object
+            bool bActive_;                              //!< True = the object is active
+            bool bVisible_;                             //!< True = the object is visible
+            const Level* level_;                        //!< The level that loaded this object
+            std::string loaderIndentation_;             //!< Indentation of the debug output in the Loader
+            Namespace* namespace_;
+    };
+}
+
+#endif /* _BaseObject_H__ */
Index: code/trunk/src/core/CMakeLists.txt
===================================================================
--- code/trunk/src/core/CMakeLists.txt	(revision 1055)
+++ code/trunk/src/core/CMakeLists.txt	(revision 1055)
@@ -0,0 +1,38 @@
+SET( CORE_SRC_FILES
+  OrxonoxClass.cc
+  BaseObject.cc
+  Factory.cc
+  Identifier.cc
+  IdentifierDistributor.cc
+  InputHandler.cc
+  InputManager.cc
+  InputEventListener.cc
+  MetaObjectList.cc
+  ConfigFileManager.cc
+  ConfigValueContainer.cc
+  Error.cc
+  SignalHandler.cc
+  CoreSettings.cc
+  OutputHandler.cc
+  Language.cc
+  ClassTreeMask.cc
+  Loader.cc
+  Executor.cc
+  XMLPort.cc
+  Namespace.cc
+  NamespaceNode.cc
+  CommandExecutor.cc
+  InputBuffer.cc
+  Tickable.cc
+  Script.cc
+  ToLuaBind.cc
+)
+
+ADD_LIBRARY( core SHARED ${CORE_SRC_FILES})
+SET_TARGET_PROPERTIES( core PROPERTIES LINK_FLAGS "--no-undefined" )
+
+TARGET_LINK_LIBRARIES( core
+  util
+  ${Lua_LIBRARIES}
+  ${OIS_LIBRARIES}
+)
Index: code/trunk/src/core/ClassFactory.h
===================================================================
--- code/trunk/src/core/ClassFactory.h	(revision 1055)
+++ code/trunk/src/core/ClassFactory.h	(revision 1055)
@@ -0,0 +1,102 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file ClassFactory.h
+    @brief Definition and implementation of the ClassFactory class
+
+    The ClassFactory is able to create new objects of a specific class.
+*/
+
+#ifndef _ClassFactory_H__
+#define _ClassFactory_H__
+
+#include <string>
+
+#include "CorePrereqs.h"
+
+#include "Factory.h"
+#include "Identifier.h"
+#include "Debug.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###      ClassFactory       ###
+    // ###############################
+    //! The ClassFactory is able to create new objects of a specific class.
+    template <class T>
+    class ClassFactory : public BaseFactory
+    {
+        public:
+            static bool create(const std::string& name);
+            BaseObject* fabricate();
+
+        private:
+            ClassFactory() {}                               // Don't create
+            ClassFactory(const ClassFactory& factory) {}    // Don't copy
+            virtual ~ClassFactory() {}                      // Don't delete
+
+            static T* createNewObject();
+    };
+
+    /**
+        @brief Adds the ClassFactory to the Identifier of the same type and the Identifier to the Factory.
+        @return Always true (this is needed because the compiler only allows assignments before main())
+    */
+    template <class T>
+    bool ClassFactory<T>::create(const std::string& name)
+    {
+        COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl;
+        ClassManager<T>::getIdentifier()->addFactory(new ClassFactory<T>);
+        Factory::add(name, ClassManager<T>::getIdentifier());
+
+        return true;
+    }
+
+    /**
+        @brief Creates and returns a new object of class T.
+        @return The new object
+    */
+    template <class T>
+    BaseObject* ClassFactory<T>::fabricate()
+    {
+        return ClassFactory<T>::createNewObject();
+    }
+
+    /**
+        @brief Creates and returns a new object of class T; this is a wrapper for the new operator.
+        @return The new object
+    */
+    template <class T>
+    T* ClassFactory<T>::createNewObject()
+    {
+        return new T;
+    }
+}
+
+#endif /* _ClassFactory_H__ */
Index: code/trunk/src/core/ClassManager.h
===================================================================
--- code/trunk/src/core/ClassManager.h	(revision 1055)
+++ code/trunk/src/core/ClassManager.h	(revision 1055)
@@ -0,0 +1,155 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file ClassManager.h
+    @brief Definition and Implementation of the ClassManager template.
+
+    The ClassManager is a helper-class for ClassIdentifier. Because ClassIdentifiers must
+    be unique, they are created through the IdentifierDistributor-class to assure the
+    uniqueness of the ClassIdentifier. But accessing Identifiers through IdentifierDistributor
+    is slow, because it uses strings and a map. Thats why we use the ClassManager-template: It's
+    a singleton like ClassIdentifier, but it doesn't hurt if there are multiple instances in
+    different libraries, because they all store the same pointer to the unique ClassIdentifier
+    which they've retrieved through IdentifierDistributor.
+*/
+
+#ifndef _ClassManager_H__
+#define _ClassManager_H__
+
+#include <string>
+
+#include "Identifier.h"
+#include "IdentifierDistributor.h"
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    //! ClassManager is a helper class to allow faster access on the ClassIdentifiers.
+    /**
+        Because accessing the IdentifierDistributor is slow, the ClassManager accesses it once
+        and stores the result in a member-variable. IdentifierDistributor assures the uniqueness
+        of the ClassIdentifier, even if there are multiple instances of the ClassManager-template
+        in different libraries.
+    */
+    template <class T>
+    class ClassManager
+    {
+        public:
+            static ClassManager<T>* getSingleton();
+            static ClassIdentifier<T>* getIdentifier();
+            static const std::string& getName();
+
+        private:
+            ClassManager();
+            ClassManager(const ClassIdentifier<T>& identifier) {}    // don't copy
+            ~ClassManager() {}                                       // don't delete
+
+            bool bInitialized_;                 //!< This is false until the ClassIdentifier gets assigned
+            ClassIdentifier<T>* identifier_;    //!< The unique ClassIdentifier for the class T
+    };
+
+    /**
+        @brief Constructor: Marks the ClassManager as uninitialized.
+    */
+    template <class T>
+    ClassManager<T>::ClassManager()
+    {
+        this->bInitialized_ = false;
+    }
+
+    /**
+        @brief Returns the one and only instance of this class for the template parameter T.
+        @return The instance
+    */
+    template <class T>
+    ClassManager<T>* ClassManager<T>::getSingleton()
+    {
+        static ClassManager<T> theOneAndOnlyInstance = ClassManager<T>();
+        return &theOneAndOnlyInstance;
+    }
+
+    /**
+        @brief Creates the only instance of this class for the template class T and retrieves a unique Identifier for the given name.
+        @return The unique Identifier
+    */
+    template <class T>
+    ClassIdentifier<T>* ClassManager<T>::getIdentifier()
+    {
+        // Check if the ClassManager is already initialized
+        if (!ClassManager<T>::getSingleton()->bInitialized_)
+        {
+            // Get the name of the class
+            std::string name = typeid(T).name();
+
+            // It's not -> retrieve the ClassIdentifier through IdentifierDistributor
+            COUT(4) << "*** ClassManager: Request Identifier Singleton for " << name << "." << std::endl;
+
+            // First create a ClassIdentifier in case there's no instance existing yet
+            ClassIdentifier<T>* temp = new ClassIdentifier<T>();
+
+            // Ask the IdentifierDistributor for the unique ClassIdentifier
+            ClassManager<T>::getSingleton()->identifier_ = (ClassIdentifier<T>*)IdentifierDistributor::getIdentifier(name, temp);
+
+            // If the retrieved Identifier differs from our proposal, we don't need the proposal any more
+            if (temp != ClassManager<T>::getSingleton()->identifier_)
+            {
+                COUT(4) << "*** ClassManager: Requested Identifier for " << name << " was already existing and got assigned." << std::endl;
+
+                // Delete the unnecessary proposal
+                delete temp;
+            }
+            else
+            {
+                COUT(4) << "*** ClassManager: Requested Identifier for " << name << " was not yet existing and got created." << std::endl;
+            }
+
+            ClassManager<T>::getSingleton()->bInitialized_ = true;
+        }
+
+        // Finally return the unique ClassIdentifier
+        return ClassManager<T>::getSingleton()->identifier_;
+    }
+
+    /**
+        @brief Returns the name of the class the ClassManager belongs to.
+        @return The name
+    */
+    template <class T>
+    const std::string& ClassManager<T>::getName()
+    {
+        static std::string unknownClassName = std::string("unknown");
+
+        if (ClassManager<T>::getSingleton()->bInitialized_)
+            return ClassManager<T>::getSingleton()->identifier_->getName();
+        else
+            return unknownClassName;
+    }
+}
+
+#endif /* _ClassManager_H__ */
Index: code/trunk/src/core/ClassTreeMask.cc
===================================================================
--- code/trunk/src/core/ClassTreeMask.cc	(revision 1055)
+++ code/trunk/src/core/ClassTreeMask.cc	(revision 1055)
@@ -0,0 +1,854 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file ClassTreeMask.cc
+    @brief Implementation of the ClassTreeMask, ClassTreeMaskNode and ClassTreeMaskIterator classes.
+*/
+
+#include "ClassTreeMask.h"
+#include "Identifier.h"
+#include "BaseObject.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###    ClassTreeMaskNode    ###
+    // ###############################
+    /**
+        @brief Constructor: Creates the node, sets the subclass and the rule.
+        @param subclass The subclass the rule refers to
+        @param bIncluded The rule: included (true) or excluded (false)
+    */
+    ClassTreeMaskNode::ClassTreeMaskNode(const Identifier* subclass, bool bIncluded)
+    {
+        this->subclass_ = subclass;
+        this->bIncluded_ = bIncluded;
+    }
+
+    /**
+        @brief Destructor: Deletes all subnodes.
+    */
+    ClassTreeMaskNode::~ClassTreeMaskNode()
+    {
+        // Go through the list of all subnodes and delete them
+        this->deleteAllSubnodes();
+    }
+
+    /**
+        @brief Sets the rule for the node to "included".
+        @param overwrite True = overwrite previously added rules for inheriting classes
+    */
+    void ClassTreeMaskNode::include(bool overwrite)
+    {
+        this->setIncluded(true, overwrite);
+    }
+
+    /**
+        @brief Sets the rule for the node to "excluded".
+        @param overwrite True = overwrite previously added rules for inheriting classes
+    */
+    void ClassTreeMaskNode::exclude(bool overwrite)
+    {
+        this->setIncluded(false, overwrite);
+    }
+
+    /**
+        @brief Sets the rule for the node to a given value and erases all following rules.
+        @param bIncluded The rule: included (true) or excluded (false)
+        @param overwrite True = overwrite previously added rules for inheriting classes
+    */
+    void ClassTreeMaskNode::setIncluded(bool bIncluded, bool overwrite)
+    {
+        if (overwrite)
+            this->deleteAllSubnodes();
+
+        this->bIncluded_ = bIncluded;
+    }
+
+    /**
+        @brief Adds a new subnode to the list of subnodes.
+        @param subnode The new subnode
+    */
+    void ClassTreeMaskNode::addSubnode(ClassTreeMaskNode* subnode)
+    {
+        this->subnodes_.insert(this->subnodes_.end(), subnode);
+    }
+
+    /**
+        @brief Tells if the rule is "included" or not.
+        @return The rule: true = included, false = excluded
+    */
+    bool ClassTreeMaskNode::isIncluded() const
+    {
+        return this->bIncluded_;
+    }
+
+    /**
+        @brief Tells if the rule is "excluded" or not.
+        @return The inverted rule: true = excluded, false = included
+    */
+    bool ClassTreeMaskNode::isExcluded() const
+    {
+        return (!this->bIncluded_);
+    }
+
+    /**
+        @brief Returns the Identifier of the class the rule refers to.
+        @return The Identifier representing the class
+    */
+    const Identifier* ClassTreeMaskNode::getClass() const
+    {
+        return this->subclass_;
+    }
+
+    /**
+        @brief Deletes all subnodes of this node.
+    */
+    void ClassTreeMaskNode::deleteAllSubnodes()
+    {
+        // Go through the list of all subnodes and delete them
+        for (std::list<ClassTreeMaskNode*>::iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); )
+            delete (*(it++));
+
+        // Clear the list
+        this->subnodes_.clear();
+    }
+
+
+    // ###############################
+    // ###  ClassTreeMaskIterator  ###
+    // ###############################
+    /**
+        @brief Constructor: Initializes the iterator by creating a helper-list with the root-node and putting it to the stack.
+        @param node The root-node
+    */
+    ClassTreeMaskIterator::ClassTreeMaskIterator(ClassTreeMaskNode* node)
+    {
+        // Create a list and put the root-note into it
+        std::list<ClassTreeMaskNode*>::iterator it = this->rootlist_.insert(this->rootlist_.end(), node);
+
+        // Put the iterator to the only element of the list and the corresponding end()-iterator on the stack
+        this->nodes_.push(std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator>(it, this->rootlist_.end()));
+    }
+
+    /**
+        @brief Destructor: Does nothing.
+    */
+    ClassTreeMaskIterator::~ClassTreeMaskIterator()
+    {
+    }
+
+    /**
+        @brief Iterates through the rule-tree.
+        @return A reference to the iterator itself
+    */
+    ClassTreeMaskIterator& ClassTreeMaskIterator::operator++()
+    {
+        // Check if the actual node has subnodes
+        if ((*this->nodes_.top().first)->subnodes_.begin() != (*this->nodes_.top().first)->subnodes_.end())
+        {
+            // Yes it has: Push an iterator, pointing at the first subnode, on the stack
+            this->nodes_.push(std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator>((*this->nodes_.top().first)->subnodes_.begin(), (*this->nodes_.top().first)->subnodes_.end()));
+        }
+        else
+        {
+            // No subnodes, meaning we reached a leaf: Go to the next node
+            do
+            {
+                // Iterate one step in the current list
+                ++this->nodes_.top().first;
+
+                // Check if we reached the end of the list (the second item in the stored pair always represents the end)
+                if (this->nodes_.top().first == this->nodes_.top().second)
+                {
+                    // Yes we've reached the end: Pop the list-iterator from the stack
+                    this->nodes_.pop();
+
+                    // Continue with the loop, meaning: Try to iterate through the previous list
+                    continue;
+                }
+
+                // If we reached this point, we aren't yet at the end of the list: Leave the loop
+                break;
+            } while (!this->nodes_.empty()); // Stop looping if the stack is empty, meaning: We've iterated to the end
+        }
+
+        // Finally return a reference to the iterator itself
+        return *this;
+    }
+
+    /**
+        @brief Returns a pointer to the ClassTreeMaskNode whereon the iterator points.
+        @return The pointer to the node
+    */
+    ClassTreeMaskNode* ClassTreeMaskIterator::operator*() const
+    {
+        return (*this->nodes_.top().first);
+    }
+
+    /**
+        @brief Returns a pointer to the ClassTreeMaskNode whereon the iterator points.
+        @return The pointer to the node
+    */
+    ClassTreeMaskNode* ClassTreeMaskIterator::operator->() const
+    {
+        return (*this->nodes_.top().first);
+    }
+
+    /**
+        @brief Returns true if the stack is empty, meaning we've reached the end of the tree.
+        @return True if we've reached the end of the tree
+    */
+    ClassTreeMaskIterator::operator bool()
+    {
+        return (!this->nodes_.empty());
+    }
+
+    /**
+        @brief Compares the current node with the given one and returns true if they match.
+        @param compare The node to compare with
+        @return The result of the comparison (true if they match)
+    */
+    bool ClassTreeMaskIterator::operator==(ClassTreeMaskNode* compare)
+    {
+        if (!this->nodes_.empty())
+            return ((*this->nodes_.top().first) == compare);
+        else
+            return (compare == 0);
+    }
+
+    /**
+        @brief Compares the current node with the given one and returns true if they don't match.
+        @param compare The node to compare with
+        @return The result of the comparison (true if they don't match)
+    */
+    bool ClassTreeMaskIterator::operator!=(ClassTreeMaskNode* compare)
+    {
+        if (!this->nodes_.empty())
+            return ((*this->nodes_.top().first) != compare);
+        else
+            return (compare != 0);
+    }
+
+
+    // ###############################
+    // ###      ClassTreeMask      ###
+    // ###############################
+    /**
+        @brief Constructor: Adds the root-node of the tree with the first rule ("include everything").
+    */
+    ClassTreeMask::ClassTreeMask()
+    {
+        this->root_ = new ClassTreeMaskNode(ClassManager<BaseObject>::getIdentifier(), true);
+    }
+
+    /**
+        @brief Copyconstructor: Adds the root-node of the tree with the first rule ("include everything") and adds all rules from the other mask.
+        @param other The other mask
+    */
+    ClassTreeMask::ClassTreeMask(const ClassTreeMask& other)
+    {
+        this->root_ = new ClassTreeMaskNode(ClassManager<BaseObject>::getIdentifier(), true);
+        for (ClassTreeMaskIterator it = other.root_; it; ++it)
+            this->add(it->getClass(), it->isIncluded(), false);
+    }
+
+    /**
+        @brief Destructor: Deletes the root node (which will delete all subnodes too).
+    */
+    ClassTreeMask::~ClassTreeMask()
+    {
+        delete this->root_;
+    }
+
+    /**
+        @brief Adds a new "include" rule for a given subclass to the mask.
+        @param subclass The subclass
+        @param overwrite True = overwrite previously added rules for inheriting classes
+        @param clean True = clean the tree after adding the new rule
+    */
+    void ClassTreeMask::include(const Identifier* subclass, bool overwrite, bool clean)
+    {
+        this->add(subclass, true, overwrite, clean);
+    }
+
+    /**
+        @brief Adds a new "exclude" rule for a given subclass to the mask.
+        @param subclass The subclass
+        @param overwrite True = overwrite previously added rules for inheriting classes
+        @param clean True = clean the tree after adding the new rule
+    */
+    void ClassTreeMask::exclude(const Identifier* subclass, bool overwrite, bool clean)
+    {
+        this->add(subclass, false, overwrite, clean);
+    }
+
+    /**
+        @brief Adds a new rule for a given subclass to the mask.
+        @param subclass The subclass
+        @param bInclude The rule: include (true) or exclude (false)
+        @param overwrite True = overwrite previously added rules for inheriting classes
+        @param clean True = clean the tree after adding the new rule
+    */
+    void ClassTreeMask::add(const Identifier* subclass, bool bInclude, bool overwrite, bool clean)
+    {
+        // Check if the given subclass is a child of our root-class
+        if (subclass->isA(this->root_->getClass()))
+        {
+            // Yes it is: Just add the rule to the three
+            this->add(this->root_, subclass, bInclude, overwrite);
+        }
+        else
+        {
+            // No it's not: Search for classes inheriting from the given class and add the rules for them
+            for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildrenBegin(); it != subclass->getDirectChildrenEnd(); ++it)
+                if ((*it)->isA(this->root_->getClass()))
+                    if (overwrite || (!this->nodeExists(*it))) // If we don't want to overwrite, only add nodes that don't already exist
+                        this->add(this->root_, *it, bInclude, overwrite);
+        }
+
+        // Clean the rule-tree
+        if (clean)
+            this->clean();
+    }
+
+    /**
+        @brief Adds a new rule for a given subclass to a node of the internal rule-tree (recursive function).
+        @param node The node
+        @param subclass The subclass
+        @param bInclude The rule: include (true) or exclude (false)
+        @param overwrite True = overwrite previously added rules for inheriting classes
+    */
+    void ClassTreeMask::add(ClassTreeMaskNode* node, const Identifier* subclass, bool bInclude, bool overwrite)
+    {
+        // Check if the current node contains exactly the subclass we want to add
+        if (subclass == node->getClass())
+        {
+            // We're at the right place, just change the mask and return
+            node->setIncluded(bInclude, overwrite);
+            return;
+        }
+        else if (subclass->isA(node->getClass()))
+        {
+            // Search for an already existing node, containing the subclass we want to add
+            for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
+            {
+                if (subclass->isA((*it)->getClass()))
+                {
+                    // We've found an existing node -> delegate the work with a recursive function-call and return
+                    this->add(*it, subclass, bInclude, overwrite);
+                    return;
+                }
+            }
+
+            // There is no existing node satisfying our needs -> we create a new node
+            ClassTreeMaskNode* newnode = new ClassTreeMaskNode(subclass, bInclude);
+
+            // Search for nodes that should actually be subnodes of our new node and erase them
+            for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); )
+            {
+                if ((*it)->getClass()->isChildOf(subclass))
+                {
+                    // We've found a subnode: add it to the new node and erase it from the current node
+                    if (!overwrite)
+                        newnode->addSubnode(*it);
+                    else
+                        delete (*it);
+
+                    node->subnodes_.erase(it++);
+                }
+                else
+                {
+                    ++it;
+                }
+            }
+
+            // Finally add the new node as a subnode to the current node
+            node->addSubnode(newnode);
+        }
+    }
+
+    /**
+        @brief Adds a new "include" rule for a single subclass. The new rule doesn't change the mask for inheriting classes.
+        @param subclass The subclass
+        @param clean True = clean the tree after adding the new rule
+    */
+    void ClassTreeMask::includeSingle(const Identifier* subclass, bool clean)
+    {
+        this->addSingle(subclass, true, clean);
+    }
+
+    /**
+        @brief Adds a new "exclude" rule for a single subclass. The new rule doesn't change the mask for inheriting classes.
+        @param subclass The subclass
+        @param clean True = clean the tree after adding the new rule
+    */
+    void ClassTreeMask::excludeSingle(const Identifier* subclass, bool clean)
+    {
+        this->addSingle(subclass, false, clean);
+    }
+
+    /**
+        @brief Adds a new rule for a single subclass. The new rule doesn't change the mask for inheriting classes.
+        @param bInclude The rule: include (true) or exclude (false)
+        @param subclass The subclass
+        @param clean True = clean the tree after adding the new rule
+    */
+    void ClassTreeMask::addSingle(const Identifier* subclass, bool bInclude, bool clean)
+    {
+        for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildrenBegin(); it != subclass->getDirectChildrenEnd(); ++it)
+            this->add(*it, this->isIncluded(*it), false, false);
+
+        this->add(subclass, bInclude, false, clean);
+    }
+
+    /**
+        @brief Resets the mask to "include everything".
+    */
+    void ClassTreeMask::reset()
+    {
+        delete this->root_;
+        this->root_ = new ClassTreeMaskNode(ClassManager<BaseObject>::getIdentifier(), true);
+    }
+
+    /**
+        @brief Tells if a given subclass is included or not.
+        @param subclass The subclass
+        @return Included (true) or excluded (false)
+    */
+    bool ClassTreeMask::isIncluded(const Identifier* subclass) const
+    {
+        return this->isIncluded(this->root_, subclass);
+    }
+
+    /**
+        @brief Tells if a given subclass of a node in the rule-tree is included or not (recursive function).
+        @param node The node
+        @param subclass The subclass
+        @return Included (true) or excluded (false)
+    */
+    bool ClassTreeMask::isIncluded(ClassTreeMaskNode* node, const Identifier* subclass) const
+    {
+        // Check if the searched subclass is of the same type as the class in the current node or a derivative
+        if (subclass->isA(node->getClass()))
+        {
+            // Check for the special case
+            if (subclass == node->getClass())
+                return node->isIncluded();
+
+            // Go through the list of subnodes and look for a node containing the searched subclass and delegate the request by a recursive function-call.
+            for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
+                if (subclass->isA((*it)->getClass()))
+                    return isIncluded(*it, subclass);
+
+            // There is no subnode containing our class -> the rule of the current node takes in effect
+            return node->isIncluded();
+        }
+        else
+        {
+            // The class is not included in the mask: return false
+            return false;
+        }
+    }
+
+    /**
+        @brief Tells if a given subclass is excluded or not.
+        @param subclass The subclass
+        @return The inverted rule: Excluded (true) or included (false)
+    */
+    bool ClassTreeMask::isExcluded(const Identifier* subclass) const
+    {
+        return (!this->isIncluded(subclass));
+    }
+
+    /**
+        @brief Removes all unneeded rules that don't change the information of the mask.
+    */
+    void ClassTreeMask::clean()
+    {
+        this->clean(this->root_);
+    }
+
+    /**
+        @brief Removes all unneded rules that don't change the information of a node of a mask (recursive function).
+        @param node The node
+    */
+    void ClassTreeMask::clean(ClassTreeMaskNode* node)
+    {
+        // Iterate through all subnodes of the given node
+        for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); )
+        {
+            // Recursive function-call: Clean the subnode
+            this->clean(*it);
+
+            // Now check if the subnode contains the same rule as the current node
+            if ((*it)->isIncluded() == node->isIncluded())
+            {
+                // It does: Move all subnodes of the redundant subnode to the current node
+                node->subnodes_.insert(node->subnodes_.end(), (*it)->subnodes_.begin(), (*it)->subnodes_.end());
+                (*it)->subnodes_.clear();
+
+                // Remove the redundant subnode from the current node
+                node->subnodes_.erase(it++);
+            }
+            else
+            {
+                // The subnode is necessary: Move on to the next subnode
+                ++it;
+            }
+        }
+    }
+
+    /**
+        @brief Checks if a node for the given subclass exists.
+        @param subclass The Identifier of the subclass
+        @return True = the node exists
+    */
+    bool ClassTreeMask::nodeExists(const Identifier* subclass)
+    {
+        for (ClassTreeMaskIterator it = this->root_; it; ++it)
+            if ((*it)->getClass() == subclass)
+                return true;
+
+        return false;
+    }
+
+    /**
+        @brief Assignment operator: Adds all rules of the other mask.
+        @param other The other mask
+        @return A reference to the mask itself
+    */
+    ClassTreeMask& ClassTreeMask::operator=(const ClassTreeMask& other)
+    {
+        // Make a copy to avoid troubles with self-assignments (like A = A).
+        ClassTreeMask temp(other);
+
+        // Removes all current rules
+        this->reset();
+
+        // Copy all rules from the other mask
+        for (ClassTreeMaskIterator it = temp.root_; it; ++it)
+            this->add(it->getClass(), it->isIncluded(), false, false);
+
+        // Return a reference to the mask itself
+        return (*this);
+    }
+
+    /**
+        @brief Compares the mask with another mask and returns true if they represent the same logic.
+        @param other The other mask
+        @return True if both masks represent the same logic
+    */
+    bool ClassTreeMask::operator==(const ClassTreeMask& other) const
+    {
+        ClassTreeMask temp1 = other;
+        ClassTreeMask temp2 = (*this);
+
+        temp1.clean();
+        temp2.clean();
+
+        ClassTreeMaskIterator it1 = temp1.root_;
+        ClassTreeMaskIterator it2 = temp2.root_;
+
+        for ( ; it1 && it2; ++it1, ++it2)
+            if (it1->getClass() != it2->getClass())
+                return false;
+
+        return true;
+    }
+
+    /**
+        @brief Compares the mask with another mask and returns true if they represent different logics.
+        @param other The other mask
+        @return True if the masks represent different logics
+    */
+    bool ClassTreeMask::operator!=(const ClassTreeMask& other) const
+    {
+        return (!((*this) == other));
+    }
+
+    /**
+        @brief Prefix operator + does nothing.
+        @return A reference to the mask itself
+    */
+    ClassTreeMask& ClassTreeMask::operator+()
+    {
+        return (*this);
+    }
+
+    /**
+        @brief Prefix operator - inverts the mask.
+        @return The inverted mask
+    */
+    ClassTreeMask ClassTreeMask::operator-() const
+    {
+        return (!(*this));
+    }
+
+    /**
+        @brief Adds two masks in the sense of a union (all classes that are included in at least one of the masks will be included in the resulting mask too).
+        @param other The mask to unite with
+        @return The union
+    */
+    ClassTreeMask ClassTreeMask::operator+(const ClassTreeMask& other) const
+    {
+        // Create a new mask
+        ClassTreeMask newmask;
+
+        // Add all nodes from the first mask, calculate the rule with the or-operation
+        for (ClassTreeMaskIterator it = this->root_; it; ++it)
+        {
+            const Identifier* subclass = it->getClass();
+            newmask.add(subclass, this->isIncluded(subclass) or other.isIncluded(subclass), false, false);
+        }
+
+        // Add all nodes from the second mask, calculate the rule with the or-operation
+        for (ClassTreeMaskIterator it = other.root_; it; ++it)
+        {
+            const Identifier* subclass = it->getClass();
+            newmask.add(subclass, this->isIncluded(subclass) or other.isIncluded(subclass), false, false);
+        }
+
+        // Drop all redundant rules
+        newmask.clean();
+
+        // Return the new mask
+        return newmask;
+    }
+
+    /**
+        @brief Intersects two masks (only classes that are included in both masks will be included in the resulting mask too).
+        @param other The mask to intersect with
+        @return The intersection
+    */
+    ClassTreeMask ClassTreeMask::operator*(const ClassTreeMask& other) const
+    {
+        // Create a new mask
+        ClassTreeMask newmask;
+
+        // Add all nodes from the first mask, calculate the rule with the and-operation
+        for (ClassTreeMaskIterator it = this->root_; it; ++it)
+        {
+            const Identifier* subclass = it->getClass();
+            newmask.add(subclass, this->isIncluded(subclass) and other.isIncluded(subclass), false, false);
+        }
+
+        // Add all nodes from the second mask, calculate the rule with the and-operation
+        for (ClassTreeMaskIterator it = other.root_; it; ++it)
+        {
+            const Identifier* subclass = it->getClass();
+            newmask.add(subclass, this->isIncluded(subclass) and other.isIncluded(subclass), false, false);
+        }
+
+        // Drop all redundant rules
+        newmask.clean();
+
+        // Return the new mask
+        return newmask;
+    }
+
+    /**
+        @brief Removes all elements of the second mask from the first mask (all classes that are included in the first mask stay included, except those that are included in the second mask too).
+        @param other The mask to subtract.
+        @return The difference
+    */
+    ClassTreeMask ClassTreeMask::operator-(const ClassTreeMask& other) const
+    {
+        return ((*this) * (!other));
+    }
+
+    /**
+        @brief Inverts the mask (all included classes are now excluded and vice versa).
+        @return The complement
+    */
+    ClassTreeMask ClassTreeMask::operator!() const
+    {
+        // Create a new mask
+        ClassTreeMask newmask;
+
+        // Add all nodes from the other mask, inverting the rules
+        for (ClassTreeMaskIterator it = this->root_; it; ++it)
+        {
+            const Identifier* subclass = it->getClass();
+            newmask.add(subclass, !this->isIncluded(subclass), false, false);
+        }
+
+        // Return the new mask
+        return newmask;
+    }
+
+    /**
+        @brief Unites this mask with another mask.
+        @param other The other mask
+        @return A reference to the mask itself
+    */
+    ClassTreeMask& ClassTreeMask::operator+=(const ClassTreeMask& other)
+    {
+        (*this) = (*this) + other;
+        return (*this);
+    }
+
+    /**
+        @brief Intersects this mask with another mask.
+        @param other The other mask
+        @return A reference to the mask itself
+    */
+    ClassTreeMask& ClassTreeMask::operator*=(const ClassTreeMask& other)
+    {
+        (*this) = (*this) * other;
+        return (*this);
+    }
+
+    /**
+        @brief Subtracts another mask from this mask.
+        @param other The other mask
+        @return A reference to the mask itself
+    */
+    ClassTreeMask& ClassTreeMask::operator-=(const ClassTreeMask& other)
+    {
+        (*this) = (*this) - other;
+        return (*this);
+    }
+
+    /**
+        @brief Intersects two masks (only classes that are included in both masks will be included in the resulting mask too).
+        @param other The mask to intersect with
+        @return The intersection
+    */
+    ClassTreeMask ClassTreeMask::operator&(const ClassTreeMask& other) const
+    {
+        return ((*this) * other);
+    }
+
+    /**
+        @brief Adds two masks in the sense of a union (all classes that are included in at least one of the masks will be included in the resulting mask too).
+        @param other The mask to unite with
+        @return The union
+    */
+    ClassTreeMask ClassTreeMask::operator|(const ClassTreeMask& other) const
+    {
+        return ((*this) + other);
+    }
+
+    /**
+        @brief Joins two masks in the sense of a xor (exclusivity) operation (all classes that are included in exactly one of the masks, but not in both, will be included in the resulting mask too).
+        @param other The mask to join with
+        @return The result
+    */
+    ClassTreeMask ClassTreeMask::operator^(const ClassTreeMask& other) const
+    {
+        // Create a new mask
+        ClassTreeMask newmask;
+
+        // Add all nodes from the first mask, calculate the rule with the xor-operation
+        for (ClassTreeMaskIterator it = this->root_; it; ++it)
+        {
+            const Identifier* subclass = it->getClass();
+            newmask.add(subclass, this->isIncluded(subclass) xor other.isIncluded(subclass), false, false);
+        }
+
+        // Add all nodes from the second mask, calculate the rule with the xor-operation
+        for (ClassTreeMaskIterator it = other.root_; it; ++it)
+        {
+            const Identifier* subclass = it->getClass();
+            newmask.add(subclass, this->isIncluded(subclass) xor other.isIncluded(subclass), false, false);
+        }
+
+        // Drop all redundant rules
+        newmask.clean();
+
+        // Return the new mask
+        return newmask;
+    }
+
+    /**
+        @brief Inverts the mask (all included classes are now excluded and vice versa).
+        @return The complement
+    */
+    ClassTreeMask ClassTreeMask::operator~() const
+    {
+        return (!(*this));
+    }
+
+    /**
+        @brief Intersects this mask with another mask (and-operation)
+        @param other The other mask
+        @return A reference to the mask itself
+    */
+    ClassTreeMask& ClassTreeMask::operator&=(const ClassTreeMask& other)
+    {
+        (*this) = (*this) & other;
+        return (*this);
+    }
+
+    /**
+        @brief Unites this mask with another mask (or-operation).
+        @param other The other mask
+        @return A reference to the mask itself
+    */
+    ClassTreeMask& ClassTreeMask::operator|=(const ClassTreeMask& other)
+    {
+        (*this) = (*this) | other;
+        return (*this);
+    }
+
+    /**
+        @brief Joins this mask with another mask with a xor-operation.
+        @param other The other mask
+        @return A reference to the mask itself
+    */
+    ClassTreeMask& ClassTreeMask::operator^=(const ClassTreeMask& other)
+    {
+        (*this) = (*this) ^ other;
+        return (*this);
+    }
+
+    /**
+        @brief Converts the content of a mask into a human readable string and puts it on the ostream.
+        @param out The ostream
+        @param mask The mask
+        @return A reference to the ostream
+    */
+    std::ostream& operator<<(std::ostream& out, const ClassTreeMask& mask)
+    {
+        // Iterate through all rules
+        for (ClassTreeMaskIterator it = mask.root_; it; ++it)
+        {
+            // Calculate the prefix: + means included, - means excluded
+            if (it->isIncluded())
+                out << "+";
+            else
+                out << "-";
+
+            // Put the name of the corresponding class on the stream
+            out << it->getClass()->getName() << " ";
+        }
+
+        return out;
+    }
+}
Index: code/trunk/src/core/ClassTreeMask.h
===================================================================
--- code/trunk/src/core/ClassTreeMask.h	(revision 1055)
+++ code/trunk/src/core/ClassTreeMask.h	(revision 1055)
@@ -0,0 +1,217 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file ClassTreeMask.h
+    @brief Definition of the ClassTreeMask, ClassTreeMaskNode and ClassTreeMaskIterator classes.
+
+    ClassTreeMask is a class to define a mask of the class-tree beginning with BaseObject.
+    You can include or exclude classes by calling the corresponding functions with the
+    Identifier of the class.
+
+    You can work with a ClassTreeMask in the sense of the set-theory, meaning that you can create
+    unions, intersections, complements and differences by using overloaded operators.
+
+
+
+    The ClassTreeMask is internally represented by a tree. The nodes in the tree are
+    ClassTreeMaskNodes, containing the rule (included or excluded) for this class and all
+    subclasses and a list of all subnodes. To minimize the size, the tree contains only
+    nodes changing the mask. By adding new rules, the tree gets reordered dynamically.
+
+    Adding a new rule overwrites all rules assigned to inherited classes. Use overwrite = false
+    if you don't like this feature. Useless rules that don't change the information of the mask
+    aren't saved in the internal tree. Use clean = false if you wan't to save them.
+
+    With overwrite = false and clean = false it doesn't matter in which way you create the mask.
+    You can manually drop useless rules from the tree by calling clean().
+
+
+
+    Because of the complicated shape of the internal tree, there is an iterator to iterate
+    through all ClassTreeMaskNodes of a mask. It starts with the BaseObject and moves on to
+    the first subclass until it reaches a leaf of the tree. Then the iterator moves one step
+    back and iterates to the second subclass. If there are no more subclasses, it steps another
+    step back, and so on.
+
+    Example: A and B are childs of BaseObject, A1 and A2 are childs of A, B1 and B2 are childs of B.
+    The ClassTreeMaskIterator would move trough the tree in the following order:
+    BaseObject, A, A1, A2, B, B1, B2.
+
+    Note that the iterator doesn't move trough the whole class-tree, but only through the
+    internal tree of the mask, containing the minimal needed set of nodes to describe the mask.
+*/
+
+#ifndef _ClassTreeMask_H__
+#define _ClassTreeMask_H__
+
+#include <list>
+#include <stack>
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###    ClassTreeMaskNode    ###
+    // ###############################
+    //! The ClassTreeMaskNode is a node in the internal tree of the ClassTreeMask, containing the rules of the mask.
+    /**
+        The ClassTreeMaskNode is used to store the rule (included or excluded) for a given
+        class (described by the corresponding Identifier). The nodes are used in the internal
+        tree of ClassTreeMask. To build a tree, they store a list of all subnodes.
+    */
+    class _CoreExport ClassTreeMaskNode
+    {
+        friend class ClassTreeMask;
+        friend class ClassTreeMaskIterator;
+
+        public:
+            ClassTreeMaskNode(const Identifier* subclass, bool bIncluded = true);
+            ~ClassTreeMaskNode();
+
+            void include(bool overwrite = true);
+            void exclude(bool overwrite = true);
+            void setIncluded(bool bIncluded, bool overwrite = true);
+
+            void addSubnode(ClassTreeMaskNode* subnode);
+
+            bool isIncluded() const;
+            bool isExcluded() const;
+
+            const Identifier* getClass() const;
+
+        private:
+            void deleteAllSubnodes();
+
+            const Identifier* subclass_;                //!< The Identifier of the subclass the rule refers to
+            bool bIncluded_;                            //!< The rule: included or excluded
+            std::list<ClassTreeMaskNode*> subnodes_;    //!< A list containing all subnodes in the tree
+    };
+
+
+    // ###############################
+    // ###  ClassTreeMaskIterator  ###
+    // ###############################
+    //! The ClassTreeMaskIterator moves through all ClassTreeMaskNodes of the internal tree of a ClassTreeMask, containing the rules.
+    /**
+        Because of the complicated shape of the internal rule-tree of ClassTreeMask, an
+        iterator is used to move through all nodes of the tree. It starts with the BaseObject
+        and moves on to the first subclass until it reaches a leaf of the tree. Then the
+        iterator moves one step back and iterates to the second subclass. If there are no more
+        subclasses, it steps another step back, and so on.
+    */
+    class _CoreExport ClassTreeMaskIterator
+    {
+        public:
+            ClassTreeMaskIterator(ClassTreeMaskNode* node);
+            ~ClassTreeMaskIterator();
+
+            ClassTreeMaskIterator& operator++();
+            ClassTreeMaskNode* operator*() const;
+            ClassTreeMaskNode* operator->() const;
+            operator bool();
+            bool operator==(ClassTreeMaskNode* compare);
+            bool operator!=(ClassTreeMaskNode* compare);
+
+        private:
+            std::stack<std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator> > nodes_;    //!< A stack to store list-iterators
+            std::list<ClassTreeMaskNode*> rootlist_;                                                                            //!< A list for internal use (it only stores the root-node)
+    };
+
+
+    // ###############################
+    // ###      ClassTreeMask      ###
+    // ###############################
+    //! The ClassTreeMask is a set of rules, containing the information for each class whether it's included or not.
+    /**
+        With a ClassTreeMask, you can include or exclude subtrees of the class-tree, starting
+        with a given subclass, described by the corresponding Identifier. To minimize the size
+        of the mask, the mask saves only relevant rules. But you can manually add rules that
+        don't change the information of the mask by using clean = false. If you want to drop
+        useless rules, call the clean() function.
+    */
+    class _CoreExport ClassTreeMask
+    {
+        public:
+            ClassTreeMask();
+            ClassTreeMask(const ClassTreeMask& other);
+            ~ClassTreeMask();
+
+            void include(const Identifier* subclass, bool overwrite = true, bool clean = true);
+            void exclude(const Identifier* subclass, bool overwrite = true, bool clean = true);
+            void add(const Identifier* subclass, bool bInclude, bool overwrite = true, bool clean = true);
+
+            void includeSingle(const Identifier* subclass, bool clean = true);
+            void excludeSingle(const Identifier* subclass, bool clean = true);
+            void addSingle(const Identifier* subclass, bool bInclude, bool clean = true);
+
+            void reset();
+            void clean();
+
+            bool isIncluded(const Identifier* subclass) const;
+            bool isExcluded(const Identifier* subclass) const;
+
+            ClassTreeMask& operator=(const ClassTreeMask& other);
+
+            bool operator==(const ClassTreeMask& other) const;
+            bool operator!=(const ClassTreeMask& other) const;
+
+            ClassTreeMask& operator+();
+            ClassTreeMask operator-() const;
+
+            ClassTreeMask operator+(const ClassTreeMask& other) const;
+            ClassTreeMask operator*(const ClassTreeMask& other) const;
+            ClassTreeMask operator-(const ClassTreeMask& other) const;
+            ClassTreeMask operator!() const;
+
+            ClassTreeMask& operator+=(const ClassTreeMask& other);
+            ClassTreeMask& operator*=(const ClassTreeMask& other);
+            ClassTreeMask& operator-=(const ClassTreeMask& other);
+
+            ClassTreeMask operator&(const ClassTreeMask& other) const;
+            ClassTreeMask operator|(const ClassTreeMask& other) const;
+            ClassTreeMask operator^(const ClassTreeMask& other) const;
+            ClassTreeMask operator~() const;
+
+            ClassTreeMask& operator&=(const ClassTreeMask& other);
+            ClassTreeMask& operator|=(const ClassTreeMask& other);
+            ClassTreeMask& operator^=(const ClassTreeMask& other);
+
+            friend std::ostream& operator<<(std::ostream& out, const ClassTreeMask& mask);
+
+        private:
+            void add(ClassTreeMaskNode* node, const Identifier* subclass, bool bInclude, bool overwrite = true);
+            bool isIncluded(ClassTreeMaskNode* node, const Identifier* subclass) const;
+            void clean(ClassTreeMaskNode* node);
+            bool nodeExists(const Identifier* subclass);
+
+            ClassTreeMaskNode* root_;   //!< The root-node of the internal rule-tree, usually BaseObject
+    };
+}
+
+#endif /* _ClassTreeMask_H__ */
Index: code/trunk/src/core/CommandExecutor.cc
===================================================================
--- code/trunk/src/core/CommandExecutor.cc	(revision 1055)
+++ code/trunk/src/core/CommandExecutor.cc	(revision 1055)
@@ -0,0 +1,1362 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "CommandExecutor.h"
+#include "ConsoleCommand.h"
+#include "util/String.h"
+#include "util/Convert.h"
+#include "Identifier.h"
+#include "Language.h"
+#include "Debug.h"
+#include "Executor.h"
+#include "ConfigValueContainer.h"
+
+#define COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE "set"
+#define COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY "tset"
+#define COMMAND_EXECUTOR_KEYWORD_SET_KEYBIND "bind"
+
+namespace orxonox
+{
+    ConsoleCommandShortcutGeneric(keyword1, createExecutor((FunctorStatic*)0, "set", AccessLevel::User));
+    ConsoleCommandShortcutGeneric(keyword2, createExecutor((FunctorStatic*)0, "tset", AccessLevel::User));
+    ConsoleCommandShortcutGeneric(keyword3, createExecutor((FunctorStatic*)0, "bind", AccessLevel::User));
+
+    ConsoleCommandShortcutExtern(exec, AccessLevel::None);
+    ConsoleCommandShortcutExtern(echo, AccessLevel::None);
+
+    ConsoleCommandShortcutExtern(read, AccessLevel::None);
+    ConsoleCommandShortcutExtern(append, AccessLevel::None);
+    ConsoleCommandShortcutExtern(write, AccessLevel::None);
+
+    void exec(const std::string& filename)
+    {
+        static std::set<std::string> executingFiles;
+
+        std::set<std::string>::const_iterator it = executingFiles.find(filename);
+        if (it != executingFiles.end())
+        {
+            COUT(1) << "Error: Recurring exec command in \"" << filename << "\". Stopped execution." << std::endl;
+            return;
+        }
+
+        // Open the file
+        std::ifstream file;
+        file.open(filename.c_str(), std::fstream::in);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "Error: Couldn't execute file \"" << filename << "\"." << std::endl;
+            return;
+        }
+
+        executingFiles.insert(filename);
+
+        // Iterate through the file and put the lines into the CommandExecutor
+        char line[1024];
+        while (file.good() && !file.eof())
+        {
+            file.getline(line, 1024);
+            CommandExecutor::execute(line);
+        }
+
+        executingFiles.erase(filename);
+        file.close();
+    }
+
+    std::string echo(const std::string& text)
+    {
+        return text;
+    }
+
+    void write(const std::string& filename, const std::string& text)
+    {
+        std::ofstream file;
+        file.open(filename.c_str(), std::fstream::out);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "Error: Couldn't write to file \"" << filename << "\"." << std::endl;
+            return;
+        }
+
+        file << text << std::endl;
+        file.close();
+    }
+
+    void append(const std::string& filename, const std::string& text)
+    {
+        std::ofstream file;
+        file.open(filename.c_str(), std::fstream::app);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "Error: Couldn't append to file \"" << filename << "\"." << std::endl;
+            return;
+        }
+
+        file << text << std::endl;
+        file.close();
+    }
+
+    std::string read(const std::string& filename)
+    {
+        std::ifstream file;
+        file.open(filename.c_str(), std::fstream::in);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "Error: Couldn't read from file \"" << filename << "\"." << std::endl;
+            return "";
+        }
+
+        std::string output = "";
+        char line[1024];
+        while (file.good() && !file.eof())
+        {
+            file.getline(line, 1024);
+            output += line;
+            output += "\n";
+        }
+
+        file.close();
+
+        return output;
+    }
+
+
+    ///////////////////////
+    // CommandEvaluation //
+    ///////////////////////
+    CommandEvaluation::CommandEvaluation()
+    {
+        this->processedCommand_ = "";
+        this->additionalParameter_ = "";
+
+        this->functionclass_ = 0;
+        this->configvalueclass_ = 0;
+        this->shortcut_ = 0;
+        this->function_ = 0;
+        this->configvalue_ = 0;
+        this->key_ = 0;
+
+        this->errorMessage_ = "";
+        this->state_ = CS_Uninitialized;
+
+        this->bEvaluatedParams_ = false;
+        this->evaluatedExecutor_ = 0;
+    }
+
+    KeybindMode CommandEvaluation::getKeybindMode()
+    {
+        if (this->state_ == CS_Shortcut_Params || this->state_ == CS_Shortcut_Finished)
+        {
+//            if (this->shortcut_ != 0)
+//                return this->shortcut_->getKeybindMode();
+        }
+        else if (this->state_ == CS_Function_Params || this->state_ == CS_Function_Finished)
+        {
+//            if (this->function_ != 0)
+//                return this->function_->getKeybindMode();
+        }
+        else if (this->state_ == CS_ConfigValueType || this->state_ == CS_ConfigValueFinished)
+        {
+//            return KeybindMode::onPress;
+        }
+        else if (this->state_ == CS_KeybindCommand || this->state_ == CS_KeybindFinished)
+        {
+//            return KeybindMode::onPress;
+        }
+        else
+        {
+//            return KeybindMode::onPress;
+        }
+    }
+
+    bool CommandEvaluation::isValid() const
+    {
+        if (this->state_ == CS_Shortcut_Params || this->state_ == CS_Shortcut_Finished)
+        {
+            return this->shortcut_;
+        }
+        else if (this->state_ == CS_Function_Params || this->state_ == CS_Function_Finished)
+        {
+            return (this->functionclass_ && this->function_);
+        }
+        else if (this->state_ == CS_ConfigValueType || this->state_ == CS_ConfigValueFinished)
+        {
+            return (this->configvalueclass_ && this->configvalue_);
+        }
+        else if (this->state_ == CS_KeybindCommand || this->state_ == CS_KeybindFinished)
+        {
+            return this->key_;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    void CommandEvaluation::evaluateParams()
+    {
+        this->bEvaluatedParams_ = false;
+        this->evaluatedExecutor_ = 0;
+
+        for (unsigned int i = 0; i < MAX_FUNCTOR_ARGUMENTS; i++)
+            this->param_[i] = MT_null;
+
+        if (this->state_ == CS_Shortcut_Params || this->state_ == CS_Shortcut_Finished)
+        {
+            if (this->shortcut_)
+            {
+                if (this->shortcut_->evaluate(this->processedCommand_ + this->getAdditionalParameter(), this->param_, " "))
+                {
+                    this->bEvaluatedParams_ = true;
+                    this->evaluatedExecutor_ = this->shortcut_;
+                }
+            }
+        }
+        else if (this->state_ == CS_Function_Params || this->state_ == CS_Function_Finished)
+        {
+            if (this->function_)
+            {
+                if (this->function_->evaluate(this->processedCommand_ + this->getAdditionalParameter(), this->param_, " "))
+                {
+                    this->bEvaluatedParams_ = true;
+                    this->evaluatedExecutor_ = this->function_;
+                }
+            }
+        }
+    }
+
+    void CommandEvaluation::setEvaluatedParameter(unsigned int index, MultiTypeMath param)
+    {
+        if (index >= 0 && index < MAX_FUNCTOR_ARGUMENTS)
+            this->param_[index] = param;
+    }
+
+    MultiTypeMath CommandEvaluation::getEvaluatedParameter(unsigned int index) const
+    {
+        if (index >= 0 && index < MAX_FUNCTOR_ARGUMENTS)
+            return this->param_[index];
+
+        return MT_null;
+    }
+
+    MultiTypeMath CommandEvaluation::getReturnvalue() const
+    {
+        if (this->state_ == CS_Shortcut_Params || this->state_ == CS_Shortcut_Finished)
+        {
+            if (this->shortcut_)
+                return this->shortcut_->getReturnvalue();
+        }
+        else if (this->state_ == CS_Function_Params || this->state_ == CS_Function_Finished)
+        {
+            if (this->function_)
+                return this->function_->getReturnvalue();
+        }
+
+        return MT_null;
+    }
+
+
+    /////////////////////
+    // CommandExecutor //
+    /////////////////////
+    CommandExecutor& CommandExecutor::getInstance()
+    {
+        static CommandExecutor instance;
+        return instance;
+    }
+
+    CommandEvaluation& CommandExecutor::getEvaluation()
+    {
+        return CommandExecutor::getInstance().evaluation_;
+    }
+
+    Executor& CommandExecutor::addConsoleCommandShortcut(ExecutorStatic* executor)
+    {
+        CommandExecutor::getInstance().consoleCommandShortcuts_[executor->getName()] = executor;
+        CommandExecutor::getInstance().consoleCommandShortcuts_LC_[getLowercase(executor->getName())] = executor;
+        return (*executor);
+    }
+
+    /**
+        @brief Returns the executor of a console command shortcut with given name.
+        @brief name The name of the requested console command shortcut
+        @return The executor of the requested console command shortcut
+    */
+    ExecutorStatic* CommandExecutor::getConsoleCommandShortcut(const std::string& name)
+    {
+        std::map<std::string, ExecutorStatic*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_.find(name);
+        if (it != CommandExecutor::getInstance().consoleCommandShortcuts_.end())
+            return (*it).second;
+        else
+            return 0;
+    }
+
+    /**
+        @brief Returns the executor of a console command shortcut with given name in lowercase.
+        @brief name The name of the requested console command shortcut in lowercase
+        @return The executor of the requested console command shortcut
+    */
+    ExecutorStatic* CommandExecutor::getLowercaseConsoleCommandShortcut(const std::string& name)
+    {
+        std::map<std::string, ExecutorStatic*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_LC_.find(name);
+        if (it != CommandExecutor::getInstance().consoleCommandShortcuts_LC_.end())
+            return (*it).second;
+        else
+            return 0;
+    }
+
+    bool CommandExecutor::execute(const std::string& command)
+    {
+        std::string strippedCommand = stripEnclosingQuotes(command);
+
+        SubString tokensIO(strippedCommand, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0');
+        if (tokensIO.size() >= 2)
+        {
+            if (tokensIO[tokensIO.size() - 2] == ">")
+            {
+                bool success = CommandExecutor::execute(tokensIO.subSet(0, tokensIO.size() - 2).join());
+                write(tokensIO[tokensIO.size() - 1], CommandExecutor::getEvaluation().getReturnvalue());
+                return success;
+            }
+            else if (tokensIO[tokensIO.size() - 2] == "<")
+            {
+                std::string input = read(tokensIO[tokensIO.size() - 1]);
+                if (input == "" || input.size() == 0)
+                    return CommandExecutor::execute(tokensIO.subSet(0, tokensIO.size() - 2).join());
+                else
+                    return CommandExecutor::execute(tokensIO.subSet(0, tokensIO.size() - 2).join() + " " + input);
+            }
+        }
+
+
+        SubString tokensPipeline(strippedCommand, "|", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0');
+        if (tokensPipeline.size() > 1)
+        {
+            bool success = true;
+            std::string returnValue = "";
+            for (int i = tokensPipeline.size() - 1; i >= 0; i--)
+            {
+                if (returnValue == "" || returnValue.size() == 0)
+                {
+                    //CommandEvaluation evaluation = CommandExecutor::evaluate(tokens[i]);
+                    if (!CommandExecutor::execute(tokensPipeline[i]))
+                        success = false;
+                }
+                else
+                {
+                    //CommandEvaluation evaluation = CommandExecutor::evaluate(tokens[i] + " " + returnValue);
+                    if (!CommandExecutor::execute(tokensPipeline[i] + " " + returnValue))
+                        success = false;
+                }
+
+                //CommandExecutor::execute(evaluation);
+                //returnValue = evaluation.getReturnvalue();
+                returnValue = CommandExecutor::getEvaluation().getReturnvalue().toString();
+            }
+            return success;
+        }
+
+        if ((CommandExecutor::getEvaluation().processedCommand_ != strippedCommand) || (CommandExecutor::getEvaluation().state_ == CS_Uninitialized))
+            CommandExecutor::parse(strippedCommand);
+
+        return CommandExecutor::execute(CommandExecutor::getEvaluation());
+    }
+
+
+    bool CommandExecutor::execute(const CommandEvaluation& evaluation)
+    {
+        SubString tokens(evaluation.processedCommand_, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0');
+
+        if (evaluation.bEvaluatedParams_ && evaluation.evaluatedExecutor_)
+        {
+            (*evaluation.evaluatedExecutor_)(evaluation.param_[0], evaluation.param_[1], evaluation.param_[2], evaluation.param_[3], evaluation.param_[4]);
+        }
+
+        switch (evaluation.state_)
+        {
+            case CS_Uninitialized:
+                break;
+            case CS_Empty:
+                break;
+            case CS_FunctionClass_Or_Shortcut_Or_Keyword:
+                break;
+            case CS_Shortcut_Params:
+                // not enough parameters but lets hope there are some additional parameters and go on
+            case CS_Shortcut_Finished:
+                // call the shortcut
+                if (evaluation.shortcut_)
+                {
+                    if (tokens.size() >= 2)
+                        return evaluation.shortcut_->parse(removeSlashes(tokens.subSet(1).join() + evaluation.getAdditionalParameter()));
+                    else
+                        return evaluation.shortcut_->parse(removeSlashes(evaluation.additionalParameter_));
+                }
+                break;
+            case CS_Function:
+                break;
+            case CS_Function_Params:
+                // not enough parameters but lets hope there are some additional parameters and go on
+            case CS_Function_Finished:
+                // call the shortcut
+                if (evaluation.function_)
+                {
+                    if (tokens.size() >= 3)
+                        return evaluation.function_->parse(removeSlashes(tokens.subSet(2).join() + evaluation.getAdditionalParameter()));
+                    else
+                        return evaluation.function_->parse(removeSlashes(evaluation.additionalParameter_));
+                }
+                break;
+            case CS_ConfigValueClass:
+                break;
+            case CS_ConfigValue:
+                break;
+            case CS_ConfigValueType:
+                // not enough parameters but lets hope there are some additional parameters and go on
+            case CS_ConfigValueFinished:
+                // set the config value
+                if (evaluation.configvalue_)
+                {
+                    if ((tokens.size() >= 1) && (tokens[0] == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE))
+                    {
+                        if (tokens.size() >= 4)
+                            return evaluation.configvalue_->set(removeSlashes(tokens.subSet(3).join() + evaluation.getAdditionalParameter()));
+                        else
+                            return evaluation.configvalue_->set(removeSlashes(evaluation.additionalParameter_));
+                    }
+                    else if ((tokens.size() >= 1) && (tokens[0] == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY))
+                    {
+                        if (tokens.size() >= 4)
+                            return evaluation.configvalue_->tset(removeSlashes(tokens.subSet(3).join() + evaluation.getAdditionalParameter()));
+                        else
+                            return evaluation.configvalue_->tset(removeSlashes(evaluation.additionalParameter_));
+                    }
+                }
+                break;
+            case CS_KeybindKey:
+                break;
+            case CS_KeybindCommand:
+                // not enough parameters but lets hope there are some additional parameters and go on
+            case CS_KeybindFinished:
+                // set the keybind
+                // ...todo
+                break;
+            case CS_Error:
+                break;
+        }
+
+        return false;
+    }
+
+    std::string CommandExecutor::complete(const std::string& command)
+    {
+        if ((CommandExecutor::getEvaluation().processedCommand_ != command) || (CommandExecutor::getEvaluation().state_ == CS_Uninitialized))
+            CommandExecutor::parse(command);
+
+        return CommandExecutor::complete(CommandExecutor::getEvaluation());
+    }
+
+    std::string CommandExecutor::complete(const CommandEvaluation& evaluation)
+    {
+        SubString tokens(evaluation.processedCommand_, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0');
+
+        std::list<std::pair<const std::string*, const std::string*> > temp;
+        if (evaluation.state_ == CS_Empty)
+        {
+            temp.insert(temp.end(), evaluation.listOfPossibleShortcuts_.begin(), evaluation.listOfPossibleShortcuts_.end());
+            temp.insert(temp.end(), evaluation.listOfPossibleFunctionClasses_.begin(), evaluation.listOfPossibleFunctionClasses_.end());
+        }
+
+        switch (evaluation.state_)
+        {
+            case CS_Uninitialized:
+                break;
+            case CS_Empty:
+                return (CommandExecutor::getCommonBegin(temp));
+                break;
+            case CS_FunctionClass_Or_Shortcut_Or_Keyword:
+                break;
+            case CS_Shortcut_Params:
+                if (evaluation.shortcut_)
+                    return (evaluation.shortcut_->getName() + " ");
+                break;
+            case CS_Shortcut_Finished:
+                if (evaluation.shortcut_)
+                {
+                    if (evaluation.shortcut_->getParamCount() == 0)
+                        return (evaluation.shortcut_->getName());
+                    else if (tokens.size() >= 2)
+                        return (evaluation.shortcut_->getName() + " " + tokens.subSet(1).join());
+                }
+                break;
+            case CS_Function:
+                if (evaluation.functionclass_)
+                    return (evaluation.functionclass_->getName() + " " + CommandExecutor::getCommonBegin(evaluation.listOfPossibleFunctions_));
+                break;
+            case CS_Function_Params:
+                if (evaluation.functionclass_ && evaluation.function_)
+                    return (evaluation.functionclass_->getName() + " " + evaluation.function_->getName() + " ");
+                break;
+            case CS_Function_Finished:
+                if (evaluation.functionclass_ && evaluation.function_)
+                {
+                    if (evaluation.function_->getParamCount() == 0)
+                        return (evaluation.functionclass_->getName() + " " + evaluation.function_->getName());
+                    else if (tokens.size() >= 3)
+                        return (evaluation.functionclass_->getName() + " " + evaluation.function_->getName() + " " + tokens.subSet(2).join());
+                }
+                break;
+            case CS_ConfigValueClass:
+                if (tokens.size() >= 1)
+                    return (tokens[0] + " " + CommandExecutor::getCommonBegin(evaluation.listOfPossibleConfigValueClasses_));
+                break;
+            case CS_ConfigValue:
+                if ((tokens.size() >= 1) && evaluation.configvalueclass_)
+                    return (tokens[0] + " " + evaluation.configvalueclass_->getName() + " " + CommandExecutor::getCommonBegin(evaluation.listOfPossibleConfigValues_));
+                break;
+            case CS_ConfigValueType:
+                if ((tokens.size() >= 1) && evaluation.configvalueclass_ && evaluation.configvalue_)
+                    return (tokens[0] + " " + evaluation.configvalueclass_->getName() + " " + evaluation.configvalue_->getName() + " ");
+                break;
+            case CS_ConfigValueFinished:
+                if ((tokens.size() >= 1) && evaluation.configvalueclass_ && evaluation.configvalue_ && (tokens.size() >= 4))
+                    return (tokens[0] + " " + evaluation.configvalueclass_->getName() + " " + evaluation.configvalue_->getName() + " " + tokens.subSet(3).join());
+                break;
+            case CS_KeybindKey:
+                if (tokens.size() >= 1)
+                    return (tokens[0] + " " + CommandExecutor::getCommonBegin(evaluation.listOfPossibleKeys_));
+                break;
+            case CS_KeybindCommand:
+                if ((evaluation.processedCommand_.size() >= 1) && (evaluation.processedCommand_[evaluation.processedCommand_.size() - 1] != ' '))
+                    return (evaluation.processedCommand_ + " ");
+                break;
+            case CS_KeybindFinished:
+                break;
+            case CS_Error:
+                break;
+        }
+
+        return evaluation.processedCommand_;
+    }
+
+    std::string CommandExecutor::hint(const std::string& command)
+    {
+        if ((CommandExecutor::getEvaluation().processedCommand_ != command) || (CommandExecutor::getEvaluation().state_ == CS_Uninitialized))
+            CommandExecutor::parse(command);
+
+        return CommandExecutor::hint(CommandExecutor::getEvaluation());
+    }
+
+    std::string CommandExecutor::hint(const CommandEvaluation& evaluation)
+    {
+        SubString tokens(evaluation.processedCommand_, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0');
+
+        switch (evaluation.state_)
+        {
+            case CS_Uninitialized:
+                break;
+            case CS_Empty:
+                return (CommandExecutor::dump(evaluation.listOfPossibleShortcuts_) + "\n" + CommandExecutor::dump(evaluation.listOfPossibleFunctionClasses_));
+                break;
+            case CS_FunctionClass_Or_Shortcut_Or_Keyword:
+                break;
+            case CS_Shortcut_Params:
+                if (evaluation.shortcut_)
+                    return CommandExecutor::dump(evaluation.shortcut_);
+                break;
+            case CS_Shortcut_Finished:
+                if (evaluation.shortcut_)
+                    return CommandExecutor::dump(evaluation.shortcut_);
+                break;
+            case CS_Function:
+                return CommandExecutor::dump(evaluation.listOfPossibleFunctions_);
+                break;
+            case CS_Function_Params:
+                if (evaluation.function_)
+                    return CommandExecutor::dump(evaluation.function_);
+                break;
+            case CS_Function_Finished:
+                if (evaluation.function_)
+                    return CommandExecutor::dump(evaluation.function_);
+                break;
+            case CS_ConfigValueClass:
+                return CommandExecutor::dump(evaluation.listOfPossibleConfigValueClasses_);
+                break;
+            case CS_ConfigValue:
+                return CommandExecutor::dump(evaluation.listOfPossibleConfigValues_);
+                break;
+            case CS_ConfigValueType:
+                if (evaluation.configvalue_)
+                    return CommandExecutor::dump(evaluation.configvalue_);
+                break;
+            case CS_ConfigValueFinished:
+                if (evaluation.configvalue_)
+                    return CommandExecutor::dump(evaluation.configvalue_);
+                break;
+            case CS_KeybindKey:
+                return CommandExecutor::dump(evaluation.listOfPossibleKeys_);
+                break;
+            case CS_KeybindCommand:
+                if (evaluation.key_)
+                    return CommandExecutor::dump(evaluation.key_);
+                break;
+            case CS_KeybindFinished:
+                if (evaluation.key_)
+                    return CommandExecutor::dump(evaluation.key_);
+                break;
+            case CS_Error:
+                return CommandExecutor::getEvaluation().errorMessage_;
+                break;
+        }
+
+        return "";
+    }
+
+    CommandEvaluation CommandExecutor::evaluate(const std::string& command)
+    {
+        CommandExecutor::parse(command, true);
+        CommandExecutor::getEvaluation().evaluateParams();
+        return CommandExecutor::getEvaluation();
+    }
+
+    void CommandExecutor::parse(const std::string& command, bool bInitialize)
+    {
+        CommandExecutor::getEvaluation().tokens_.split((command + COMMAND_EXECUTOR_CURSOR), " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0');
+        CommandExecutor::getEvaluation().processedCommand_ = command;
+
+        if (bInitialize)
+            CommandExecutor::initialize(command);
+
+        switch (CommandExecutor::getEvaluation().state_)
+        {
+            case CS_Uninitialized:
+                // Impossible
+                break;
+            case CS_Empty:
+                if (CommandExecutor::argumentsGiven() == 0)
+                {
+                    // We want a hint for the first token
+                    // Check if there is already a perfect match
+                    CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getIdentifierOfPossibleFunctionClass(CommandExecutor::getToken(0));
+                    CommandExecutor::getEvaluation().shortcut_ = CommandExecutor::getExecutorOfPossibleShortcut(CommandExecutor::getToken(0));
+
+                    if ((CommandExecutor::getEvaluation().functionclass_) || (CommandExecutor::getEvaluation().shortcut_))
+                    {
+                        // Yes, there is a class or a shortcut with the searched name
+                        // Add a whitespace and continue parsing
+                        CommandExecutor::getEvaluation().state_ = CS_FunctionClass_Or_Shortcut_Or_Keyword;
+                        CommandExecutor::parse(command + " ", false);
+                        return;
+                    }
+
+                    // No perfect match: Create the lists of all possible classes and shortcuts and return
+                    CommandExecutor::createListOfPossibleFunctionClasses(CommandExecutor::getToken(0));
+                    CommandExecutor::createListOfPossibleShortcuts(CommandExecutor::getToken(0));
+
+                    // Check if there's only one possiblility
+                    if ((CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.size() == 1) && (CommandExecutor::getEvaluation().listOfPossibleShortcuts_.size() == 0))
+                    {
+                        // There's only one possible class
+                        CommandExecutor::getEvaluation().state_ = CS_Function;
+                        CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getIdentifierOfPossibleFunctionClass(*(*CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.begin()).first);
+                        CommandExecutor::parse(*(*CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.begin()).first + " ", false);
+                        return;
+                    }
+                    else if ((CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.size() == 0) && (CommandExecutor::getEvaluation().listOfPossibleShortcuts_.size() == 1))
+                    {
+                        if ((*(*CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin()).first != COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE)
+                         && (*(*CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin()).first != COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)
+                         && (*(*CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin()).first != COMMAND_EXECUTOR_KEYWORD_SET_KEYBIND))
+                        {
+                            // There's only one possible shortcut
+                            CommandExecutor::getEvaluation().state_ = CS_Shortcut_Params;
+                            CommandExecutor::getEvaluation().shortcut_ = CommandExecutor::getExecutorOfPossibleShortcut(*(*CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin()).first);
+                        }
+                        else if ((*(*CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin()).first == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE)
+                              || (*(*CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin()).first == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY))
+                        {
+                            // It's the 'set' or 'tset' keyword
+                            CommandExecutor::getEvaluation().state_ = CS_ConfigValueClass;
+                        }
+                        else if (*(*CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin()).first != COMMAND_EXECUTOR_KEYWORD_SET_KEYBIND)
+                        {
+                            // It's the 'bind' keyword
+                            CommandExecutor::getEvaluation().state_ = CS_KeybindKey;
+                        }
+
+                        CommandExecutor::parse(*(*CommandExecutor::getEvaluation().listOfPossibleShortcuts_.begin()).first + " ", false);
+                        return;
+                    }
+
+                    // It's ambiguous
+                    return;
+                }
+                else
+                {
+                    // There is at least one argument: Check if it's a shortcut, a classname or a special keyword
+                    CommandExecutor::getEvaluation().state_ = CS_FunctionClass_Or_Shortcut_Or_Keyword;
+                    CommandExecutor::parse(command, false);
+                    return;
+                }
+                break;
+            case CS_FunctionClass_Or_Shortcut_Or_Keyword:
+                if (CommandExecutor::argumentsGiven() >= 1)
+                {
+                    if ((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY))
+                    {
+                        // We want to set a config value
+                        CommandExecutor::getEvaluation().state_ = CS_ConfigValueClass;
+                        CommandExecutor::parse(command, false);
+                        return;
+                    }
+                    else if (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_KEYBIND)
+                    {
+                        // We want to set a keybinding
+                        CommandExecutor::getEvaluation().state_ = CS_KeybindKey;
+                        CommandExecutor::parse(command, false);
+                        return;
+                    }
+
+                    if (!CommandExecutor::getEvaluation().functionclass_)
+                        CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getIdentifierOfPossibleFunctionClass(CommandExecutor::getToken(0));
+                    if (!CommandExecutor::getEvaluation().shortcut_)
+                        CommandExecutor::getEvaluation().shortcut_ = CommandExecutor::getExecutorOfPossibleShortcut(CommandExecutor::getToken(0));
+
+                    if ((!CommandExecutor::getEvaluation().functionclass_) && (!CommandExecutor::getEvaluation().shortcut_))
+                    {
+                        // Argument 1 seems to be wrong
+                        AddLanguageEntry("CommandExecutor::NoSuchCommandOrClassName", "No such command or classname");
+                        CommandExecutor::getEvaluation().errorMessage_ = (CommandExecutor::getToken(0) + ": " + GetLocalisation("CommandExecutor::NoSuchCommandOrClassName"));
+                        CommandExecutor::getEvaluation().state_ = CS_Error;
+                        return;
+                    }
+                    else if (CommandExecutor::getEvaluation().shortcut_)
+                    {
+                        // Argument 1 is a shortcut: Return the needed parameter types
+                        CommandExecutor::getEvaluation().state_ = CS_Shortcut_Params;
+                        CommandExecutor::parse(command, false);
+                        return;
+                    }
+                    else
+                    {
+                        // Argument 1 is a classname: Return the possible functions
+                        CommandExecutor::getEvaluation().state_ = CS_Function;
+                        CommandExecutor::parse(command, false);
+                        return;
+                    }
+                }
+                else
+                {
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
+                    return;
+                }
+                break;
+            case CS_Shortcut_Params:
+                if (CommandExecutor::getEvaluation().shortcut_)
+                {
+                    // Valid command
+                    // Check if there are enough parameters
+                    if (CommandExecutor::enoughParametersGiven(1, CommandExecutor::getEvaluation().shortcut_))
+                    {
+                        CommandExecutor::getEvaluation().state_ = CS_Shortcut_Finished;
+                        return;
+                    }
+                }
+                else
+                {
+                    // Something is wrong
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
+                    return;
+                }
+                break;
+            case CS_Function:
+                if (CommandExecutor::getEvaluation().functionclass_)
+                {
+                    // We have a valid classname
+                    // Check if there is a second argument
+                    if (CommandExecutor::argumentsGiven() >= 2)
+                    {
+                        // There is a second argument: Check if it's a valid functionname
+                        CommandExecutor::getEvaluation().function_ = CommandExecutor::getExecutorOfPossibleFunction(CommandExecutor::getToken(1), CommandExecutor::getEvaluation().functionclass_);
+                        if (!CommandExecutor::getEvaluation().function_)
+                        {
+                            // Argument 2 seems to be wrong
+                            AddLanguageEntry("CommandExecutor::NoSuchFunctionnameIn", "No such functionname in");
+                            CommandExecutor::getEvaluation().errorMessage_ = (CommandExecutor::getToken(1) + ": " + GetLocalisation("CommandExecutor::NoSuchFunctionnameIn") + " " + CommandExecutor::getEvaluation().functionclass_->getName());
+                            CommandExecutor::getEvaluation().state_ = CS_Error;
+                            return;
+                        }
+                        else
+                        {
+                            // Argument 2 seems to be a valid functionname: Get the parameters
+                            CommandExecutor::getEvaluation().state_ = CS_Function_Params;
+                            CommandExecutor::parse(command, false);
+                            return;
+                        }
+                    }
+                    else
+                    {
+                        // There is no finished second argument
+                        // Check if there's already a perfect match
+                        if (CommandExecutor::getEvaluation().tokens_.size() >= 2)
+                        {
+                            CommandExecutor::getEvaluation().function_ = CommandExecutor::getExecutorOfPossibleFunction(CommandExecutor::getToken(1), CommandExecutor::getEvaluation().functionclass_);
+                            if (CommandExecutor::getEvaluation().function_)
+                            {
+                                // There is a perfect match: Add a whitespace and continue parsing
+                                CommandExecutor::getEvaluation().state_ = CS_Function_Params;
+                                CommandExecutor::parse(command + " ", false);
+                                return;
+                            }
+                        }
+
+                        // No perfect match: Create the list of all possible functions and return
+                        CommandExecutor::createListOfPossibleFunctions(CommandExecutor::getToken(1), CommandExecutor::getEvaluation().functionclass_);
+
+                        // Check if there's only one possiblility
+                        if (CommandExecutor::getEvaluation().listOfPossibleFunctions_.size() == 1)
+                        {
+                            // There's only one possible function
+                            CommandExecutor::getEvaluation().state_ = CS_Function_Params;
+                            CommandExecutor::getEvaluation().function_ = CommandExecutor::getExecutorOfPossibleFunction(*(*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).first, CommandExecutor::getEvaluation().functionclass_);
+                            CommandExecutor::parse(CommandExecutor::getToken(0) + " " + *(*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).first + " ", false);
+                            return;
+                        }
+
+                        // It's ambiguous
+                        return;
+                    }
+                }
+                else
+                {
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
+                    return;
+                }
+                break;
+            case CS_Function_Params:
+                if (CommandExecutor::getEvaluation().functionclass_ && CommandExecutor::getEvaluation().function_)
+                {
+                    // Valid command
+                    // Check if there are enough parameters
+                    if (CommandExecutor::enoughParametersGiven(2, CommandExecutor::getEvaluation().function_))
+                    {
+                        CommandExecutor::getEvaluation().state_ = CS_Function_Finished;
+                        return;
+                    }
+                }
+                else
+                {
+                    // Something is wrong
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
+                    return;
+                }
+                break;
+            case CS_ConfigValueClass:
+                if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)))
+                {
+                    // We want to set a config value
+                    // Check if there is a second argument
+                    if (CommandExecutor::argumentsGiven() >= 2)
+                    {
+                        // There is a second argument: Check if it's a valid classname
+                        CommandExecutor::getEvaluation().configvalueclass_ = CommandExecutor::getIdentifierOfPossibleConfigValueClass(CommandExecutor::getToken(1));
+                        if (!CommandExecutor::getEvaluation().configvalueclass_)
+                        {
+                            // Argument 2 seems to be wrong
+                            AddLanguageEntry("CommandExecutor::NoSuchClassWithConfigValues", "No such class with config values");
+                            CommandExecutor::getEvaluation().errorMessage_ = (CommandExecutor::getToken(1) + ": " + GetLocalisation("CommandExecutor::NoSuchClassWithConfigValues"));
+                            CommandExecutor::getEvaluation().state_ = CS_Error;
+                            return;
+                        }
+                        else
+                        {
+                            // Argument 2 seems to be a valid classname: Search for possible config values
+                            CommandExecutor::getEvaluation().state_ = CS_ConfigValue;
+                            CommandExecutor::parse(command, false);
+                            return;
+                        }
+                    }
+                    else
+                    {
+                        // There's no finished second argument
+                        // Check if there's already a perfect match
+                        if (CommandExecutor::getEvaluation().tokens_.size() >= 2)
+                        {
+                            CommandExecutor::getEvaluation().configvalueclass_ = CommandExecutor::getIdentifierOfPossibleConfigValueClass(CommandExecutor::getToken(1));
+                            if (CommandExecutor::getEvaluation().configvalueclass_)
+                            {
+                                // There is a perfect match: Add a whitespace and continue parsing
+                                CommandExecutor::getEvaluation().state_ = CS_ConfigValue;
+                                CommandExecutor::parse(command + " ", false);
+                                return;
+                            }
+                        }
+
+                        // No perfect match: Create the list of all possible classnames and return
+                        CommandExecutor::createListOfPossibleConfigValueClasses(CommandExecutor::getToken(1));
+
+                        // Check if there's only one possiblility
+                        if (CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.size() == 1)
+                        {
+                            // There's only one possible classname
+                            CommandExecutor::getEvaluation().state_ = CS_ConfigValue;
+                            CommandExecutor::getEvaluation().configvalueclass_ = CommandExecutor::getIdentifierOfPossibleConfigValueClass(*(*CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.begin()).first);
+                            CommandExecutor::parse(CommandExecutor::getToken(0) + " " + *(*CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.begin()).first + " ", false);
+                            return;
+                        }
+
+                        // It's ambiguous
+                        return;
+                    }
+                }
+                else
+                {
+                    // Something is wrong
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
+                    return;
+                }
+                break;
+            case CS_ConfigValue:
+                if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) && (CommandExecutor::getEvaluation().configvalueclass_))
+                {
+                    // Check if there is a third argument
+                    if (CommandExecutor::argumentsGiven() >= 3)
+                    {
+                        // There is a third argument: Check if it's a valid config value
+                        CommandExecutor::getEvaluation().configvalue_ = CommandExecutor::getContainerOfPossibleConfigValue(CommandExecutor::getToken(2), CommandExecutor::getEvaluation().configvalueclass_);
+                        if (!CommandExecutor::getEvaluation().configvalue_)
+                        {
+                            // Argument 3 seems to be wrong
+                            AddLanguageEntry("CommandExecutor::NoSuchConfigValueIn", "No such config value in");
+                            CommandExecutor::getEvaluation().errorMessage_ = (CommandExecutor::getToken(2) + ": " + GetLocalisation("CommandExecutor::NoSuchConfigValueIn") + " " + CommandExecutor::getEvaluation().configvalueclass_->getName());
+                            CommandExecutor::getEvaluation().state_ = CS_Error;
+                            return;
+                        }
+                        else
+                        {
+                            // Argument 3 seems to be a valid config value: Get the type
+                            CommandExecutor::getEvaluation().state_ = CS_ConfigValueType;
+                            CommandExecutor::parse(command, false);
+                            return;
+                        }
+                    }
+                    else
+                    {
+                        // There is no finished third argument
+                        // Check if there's already a perfect match
+                        if (CommandExecutor::getEvaluation().tokens_.size() >= 3)
+                        {
+                            CommandExecutor::getEvaluation().configvalue_ = CommandExecutor::getContainerOfPossibleConfigValue(CommandExecutor::getToken(2), CommandExecutor::getEvaluation().configvalueclass_);
+                            if (CommandExecutor::getEvaluation().configvalue_)
+                            {
+                                // There is a perfect match: Add a whitespace and continue parsing
+                                CommandExecutor::getEvaluation().state_ = CS_ConfigValueType;
+                                CommandExecutor::parse(command + " ", false);
+                                return;
+                            }
+                        }
+
+                        // No perfect match: Create the list of all possible config values
+                        CommandExecutor::createListOfPossibleConfigValues(CommandExecutor::getToken(2), CommandExecutor::getEvaluation().configvalueclass_);
+
+                        // Check if there's only one possiblility
+                        if (CommandExecutor::getEvaluation().listOfPossibleConfigValues_.size() == 1)
+                        {
+                            // There's only one possible config value
+                            CommandExecutor::getEvaluation().state_ = CS_ConfigValueType;
+                            CommandExecutor::getEvaluation().configvalue_ = CommandExecutor::getContainerOfPossibleConfigValue(*(*CommandExecutor::getEvaluation().listOfPossibleConfigValues_.begin()).first, CommandExecutor::getEvaluation().configvalueclass_);
+                            CommandExecutor::parse(CommandExecutor::getToken(0) + " " + CommandExecutor::getToken(1) + " " + *(*CommandExecutor::getEvaluation().listOfPossibleConfigValues_.begin()).first + " ", false);
+                            return;
+                        }
+
+                        // It's ambiguous
+                        return;
+                    }
+                }
+                else
+                {
+                    // Something is wrong
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
+                    return;
+                }
+                break;
+            case CS_ConfigValueType:
+                if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) && CommandExecutor::getEvaluation().configvalueclass_ && CommandExecutor::getEvaluation().configvalue_)
+                {
+                    // Valid command
+                    // Check if there are enough parameters
+                    if ((CommandExecutor::getEvaluation().tokens_.size() >= 4) && (CommandExecutor::getEvaluation().tokens_[3] != COMMAND_EXECUTOR_CURSOR))
+                    {
+                        CommandExecutor::getEvaluation().state_ = CS_ConfigValueFinished;
+                        return;
+                    }
+                }
+                else
+                {
+                    // Something is wrong
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
+                    return;
+                }
+                break;
+            case CS_KeybindKey:
+                if ((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_KEYBIND))
+                {
+                    // todo
+                }
+                else
+                {
+                    // Something is wrong
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
+                    return;
+                }
+                break;
+            case CS_KeybindCommand:
+                if ((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_KEYBIND) && (false)) // todo
+                {
+                    // Valid command
+                    // Check if there are enough parameters
+                    if (CommandExecutor::getEvaluation().tokens_.size() >= 3)
+                    {
+                        CommandExecutor::getEvaluation().state_ = CS_KeybindFinished;
+                        return;
+                    }
+
+                }
+                else
+                {
+                    // Something is wrong
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
+                    return;
+                }
+                break;
+            case CS_Shortcut_Finished:
+                // Nothing to do
+                break;
+            case CS_Function_Finished:
+                // Nothing to do
+                break;
+            case CS_ConfigValueFinished:
+                // Nothing to do
+                break;
+            case CS_KeybindFinished:
+                // Nothing to do
+                break;
+            case CS_Error:
+                // This is bad
+                break;
+        }
+    }
+
+    void CommandExecutor::initialize(const std::string& command)
+    {
+        CommandExecutor::getEvaluation().processedCommand_ = command;
+        CommandExecutor::getEvaluation().additionalParameter_ = "";
+
+        CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.clear();
+        CommandExecutor::getEvaluation().listOfPossibleShortcuts_.clear();
+        CommandExecutor::getEvaluation().listOfPossibleFunctions_.clear();
+        CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.clear();
+        CommandExecutor::getEvaluation().listOfPossibleConfigValues_.clear();
+        CommandExecutor::getEvaluation().listOfPossibleKeys_.clear();
+
+        CommandExecutor::getEvaluation().functionclass_ = 0;
+        CommandExecutor::getEvaluation().configvalueclass_ = 0;
+        CommandExecutor::getEvaluation().shortcut_ = 0;
+        CommandExecutor::getEvaluation().function_ = 0;
+        CommandExecutor::getEvaluation().configvalue_ = 0;
+        CommandExecutor::getEvaluation().key_ = 0;
+
+        CommandExecutor::getEvaluation().errorMessage_ = "";
+        CommandExecutor::getEvaluation().state_ = CS_Empty;
+    }
+
+    bool CommandExecutor::argumentsGiven(unsigned int num)
+    {
+        // Because we added a cursor we have +1 arguments
+        // There are num arguments given if there are at least num arguments + one cursor
+        return (CommandExecutor::getEvaluation().tokens_.size() >= (num + 1));
+    }
+
+    unsigned int CommandExecutor::argumentsGiven()
+    {
+        // Because we added a cursor we have +1 arguments
+        if (CommandExecutor::getEvaluation().tokens_.size() >= 1)
+            return (CommandExecutor::getEvaluation().tokens_.size() - 1);
+        else
+            return 0;
+    }
+
+    std::string CommandExecutor::getToken(unsigned int index)
+    {
+        if ((index >= 0) && (index < (CommandExecutor::getEvaluation().tokens_.size() - 1)))
+            return CommandExecutor::getEvaluation().tokens_[index];
+        else if (index == (CommandExecutor::getEvaluation().tokens_.size() - 1))
+            return CommandExecutor::getEvaluation().tokens_[index].substr(0, CommandExecutor::getEvaluation().tokens_[index].size() - 1);
+        else
+            return "";
+    }
+
+    bool CommandExecutor::enoughParametersGiven(unsigned int head, Executor* executor)
+    {
+        unsigned int neededParams = head + executor->getParamCount();
+        /*
+        for (unsigned int i = executor->getParamCount() - 1; i >= 0; i--)
+        {
+            if (executor->defaultValueSet(i))
+                neededParams--;
+            else
+                break;
+        }
+        */
+        return ((CommandExecutor::getEvaluation().tokens_.size() >= neededParams) && (CommandExecutor::getEvaluation().tokens_[neededParams - 1] != COMMAND_EXECUTOR_CURSOR));
+    }
+
+    void CommandExecutor::createListOfPossibleFunctionClasses(const std::string& fragment)
+    {
+        for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseIdentifierMapBegin(); it != Identifier::getLowercaseIdentifierMapEnd(); ++it)
+        {
+            if ((*it).second->hasConsoleCommands())
+            {
+                if ((*it).first.find(getLowercase(fragment)) == 0 || fragment == "")
+                {
+                    CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
+                }
+            }
+        }
+
+        CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.sort(CommandExecutor::compareStringsInList);
+    }
+
+    void CommandExecutor::createListOfPossibleShortcuts(const std::string& fragment)
+    {
+        for (std::map<std::string, ExecutorStatic*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMapBegin(); it != CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd(); ++it)
+        {
+            if ((*it).first.find(getLowercase(fragment)) == 0 || fragment == "")
+            {
+                CommandExecutor::getEvaluation().listOfPossibleShortcuts_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
+            }
+        }
+
+        CommandExecutor::getEvaluation().listOfPossibleShortcuts_.sort(CommandExecutor::compareStringsInList);
+    }
+
+    void CommandExecutor::createListOfPossibleFunctions(const std::string& fragment, Identifier* identifier)
+    {
+        for (std::map<std::string, ExecutorStatic*>::const_iterator it = identifier->getLowercaseConsoleCommandMapBegin(); it != identifier->getLowercaseConsoleCommandMapEnd(); ++it)
+        {
+            if ((*it).first.find(getLowercase(fragment)) == 0 || fragment == "")
+            {
+                CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
+            }
+        }
+
+        CommandExecutor::getEvaluation().listOfPossibleFunctions_.sort(CommandExecutor::compareStringsInList);
+    }
+
+    void CommandExecutor::createListOfPossibleConfigValueClasses(const std::string& fragment)
+    {
+        for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseIdentifierMapBegin(); it != Identifier::getLowercaseIdentifierMapEnd(); ++it)
+        {
+            if ((*it).second->hasConfigValues())
+            {
+                if ((*it).first.find(getLowercase(fragment)) == 0 || fragment == "")
+                {
+                    CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
+                }
+            }
+        }
+
+        CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.sort(CommandExecutor::compareStringsInList);
+    }
+
+    void CommandExecutor::createListOfPossibleConfigValues(const std::string& fragment, Identifier* identifier)
+    {
+        for (std::map<std::string, ConfigValueContainer*>::const_iterator it = identifier->getLowercaseConfigValueMapBegin(); it != identifier->getLowercaseConfigValueMapEnd(); ++it)
+        {
+            if ((*it).first.find(getLowercase(fragment)) == 0 || fragment == "")
+            {
+                CommandExecutor::getEvaluation().listOfPossibleConfigValues_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
+            }
+        }
+
+        CommandExecutor::getEvaluation().listOfPossibleConfigValues_.sort(CommandExecutor::compareStringsInList);
+    }
+
+    void CommandExecutor::createListOfPossibleKeys(const std::string& fragment)
+    {
+        // todo
+
+        CommandExecutor::getEvaluation().listOfPossibleKeys_.sort(CommandExecutor::compareStringsInList);
+    }
+
+    bool CommandExecutor::compareStringsInList(const std::pair<const std::string*, const std::string*>& first, const std::pair<const std::string*, const std::string*>& second)
+    {
+        return ((*first.first) < (*second.first));
+    }
+
+    Identifier* CommandExecutor::getIdentifierOfPossibleFunctionClass(const std::string& name)
+    {
+        std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseIdentifierMap().find(getLowercase(name));
+        if ((it != Identifier::getLowercaseIdentifierMapEnd()) && (*it).second->hasConsoleCommands())
+            return (*it).second;
+
+        return 0;
+    }
+
+    ExecutorStatic* CommandExecutor::getExecutorOfPossibleShortcut(const std::string& name)
+    {
+        std::map<std::string, ExecutorStatic*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMap().find(getLowercase(name));
+        if (it != CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd())
+            return (*it).second;
+
+        return 0;
+    }
+
+    ExecutorStatic* CommandExecutor::getExecutorOfPossibleFunction(const std::string& name, Identifier* identifier)
+    {
+        std::map<std::string, ExecutorStatic*>::const_iterator it = identifier->getLowercaseConsoleCommandMap().find(getLowercase(name));
+        if (it != identifier->getLowercaseConsoleCommandMapEnd())
+            return (*it).second;
+
+        return 0;
+    }
+
+    Identifier* CommandExecutor::getIdentifierOfPossibleConfigValueClass(const std::string& name)
+    {
+        std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseIdentifierMap().find(getLowercase(name));
+        if ((it != Identifier::getLowercaseIdentifierMapEnd()) && (*it).second->hasConfigValues())
+            return (*it).second;
+
+        return 0;
+    }
+
+    ConfigValueContainer* CommandExecutor::getContainerOfPossibleConfigValue(const std::string& name, Identifier* identifier)
+    {
+        std::map<std::string, ConfigValueContainer*>::const_iterator it = identifier->getLowercaseConfigValueMap().find(getLowercase(name));
+        if (it != identifier->getLowercaseConfigValueMapEnd())
+        {
+            return (*it).second;
+        }
+
+        return 0;
+    }
+
+    ConfigValueContainer* CommandExecutor::getContainerOfPossibleKey(const std::string& name)
+    {
+        // todo
+
+        return 0;
+    }
+
+    std::string CommandExecutor::dump(const std::list<std::pair<const std::string*, const std::string*> >& list)
+    {
+        std::string output = "";
+        for (std::list<std::pair<const std::string*, const std::string*> >::const_iterator it = list.begin(); it != list.end(); ++it)
+        {
+            if (it != list.begin())
+                output += " ";
+
+            output += *(*it).second;
+        }
+        return output;
+    }
+
+    std::string CommandExecutor::dump(const ExecutorStatic* executor)
+    {
+        std::string output = "";
+        for (unsigned int i = 0; i < executor->getParamCount(); i++)
+        {
+            if (i != 0)
+                output += " ";
+
+            if (executor->defaultValueSet(i))
+                output += "[";
+            else
+                output += "{";
+
+            output += executor->getTypenameParam(i);
+
+            if (executor->defaultValueSet(i))
+                output += "=" + executor->getDefaultValue(i).toString() + "]";
+            else
+                output += "}";
+        }
+        return output;
+    }
+
+    std::string CommandExecutor::dump(const ConfigValueContainer* container)
+    {
+        AddLanguageEntry("CommandExecutor::oldvalue", "old value");
+        if (!container->isVector())
+            return ("{" + container->getTypename() + "} (" + GetLocalisation("CommandExecutor::oldvalue") + ": " + container->toString() + ")");
+        else
+            return ("(vector<" + container->getTypename() + ">) (size: " + getConvertedValue<unsigned int, std::string>(container->getVectorSize()) + ")");
+    }
+
+    std::string CommandExecutor::getCommonBegin(const std::list<std::pair<const std::string*, const std::string*> >& list)
+    {
+        if (list.size() == 0)
+        {
+            return "";
+        }
+        else if (list.size() == 1)
+        {
+            return ((*(*list.begin()).first) + " ");
+        }
+        else
+        {
+            std::string output = "";
+            for (unsigned int i = 0; true; i++)
+            {
+                char temp = 0;
+                for (std::list<std::pair<const std::string*, const std::string*> >::const_iterator it = list.begin(); it != list.end(); ++it)
+                {
+                    if ((*(*it).first).size() > i)
+                    {
+                        if (it == list.begin())
+                        {
+                            temp = (*(*it).first)[i];
+                        }
+                        else
+                        {
+                            if (temp != (*(*it).first)[i])
+                                return output;
+                        }
+                    }
+                    else
+                    {
+                        return output;
+                    }
+                }
+                output += temp;
+            }
+            return output;
+        }
+    }
+}
Index: code/trunk/src/core/CommandExecutor.h
===================================================================
--- code/trunk/src/core/CommandExecutor.h	(revision 1055)
+++ code/trunk/src/core/CommandExecutor.h	(revision 1055)
@@ -0,0 +1,206 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _CommandExecutor_H__
+#define _CommandExecutor_H__
+
+#include <string>
+#include <map>
+#include <list>
+
+#include "util/SubString.h"
+#include "util/MultiTypeMath.h"
+#include "CorePrereqs.h"
+
+#define COMMAND_EXECUTOR_CURSOR "$"
+
+namespace orxonox
+{
+    enum CommandState
+    {
+        CS_Uninitialized,
+        CS_Empty,
+        CS_FunctionClass_Or_Shortcut_Or_Keyword,
+        CS_Shortcut_Params,
+        CS_Shortcut_Finished,
+        CS_Function,
+        CS_Function_Params,
+        CS_Function_Finished,
+        CS_ConfigValueClass,
+        CS_ConfigValue,
+        CS_ConfigValueType,
+        CS_ConfigValueFinished,
+        CS_KeybindKey,
+        CS_KeybindCommand,
+        CS_KeybindFinished,
+        CS_Error
+    };
+
+    void exec(const std::string& filename);
+    std::string echo(const std::string& text);
+
+    void write(const std::string& filename, const std::string& text);
+    void append(const std::string& filename, const std::string& text);
+    std::string read(const std::string& filename);
+
+    enum KeybindMode {}; // temporary
+
+    ///////////////////////
+    // CommandEvaluation //
+    ///////////////////////
+    class _CoreExport CommandEvaluation
+    {
+        friend class CommandExecutor;
+
+        public:
+            CommandEvaluation();
+
+            KeybindMode getKeybindMode();
+            bool isValid() const;
+
+            inline void setAdditionalParameter(const std::string& param)
+                { this->additionalParameter_ = param; this->bEvaluatedParams_ = false; }
+            inline std::string getAdditionalParameter() const
+                { return (this->additionalParameter_ != "") ? (" " + this->additionalParameter_) : ""; }
+
+            void setEvaluatedParameter(unsigned int index, MultiTypeMath param);
+            MultiTypeMath getEvaluatedParameter(unsigned int index) const;
+
+            void evaluateParams();
+
+            MultiTypeMath getReturnvalue() const;
+
+        private:
+            std::string processedCommand_;
+            SubString tokens_;
+            std::string additionalParameter_;
+
+            std::list<std::pair<const std::string*, const std::string*> > listOfPossibleFunctionClasses_;
+            std::list<std::pair<const std::string*, const std::string*> > listOfPossibleShortcuts_;
+            std::list<std::pair<const std::string*, const std::string*> > listOfPossibleFunctions_;
+            std::list<std::pair<const std::string*, const std::string*> > listOfPossibleConfigValueClasses_;
+            std::list<std::pair<const std::string*, const std::string*> > listOfPossibleConfigValues_;
+            std::list<std::pair<const std::string*, const std::string*> > listOfPossibleKeys_;
+
+            Identifier* functionclass_;
+            Identifier* configvalueclass_;
+            ExecutorStatic* shortcut_;
+            ExecutorStatic* function_;
+            ConfigValueContainer* configvalue_;
+            ConfigValueContainer* key_;
+
+            std::string errorMessage_;
+            CommandState state_;
+
+            bool bEvaluatedParams_;
+            MultiTypeMath param_[5];
+            ExecutorStatic* evaluatedExecutor_;
+    };
+
+    /////////////////////
+    // CommandExecutor //
+    /////////////////////
+    class _CoreExport CommandExecutor
+    {
+        public:
+            static bool execute(const std::string& command);
+            static bool execute(const CommandEvaluation& evaluation);
+
+            static std::string complete(const std::string& command);
+            static std::string complete(const CommandEvaluation& evaluation);
+
+            static std::string hint(const std::string& command);
+            static std::string hint(const CommandEvaluation& evaluation);
+
+            static CommandEvaluation evaluate(const std::string& command);
+
+            static Executor& addConsoleCommandShortcut(ExecutorStatic* executor);
+            static ExecutorStatic* getConsoleCommandShortcut(const std::string& name);
+            static ExecutorStatic* getLowercaseConsoleCommandShortcut(const std::string& name);
+
+            /** @brief Returns the map that stores all console commands. @return The const_iterator */
+            static inline const std::map<std::string, ExecutorStatic*>& getConsoleCommandShortcutMap() { return CommandExecutor::getInstance().consoleCommandShortcuts_; }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all console commands. @return The const_iterator */
+            static inline std::map<std::string, ExecutorStatic*>::const_iterator getConsoleCommandShortcutMapBegin() { return CommandExecutor::getInstance().consoleCommandShortcuts_.begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all console commands. @return The const_iterator */
+            static inline std::map<std::string, ExecutorStatic*>::const_iterator getConsoleCommandShortcutMapEnd() { return CommandExecutor::getInstance().consoleCommandShortcuts_.end(); }
+
+            /** @brief Returns the map that stores all console commands with their names in lowercase. @return The const_iterator */
+            static inline const std::map<std::string, ExecutorStatic*>& getLowercaseConsoleCommandShortcutMap() { return CommandExecutor::getInstance().consoleCommandShortcuts_LC_; }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all console commands with their names in lowercase. @return The const_iterator */
+            static inline std::map<std::string, ExecutorStatic*>::const_iterator getLowercaseConsoleCommandShortcutMapBegin() { return CommandExecutor::getInstance().consoleCommandShortcuts_LC_.begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all console commands with their names in lowercase. @return The const_iterator */
+            static inline std::map<std::string, ExecutorStatic*>::const_iterator getLowercaseConsoleCommandShortcutMapEnd() { return CommandExecutor::getInstance().consoleCommandShortcuts_LC_.end(); }
+
+        private:
+            CommandExecutor() {}
+            CommandExecutor(const CommandExecutor& other) {}
+            ~CommandExecutor() {}
+
+            static CommandExecutor& getInstance();
+            static CommandEvaluation& getEvaluation();
+
+            static void parse(const std::string& command, bool bInitialize = true);
+            static void initialize(const std::string& command);
+
+            static bool argumentsGiven(unsigned int num);
+            static unsigned int argumentsGiven();
+
+            static std::string getToken(unsigned int index);
+
+            static bool enoughParametersGiven(unsigned int head, Executor* executor);
+
+            static void createListOfPossibleShortcuts(const std::string& fragment);
+            static void createListOfPossibleFunctionClasses(const std::string& fragment);
+            static void createListOfPossibleFunctions(const std::string& fragment, Identifier* identifier);
+            static void createListOfPossibleConfigValueClasses(const std::string& fragment);
+            static void createListOfPossibleConfigValues(const std::string& fragment, Identifier* identifier);
+            static void createListOfPossibleKeys(const std::string& fragment);
+
+            static bool compareStringsInList(const std::pair<const std::string*, const std::string*>& first, const std::pair<const std::string*, const std::string*>& second);
+
+            static std::string dump(const std::list<std::pair<const std::string*, const std::string*> >& list);
+            static std::string dump(const ExecutorStatic* executor);
+            static std::string dump(const ConfigValueContainer* container);
+
+            static std::string getCommonBegin(const std::list<std::pair<const std::string*, const std::string*> >& list);
+
+            static Identifier* getIdentifierOfPossibleFunctionClass(const std::string& name);
+            static ExecutorStatic* getExecutorOfPossibleShortcut(const std::string& name);
+            static ExecutorStatic* getExecutorOfPossibleFunction(const std::string& name, Identifier* identifier);
+            static Identifier* getIdentifierOfPossibleConfigValueClass(const std::string& name);
+            static ConfigValueContainer* getContainerOfPossibleConfigValue(const std::string& name, Identifier* identifier);
+            static ConfigValueContainer* getContainerOfPossibleKey(const std::string& name);
+
+            CommandEvaluation evaluation_;
+
+            std::map<std::string, ExecutorStatic*> consoleCommandShortcuts_;
+            std::map<std::string, ExecutorStatic*> consoleCommandShortcuts_LC_;
+    };
+}
+
+#endif /* _CommandExecutor_H__ */
Index: code/trunk/src/core/ConfigFileManager.cc
===================================================================
--- code/trunk/src/core/ConfigFileManager.cc	(revision 1055)
+++ code/trunk/src/core/ConfigFileManager.cc	(revision 1055)
@@ -0,0 +1,522 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ConfigFileManager.h"
+#include "ConfigValueContainer.h"
+#include "ConsoleCommand.h"
+#include "Identifier.h"
+#include "util/Convert.h"
+#include "util/String.h"
+
+#define CONFIG_FILE_MAX_LINELENGHT 1024
+
+namespace orxonox
+{
+    ConsoleCommandShortcutExtern(reloadConfig, AccessLevel::None);
+    ConsoleCommandShortcutExtern(cleanConfig, AccessLevel::None);
+    ConsoleCommandShortcutExtern(loadSettings, AccessLevel::None);
+    ConsoleCommandShortcutExtern(loadKeybindings, AccessLevel::None);
+
+    void reloadConfig()
+    {
+        ConfigFileManager::getSingleton()->load();
+    }
+
+    void cleanConfig()
+    {
+        ConfigFileManager::getSingleton()->clean(false);
+    }
+
+    void loadSettings(const std::string& filename)
+    {
+        ConfigFileManager::getSingleton()->setFile(CFT_Settings, filename, false);
+    }
+
+    void loadKeybindings(const std::string& filename)
+    {
+        ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, filename);
+    }
+
+
+    //////////////////////////
+    // ConfigFileEntryValue //
+    //////////////////////////
+
+    void ConfigFileEntryValue::setValue(const std::string& value)
+    {
+        if (!this->bString_)
+            this->value_ = value;
+        else
+            this->value_ = "\"" + addSlashes(stripEnclosingQuotes(value)) + "\"";
+    }
+
+    std::string ConfigFileEntryValue::getValue() const
+    {
+        if (!this->bString_)
+            return this->value_;
+        else
+            return removeSlashes(stripEnclosingQuotes(this->value_));
+    }
+
+    std::string ConfigFileEntryValue::getFileEntry() const
+    {
+        if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
+            return (this->name_ + "=" + this->value_);
+        else
+            return (this->name_ + "=" + this->value_ + " " + this->additionalComment_);
+    }
+
+
+    ///////////////////////////////
+    // ConfigFileEntryVectorValue //
+    ///////////////////////////////
+    std::string ConfigFileEntryVectorValue::getFileEntry() const
+    {
+        if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
+            return (this->name_ + "[" + getConvertedValue<unsigned int, std::string>(this->index_, "0") + "]" + "=" + this->value_);
+        else
+            return (this->name_ + "[" + getConvertedValue<unsigned int, std::string>(this->index_, "0") + "]=" + this->value_ + " " + this->additionalComment_);
+    }
+
+
+    ///////////////////////
+    // ConfigFileSection //
+    ///////////////////////
+    ConfigFileSection::~ConfigFileSection()
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); )
+            delete (*(it++));
+    }
+
+    void ConfigFileSection::deleteVectorEntries(const std::string& name, unsigned int startindex)
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); )
+        {
+            if (((*it)->getName() == name) && ((*it)->getIndex() >= startindex))
+            {
+                delete (*it);
+                this->entries_.erase(it++);
+            }
+            else
+            {
+                ++it;
+            }
+        }
+    }
+
+    unsigned int ConfigFileSection::getVectorSize(const std::string& name)
+    {
+        unsigned int size = 0;
+        for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+            if ((*it)->getName() == name)
+                if ((*it)->getIndex() > size)
+                    size = (*it)->getIndex();
+        return (size + 1);
+    }
+
+    std::string ConfigFileSection::getFileEntry() const
+    {
+        if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
+            return ("[" + this->name_ + "]");
+        else
+            return ("[" + this->name_ + "] " + this->additionalComment_);
+    }
+
+    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getEntryIterator(const std::string& name, const std::string& fallback, bool bString)
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+        {
+            if ((*it)->getName() == name)
+            {
+                (*it)->setString(bString);
+                return it;
+            }
+        }
+
+        this->bUpdated_ = true;
+
+        return this->entries_.insert(this->entries_.end(), (ConfigFileEntry*)(new ConfigFileEntryValue(name, fallback, bString)));
+    }
+
+    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+        {
+            if (((*it)->getName() == name) && ((*it)->getIndex() == index))
+            {
+                (*it)->setString(bString);
+                return it;
+            }
+        }
+
+        this->bUpdated_ = true;
+
+        if (index == 0)
+            return this->entries_.insert(this->entries_.end(), (ConfigFileEntry*)(new ConfigFileEntryVectorValue(name, index, fallback, bString)));
+        else
+            return this->entries_.insert(++this->getEntryIterator(name, index - 1, "", bString), (ConfigFileEntry*)(new ConfigFileEntryVectorValue(name, index, fallback, bString)));
+    }
+
+
+    ////////////////
+    // ConfigFile //
+    ////////////////
+    ConfigFile::~ConfigFile()
+    {
+        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); )
+            delete (*(it++));
+    }
+
+    void ConfigFile::load(bool bCreateIfNotExisting)
+    {
+        if (bCreateIfNotExisting)
+        {
+            // This creates the default config file if it's not existing
+            std::ofstream createFile;
+            createFile.open(this->filename_.c_str(), std::fstream::app);
+            createFile.close();
+        }
+
+        // Open the file
+        std::ifstream file;
+        file.open(this->filename_.c_str(), std::fstream::in);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "An error occurred in ConfigFileManager.cc:" << std::endl;
+            COUT(1) << "Error: Couldn't open config-file \"" << this->filename_ << "\"." << std::endl;
+            return;
+        }
+
+        char linearray[CONFIG_FILE_MAX_LINELENGHT];
+
+        ConfigFileSection* newsection = 0;
+
+        while (file.good() && !file.eof())
+        {
+            file.getline(linearray, CONFIG_FILE_MAX_LINELENGHT);
+
+            std::string line = std::string(linearray);
+
+            std::string temp = getStripped(line);
+            if (!isEmpty(temp) && !isComment(temp))
+            {
+                unsigned int   pos1 = temp.find('[');
+                if (pos1 == 0) pos1 = line.find('['); else pos1 = std::string::npos;
+                unsigned int   pos2 = line.find(']');
+
+                if (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1)
+                {
+                    // New section
+                    std::string comment = line.substr(pos2 + 1);
+                    if (isComment(comment))
+                        newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1), comment);
+                    else
+                        newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1));
+                    this->sections_.insert(this->sections_.end(), newsection);
+                    continue;
+                }
+            }
+
+            if (newsection != 0)
+            {
+                if (isComment(line))
+                {
+                    // New comment
+                    newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryComment(removeTrailingWhitespaces(line)));
+                    continue;
+                }
+                else
+                {
+                    unsigned int pos1 = line.find('=');
+
+                    if (pos1 != std::string::npos && pos1 > 0)
+                    {
+                        // New entry
+                        unsigned int pos2 = line.find('[');
+                        unsigned int pos3 = line.find(']');
+                        unsigned int commentposition = getNextCommentPosition(line, pos1 + 1);
+                        while (isBetweenQuotes(line, commentposition))
+                        {
+                            commentposition = getNextCommentPosition(line, commentposition + 1);
+                        }
+                        std::string value = "", comment = "";
+                        if (commentposition == std::string::npos)
+                        {
+                            value = removeTrailingWhitespaces(line.substr(pos1 + 1));
+                        }
+                        else
+                        {
+                            value = removeTrailingWhitespaces(line.substr(pos1 + 1, commentposition - pos1 - 1));
+                            comment = removeTrailingWhitespaces(line.substr(commentposition));
+                        }
+
+                        if (pos2 != std::string::npos && pos3 != std::string::npos && pos3 > pos2 + 1)
+                        {
+                            // There might be an array index
+                            unsigned int index = 0;
+                            if (ConvertValue(&index, line.substr(pos2 + 1, pos3 - pos2 - 1)))
+                            {
+                                // New array
+                                std::list<ConfigFileEntry*>::iterator it = newsection->getEntryIterator(getStripped(line.substr(0, pos2)), index, value, false);
+                                (*it)->setValue(value);
+                                (*it)->setComment(comment);
+                                continue;
+                            }
+                        }
+
+                        // New value
+                        newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryValue(getStripped(line.substr(0, pos1)), value, false, comment));
+                        continue;
+                    }
+                }
+            }
+        }
+
+        file.close();
+
+        COUT(3) << "Loaded config file \"" << this->filename_ << "\"." << std::endl;
+
+        // Save the file in case something changed (like stripped whitespaces)
+        this->save();
+    }
+
+    void ConfigFile::save() const
+    {
+        std::ofstream file;
+        file.open(this->filename_.c_str(), std::fstream::out);
+        file.setf(std::ios::fixed, std::ios::floatfield);
+        file.precision(6);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "An error occurred in ConfigFileManager.cc:" << std::endl;
+            COUT(1) << "Error: Couldn't open config-file \"" << this->filename_ << "\"." << std::endl;
+            return;
+        }
+
+        for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
+        {
+            file << (*it)->getFileEntry() << std::endl;
+
+            for (std::list<ConfigFileEntry*>::const_iterator it_entries = (*it)->getEntriesBegin(); it_entries != (*it)->getEntriesEnd(); ++it_entries)
+            {
+                file << (*it_entries)->getFileEntry() << std::endl;
+            }
+
+            file << std::endl;
+        }
+
+        file.close();
+
+        COUT(4) << "Saved config file \"" << this->filename_ << "\"." << std::endl;
+    }
+
+    void ConfigFile::clean(bool bCleanComments)
+    {
+        for (std::list<ConfigFileSection*>::iterator it1 = this->sections_.begin(); it1 != this->sections_.end(); )
+        {
+            std::map<std::string, Identifier*>::const_iterator it2 = Identifier::getIdentifierMap().find((*it1)->getName());
+            if (it2 != Identifier::getIdentifierMapEnd() && (*it2).second->hasConfigValues())
+            {
+                // The section exists, delete comment
+                if (bCleanComments)
+                    (*it1)->setComment("");
+                for (std::list<ConfigFileEntry*>::iterator it3 = (*it1)->entries_.begin(); it3 != (*it1)->entries_.end(); )
+                {
+                    std::map<std::string, ConfigValueContainer*>::const_iterator it4 = (*it2).second->getConfigValueMap().find((*it3)->getName());
+                    if (it4 != (*it2).second->getConfigValueMapEnd())
+                    {
+                        // The config-value exists, delete comment
+                        if (bCleanComments)
+                            (*it3)->setComment("");
+                        ++it3;
+                    }
+                    else
+                    {
+                        // The config-value doesn't exist
+                        delete (*it3);
+                        (*it1)->entries_.erase(it3++);
+                    }
+                }
+                ++it1;
+            }
+            else
+            {
+                // The section doesn't exist
+                delete (*it1);
+                this->sections_.erase(it1++);
+            }
+        }
+
+        // Save the file
+        this->save();
+    }
+
+    ConfigFileSection* ConfigFile::getSection(const std::string& section)
+    {
+        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
+            if ((*it)->getName() == section)
+                return (*it);
+
+        this->bUpdated_ = true;
+
+        return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(section)));
+    }
+
+    void ConfigFile::saveIfUpdated()
+    {
+        bool sectionsUpdated = false;
+
+        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
+        {
+            if ((*it)->bUpdated_)
+            {
+                sectionsUpdated = true;
+                (*it)->bUpdated_ = false;
+            }
+        }
+
+        if (this->bUpdated_ || sectionsUpdated)
+        {
+            this->bUpdated_ = false;
+            this->save();
+        }
+    }
+
+
+    ///////////////////////
+    // ConfigFileManager //
+    ///////////////////////
+    ConfigFileManager::ConfigFileManager()
+    {
+        this->setFile(CFT_Settings, DEFAULT_CONFIG_FILE);
+    }
+
+    ConfigFileManager::~ConfigFileManager()
+    {
+        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); )
+            delete (*(it++)).second;
+    }
+
+    ConfigFileManager* ConfigFileManager::getSingleton()
+    {
+        static ConfigFileManager instance;
+        return (&instance);
+    }
+
+    void ConfigFileManager::setFile(ConfigFileType type, const std::string& filename, bool bCreateIfNotExisting)
+    {
+        std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.find(type);
+        if (it != this->configFiles_.end())
+            if ((*it).second != 0)
+                delete (*it).second;
+
+        this->configFiles_[type] = new ConfigFile(this->getFilePath(filename));
+        this->load(type, bCreateIfNotExisting);
+    }
+
+    void ConfigFileManager::load(bool bCreateIfNotExisting)
+    {
+        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
+            (*it).second->load(bCreateIfNotExisting);
+
+        this->updateConfigValues();
+    }
+
+    void ConfigFileManager::save()
+    {
+        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
+            (*it).second->save();
+    }
+
+    void ConfigFileManager::clean(bool bCleanComments)
+    {
+        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
+            this->clean((*it).first, bCleanComments);
+    }
+
+    void ConfigFileManager::load(ConfigFileType type, bool bCreateIfNotExisting)
+    {
+        this->getFile(type)->load(bCreateIfNotExisting);
+        this->updateConfigValues(type);
+    }
+
+    void ConfigFileManager::save(ConfigFileType type)
+    {
+        this->getFile(type)->save();
+    }
+
+    void ConfigFileManager::clean(ConfigFileType type, bool bCleanComments)
+    {
+        this->getFile(type)->clean(bCleanComments);
+    }
+
+    void ConfigFileManager::updateConfigValues() const
+    {
+        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
+            this->updateConfigValues((*it).first);
+    }
+
+    void ConfigFileManager::updateConfigValues(ConfigFileType type) const
+    {
+        if (type == CFT_Settings)
+        {
+            for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getIdentifierMapBegin(); it != Identifier::getIdentifierMapEnd(); ++it)
+            {
+                if ((*it).second->hasConfigValues() /* && (*it).second != ClassManager<KeyBinder>::getIdentifier()*/)
+                {
+                    for (std::map<std::string, ConfigValueContainer*>::const_iterator it2 = (*it).second->getConfigValueMapBegin(); it2 != (*it).second->getConfigValueMapEnd(); ++it2)
+                        (*it2).second->update();
+
+                    (*it).second->updateConfigValues();
+                }
+            }
+        }
+        else if (type == CFT_Keybindings)
+        {
+            // todo
+        }
+    }
+
+    ConfigFile* ConfigFileManager::getFile(ConfigFileType type)
+    {
+        std::map<ConfigFileType, ConfigFile*>::iterator it = this->configFiles_.find(type);
+        if (it != this->configFiles_.end())
+            return (*it).second;
+
+        if (type == CFT_Settings)
+            return this->configFiles_[type] = new ConfigFile(DEFAULT_CONFIG_FILE);
+        else
+            return this->configFiles_[type] = new ConfigFile("");
+    }
+
+    std::string ConfigFileManager::getFilePath(const std::string& name) const
+    {
+        return name;
+    }
+}
Index: code/trunk/src/core/ConfigFileManager.h
===================================================================
--- code/trunk/src/core/ConfigFileManager.h	(revision 1055)
+++ code/trunk/src/core/ConfigFileManager.h	(revision 1055)
@@ -0,0 +1,298 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ConfigFileManager_H__
+#define _ConfigFileManager_H__
+
+#include <iostream>
+#include <string>
+#include <list>
+#include <map>
+
+#include "util/Math.h"
+
+#include "CorePrereqs.h"
+
+#define DEFAULT_CONFIG_FILE "default.ini"
+
+namespace orxonox
+{
+    enum _CoreExport ConfigFileType
+    {
+        CFT_Settings,
+        CFT_Keybindings
+    };
+
+
+    void reloadConfig();
+    void saveConfig();
+    void cleanConfig();
+    void loadSettings(const std::string& filename);
+    void loadKeybindings(const std::string& filename);
+
+
+    /////////////////////
+    // ConfigFileEntry //
+    /////////////////////
+    class _CoreExport ConfigFileEntry
+    {
+        public:
+            virtual void setValue(const std::string& value) = 0;
+            virtual std::string getValue() const = 0;
+            virtual const std::string& getName() const = 0;
+            virtual void setComment(const std::string& comment) = 0;
+            virtual unsigned int getIndex() const { return 0; }
+            virtual void setString(bool bString) = 0;
+            virtual std::string getFileEntry() const = 0;
+    };
+
+
+    //////////////////////////
+    // ConfigFileEntryValue //
+    //////////////////////////
+    class _CoreExport ConfigFileEntryValue : public ConfigFileEntry
+    {
+        public:
+            inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "") : name_(name), value_(value), bString_(bString), additionalComment_(additionalComment) {}
+            inline virtual ~ConfigFileEntryValue() {}
+
+            inline virtual const std::string& getName() const
+                { return this->name_; }
+
+            inline virtual void setComment(const std::string& comment)
+                { this->additionalComment_ = comment; }
+
+            virtual void setValue(const std::string& value);
+            virtual std::string getValue() const;
+
+            inline bool isString() const
+                { return this->bString_; }
+            inline void setString(bool bString)
+                { this->bString_ = bString; }
+
+            virtual std::string getFileEntry() const;
+
+        protected:
+            std::string name_;
+            std::string value_;
+            bool bString_;
+            std::string additionalComment_;
+    };
+
+
+    ///////////////////////////////
+    // ConfigFileEntryVectorValue //
+    ///////////////////////////////
+    class _CoreExport ConfigFileEntryVectorValue : public ConfigFileEntryValue
+    {
+        public:
+            inline ConfigFileEntryVectorValue(const std::string& name, unsigned int index, const std::string& value = "", bool bString = false, const std::string& additionalComment = "") : ConfigFileEntryValue(name, value, bString, additionalComment), index_(index) {}
+            inline virtual ~ConfigFileEntryVectorValue() {}
+
+            inline virtual unsigned int getIndex() const
+                { return this->index_; }
+
+            virtual std::string getFileEntry() const;
+
+        private:
+            unsigned int index_;
+    };
+
+
+    ////////////////////////////
+    // ConfigFileEntryComment //
+    ////////////////////////////
+    class _CoreExport ConfigFileEntryComment : public ConfigFileEntry
+    {
+        public:
+            inline ConfigFileEntryComment(const std::string& comment) : comment_(comment) {}
+            inline virtual ~ConfigFileEntryComment() {}
+
+            inline virtual const std::string& getName() const
+                { return this->comment_; }
+
+            inline virtual void setComment(const std::string& comment)
+                { this->comment_ = comment; }
+
+            inline virtual void setValue(const std::string& value)
+                {}
+            inline virtual std::string getValue() const
+                { return this->comment_; }
+
+            inline void setString(bool bString) {}
+
+            inline virtual std::string getFileEntry() const
+                { return this->comment_; }
+
+        private:
+            std::string comment_;
+    };
+
+
+    ///////////////////////
+    // ConfigFileSection //
+    ///////////////////////
+    class _CoreExport ConfigFileSection
+    {
+        friend class ConfigFile;
+
+        public:
+            inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "") : name_(name), additionalComment_(additionalComment), bUpdated_(false) {}
+            ~ConfigFileSection();
+
+            inline const std::string& getName() const
+                { return this->name_; }
+
+            inline void setComment(const std::string& comment)
+                { this->additionalComment_ = comment; }
+
+            inline void setValue(const std::string& name, const std::string& value, bool bString)
+                { this->getEntry(name, value, bString)->setValue(value); }
+            inline std::string getValue(const std::string& name, const std::string& fallback, bool bString)
+                { return this->getEntry(name, fallback, bString)->getValue(); }
+
+            inline void setValue(const std::string& name, unsigned int index, const std::string& value, bool bString)
+                { this->getEntry(name, index, value, bString)->setValue(value); }
+            inline std::string getValue(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+                { return this->getEntry(name, index, fallback, bString)->getValue(); }
+
+            void deleteVectorEntries(const std::string& name, unsigned int startindex = 0);
+            unsigned int getVectorSize(const std::string& name);
+
+            std::string getFileEntry() const;
+
+        private:
+            std::list<ConfigFileEntry*>& getEntries()
+                { return this->entries_; }
+            std::list<ConfigFileEntry*>::const_iterator getEntriesBegin() const
+                { return this->entries_.begin(); }
+            std::list<ConfigFileEntry*>::const_iterator getEntriesEnd() const
+                { return this->entries_.end(); }
+
+            std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, const std::string& fallback, bool bString);
+            std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString);
+
+            inline ConfigFileEntry* getEntry(const std::string& name, const std::string& fallback, bool bString)
+                { return (*this->getEntryIterator(name, fallback, bString)); }
+            inline ConfigFileEntry* getEntry(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+                { return (*this->getEntryIterator(name, index, fallback, bString)); }
+
+            std::string name_;
+            std::string additionalComment_;
+            std::list<ConfigFileEntry*> entries_;
+            bool bUpdated_;
+    };
+
+
+    ////////////////
+    // ConfigFile //
+    ////////////////
+    class _CoreExport ConfigFile
+    {
+        public:
+            inline ConfigFile(const std::string& filename) : filename_(filename), bUpdated_(false) {}
+            ~ConfigFile();
+
+            void load(bool bCreateIfNotExisting = true);
+            void save() const;
+            void clean(bool bCleanComments = false);
+
+            inline void setValue(const std::string& section, const std::string& name, const std::string& value, bool bString)
+                { this->getSection(section)->setValue(name, value, bString); this->save(); }
+            inline std::string getValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString)
+                { std::string output = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; }
+
+            inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString)
+                { this->getSection(section)->setValue(name, index, value, bString); this->save(); }
+            inline std::string getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+                { std::string output = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; }
+
+            inline void deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex = 0)
+                { this->getSection(section)->deleteVectorEntries(name, startindex); }
+            inline unsigned int getVectorSize(const std::string& section, const std::string& name)
+                { return this->getSection(section)->getVectorSize(name); }
+
+        private:
+            ConfigFileSection* getSection(const std::string& section);
+            void saveIfUpdated();
+
+            std::string filename_;
+            std::list<ConfigFileSection*> sections_;
+            bool bUpdated_;
+    };
+
+
+    ///////////////////////
+    // ConfigFileManager //
+    ///////////////////////
+    class _CoreExport ConfigFileManager
+    {
+        public:
+            static ConfigFileManager* getSingleton();
+
+            void setFile(ConfigFileType type, const std::string& filename, bool bCreateIfNotExisting = true);
+
+            void load(bool bCreateIfNotExisting = true);
+            void save();
+            void clean(bool bCleanComments = false);
+
+            void load(ConfigFileType type, bool bCreateIfNotExisting = true);
+            void save(ConfigFileType type);
+            void clean(ConfigFileType type, bool bCleanComments = false);
+
+            inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& value, bool bString)
+                { this->getFile(type)->setValue(section, name, value, bString); }
+            inline std::string getValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& fallback, bool bString)
+                { return this->getFile(type)->getValue(section, name, fallback, bString); }
+
+            inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString)
+                { this->getFile(type)->setValue(section, name, index, value, bString); }
+            inline std::string getValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+                { return this->getFile(type)->getValue(section, name, index, fallback, bString); }
+
+            inline void deleteVectorEntries(ConfigFileType type, const std::string& section, const std::string& name, unsigned int startindex = 0)
+                { this->getFile(type)->deleteVectorEntries(section, name, startindex); }
+            inline unsigned int getVectorSize(ConfigFileType type, const std::string& section, const std::string& name)
+                { return this->getFile(type)->getVectorSize(section, name); }
+
+            void updateConfigValues() const;
+            void updateConfigValues(ConfigFileType type) const;
+
+        private:
+            ConfigFileManager();
+            ConfigFileManager(const ConfigFileManager& other) {}
+            ~ConfigFileManager();
+
+            ConfigFile* getFile(ConfigFileType type);
+
+            std::string getFilePath(const std::string& name) const;
+
+            std::map<ConfigFileType, ConfigFile*> configFiles_;
+    };
+}
+
+#endif /* _ConfigFileManager_H__ */
Index: code/trunk/src/core/ConfigValueContainer.cc
===================================================================
--- code/trunk/src/core/ConfigValueContainer.cc	(revision 1055)
+++ code/trunk/src/core/ConfigValueContainer.cc	(revision 1055)
@@ -0,0 +1,400 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file ConfigValueContainer.cc
+    @brief Implementation of the ConfigValueContainer class.
+*/
+
+#include <fstream>
+
+#include "ConfigValueContainer.h"
+#include "Language.h"
+#include "Identifier.h"
+#include "util/SubString.h"
+#include "util/Convert.h"
+
+#define MAX_VECTOR_INDEX 255 // to avoid up to 4*10^9 vector entries in the config file after accidentally using a wrong argument
+
+
+namespace orxonox
+{
+    /**
+        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
+        @param type The type of the corresponding config-file
+        @param identifier The identifier of the class the variable belongs to
+        @param varname The name of the variable
+        @param defvalue The default-value
+    */
+    ConfigValueContainer::ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const MultiTypeMath& defvalue)
+    {
+        this->type_ = type;
+        this->identifier_ = identifier;
+        this->sectionname_ = identifier->getName();
+        this->varname_ = varname;
+
+        this->value_ = defvalue;
+        this->bAddedDescription_ = false;
+        this->bIsVector_ = false;
+
+        this->defvalueString_ = defvalue.toString();
+        this->update();
+    }
+
+    /**
+        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
+        @param type The type of the corresponding config-file
+        @param identifier The identifier of the class the variable belongs to
+        @param varname The name of the variable
+        @param defvalue The default-value
+    */
+    ConfigValueContainer::ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const std::vector<MultiTypeMath>& defvalue)
+    {
+        this->type_ = type;
+        this->identifier_ = identifier;
+        this->sectionname_ = identifier->getName();
+        this->varname_ = varname;
+
+        this->valueVector_ = defvalue;
+        this->bAddedDescription_ = false;
+        this->bIsVector_ = true;
+
+        if (defvalue.size() > 0)
+            this->value_ = defvalue[0];
+
+        for (unsigned int i = 0; i < defvalue.size(); i++)
+            ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, i, defvalue[i].toString(), this->value_.isA(MT_string));
+
+        for (unsigned int i = 0; i < defvalue.size(); i++)
+            this->defvalueStringVector_.push_back(defvalue[i].toString());
+
+        this->update();
+    }
+
+    /**
+        @brief Adds a new entry to the end of the vector.
+        @param input The new entry
+        @return True if the new entry was successfully added
+    */
+    bool ConfigValueContainer::add(const std::string& input)
+    {
+        if (this->bIsVector_)
+            return this->set(this->valueVector_.size(), input);
+
+        COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+        return false;
+    }
+
+    /**
+        @brief Removes an existing entry from the vector.
+        @param index The index of the entry
+        @return True if the entry was removed
+    */
+    bool ConfigValueContainer::remove(unsigned int index)
+    {
+        if (this->bIsVector_)
+        {
+            if (index < this->valueVector_.size())
+            {
+                this->valueVector_.erase(this->valueVector_.begin() + index);
+                for (unsigned int i = index; i < this->valueVector_.size(); i++)
+                    ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isA(MT_string));
+                ConfigFileManager::getSingleton()->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->valueVector_.size());
+
+                return true;
+            }
+            COUT(1) << "Error: Invalid vector-index." << std::endl;
+        }
+
+        COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+        return false;
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects and writes the change into the config-file.
+        @param input The new value
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::set(const std::string& input)
+    {
+        if (this->bIsVector_)
+        {
+            SubString token(input, " ", "", true, '"', false, '(', ')', false, '\0');
+            int index = -1;
+            bool success = false;
+
+            if (token.size() > 0)
+                success = ConvertValue(&index, token[0]);
+
+            if (!success || index < 0 || index > MAX_VECTOR_INDEX)
+            {
+                if (!success)
+                {
+                    COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is a vector." << std::endl;
+                }
+                else
+                {
+                    COUT(1) << "Error: Invalid vector-index." << std::endl;
+                }
+                return false;
+            }
+
+            if (token.size() >= 2)
+                return this->set(index, token.subSet(1).join());
+            else
+                return this->set(index, "");
+        }
+
+        bool success = this->tset(input);
+        ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, input, this->value_.isA(MT_string));
+        return success;
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects and writes the change into the config-file.
+        @param index The index in the vector
+        @param input The new value
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::set(unsigned int index, const std::string& input)
+    {
+        if (this->bIsVector_)
+        {
+            bool success = this->tset(index, input);
+            ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, index, input, this->value_.isA(MT_string));
+            return success;
+        }
+
+        COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+        return false;
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects, but doesn't change the config-file (t stands for temporary).
+        @param input The new value
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::tset(const std::string& input)
+    {
+        bool success = this->parse(input);
+        if (this->identifier_)
+            this->identifier_->updateConfigValues();
+        return success;
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects, but doesn't change the config-file (t stands for temporary).
+        @param index The index in the vector
+        @param input The new value
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::tset(unsigned int index, const std::string& input)
+    {
+        if (this->bIsVector_)
+        {
+            bool success = this->parse(index, input);
+            if (this->identifier_)
+                this->identifier_->updateConfigValues();
+            return success;
+        }
+
+        COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+        return false;
+    }
+
+    /**
+        @brief Sets the value of the variable back to the default value and resets the config-file entry.
+    */
+    bool ConfigValueContainer::reset()
+    {
+        if (!this->bIsVector_)
+            return this->set(this->defvalueString_);
+        else
+        {
+            bool success = true;
+            for (unsigned int i = 0; i < this->defvalueStringVector_.size(); i++)
+                if (!this->set(i, this->defvalueStringVector_[i]))
+                    success = false;
+            ConfigFileManager::getSingleton()->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->defvalueStringVector_.size());
+            return success;
+        }
+    }
+
+    /**
+        @brief Retrieves the configured value from the currently loaded config-file.
+    */
+    void ConfigValueContainer::update()
+    {
+        if (!this->bIsVector_)
+            this->value_.fromString(ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isA(MT_string)));
+        else
+        {
+            this->valueVector_.clear();
+            for (unsigned int i = 0; i < ConfigFileManager::getSingleton()->getVectorSize(this->type_, this->sectionname_, this->varname_); i++)
+            {
+                this->value_.fromString(ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isA(MT_string)));
+                this->valueVector_.push_back(this->value_);
+            }
+        }
+    }
+
+    /**
+        @brief Parses a given std::string into a value of the type of the associated variable and assigns it.
+        @param input The string to convert
+        @return True if the string was successfully parsed
+    */
+    bool ConfigValueContainer::parse(const std::string& input)
+    {
+        if (this->bIsVector_)
+        {
+            SubString token(input, " ", "", true, '"', false, '(', ')', false, '\0');
+            int index = -1;
+            bool success = false;
+
+            if (token.size() > 0)
+                success = ConvertValue(&index, token[0]);
+
+            if (!success || index < 0 || index > MAX_VECTOR_INDEX)
+            {
+                if (!success)
+                {
+                    COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is a vector." << std::endl;
+                }
+                else
+                {
+                    COUT(1) << "Error: Invalid vector-index." << std::endl;
+                }
+                return false;
+            }
+
+            if (token.size() >= 2)
+                return this->parse(index, token.subSet(1).join());
+            else
+                return this->parse(index, "");
+        }
+
+        MultiTypeMath temp = this->value_;
+        if (temp.fromString(input))
+        {
+            this->value_ = temp;
+            return true;
+        }
+        return false;
+    }
+
+    /**
+        @brief Parses a given std::string into a value of the type of the associated variable and assigns it.
+        @param index The index in the vector
+        @param input The string to convert
+        @return True if the string was successfully parsed
+    */
+    bool ConfigValueContainer::parse(unsigned int index, const std::string& input)
+    {
+        if (this->bIsVector_)
+        {
+            if (index >= this->valueVector_.size())
+            {
+                for (unsigned int i = this->valueVector_.size(); i <= index; i++)
+                {
+                    this->valueVector_.push_back(MultiTypeMath());
+                    ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isA(MT_string));
+                }
+            }
+
+            MultiTypeMath temp = this->value_;
+            if (temp.fromString(input))
+            {
+                this->valueVector_[index] = temp;
+                return true;
+            }
+            return false;
+        }
+
+        COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+        return false;
+    }
+
+    /**
+        @brief Parses a given std::string into a value of the type of the associated variable and assigns it.
+        @param input The string to convert
+        @param defvalue The default value to assign if the parsing fails
+        @return True if the string was successfully parsed
+    */
+    bool ConfigValueContainer::parse(const std::string& input, const MultiTypeMath& defvalue)
+    {
+        if (this->parse(input))
+            return true;
+
+        this->value_ = defvalue;
+        return false;
+    }
+
+    /**
+        @brief Parses a given std::string into a value of the type of the associated variable and assigns it.
+        @param index The index in the vector
+        @param input The string to convert
+        @param defvalue The default value to assign if the parsing fails
+        @return True if the string was successfully parsed
+    */
+    bool ConfigValueContainer::parse(unsigned int index, const std::string& input, const MultiTypeMath& defvalue)
+    {
+        if (this->bIsVector_)
+        {
+            if (this->parse(index, input))
+                return true;
+
+            this->valueVector_[index] = defvalue;
+            return false;
+        }
+
+        COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+        return false;
+    }
+
+    /**
+        @brief Adds a description to the config-value.
+        @param description The description
+    */
+    void ConfigValueContainer::description(const std::string& description)
+    {
+        if (!this->bAddedDescription_)
+        {
+            this->description_ = std::string("ConfigValueDescription::" + this->identifier_->getName() + "::" + this->varname_);
+            AddLanguageEntry(this->description_, description);
+            this->bAddedDescription_ = true;
+        }
+    }
+
+    /**
+        @brief Returns the description of the config-value.
+        @return The description
+    */
+    const std::string& ConfigValueContainer::getDescription() const
+    {
+        return GetLocalisation(this->description_);
+    }
+}
Index: code/trunk/src/core/ConfigValueContainer.h
===================================================================
--- code/trunk/src/core/ConfigValueContainer.h	(revision 1055)
+++ code/trunk/src/core/ConfigValueContainer.h	(revision 1055)
@@ -0,0 +1,141 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file ConfigValueContainer.h
+    @brief Definition of the ConfigValueContainer class.
+
+    The ConfigValueContainer class contains all needed informations about a configurable variable:
+     - the name of the variable
+     - the name of the class the variable belongs to
+     - the default value
+     - the user-specified value
+     - a pointer to the entry in the config-file
+
+    This is needed to assign the configured values to all newly created objects.
+*/
+
+#ifndef _ConfigValueContainer_H__
+#define _ConfigValueContainer_H__
+
+#include <string>
+#include <vector>
+
+#include "CorePrereqs.h"
+
+#include "util/Math.h"
+#include "util/MultiTypeMath.h"
+#include "ConfigFileManager.h"
+
+namespace orxonox
+{
+    //! The ConfigValuecontainer contains all needed informations about a configurable variable.
+    /**
+        The ConfigValueContainer class contains all needed informations about a configurable variable:
+         - the name of the variable
+         - the name of the class the variable belongs to
+         - the default value
+         - the user-specified value
+         - a pointer to the entry in the config-file
+
+        This is needed to assign the configured values to all newly created objects.
+
+        The container searches for the entry in the config file.
+        If there is an entry, it parses the specified value and assigns it to the variable of the right type.
+        If there is no entry, it adds the entry with the default-value to the section of the variables class.
+        If there is no section, the section and the entry are added to the end of the config-file.
+    */
+    class _CoreExport ConfigValueContainer
+    {
+        public:
+            ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const MultiTypeMath& defvalue);
+            ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const std::vector<MultiTypeMath>& defvalue);
+
+            /** @brief Returns the configured value. @param value This is only needed to determine the right type. @return The value */
+            template <typename T>
+            inline ConfigValueContainer& getValue(T* value)
+                { this->value_.getValue(value); return *this; }
+            template <typename T>
+            inline ConfigValueContainer& getValue(std::vector<T>* value)
+            {
+                value->clear();
+                for (unsigned int i = 0; i < this->valueVector_.size(); i++)
+                    value->push_back(this->valueVector_[i]);
+                return *this;
+            }
+
+            inline const std::string& getName() const
+                { return this->varname_; }
+            inline bool isVector() const
+                { return this->bIsVector_; }
+            inline unsigned int getVectorSize() const
+                { return this->valueVector_.size(); }
+
+            void description(const std::string& description);
+            const std::string& getDescription() const;
+
+            bool add(const std::string& input);
+            bool remove(unsigned int index);
+            bool set(const std::string& input);
+            bool tset(const std::string& input);
+            bool reset();
+            void update();
+
+            /** @brief Converts the config-value to a string. @return The string */
+            inline std::string toString() const
+                { return this->value_.toString(); }
+            /** @brief Returns the typename of the assigned config-value. @return The typename */
+            inline std::string getTypename() const
+                { return this->value_.getTypename(); }
+
+        private:
+            bool parse(const std::string& input);
+            bool parse(const std::string& input, const MultiTypeMath& defvalue);
+
+            bool set(unsigned int index, const std::string& input);
+            bool tset(unsigned int index, const std::string& input);
+            bool parse(unsigned int index, const std::string& input);
+            bool parse(unsigned int index, const std::string& input, const MultiTypeMath& defvalue);
+
+            bool                       bIsVector_;                  //!< True if the container contains a std::vector
+
+            ConfigFileType             type_;                       //!< The type of the corresponding config-file
+            Identifier*                identifier_;                 //!< The identifier of the class
+            std::string                sectionname_;                //!< The name of the class the variable belongs to
+            std::string                varname_;                    //!< The name of the variable
+            std::string                defvalueString_;             //!< The string of the default-value
+            std::vector<std::string>   defvalueStringVector_;       //!< A vector, containg the strings of the default-values in case we're storing a vector
+
+            MultiTypeMath              value_;                      //!< The value
+            std::vector<MultiTypeMath> valueVector_;                //!< A vector, containg the values in case we're storing a vector
+
+            bool                       bAddedDescription_;          //!< True if a description was added
+            LanguageEntryLabel         description_;                //!< The description
+    };
+}
+
+#endif /* _ConfigValueContainer_H__ */
Index: code/trunk/src/core/ConfigValueIncludes.h
===================================================================
--- code/trunk/src/core/ConfigValueIncludes.h	(revision 1055)
+++ code/trunk/src/core/ConfigValueIncludes.h	(revision 1055)
@@ -0,0 +1,118 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file ConfigValueIncludes.h
+    @brief Definition of macros for config-values.
+*/
+
+#ifndef _ConfigValueIncludes_H__
+#define _ConfigValueIncludes_H__
+
+#include "Identifier.h"
+#include "ConfigValueContainer.h"
+#include "ConfigFileManager.h"
+
+
+/**
+    @brief Assigns the value, defined in the config-file, to the variable (or the default-value, if there is no entry in the file).
+    @param varname The name of the variable
+    @param defvalue The default-value of the variable
+*/
+#define SetConfigValue(varname, defvalue) \
+    orxonox::ConfigValueContainer* container##varname = this->getIdentifier()->getConfigValueContainer(#varname); \
+    if (!container##varname) \
+    { \
+        container##varname = new orxonox::ConfigValueContainer(CFT_Settings, this->getIdentifier(), #varname, varname = defvalue); \
+        this->getIdentifier()->addConfigValueContainer(#varname, container##varname); \
+    } \
+    container##varname->getValue(&varname)
+
+/**
+    @brief Assigns the vector-values, defined in the config-file, to the vector (or the default-value, if there are no entries in the file).
+    @param varname The name of the std::vector
+    @param defvalue The default-value
+*/
+#define SetConfigValueVector(varname, defvalue) \
+    orxonox::ConfigValueContainer* container##varname = this->getIdentifier()->getConfigValueContainer(#varname); \
+    if (!container##varname) \
+    { \
+        std::vector<MultiTypeMath> temp; \
+        for (unsigned int i = 0; i < defvalue.size(); i++) \
+            temp.push_back(MultiTypeMath(defvalue[i])); \
+        container##varname = new orxonox::ConfigValueContainer(CFT_Settings, this->getIdentifier(), #varname, temp); \
+        this->getIdentifier()->addConfigValueContainer(#varname, container##varname); \
+    } \
+    container##varname->getValue(&varname)
+
+/**
+    @brief Sets the variable and the config-file entry back to the previously defined default-value.
+    @param varname The name of the variable
+*/
+#define ResetConfigValue(varname) \
+    orxonox::ConfigValueContainer* container##varname##reset = this->getIdentifier()->getConfigValueContainer(#varname); \
+    if (container##varname##reset) \
+    { \
+        container##varname##reset->reset(); \
+        container##varname##reset->getValue(&varname); \
+    } \
+    else \
+    { \
+        COUT(2) << "Warning: Couldn't reset config-value '" << #varname << "', corresponding container doesn't exist." << std::endl; \
+    }
+
+/**
+    @brief Modifies a config-value by using a modifier and some arguments.
+    @param varname The name of the config-value
+    @param modifier The name of the modifier: set, tset, add, remove, reset, update
+*/
+#define ModifyConfigValue(varname, modifier, ...) \
+    orxonox::ConfigValueContainer* container##varname##modify##modifier = this->getIdentifier()->getConfigValueContainer(#varname); \
+    if (container##varname##modify##modifier) \
+    { \
+        container##varname##modify##modifier->modifier(__VA_ARGS__); \
+        container##varname##modify##modifier->getValue(&varname); \
+    } \
+    else \
+    { \
+        COUT(2) << "Warning: Couln't modify config-value '" << #varname << "', corresponding container doesn't exist." << std::endl; \
+    }
+
+/**
+    @brief Assigns the command, defined in the keybind-file, to the key-variable (or an empty string, if there is no entry in the file).
+    @param varname The name of the key-variable
+*/
+#define SetKeybind(keyname) \
+    orxonox::ConfigValueContainer* container##keyname = this->getIdentifier()->getConfigValueContainer(#keyname); \
+    if (!container##keyname) \
+    { \
+        container##keyname = new orxonox::ConfigValueContainer(CFT_Keybindings, this->getIdentifier(), #keyname, keyname = ""); \
+        this->getIdentifier()->addConfigValueContainer(#keyname, container##keyname); \
+    } \
+    container##keyname->getValue(&varname)
+
+#endif /* _ConfigValueIncludes_H__ */
Index: code/trunk/src/core/ConsoleCommand.h
===================================================================
--- code/trunk/src/core/ConsoleCommand.h	(revision 1055)
+++ code/trunk/src/core/ConsoleCommand.h	(revision 1055)
@@ -0,0 +1,55 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ConsoleCommand_H__
+#define _ConsoleCommand_H__
+
+#include "Executor.h"
+#include "ClassManager.h"
+#include "Identifier.h"
+#include "CommandExecutor.h"
+
+
+
+#define ConsoleCommand(classname, function, accesslevel, bCreateShortcut) \
+    ConsoleCommandGeneric(classname##function##consolecommand__, classname, orxonox::createExecutor(orxonox::createFunctor(&classname::function), #function, accesslevel), bCreateShortcut)
+
+#define ConsoleCommandGeneric(fakevariable, classname, executor, bCreateShortcut) \
+    Executor& fakevariable = ClassManager<classname>::getIdentifier()->addConsoleCommand((ExecutorStatic*)executor, bCreateShortcut)
+
+
+#define ConsoleCommandShortcut(classname, function, accesslevel) \
+    ConsoleCommandShortcutGeneric(function##consolecommand__, orxonox::createExecutor(orxonox::createFunctor(&classname::function), #function, accesslevel))
+
+#define ConsoleCommandShortcutExtern(function, accesslevel) \
+    ConsoleCommandShortcutGeneric(function##consolecommand__, orxonox::createExecutor(orxonox::createFunctor(&function), #function, accesslevel))
+
+#define ConsoleCommandShortcutGeneric(fakevariable, executor) \
+    Executor& fakevariable = CommandExecutor::addConsoleCommandShortcut((ExecutorStatic*)executor)
+
+
+#endif /* _ConsoleCommand_H__ */
Index: code/trunk/src/core/CoreIncludes.h
===================================================================
--- code/trunk/src/core/CoreIncludes.h	(revision 1055)
+++ code/trunk/src/core/CoreIncludes.h	(revision 1055)
@@ -0,0 +1,106 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file CoreIncludes.h
+    @brief Definition of macros for Identifier and Factory.
+
+    Every class needs the RegisterObject(class) macro in its constructor. If the class is an interface
+    or the BaseObject itself, it needs the macro RegisterRootObject(class) instead.
+
+    To allow the object being created through the factory, use the CreateFactory(class) macro outside
+    the of the class implementation, so it gets executed before main().
+*/
+
+#ifndef _CoreIncludes_H__
+#define _CoreIncludes_H__
+
+#include "Identifier.h"
+#include "ClassManager.h"
+#include "Factory.h"
+#include "ClassFactory.h"
+#include "Debug.h"
+
+
+/**
+    @brief Intern macro, containing the common parts of RegisterObject and RegisterRootObject.
+    @param ClassName The name of the class
+    @param bRootClass True if the class is directly derived from OrxonoxClass
+*/
+#define InternRegisterObject(ClassName, bRootClass) \
+    this->setIdentifier(orxonox::ClassManager<ClassName>::getIdentifier()->registerClass(this->getParents(), #ClassName, bRootClass)); \
+    if (orxonox::Identifier::isCreatingHierarchy() && this->getParents()) \
+        this->getParents()->insert(this->getParents()->end(), this->getIdentifier()); \
+    orxonox::ClassManager<ClassName>::getIdentifier()->addObject(this)
+
+/**
+    @brief Intern macro, containing the specific part of RegisterRootObject.
+    @param ClassName The name of the class
+*/
+#define InternRegisterRootObject(ClassName) \
+    if (orxonox::Identifier::isCreatingHierarchy() && !this->getParents()) \
+        this->createParents(); \
+    InternRegisterObject(ClassName, true)
+
+/**
+    @brief RegisterObject - with and without debug output.
+    @param ClassName The name of the class
+*/
+#define RegisterObject(ClassName) \
+    COUT(5) << "*** Register Object: " << #ClassName << std::endl; \
+    InternRegisterObject(ClassName, false)
+
+/**
+    @brief RegisterRootObject - with and without debug output.
+    @param ClassName The name of the class
+*/
+#define RegisterRootObject(ClassName) \
+    COUT(5) << "*** Register Root-Object: " << #ClassName << std::endl; \
+    InternRegisterRootObject(ClassName)
+
+/**
+    @brief Returns the Identifier of the given class.
+    @param ClassName The name of the class
+*/
+#define Class(ClassName) \
+    ClassManager<ClassName>::getIdentifier()
+
+/**
+    @brief Creates the entry in the Factory.
+    @param ClassName The name of the class
+*/
+#define CreateFactory(ClassName) \
+    bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName)
+
+/**
+    @brief Returns the Identifier with either a given name or a given network ID through the factory.
+    @param StringOrInt The name or the network ID of the class
+*/
+#define ID(StringOrInt) \
+    orxonox::Factory::getIdentifier(StringOrInt)
+
+#endif /* _CoreIncludes_H__ */
Index: code/trunk/src/core/CorePrereqs.h
===================================================================
--- code/trunk/src/core/CorePrereqs.h	(revision 1055)
+++ code/trunk/src/core/CorePrereqs.h	(revision 1055)
@@ -0,0 +1,149 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+  @file
+  @brief Contains all the necessary forward declarations for all classes and structs.
+*/
+
+#ifndef _CorePrereqs_H__
+#define _CorePrereqs_H__
+
+#include <string>
+
+#include "OrxonoxPlatform.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+#if (ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32) && !defined( CORE_STATIC_BUILD )
+#  ifdef CORE_SHARED_BUILD
+#    define _CoreExport __declspec(dllexport)
+#  else
+#    if defined( __MINGW32__ )
+#      define _CoreExport
+#    else
+#      define _CoreExport __declspec(dllimport)
+#    endif
+#  endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+#  define _CoreExport  __attribute__ ((visibility("default")))
+#else
+#  define _CoreExport
+#endif
+
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+class SignalHandler;
+
+namespace orxonox
+{
+#ifndef _XMLPort_Mode__
+#define _XMLPort_Mode__
+  namespace XMLPort
+  {
+    enum Mode
+    {
+      LoadObject,
+      SaveObject
+    };
+  }
+#endif
+
+  typedef std::string LanguageEntryLabel;
+
+  class BaseFactory;
+  class BaseMetaObjectListElement;
+  class BaseObject;
+  template <class T>
+  class ClassFactory;
+  template <class T>
+  class ClassIdentifier;
+  template <class T>
+  class ClassManager;
+  class ClassTreeMask;
+  class ClassTreeMaskIterator;
+  class ClassTreeMaskNode;
+  class CommandEvaluation;
+  class CommandExecutor;
+  class ConfigFile;
+  class ConfigFileEntry;
+  class ConfigFileEntryComment;
+  class ConfigFileEntryValue;
+  class ConfigFileManager;
+  class ConfigFileSection;
+  class ConfigValueContainer;
+  class CoreSettings;
+  class Error;
+  class Executor;
+  template <class T>
+  class ExecutorMember;
+  class ExecutorStatic;
+  class Factory;
+  class Functor;
+  template <class T>
+  class FunctorMember;
+  class FunctorStatic;
+  class Identifier;
+  class IdentifierDistributor;
+  class InputBuffer;
+  class InputBufferListener;
+  class InputHandlerGame;
+  class InputHandlerGUI;
+  class InputManager;
+  template <class T>
+  class Iterator;
+  class Language;
+  class LanguageEntry;
+  class Level;
+  class Loader;
+  class MetaObjectList;
+  template <class T>
+  class MetaObjectListElement;
+  class Namespace;
+  class NamespaceNode;
+  template <class T>
+  class ObjectList;
+  template <class T>
+  class ObjectListElement;
+  class OrxonoxClass;
+  class OutputHandler;
+  class Shell;
+  template <class T>
+  class SubclassIdentifier;
+  class Tickable;
+  template <class T, class O>
+  class XMLPortClassObjectContainer;
+  template <class T>
+  class XMLPortClassParamContainer;
+  class XMLPortObjectContainer;
+  class XMLPortParamContainer;
+}
+
+#endif /* _CorePrereqs_H__ */
Index: code/trunk/src/core/CoreSettings.cc
===================================================================
--- code/trunk/src/core/CoreSettings.cc	(revision 1055)
+++ code/trunk/src/core/CoreSettings.cc	(revision 1055)
@@ -0,0 +1,162 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file CoreSettings.cc
+    @brief Implementation of the CoreSettings class.
+*/
+
+#include "CoreSettings.h"
+#include "Language.h"
+#include "CoreIncludes.h"
+#include "ConfigValueIncludes.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor: Registers the object and sets the config-values.
+        @param A reference to a global variable, used to avoid an infinite recursion in getSoftDebugLevel()
+    */
+    CoreSettings::CoreSettings()
+    {
+        RegisterRootObject(CoreSettings);
+        this->setConfigValues();
+    }
+
+    bool& CoreSettings::isCreatingCoreSettings()
+    {
+        static bool bCreatingCoreSettings = true;
+        static bool bFirstTime = true;
+        if (bFirstTime)
+        {
+            bFirstTime = false;
+            CoreSettings::getInstance();
+        }
+        return bCreatingCoreSettings;
+    }
+
+    /**
+        @brief Returns a unique instance of CoreSettings.
+        @return The instance
+    */
+    CoreSettings& CoreSettings::getInstance()
+    {
+        static CoreSettings instance = CoreSettings();
+
+        // If bCreatingSoftDebugLevelObject is true, we're just about to create an instance of the DebugLevel class
+        if (CoreSettings::isCreatingCoreSettings())
+        {
+            isCreatingCoreSettings() = false;
+            instance.setConfigValues();
+        }
+        return instance;
+    }
+
+    /**
+        @brief Function to collect the SetConfigValue-macro calls.
+    */
+    void CoreSettings::setConfigValues()
+    {
+        SetConfigValue(softDebugLevelConsole_, 3).description("The maximal level of debug output shown in the console");
+        SetConfigValue(softDebugLevelLogfile_, 3).description("The maximal level of debug output shown in the logfile");
+        SetConfigValue(softDebugLevelShell_, 1).description("The maximal level of debug output shown in the ingame shell");
+
+        // softDebugLevel_ is the maximum of the 3 variables
+        this->softDebugLevel_ = this->softDebugLevelConsole_;
+        if (this->softDebugLevelLogfile_ > this->softDebugLevel_)
+            this->softDebugLevel_ = this->softDebugLevelLogfile_;
+        if (this->softDebugLevelShell_ > this->softDebugLevel_)
+            this->softDebugLevel_ = this->softDebugLevelShell_;
+
+
+        std::string temp = this->language_;
+        SetConfigValue(language_, Language::getLanguage().defaultLanguage_).description("The language of the ingame text");
+
+        if (this->language_ != temp)
+        {
+            // Read the translation file after the language was configured
+            Language::getLanguage().readTranslatedLanguageFile();
+        }
+    }
+
+    /**
+        @brief Static function that holds the singleton.
+    */
+    int CoreSettings::getSoftDebugLevel(OutputHandler::OutputDevice device)
+    {
+        if (!CoreSettings::isCreatingCoreSettings())
+        {
+            if (device == OutputHandler::LD_All)
+                return CoreSettings::getInstance().softDebugLevel_;
+            else if (device == OutputHandler::LD_Console)
+                return CoreSettings::getInstance().softDebugLevelConsole_;
+            else if (device == OutputHandler::LD_Logfile)
+                return CoreSettings::getInstance().softDebugLevelLogfile_;
+            else if (device == OutputHandler::LD_Shell)
+                return CoreSettings::getInstance().softDebugLevelShell_;
+        }
+
+        // Return a constant value while we're creating the object
+        return 2;
+    }
+
+    /**
+        @brief Returns the configured language.
+    */
+    const std::string& CoreSettings::getLanguage()
+    {
+        if (!CoreSettings::isCreatingCoreSettings())
+            return CoreSettings::getInstance().language_;
+
+        return Language::getLanguage().defaultLanguage_;
+    }
+
+    /**
+        @brief Sets the language in the config-file back to the default.
+    */
+    void CoreSettings::resetLanguage()
+    {
+        CoreSettings::getInstance().resetLanguageIntern();
+    }
+
+    /**
+        @brief Sets the language in the config-file back to the default.
+    */
+    void CoreSettings::resetLanguageIntern()
+    {
+        ResetConfigValue(language_);
+    }
+}
+
+/**
+    @brief Returns the soft debug level, stored in the only existing instance of the DebugLevel class, configured in the config-file.
+    @return The soft debug level
+*/
+int getSoftDebugLevel()
+{
+    return orxonox::CoreSettings::getSoftDebugLevel();
+}
Index: code/trunk/src/core/CoreSettings.h
===================================================================
--- code/trunk/src/core/CoreSettings.h	(revision 1055)
+++ code/trunk/src/core/CoreSettings.h	(revision 1055)
@@ -0,0 +1,73 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file CoreSettings.h
+    @brief Definition of the CoreSettings class.
+
+    The CoreSettings class is a singleton, only used to configure some variables
+    in the core through the config-file.
+*/
+
+#ifndef _CoreSettings_H__
+#define _CoreSettings_H__
+
+#include "OrxonoxClass.h"
+#include "OutputHandler.h"
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    //! The CoreSettings class is a singleton, only used to configure some config-values.
+    class _CoreExport CoreSettings : public OrxonoxClass
+    {
+        public:
+            static CoreSettings& getInstance();
+            static bool& isCreatingCoreSettings();
+            void setConfigValues();
+
+            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
+            static const std::string& getLanguage();
+            static void resetLanguage();
+
+        private:
+            void resetLanguageIntern();
+
+            CoreSettings();
+            CoreSettings(const CoreSettings& other) {}
+            virtual ~CoreSettings() {}
+
+            int softDebugLevel_;                            //!< The debug level
+            int softDebugLevelConsole_;                     //!< The debug level for the console
+            int softDebugLevelLogfile_;                     //!< The debug level for the logfile
+            int softDebugLevelShell_;                       //!< The debug level for the ingame shell
+            std::string language_;                          //!< The language
+    };
+}
+
+#endif /* _CoreSettings_H__ */
Index: code/trunk/src/core/Debug.h
===================================================================
--- code/trunk/src/core/Debug.h	(revision 1055)
+++ code/trunk/src/core/Debug.h	(revision 1055)
@@ -0,0 +1,261 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Grauer
+ *   Co-authors:
+ *      Fabian 'x3n' Landau
+ *
+ */
+
+/**
+ * @file Debug.h
+ * @brief Handles the output for different verbose-modes.
+ *
+ * There are two modes: HARD and SOFT. HARD is precessed during compiletime, while SOFT is for runtime.
+ */
+
+#ifndef _Debug_H__
+#define _Debug_H__
+
+#include <stdio.h>
+
+#include "CorePrereqs.h"
+
+#include "OutputHandler.h"
+
+extern "C" _CoreExport int getSoftDebugLevel();
+
+// DEFINE ERROR MODES
+#define ORX_NONE            0
+#define ORX_ERROR           1
+#define ORX_WARNING         2
+#define ORX_INFO            3
+#define ORX_DEBUG           4
+#define ORX_vDEBUG          5
+
+//definitions
+#define ORX_PRINT_DEBUG_OUTPUT 1 // <-- fix that! should be a configurable setting
+
+#define ORX_HARD_DEBUG_LEVEL ORX_vDEBUG
+//#define ORX_SOFT_DEBUG_LEVEL ORX_WARNING // <-- fix that! should be a configurable setting
+
+///////////////////////////////////////////////////
+/// PRINTF: prints with filename and linenumber ///
+///////////////////////////////////////////////////
+#define PRINTFORX_NONE    PRINTF0
+#define PRINTFORX_ERROR   PRINTF1
+#define PRINTFORX_WARNING PRINTF2
+#define PRINTFORX_INFO    PRINTF3
+#define PRINTFORX_DEBUG   PRINTF4
+#define PRINTFORX_vDEBUG  PRINTF5
+
+#define PRINT_EXEC  printf
+#define COUT_EXEC(x) \
+  orxonox::OutputHandler::getOutStream().setOutputLevel(x)
+
+#ifndef PRINTF
+ #if ORX_PRINT_DEBUG_OUTPUT
+
+  #define PRINTF(x) \
+   PRINTF ## x
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
+   #define PRINTF1 \
+    if (getSoftDebugLevel() >= ORX_ERROR) \
+     printf("Error (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
+  #else
+   #define PRINTF1 if (ORX_NONE) PRINT_EXEC
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
+   #define PRINTF2 \
+    if (getSoftDebugLevel() >= ORX_WARNING) \
+     printf("Warning (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
+  #else
+   #define PRINTF2 if (ORX_NONE) PRINT_EXEC
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
+   #define PRINTF3 \
+    if (getSoftDebugLevel() >= ORX_INFO) \
+     printf("Info (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
+  #else
+   #define PRINTF3 if (ORX_NONE) PRINT_EXEC
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
+   #define PRINTF4 \
+    if (getSoftDebugLevel() >= ORX_DEBUG) \
+     printf("Debug (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
+  #else
+   #define PRINTF4 if (ORX_NONE) PRINT_EXEC
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_vDEBUG
+   #define PRINTF5 \
+    if (getSoftDebugLevel() >= ORX_vDEBUG) \
+     printf("vDebug (in %s, line %d): ", __FILE__, __LINE__), PRINT_EXEC
+  #else
+   #define PRINTF5 if (ORX_NONE) PRINT_EXEC
+  #endif
+
+ #else /* if ORX_PRINT_DEBUG_OUTPUT */
+  #define PRINTF(x) if (ORX_NONE) PRINT_EXEC
+ #endif /* if ORX_PRINT_DEBUG_OUTPUT */
+
+ #define PRINTF0 \
+  PRINT_EXEC
+#endif /* ifndef PRINTF */
+
+///////////////////////////////////////////////////
+///  PRINT: just prints output as is            ///
+///////////////////////////////////////////////////
+#define PRINTORX_NONE    PRINT0
+#define PRINTORX_ERROR   PRINT1
+#define PRINTORX_WARNING PRINT2
+#define PRINTORX_INFO    PRINT3
+#define PRINTORX_DEBUG   PRINT4
+#define PRINTORX_vDEBUG  PRINT5
+
+#ifndef PRINT
+ #if ORX_PRINT_DEBUG_OUTPUT
+  #define PRINT(x) \
+   PRINT ## x
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
+   #define PRINT1  \
+    if (getSoftDebugLevel() >= ORX_ERROR)  \
+     PRINT_EXEC
+  #else
+   #define PRINT1 if (ORX_NONE) PRINT_EXEC
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
+   #define PRINT2 \
+    if (getSoftDebugLevel() >= ORX_WARNING) \
+     PRINT_EXEC
+  #else
+   #define PRINT2 if (ORX_NONE) PRINT_EXEC
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
+   #define PRINT3 \
+    if (getSoftDebugLevel() >= ORX_INFO) \
+     PRINT_EXEC
+  #else
+   #define PRINT3 if (ORX_NONE) PRINT_EXEC
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
+   #define PRINT4 \
+    if (getSoftDebugLevel() >= ORX_DEBUG) \
+     PRINT_EXEC
+  #else
+   #define PRINT4 if (ORX_NONE) PRINT_EXEC
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_vDEBUG
+   #define PRINT5 \
+    if (getSoftDebugLevel() >= ORX_vDEBUG) \
+     PRINT_EXEC
+  #else
+   #define PRINT5 if (ORX_NONE) PRINT_EXEC
+  #endif
+
+ #else /* if ORX_PRINT_DEBUG_OUTPUT */
+  #define PRINT(x) if (ORX_NONE) PRINT_EXEC
+ #endif /* if ORX_PRINT_DEBUG_OUTPUT */
+
+ #define PRINT0 \
+  PRINT_EXEC
+#endif /* ifndef PRINT */
+
+
+////////////////////////////////////////////////////////
+///  COUT: just prints output as is with std::cout   ///
+////////////////////////////////////////////////////////
+#define COUTORX_NONE    COUT0
+#define COUTORX_ERROR   COUT1
+#define COUTORX_WARNING COUT2
+#define COUTORX_INFO    COUT3
+#define COUTORX_DEBUG   COUT4
+#define COUTORX_vDEBUG  COUT5
+
+#ifndef COUT
+ #if ORX_PRINT_DEBUG_OUTPUT
+  #define COUT(x) \
+   COUT ## x
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
+   #define COUT1  \
+    if (getSoftDebugLevel() >= ORX_ERROR)  \
+     COUT_EXEC(1)
+  #else
+   #define COUT1 if (ORX_NONE)\
+    COUT_EXEC(1)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
+   #define COUT2 \
+    if (getSoftDebugLevel() >= ORX_WARNING) \
+     COUT_EXEC(2)
+  #else
+   #define COUT2 if (ORX_NONE) \
+    COUT_EXEC(2)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
+   #define COUT3 \
+    if (getSoftDebugLevel() >= ORX_INFO) \
+     COUT_EXEC(3)
+  #else
+   #define COUT3 if (ORX_NONE) \
+    COUT_EXEC(3)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
+   #define COUT4 \
+    if (getSoftDebugLevel() >= ORX_DEBUG) \
+     COUT_EXEC(4)
+  #else
+   #define COUT4 if (ORX_NONE) \
+    COUT_EXEC(4)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_vDEBUG
+   #define COUT5 \
+    if (getSoftDebugLevel() >= ORX_vDEBUG) \
+     COUT_EXEC(5)
+  #else
+   #define COUT5 if (ORX_NONE) \
+    COUT_EXEC(5)
+  #endif
+
+ #else /* if ORX_PRINT_DEBUG_OUTPUT */
+  #define COUT(x) if (ORX_NONE) \
+   COUT_EXEC(5)
+ #endif /* if ORX_PRINT_DEBUG_OUTPUT */
+
+ #define COUT0 \
+  COUT_EXEC(0)
+#endif /* ifndef COUT */
+
+#endif /* _Debug_H__ */
Index: code/trunk/src/core/Error.cc
===================================================================
--- code/trunk/src/core/Error.cc	(revision 1055)
+++ code/trunk/src/core/Error.cc	(revision 1055)
@@ -0,0 +1,68 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Nicolas Perrenoud
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Error.cc
+    @brief Implementation of the Error class.
+*/
+
+#include "Debug.h"
+#include "Error.h"
+
+namespace orxonox
+{
+	Error::Error()
+	{
+		Error(0,"");
+	}
+
+	Error::Error(std::string errorMsg, int errorCode)
+	{
+		Error(errorCode, errorMsg);
+	}
+
+	Error::Error(int errorCode, std::string errorMsg)
+	{
+		COUT(1) << "############################ "<< std::endl
+							<< "#         Error "<<errorCode<< "          #"<< std::endl
+							<< "############################ "<< std::endl
+							<< "An error occured in Orxonox: "<< std::endl;
+
+		if (errorMsg=="")
+		{
+			switch (errorCode)
+			{
+				case 1:
+					errorMsg = "Some error!";
+					break;
+				default:
+					errorMsg = "Unknown error!";
+			}
+		}
+		COUT(1) << errorMsg << std::endl<< std::endl;
+	}
+}
Index: code/trunk/src/core/Error.h
===================================================================
--- code/trunk/src/core/Error.h	(revision 1055)
+++ code/trunk/src/core/Error.h	(revision 1055)
@@ -0,0 +1,53 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Nicolas Perrenoud
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Error.h
+    @brief Definition of the Error class.
+*/
+
+#ifndef _Error_H__
+#define _Error_H__
+
+#include <string>
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+	class _CoreExport Error
+	{
+	public:
+		Error();
+		Error(std::string errorMsg, int errorCode = 0);
+		Error(int errorCode, std::string errorMsg = "");
+	private:
+
+	};
+}
+
+#endif /* _Error_H__ */
Index: code/trunk/src/core/Executor.cc
===================================================================
--- code/trunk/src/core/Executor.cc	(revision 1055)
+++ code/trunk/src/core/Executor.cc	(revision 1055)
@@ -0,0 +1,251 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ *   Inspiration: Executor by Benjamin Grauer
+ */
+
+#include "Executor.h"
+#include "Language.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    Executor::Executor(Functor* functor, const std::string& name, AccessLevel::Level level)
+    {
+        this->functor_ = functor;
+        this->name_ = name;
+        this->accessLevel_ = level;
+
+        this->bAddedDescription_ = false;
+        this->bAddedDescriptionReturnvalue_ = false;
+
+        this->bAddedDescriptionParam_[0] = false;
+        this->bAddedDescriptionParam_[1] = false;
+        this->bAddedDescriptionParam_[2] = false;
+        this->bAddedDescriptionParam_[3] = false;
+        this->bAddedDescriptionParam_[4] = false;
+
+        this->bAddedDefaultValue_[0] = false;
+        this->bAddedDefaultValue_[1] = false;
+        this->bAddedDefaultValue_[2] = false;
+        this->bAddedDefaultValue_[3] = false;
+        this->bAddedDefaultValue_[4] = false;
+    }
+
+    Executor::~Executor()
+    {
+        delete this->functor_;
+    }
+
+    bool Executor::parse(const std::string& params, const std::string& delimiter) const
+    {
+        EXECUTOR_PARSE(normal);
+    }
+
+    bool Executor::evaluate(const std::string& params, MultiTypeMath param[5], const std::string& delimiter) const
+    {
+        unsigned int paramCount = this->functor_->getParamCount();
+
+        if (paramCount == 1)
+        {
+            // only one param: check if there are params given, otherwise try to use default values
+            std::string temp = getStripped(params);
+            if ((temp != "") && (temp.size() != 0))
+            {
+                param[0] = params;
+                this->functor_->evaluateParam(0, param[0]);
+                return true;
+            }
+            else if (this->bAddedDefaultValue_[0])
+            {
+                param[0] = this->defaultValue_[0];
+                this->functor_->evaluateParam(0, param[0]);
+                return true;
+            }
+            return false;
+        }
+        else
+        {
+            // more than one param
+            SubString tokens(params, delimiter, SubString::WhiteSpaces, false, '\\', true, '"', true, '(', ')', true, '\0');
+
+            // if there are not enough params given, check if there are default values
+            for (unsigned int i = tokens.size(); i < this->functor_->getParamCount(); i++)
+                if (!this->bAddedDefaultValue_[i])
+                    return false;
+
+            // assign all given arguments to the multitypes
+            for (unsigned int i = 0; i < min(tokens.size(), (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+                param[i] = tokens[i];
+
+            // fill the remaining multitypes with default values
+            for (unsigned int i = tokens.size(); i < min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+                param[i] = this->defaultValue_[i];
+
+            // evaluate the param types through the functor
+            for (unsigned int i = 0; i < min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+                this->functor_->evaluateParam(i, param[i]);
+
+            return true;
+        }
+    }
+
+    Executor& Executor::setDescription(const std::string& description)
+    {
+        if (!this->bAddedDescription_)
+        {
+            this->description_ = std::string("ExecutorDescription::" + this->name_ + "::function");
+            AddLanguageEntry(this->description_, description);
+            this->bAddedDescription_ = true;
+        }
+        return (*this);
+    }
+
+    const std::string& Executor::getDescription() const
+    {
+        return GetLocalisation(this->description_);
+    }
+
+    Executor& Executor::setDescriptionParam(int param, const std::string& description)
+    {
+        if (param >= 0 && param < MAX_FUNCTOR_ARGUMENTS)
+        {
+            if (!this->bAddedDescriptionParam_[param])
+            {
+                std::string paramnumber;
+                if (!Convert::ToString(&paramnumber, param))
+                    return (*this);
+
+                this->descriptionParam_[param] = std::string("ExecutorDescription::" + this->name_ + "::param" + paramnumber);
+                AddLanguageEntry(this->descriptionParam_[param], description);
+                this->bAddedDescriptionParam_[param] = true;
+            }
+        }
+        return (*this);
+    }
+
+    const std::string& Executor::getDescriptionParam(int param) const
+    {
+        if (param >= 0 && param < MAX_FUNCTOR_ARGUMENTS)
+            return GetLocalisation(this->descriptionParam_[param]);
+
+        return this->descriptionParam_[0];
+    }
+
+    Executor& Executor::setDescriptionReturnvalue(const std::string& description)
+    {
+        if (!this->bAddedDescriptionReturnvalue_)
+        {
+            this->descriptionReturnvalue_ = std::string("ExecutorDescription::" + this->name_ + "::returnvalue");
+            AddLanguageEntry(this->descriptionReturnvalue_, description);
+            this->bAddedDescriptionReturnvalue_ = true;
+        }
+        return (*this);
+    }
+
+    const std::string& Executor::getDescriptionReturnvalue(int param) const
+    {
+        return GetLocalisation(this->descriptionReturnvalue_);
+    }
+
+    Executor& Executor::setDefaultValues(const MultiTypeMath& param1)
+    {
+        this->defaultValue_[0] = param1;
+        this->bAddedDefaultValue_[0] = true;
+
+        return (*this);
+    }
+
+    Executor& Executor::setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2)
+    {
+        this->defaultValue_[0] = param1;
+        this->bAddedDefaultValue_[0] = true;
+        this->defaultValue_[1] = param2;
+        this->bAddedDefaultValue_[1] = true;
+
+        return (*this);
+    }
+
+    Executor& Executor::setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3)
+    {
+        this->defaultValue_[0] = param1;
+        this->bAddedDefaultValue_[0] = true;
+        this->defaultValue_[1] = param2;
+        this->bAddedDefaultValue_[1] = true;
+        this->defaultValue_[2] = param3;
+        this->bAddedDefaultValue_[2] = true;
+
+        return (*this);
+    }
+
+    Executor& Executor::setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4)
+    {
+        this->defaultValue_[0] = param1;
+        this->bAddedDefaultValue_[0] = true;
+        this->defaultValue_[1] = param2;
+        this->bAddedDefaultValue_[1] = true;
+        this->defaultValue_[2] = param3;
+        this->bAddedDefaultValue_[2] = true;
+        this->defaultValue_[3] = param4;
+        this->bAddedDefaultValue_[3] = true;
+
+        return (*this);
+    }
+
+    Executor& Executor::setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4, const MultiTypeMath& param5)
+    {
+        this->defaultValue_[0] = param1;
+        this->bAddedDefaultValue_[0] = true;
+        this->defaultValue_[1] = param2;
+        this->bAddedDefaultValue_[1] = true;
+        this->defaultValue_[2] = param3;
+        this->bAddedDefaultValue_[2] = true;
+        this->defaultValue_[3] = param4;
+        this->bAddedDefaultValue_[3] = true;
+        this->defaultValue_[4] = param5;
+        this->bAddedDefaultValue_[4] = true;
+
+        return (*this);
+    }
+
+    Executor& Executor::setDefaultValue(unsigned int index, const MultiTypeMath& param)
+    {
+        if (index >= 0 && index < MAX_FUNCTOR_ARGUMENTS)
+        {
+            this->defaultValue_[index] = param;
+            this->bAddedDefaultValue_[index] = true;
+        }
+        return (*this);
+    }
+
+    bool Executor::allDefaultValuesSet() const
+    {
+        for (unsigned int i = 0; i < this->functor_->getParamCount(); i++)
+            if (!this->bAddedDefaultValue_[i])
+                return false;
+
+        return true;
+    }
+}
Index: code/trunk/src/core/Executor.h
===================================================================
--- code/trunk/src/core/Executor.h	(revision 1055)
+++ code/trunk/src/core/Executor.h	(revision 1055)
@@ -0,0 +1,320 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ *   Inspiration: Executor by Benjamin Grauer
+ */
+
+#ifndef _Executor_H__
+#define _Executor_H__
+
+#include "CorePrereqs.h"
+#include "Functor.h"
+#include "Debug.h"
+#include "util/SubString.h"
+#include "util/String.h"
+
+
+#define EXECUTOR_PARSE_FUNCTORCALL(mode) EXECUTOR_PARSE_FUNCTORCALL##mode
+#define EXECUTOR_PARSE_FUNCTORCALLnormal (*this->functor_)
+#define EXECUTOR_PARSE_FUNCTORCALLobject (*((FunctorMember<T>*)this->functor_))
+
+#define EXECUTOR_PARSE_OBJECT(mode, comma) EXECUTOR_PARSE_OBJECT##mode##comma
+#define EXECUTOR_PARSE_OBJECTnormal0
+#define EXECUTOR_PARSE_OBJECTnormal1
+#define EXECUTOR_PARSE_OBJECTobject0 object
+#define EXECUTOR_PARSE_OBJECTobject1 object,
+
+#define EXECUTOR_PARSE(mode) \
+    unsigned int paramCount = this->functor_->getParamCount(); \
+    \
+    if (paramCount == 0) \
+    { \
+        COUT(5) << "Calling Executor " << this->name_ << " through parser without parameters." << std::endl; \
+        EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 0)); \
+    } \
+    else if (paramCount == 1) \
+    { \
+        std::string temp = getStripped(params); \
+        if ((temp != "") && (temp.size() != 0)) \
+        { \
+            COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using whole string: " << params << std::endl; \
+            EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) MultiTypeMath(params)); \
+        } \
+        else if (this->bAddedDefaultValue_[0]) \
+        { \
+            COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using default value: " << this->defaultValue_[0] << std::endl; \
+            EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) this->defaultValue_[0]); \
+        } \
+        else \
+        { \
+            COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given (input: " << temp << ")." << std::endl; \
+            return false; \
+        } \
+    } \
+    else \
+    { \
+        SubString tokens(params, delimiter, SubString::WhiteSpaces, false, '\\', true, '"', true, '(', ')', true, '\0'); \
+        \
+        for (unsigned int i = tokens.size(); i < this->functor_->getParamCount(); i++) \
+        { \
+            if (!this->bAddedDefaultValue_[i]) \
+            { \
+                COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given (input:" << params << ")." << std::endl; \
+                return false; \
+            } \
+        } \
+        \
+        MultiTypeMath param[MAX_FUNCTOR_ARGUMENTS]; \
+        COUT(5) << "Calling Executor " << this->name_ << " through parser with " << paramCount << " parameters, using " << tokens.size() << " tokens ("; \
+        for (unsigned int i = 0; i < tokens.size() && i < MAX_FUNCTOR_ARGUMENTS; i++) \
+        { \
+            param[i] = tokens[i]; \
+            if (i != 0) \
+            { \
+                COUT(5) << ", "; \
+            } \
+            COUT(5) << tokens[i]; \
+        } \
+        COUT(5) << ") and " << (paramCount - tokens.size()) << " default values ("; \
+        for (unsigned int i = tokens.size(); i < paramCount; i++) \
+        { \
+            param[i] = this->defaultValue_[i]; \
+            if (i != 0) \
+            { \
+                COUT(5) << ", "; \
+            } \
+            COUT(5) << this->defaultValue_[i]; \
+        } \
+        COUT(5) << ")." << std::endl; \
+        \
+        if ((tokens.size() > paramCount) && (this->functor_->getTypenameParam(paramCount - 1) == "string")) \
+            param[paramCount - 1] = tokens.subSet(paramCount - 1).join(); \
+        \
+        switch(paramCount) \
+        { \
+            case 2: \
+                EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) param[0], param[1]); \
+                break; \
+            case 3: \
+                EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) param[0], param[1], param[2]); \
+                break; \
+            case 4: \
+                EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) param[0], param[1], param[2], param[3]); \
+                break; \
+            case 5: \
+                EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) param[0], param[1], param[2], param[3], param[4]); \
+                break; \
+        } \
+    } \
+    \
+    return true
+
+namespace AccessLevel
+{
+    enum Level
+    {
+        None,
+        User,
+        Admin,
+        Offline,
+        Debug,
+        Disabled
+    };
+}
+
+namespace orxonox
+{
+    class _CoreExport Executor
+    {
+        public:
+            Executor(Functor* functor, const std::string& name = "", AccessLevel::Level level = AccessLevel::None);
+            virtual ~Executor();
+
+            inline void operator()() const
+                { (*this->functor_)(this->defaultValue_[0], this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const MultiTypeMath& param1) const
+                { (*this->functor_)(param1, this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const MultiTypeMath& param1, const MultiTypeMath& param2) const
+                { (*this->functor_)(param1, param2, this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3) const
+                { (*this->functor_)(param1, param2, param3, this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4) const
+                { (*this->functor_)(param1, param2, param3, param4, this->defaultValue_[4]); }
+            inline void operator()(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4, const MultiTypeMath& param5) const
+                { (*this->functor_)(param1, param2, param3, param4, param5); }
+
+            bool parse(const std::string& params, const std::string& delimiter = " ") const;
+
+            bool evaluate(const std::string& params, MultiTypeMath param[5], const std::string& delimiter = " ") const;
+
+            Executor& setDescription(const std::string& description);
+            const std::string& getDescription() const;
+
+            Executor& setDescriptionParam(int param, const std::string& description);
+            const std::string& getDescriptionParam(int param) const;
+
+            Executor& setDescriptionReturnvalue(const std::string& description);
+            const std::string& getDescriptionReturnvalue(int param) const;
+
+            inline unsigned int getParamCount() const
+                { return this->functor_->getParamCount(); }
+            inline bool hasReturnvalue() const
+                { return this->functor_->hasReturnvalue(); }
+            inline FunctionType getType() const
+                { return this->functor_->getType(); }
+            inline MultiTypeMath getReturnvalue() const
+                { return this->functor_->getReturnvalue(); }
+            inline std::string getTypenameParam(unsigned int param) const
+                { return this->functor_->getTypenameParam(param); }
+            inline std::string getTypenameReturnvalue() const
+                { return this->functor_->getTypenameReturnvalue(); }
+
+            inline void setName(const std::string name)
+                { this->name_ = name; }
+            inline const std::string& getName() const
+                { return this->name_; }
+
+            inline void setAccessLevel(AccessLevel::Level level)
+                { this->accessLevel_ = level; }
+            inline AccessLevel::Level getAccessLevel() const
+                { return this->accessLevel_; }
+
+            Executor& setDefaultValues(const MultiTypeMath& param1);
+            Executor& setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2);
+            Executor& setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3);
+            Executor& setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4);
+            Executor& setDefaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4, const MultiTypeMath& param5);
+            Executor& setDefaultValue(unsigned int index, const MultiTypeMath& param);
+
+            inline MultiTypeMath getDefaultValue(unsigned int index) const
+            {
+                if (index >= 0 && index < MAX_FUNCTOR_ARGUMENTS)
+                    return this->defaultValue_[index];
+
+                return MT_null;
+            }
+
+            bool allDefaultValuesSet() const;
+            inline bool defaultValueSet(unsigned int index) const
+            {
+                if (index >= 0 && index < MAX_FUNCTOR_ARGUMENTS)
+                    return this->bAddedDefaultValue_[index];
+
+                return false;
+            }
+
+        protected:
+            Functor* functor_;
+            std::string name_;
+            MultiTypeMath defaultValue_[MAX_FUNCTOR_ARGUMENTS];
+            bool bAddedDefaultValue_[MAX_FUNCTOR_ARGUMENTS];
+
+        private:
+            LanguageEntryLabel description_;
+            LanguageEntryLabel descriptionReturnvalue_;
+            LanguageEntryLabel descriptionParam_[MAX_FUNCTOR_ARGUMENTS];
+
+            bool bAddedDescription_;
+            bool bAddedDescriptionReturnvalue_;
+            bool bAddedDescriptionParam_[MAX_FUNCTOR_ARGUMENTS];
+
+            AccessLevel::Level accessLevel_;
+    };
+
+    class _CoreExport ExecutorStatic : public Executor
+    {
+        public:
+            ExecutorStatic(FunctorStatic* functor, const std::string& name = "", AccessLevel::Level level = AccessLevel::None) : Executor(functor, name, level) {}
+            virtual ~ExecutorStatic() {}
+    };
+
+    template <class T>
+    class ExecutorMember : public Executor
+    {
+        public:
+            ExecutorMember(FunctorMember<T>* functor, const std::string& name = "", AccessLevel::Level level = AccessLevel::None) : Executor(functor, name, level) {}
+            virtual ~ExecutorMember() {}
+
+            inline void operator()(T* object) const
+                { (*((FunctorMember<T>*)this->functor_))(object, this->defaultValue_[0], this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(T* object, const MultiTypeMath& param1) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(T* object, const MultiTypeMath& param1, const MultiTypeMath& param2) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(T* object, const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(T* object, const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, param4, this->defaultValue_[4]); }
+            inline void operator()(T* object, const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4, const MultiTypeMath& param5) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, param4, param5); }
+
+
+            inline void operator()(const T* object) const
+                { (*((FunctorMember<T>*)this->functor_))(object, this->defaultValue_[0], this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const T* object, const MultiTypeMath& param1) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const T* object, const MultiTypeMath& param1, const MultiTypeMath& param2) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const T* object, const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const T* object, const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, param4, this->defaultValue_[4]); }
+            inline void operator()(const T* object, const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4, const MultiTypeMath& param5) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, param4, param5); }
+
+            inline void setObject(T* object) const
+                { ((FunctorMember<T>*)this->functor_)->setObject(object); }
+            inline void setObject(const T* object) const
+                { ((FunctorMember<T>*)this->functor_)->setObject(object); }
+
+            bool parse(T* object, const std::string& params, const std::string& delimiter = " ") const
+            {
+                EXECUTOR_PARSE(object);
+            }
+
+            bool parse(const T* object, const std::string& params, const std::string& delimiter = " ") const
+            {
+                EXECUTOR_PARSE(object);
+            }
+    };
+
+    inline Executor* createExecutor(Functor* functor, const std::string& name = "", AccessLevel::Level level = AccessLevel::None)
+    {
+        return new Executor(functor, name, level);
+    }
+
+    template <class T>
+    inline ExecutorMember<T>* createExecutor(FunctorMember<T>* functor, const std::string& name = "", AccessLevel::Level level = AccessLevel::None)
+    {
+        return new ExecutorMember<T>(functor, name, level);
+    }
+
+    inline ExecutorStatic* createExecutor(FunctorStatic* functor, const std::string& name = "", AccessLevel::Level level = AccessLevel::None)
+    {
+        return new ExecutorStatic(functor, name, level);
+    }
+}
+
+#endif /* _Executor_H__ */
Index: code/trunk/src/core/Factory.cc
===================================================================
--- code/trunk/src/core/Factory.cc	(revision 1055)
+++ code/trunk/src/core/Factory.cc	(revision 1055)
@@ -0,0 +1,129 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Factory.cc
+    @brief Implementation of the Factory class.
+*/
+
+#include "Identifier.h"
+#include "Debug.h"
+#include "BaseObject.h"
+#include "Factory.h"
+
+namespace orxonox
+{
+    /**
+        @brief Returns the Identifier with a given name.
+        @param name The name of the wanted Identifier
+        @return The Identifier
+    */
+    Identifier* Factory::getIdentifier(const std::string& name)
+    {
+        return getFactoryPointer()->identifierStringMap_[name];
+    }
+
+    /**
+        @brief Returns the Identifier with a given network ID.
+        @param id The network ID of the wanted Identifier
+        @return The Identifier
+    */
+    Identifier* Factory::getIdentifier(const unsigned int id)
+    {
+        return getFactoryPointer()->identifierNetworkIDMap_[id];
+    }
+
+    /**
+        @brief Adds a new Identifier to both maps.
+        @param name The name of the identifier
+        @param identifier The identifier to add
+    */
+    void Factory::add(const std::string& name, Identifier* identifier)
+    {
+        getFactoryPointer()->identifierStringMap_[name] = identifier;
+        getFactoryPointer()->identifierNetworkIDMap_[identifier->getNetworkID()] = identifier;
+    }
+
+    /**
+        @brief Removes the entry with the old network ID and adds a new one.
+        @param identifier The identifier to change
+        @param oldID The old networkID
+        @param newID The new networkID
+    */
+    void Factory::changeNetworkID(Identifier* identifier, const unsigned int oldID, const unsigned int newID)
+    {
+        getFactoryPointer()->identifierNetworkIDMap_.erase(oldID);
+        getFactoryPointer()->identifierNetworkIDMap_[newID] = identifier;
+    }
+
+    /**
+        @brief Creates the class-hierarchy by creating and destroying one object of each type.
+    */
+    void Factory::createClassHierarchy()
+    {
+        COUT(3) << "*** Factory: Create class-hierarchy" << std::endl;
+        std::map<std::string, Identifier*>::iterator it;
+        it = getFactoryPointer()->identifierStringMap_.begin();
+        (*getFactoryPointer()->identifierStringMap_.begin()).second->startCreatingHierarchy();
+        for (it = getFactoryPointer()->identifierStringMap_.begin(); it != getFactoryPointer()->identifierStringMap_.end(); ++it)
+        {
+            // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
+            BaseObject* temp = (*it).second->fabricate();
+            delete temp;
+        }
+        (*getFactoryPointer()->identifierStringMap_.begin()).second->stopCreatingHierarchy();
+        COUT(3) << "*** Factory: Finished class-hierarchy creation" << std::endl;
+    }
+
+    /**
+        @brief Ensures the Factory gets created in the right moment.
+        @return The Factory.
+    */
+    Factory* Factory::getFactoryPointer()
+    {
+      static Factory theOneAndOnlyFactoryInstance = Factory();
+      return &theOneAndOnlyFactoryInstance;
+    }
+
+    /**
+        @brief Returns the begin-iterator of the factory-map.
+        @return The begin-iterator
+    */
+    std::map<std::string, Identifier*>::const_iterator Factory::getFactoryBegin()
+    {
+        return Factory::getFactoryPointer()->identifierStringMap_.begin();
+    }
+
+    /**
+        @brief Returns the end-iterator of the factory-map.
+        @return The end-iterator
+    */
+    std::map<std::string, Identifier*>::const_iterator Factory::getFactoryEnd()
+    {
+        return Factory::getFactoryPointer()->identifierStringMap_.end();
+    }
+}
Index: code/trunk/src/core/Factory.h
===================================================================
--- code/trunk/src/core/Factory.h	(revision 1055)
+++ code/trunk/src/core/Factory.h	(revision 1055)
@@ -0,0 +1,91 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Factory.h
+    @brief Definition of the Factory and the BaseFactory class.
+
+    The Factory is a singleton, containing two maps to map either the name or the network ID
+    of a class with the corresponding Identifier.
+
+    Usage:
+    ID(classname) or ID(networkID) returns the corresponding Identifier.
+
+
+    BaseObject is the parent of ClassFactory which is defined in ClassFactory.h.
+    It can't be defined in ClassFactory.h, because of circular dependencies.
+*/
+
+#ifndef _Factory_H__
+#define _Factory_H__
+
+#include <map>
+#include <string>
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###         Factory         ###
+    // ###############################
+    //! The Factory is used to map the name or the network ID of a class with its Identifier.
+    class _CoreExport Factory
+    {
+        public:
+            static Identifier* getIdentifier(const std::string& name);
+            static Identifier* getIdentifier(const unsigned int id);
+            static void add(const std::string& name, Identifier* identifier);
+            static void changeNetworkID(Identifier* identifier, const unsigned int oldID, const unsigned int newID);
+            static void createClassHierarchy();
+
+            static Factory* getFactoryPointer();    // avoid overriding order problem in the static intialisation process
+            static std::map<std::string, Identifier*>::const_iterator getFactoryBegin();
+            static std::map<std::string, Identifier*>::const_iterator getFactoryEnd();
+
+        private:
+            Factory() {}                            // don't create
+            Factory(const Factory& factory) {}      // don't copy
+            ~Factory() {}                           // don't delete
+
+            std::map<std::string, Identifier*> identifierStringMap_;            //!< The map, mapping the name with the Identifier
+            std::map<unsigned int, Identifier*> identifierNetworkIDMap_;        //!< The map, mapping the network ID with the Identifier
+    };
+
+    // ###############################
+    // ###       BaseFactory       ###
+    // ###############################
+    //! Base-class of ClassFactory. Has to be defined separate because of circular dependencies.
+    class _CoreExport BaseFactory
+    {
+        public:
+            virtual BaseObject* fabricate() = 0;
+            virtual ~BaseFactory() {};
+    };
+}
+
+#endif /* _Factory_H__ */
Index: code/trunk/src/core/Functor.h
===================================================================
--- code/trunk/src/core/Functor.h	(revision 1055)
+++ code/trunk/src/core/Functor.h	(revision 1055)
@@ -0,0 +1,466 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ *   Inspiration: Functor by Benjamin Grauer
+ */
+
+#ifndef _Functor_H__
+#define _Functor_H__
+
+#include "util/MultiTypeMath.h"
+#include "Debug.h"
+
+#include "CorePrereqs.h"
+
+#define MAX_FUNCTOR_ARGUMENTS 5
+
+namespace orxonox
+{
+    enum FunctionType
+    {
+        FT_MEMBER,
+        FT_CONSTMEMBER,
+        FT_STATIC
+    };
+
+
+    template <class T>
+    inline std::string typeToString() { return "unknown"; }
+
+#define CreateTypeToStringTemplate(type) \
+    template <> \
+    inline std::string typeToString<type>() { return #type; } \
+    template <> \
+    inline std::string typeToString<type&>() { return #type; } \
+    template <> \
+    inline std::string typeToString<const type>() { return #type; } \
+    template <> \
+    inline std::string typeToString<const type&>() { return #type; }
+
+    CreateTypeToStringTemplate(int);
+    CreateTypeToStringTemplate(unsigned int);
+    CreateTypeToStringTemplate(char);
+    CreateTypeToStringTemplate(unsigned char);
+    CreateTypeToStringTemplate(short);
+    CreateTypeToStringTemplate(unsigned short);
+    CreateTypeToStringTemplate(long);
+    CreateTypeToStringTemplate(unsigned long);
+    CreateTypeToStringTemplate(float);
+    CreateTypeToStringTemplate(double);
+    CreateTypeToStringTemplate(long double);
+    CreateTypeToStringTemplate(bool);
+    CreateTypeToStringTemplate(Vector2);
+    CreateTypeToStringTemplate(Vector3);
+    CreateTypeToStringTemplate(Quaternion);
+    CreateTypeToStringTemplate(ColourValue);
+    CreateTypeToStringTemplate(Radian);
+    CreateTypeToStringTemplate(Degree);
+
+    template <> \
+    inline std::string typeToString<std::string>() { return "string"; } \
+    template <> \
+    inline std::string typeToString<std::string&>() { return "string"; } \
+    template <> \
+    inline std::string typeToString<const std::string>() { return "string"; } \
+    template <> \
+    inline std::string typeToString<const std::string&>() { return "string"; }
+
+    class _CoreExport Functor
+    {
+        public:
+            Functor() {}
+            virtual ~Functor() {}
+
+            virtual void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
+
+            inline unsigned int getParamCount() const { return this->numParams_; }
+            inline bool hasReturnvalue() const { return this->hasReturnValue_; }
+            inline FunctionType getType() const { return this->type_; }
+            inline MultiTypeMath getReturnvalue() const { return this->returnedValue_; }
+
+            std::string getTypenameParam(unsigned int param) const { return (param >= 0 && param < 5) ? this->typeParam_[param] : ""; }
+            std::string getTypenameReturnvalue() const { return this->typeReturnvalue_; }
+
+            virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const = 0;
+
+        protected:
+            unsigned int numParams_;
+            bool hasReturnValue_;
+            FunctionType type_;
+            MultiTypeMath returnedValue_;
+
+            std::string typeReturnvalue_;
+            std::string typeParam_[MAX_FUNCTOR_ARGUMENTS];
+    };
+
+    class _CoreExport FunctorStatic : public Functor
+    {
+        public:
+            virtual ~FunctorStatic() {}
+            virtual void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
+    };
+
+    template <class T>
+    class FunctorMember : public Functor
+    {
+        public:
+            FunctorMember()
+            {
+                constObject_ = 0;
+                object_ = 0;
+                bConstObject_ = false;
+            }
+            virtual ~FunctorMember() {}
+
+            virtual void operator()(T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
+            virtual void operator()(const T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
+
+            virtual void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null)
+            {
+                if (this->bConstObject_)
+                {
+                    if (this->constObject_)
+                        (*this)(this->constObject_, param1, param2, param3, param4, param5);
+                    else
+                    {
+                        COUT(1) << "An error occurred in Functor.h:" << std::endl;
+                        COUT(1) << "Error: No const object set." << std::endl;
+                    }
+                }
+                else
+                {
+                    if (this->object_)
+                        (*this)(this->object_, param1, param2, param3, param4, param5);
+                    else
+                    {
+                        COUT(1) << "An error occurred in Functor.h:" << std::endl;
+                        COUT(1) << "Error: No object set." << std::endl;
+                    }
+                }
+            }
+
+            void setObject(T* object)
+            {
+                this->bConstObject_ = false;
+                this->object_ = object;
+            }
+
+            void setObject(const T* object)
+            {
+                this->bConstObject_ = true;
+                this->constObject_ = object;
+            }
+
+        private:
+            const T* constObject_;
+            T* object_;
+            bool bConstObject_;
+    };
+
+
+
+#define FUNCTOR_TEMPLATE(ismember, returnvalue, numparams) FUNCTOR_TEMPLATE##ismember##returnvalue##numparams
+#define FUNCTOR_TEMPLATE000
+#define FUNCTOR_TEMPLATE001 template <class P1>
+#define FUNCTOR_TEMPLATE002 template <class P1, class P2>
+#define FUNCTOR_TEMPLATE003 template <class P1, class P2, class P3>
+#define FUNCTOR_TEMPLATE004 template <class P1, class P2, class P3, class P4>
+#define FUNCTOR_TEMPLATE005 template <class P1, class P2, class P3, class P4, class P5>
+#define FUNCTOR_TEMPLATE010 template <class R>
+#define FUNCTOR_TEMPLATE011 template <class R, class P1>
+#define FUNCTOR_TEMPLATE012 template <class R, class P1, class P2>
+#define FUNCTOR_TEMPLATE013 template <class R, class P1, class P2, class P3>
+#define FUNCTOR_TEMPLATE014 template <class R, class P1, class P2, class P3, class P4>
+#define FUNCTOR_TEMPLATE015 template <class R, class P1, class P2, class P3, class P4, class P5>
+#define FUNCTOR_TEMPLATE100 template <class T>
+#define FUNCTOR_TEMPLATE101 template <class T, class P1>
+#define FUNCTOR_TEMPLATE102 template <class T, class P1, class P2>
+#define FUNCTOR_TEMPLATE103 template <class T, class P1, class P2, class P3>
+#define FUNCTOR_TEMPLATE104 template <class T, class P1, class P2, class P3, class P4>
+#define FUNCTOR_TEMPLATE105 template <class T, class P1, class P2, class P3, class P4, class P5>
+#define FUNCTOR_TEMPLATE110 template <class T, class R>
+#define FUNCTOR_TEMPLATE111 template <class T, class R, class P1>
+#define FUNCTOR_TEMPLATE112 template <class T, class R, class P1, class P2>
+#define FUNCTOR_TEMPLATE113 template <class T, class R, class P1, class P2, class P3>
+#define FUNCTOR_TEMPLATE114 template <class T, class R, class P1, class P2, class P3, class P4>
+#define FUNCTOR_TEMPLATE115 template <class T, class R, class P1, class P2, class P3, class P4, class P5>
+
+
+
+#define FUNCTOR_TEMPLATE_CLASSES(ismember, returnvalue, numparams) FUNCTOR_TEMPLATE_CLASSES##ismember##returnvalue##numparams
+#define FUNCTOR_TEMPLATE_CLASSES000
+#define FUNCTOR_TEMPLATE_CLASSES001 <P1>
+#define FUNCTOR_TEMPLATE_CLASSES002 <P1, P2>
+#define FUNCTOR_TEMPLATE_CLASSES003 <P1, P2, P3>
+#define FUNCTOR_TEMPLATE_CLASSES004 <P1, P2, P3, P4>
+#define FUNCTOR_TEMPLATE_CLASSES005 <P1, P2, P3, P4, P5>
+#define FUNCTOR_TEMPLATE_CLASSES010 <R>
+#define FUNCTOR_TEMPLATE_CLASSES011 <R, P1>
+#define FUNCTOR_TEMPLATE_CLASSES012 <R, P1, P2>
+#define FUNCTOR_TEMPLATE_CLASSES013 <R, P1, P2, P3>
+#define FUNCTOR_TEMPLATE_CLASSES014 <R, P1, P2, P3, P4>
+#define FUNCTOR_TEMPLATE_CLASSES015 <R, P1, P2, P3, P4, P5>
+#define FUNCTOR_TEMPLATE_CLASSES100 <T>
+#define FUNCTOR_TEMPLATE_CLASSES101 <T, P1>
+#define FUNCTOR_TEMPLATE_CLASSES102 <T, P1, P2>
+#define FUNCTOR_TEMPLATE_CLASSES103 <T, P1, P2, P3>
+#define FUNCTOR_TEMPLATE_CLASSES104 <T, P1, P2, P3, P4>
+#define FUNCTOR_TEMPLATE_CLASSES105 <T, P1, P2, P3, P4, P5>
+#define FUNCTOR_TEMPLATE_CLASSES110 <T, R>
+#define FUNCTOR_TEMPLATE_CLASSES111 <T, R, P1>
+#define FUNCTOR_TEMPLATE_CLASSES112 <T, R, P1, P2>
+#define FUNCTOR_TEMPLATE_CLASSES113 <T, R, P1, P2, P3>
+#define FUNCTOR_TEMPLATE_CLASSES114 <T, R, P1, P2, P3, P4>
+#define FUNCTOR_TEMPLATE_CLASSES115 <T, R, P1, P2, P3, P4, P5>
+
+
+
+#define FUNCTOR_TYPENAME_PARAMS(numparams) FUNCTOR_TYPENAME_PARAMS##numparams
+#define FUNCTOR_TYPENAME_PARAMS0
+#define FUNCTOR_TYPENAME_PARAMS1 this->typeParam_[0] = typeToString<P1>();
+#define FUNCTOR_TYPENAME_PARAMS2 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>();
+#define FUNCTOR_TYPENAME_PARAMS3 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>();
+#define FUNCTOR_TYPENAME_PARAMS4 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>(); this->typeParam_[3] = typeToString<P4>();
+#define FUNCTOR_TYPENAME_PARAMS5 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>(); this->typeParam_[3] = typeToString<P4>(); this->typeParam_[4] = typeToString<P5>();
+
+#define FUNCTOR_TYPENAME_RETURN(returnvalue) FUNCTOR_TYPENAME_RETURN##returnvalue
+#define FUNCTOR_TYPENAME_RETURN0
+#define FUNCTOR_TYPENAME_RETURN1 this->typeReturnvalue_ = typeToString<R>();
+
+
+
+#define FUNCTOR_FUNCTION_PARAMS(numparams) FUNCTOR_FUNCTION_PARAMS##numparams
+#define FUNCTOR_FUNCTION_PARAMS0
+#define FUNCTOR_FUNCTION_PARAMS1 P1 param1
+#define FUNCTOR_FUNCTION_PARAMS2 P1 param1, P2 param2
+#define FUNCTOR_FUNCTION_PARAMS3 P1 param1, P2 param2, P3 param3
+#define FUNCTOR_FUNCTION_PARAMS4 P1 param1, P2 param2, P3 param3, P4 param4
+#define FUNCTOR_FUNCTION_PARAMS5 P1 param1, P2 param2, P3 param3, P4 param4, P5 param5
+
+#define FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) FUNCTOR_FUNCTION_RETURNVALUE##returnvalue
+#define FUNCTOR_FUNCTION_RETURNVALUE0 void
+#define FUNCTOR_FUNCTION_RETURNVALUE1 R
+
+
+
+#define FUNCTOR_FUNCTION_CALL(numparams) FUNCTOR_FUNCTION_CALL##numparams
+#define FUNCTOR_FUNCTION_CALL0
+#define FUNCTOR_FUNCTION_CALL1 param1
+#define FUNCTOR_FUNCTION_CALL2 param1, param2
+#define FUNCTOR_FUNCTION_CALL3 param1, param2, param3
+#define FUNCTOR_FUNCTION_CALL4 param1, param2, param3, param4
+#define FUNCTOR_FUNCTION_CALL5 param1, param2, param3, param4, param5
+
+#define FUNCTOR_STORE_RETURNVALUE(returnvalue, functioncall) FUNCTOR_STORE_RETURNVALUE##returnvalue(functioncall)
+#define FUNCTOR_STORE_RETURNVALUE0(functioncall) functioncall
+#define FUNCTOR_STORE_RETURNVALUE1(functioncall) this->returnedValue_ = functioncall
+
+
+
+#define FUNCTOR_EVALUATE_PARAM(numparams) FUNCTOR_EVALUATE_PARAM##numparams
+#define FUNCTOR_EVALUATE_PARAM0
+#define FUNCTOR_EVALUATE_PARAM1 \
+    if (index == 0) param = (P1)param
+#define FUNCTOR_EVALUATE_PARAM2 \
+    if (index == 0) param = (P1)param; \
+    else if (index == 1) param = (P2)param
+#define FUNCTOR_EVALUATE_PARAM3 \
+    if (index == 0) param = (P1)param; \
+    else if (index == 1) param = (P2)param; \
+    else if (index == 2) param = (P3)param
+#define FUNCTOR_EVALUATE_PARAM4 \
+    if (index == 0) param = (P1)param; \
+    else if (index == 1) param = (P2)param; \
+    else if (index == 2) param = (P3)param; \
+    else if (index == 3) param = (P4)param
+#define FUNCTOR_EVALUATE_PARAM5 \
+    if (index == 0) param = (P1)param; \
+    else if (index == 1) param = (P2)param; \
+    else if (index == 2) param = (P3)param; \
+    else if (index == 3) param = (P4)param; \
+    else if (index == 4) param = (P5)param
+
+
+
+
+
+#define CREATE_STATIC_FUNCTOR(returnvalue, numparams) \
+    FUNCTOR_TEMPLATE(0, returnvalue, numparams) \
+    class FunctorStatic##returnvalue##numparams : public FunctorStatic \
+    { \
+        public: \
+            FunctorStatic##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
+            { \
+                this->numParams_ = numparams; \
+                this->hasReturnValue_ = returnvalue; \
+                this->type_ = FT_STATIC; \
+                this->functionPointer_ = functionPointer; \
+                \
+                FUNCTOR_TYPENAME_PARAMS(numparams); \
+                FUNCTOR_TYPENAME_RETURN(returnvalue); \
+            } \
+    \
+            void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
+            { \
+                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
+            } \
+    \
+            virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const \
+            { \
+                FUNCTOR_EVALUATE_PARAM(numparams); \
+            } \
+    \
+        private: \
+            FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)); \
+    }; \
+    \
+    \
+    FUNCTOR_TEMPLATE(0, returnvalue, numparams) \
+    inline FunctorStatic##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(0, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
+    { \
+        return new FunctorStatic##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(0, returnvalue, numparams) (functionPointer); \
+    }
+
+
+
+
+
+#define CREATE_MEMBER_FUNCTOR(returnvalue, numparams) \
+    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
+    class FunctorMember##returnvalue##numparams : public FunctorMember<T> \
+    { \
+        public: \
+            FunctorMember##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
+            { \
+                this->numParams_ = numparams; \
+                this->hasReturnValue_ = returnvalue; \
+                this->type_ = FT_MEMBER; \
+                this->functionPointer_ = functionPointer; \
+            } \
+    \
+            void operator()(T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
+            { \
+                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
+            } \
+    \
+            void operator()(const T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
+            { \
+                COUT(1) << "An error occurred in Functor.h:" << std::endl; \
+                COUT(1) << "Error: Function is not const." << std::endl; \
+            } \
+    \
+            virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const \
+            { \
+                FUNCTOR_EVALUATE_PARAM(numparams); \
+            } \
+    \
+        private: \
+            FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)); \
+    }; \
+    \
+    \
+    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
+    class FunctorConstMember##returnvalue##numparams : public FunctorMember<T> \
+    { \
+        public: \
+            FunctorConstMember##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const) \
+            { \
+                this->numParams_ = numparams; \
+                this->hasReturnValue_ = returnvalue; \
+                this->type_ = FT_CONSTMEMBER; \
+                this->functionPointer_ = functionPointer; \
+            } \
+    \
+            void operator()(T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
+            { \
+                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
+            } \
+    \
+            void operator()(const T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
+            { \
+                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
+            } \
+    \
+            virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const \
+            { \
+                FUNCTOR_EVALUATE_PARAM(numparams); \
+            } \
+    \
+        private: \
+            FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)) const; \
+    }; \
+    \
+    \
+    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
+    inline FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
+    { \
+        return new FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
+    } \
+    \
+    \
+    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
+    inline FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const) \
+    { \
+        return new FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
+    }
+
+
+
+
+#define CREATE_ALL_STATIC_FUNCTORS() \
+    CREATE_STATIC_FUNCTOR(0, 0); \
+    CREATE_STATIC_FUNCTOR(0, 1); \
+    CREATE_STATIC_FUNCTOR(0, 2); \
+    CREATE_STATIC_FUNCTOR(0, 3); \
+    CREATE_STATIC_FUNCTOR(0, 4); \
+    CREATE_STATIC_FUNCTOR(0, 5); \
+    CREATE_STATIC_FUNCTOR(1, 0); \
+    CREATE_STATIC_FUNCTOR(1, 1); \
+    CREATE_STATIC_FUNCTOR(1, 2); \
+    CREATE_STATIC_FUNCTOR(1, 3); \
+    CREATE_STATIC_FUNCTOR(1, 4); \
+    CREATE_STATIC_FUNCTOR(1, 5)
+
+
+#define CREATE_ALL_MEMBER_FUNCTORS() \
+    CREATE_MEMBER_FUNCTOR(0, 0); \
+    CREATE_MEMBER_FUNCTOR(0, 1); \
+    CREATE_MEMBER_FUNCTOR(0, 2); \
+    CREATE_MEMBER_FUNCTOR(0, 3); \
+    CREATE_MEMBER_FUNCTOR(0, 4); \
+    CREATE_MEMBER_FUNCTOR(0, 5); \
+    CREATE_MEMBER_FUNCTOR(1, 0); \
+    CREATE_MEMBER_FUNCTOR(1, 1); \
+    CREATE_MEMBER_FUNCTOR(1, 2); \
+    CREATE_MEMBER_FUNCTOR(1, 3); \
+    CREATE_MEMBER_FUNCTOR(1, 4); \
+    CREATE_MEMBER_FUNCTOR(1, 5)
+
+
+    CREATE_ALL_STATIC_FUNCTORS();
+    CREATE_ALL_MEMBER_FUNCTORS();
+}
+
+#endif /* _Functor_H__ */
Index: code/trunk/src/core/Identifier.cc
===================================================================
--- code/trunk/src/core/Identifier.cc	(revision 1055)
+++ code/trunk/src/core/Identifier.cc	(revision 1055)
@@ -0,0 +1,323 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Identifier.cc
+    @brief Implementation of the Identifier class.
+*/
+
+#include <ostream>
+
+#include "Identifier.h"
+#include "Factory.h"
+#include "Executor.h"
+#include "CommandExecutor.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###       Identifier        ###
+    // ###############################
+    int Identifier::hierarchyCreatingCounter_s = 0; // Set the static member variable hierarchyCreatingCounter_s to zero (this static member variable is ok: it's used in main(), not before)
+
+    /**
+        @brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
+    */
+    Identifier::Identifier()
+    {
+        this->bCreatedOneObject_ = false;
+        this->factory_ = 0;
+
+        this->bHasConfigValues_ = false;
+        this->bHasConsoleCommands_ = false;
+
+        this->children_ = new std::set<const Identifier*>();
+        this->directChildren_ = new std::set<const Identifier*>();
+
+        // Use a static variable because the classID gets created before main() and that's why we should avoid static member variables
+        static unsigned int classIDcounter_s = 0;
+        this->classID_ = classIDcounter_s++;
+    }
+
+    /**
+        @brief Destructor: Deletes the list containing the children.
+    */
+    Identifier::~Identifier()
+    {
+        delete this->children_;
+        delete this->directChildren_;
+    }
+
+    /**
+        @brief Initializes the Identifier with a list containing all parents of the class the Identifier belongs to.
+        @param parents A list containing all parents
+    */
+    void Identifier::initialize(std::set<const Identifier*>* parents)
+    {
+        COUT(4) << "*** Identifier: Initialize " << this->name_ << "-Singleton." << std::endl;
+        this->bCreatedOneObject_ = true;
+
+        if (parents)
+        {
+            this->parents_ = (*parents);
+            this->directParents_ = (*parents);
+
+            // Iterate through all parents
+            for (std::set<const Identifier*>::iterator it = parents->begin(); it != parents->end(); ++it)
+            {
+                // Tell the parent we're one of it's children
+                (*it)->getChildrenIntern().insert((*it)->getChildrenIntern().end(), this);
+
+                // Erase all parents of our parent from our direct-parent-list
+                for (std::set<const Identifier*>::const_iterator it1 = (*it)->getParents().begin(); it1 != (*it)->getParents().end(); ++it1)
+                {
+                    // Search for the parent's parent in our direct-parent-list
+                    for (std::set<const Identifier*>::iterator it2 = this->directParents_.begin(); it2 != this->directParents_.end(); ++it2)
+                    {
+                        if ((*it1) == (*it2))
+                        {
+                            // We've found a non-direct parent in our list: Erase it
+                            this->directParents_.erase(it2);
+                            break;
+                        }
+                    }
+                }
+            }
+
+            // Now iterate through all direct parents
+            for (std::set<const Identifier*>::iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
+            {
+                // Tell the parent we're one of it's direct children
+                (*it)->getDirectChildrenIntern().insert((*it)->getDirectChildrenIntern().end(), this);
+            }
+        }
+    }
+
+    /**
+        @brief Creates an object of the type the Identifier belongs to.
+        @return The new object
+    */
+    BaseObject* Identifier::fabricate()
+    {
+        if (this->factory_)
+        {
+            return this->factory_->fabricate(); // We have to return a BaseObject, because we don't know the exact type.
+        }
+        else
+        {
+            COUT(1) << "An error occurred in Identifier.cc:" << std::endl;
+            COUT(1) << "Error: Cannot fabricate an object of type '" << this->name_ << "'. Class has no factory." << std::endl;
+            COUT(1) << "Aborting..." << std::endl;
+            abort();
+            return NULL;
+        }
+    }
+
+    /**
+        @brief Sets the network ID to a new value and changes the entry in the Factory.
+        @param id The new network ID
+    */
+    void Identifier::setNetworkID(unsigned int id)
+    {
+        Factory::changeNetworkID(this, this->classID_, id);
+        this->classID_ = id;
+    }
+
+    /**
+        @brief Returns true, if the Identifier is at least of the given type.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isA(const Identifier* identifier) const
+    {
+        return (identifier == this || (this->parents_.find(identifier) != this->children_->end()));
+    }
+
+    /**
+        @brief Returns true, if the Identifier is exactly of the given type.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isExactlyA(const Identifier* identifier) const
+    {
+        return (identifier == this);
+    }
+
+    /**
+        @brief Returns true, if the assigned identifier is a child of the given identifier.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isChildOf(const Identifier* identifier) const
+    {
+        return (this->parents_.find(identifier) != this->children_->end());
+    }
+
+    /**
+        @brief Returns true, if the assigned identifier is a direct child of the given identifier.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isDirectChildOf(const Identifier* identifier) const
+    {
+        return (this->directParents_.find(identifier) != this->children_->end());
+    }
+
+    /**
+        @brief Returns true, if the assigned identifier is a parent of the given identifier.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isParentOf(const Identifier* identifier) const
+    {
+        return (this->children_->find(identifier) != this->children_->end());
+    }
+
+    /**
+        @brief Returns true, if the assigned identifier is a direct parent of the given identifier.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isDirectParentOf(const Identifier* identifier) const
+    {
+        return (this->directChildren_->find(identifier) != this->children_->end());
+    }
+
+    /**
+        @brief Returns the map that stores all Identifiers.
+        @return The map
+    */
+    std::map<std::string, Identifier*>& Identifier::getIdentifierMapIntern()
+    {
+        static std::map<std::string, Identifier*> identifierMap;
+        return identifierMap;
+    }
+
+    /**
+        @brief Returns the map that stores all Identifiers.
+        @return The map
+    */
+    std::map<std::string, Identifier*>& Identifier::getLowercaseIdentifierMapIntern()
+    {
+        static std::map<std::string, Identifier*> lowercaseIdentifierMap;
+        return lowercaseIdentifierMap;
+    }
+
+    /**
+        @brief Adds the ConfigValueContainer of a variable, given by the string of its name.
+        @param varname The name of the variablee
+        @param container The container
+    */
+    void Identifier::addConfigValueContainer(const std::string& varname, ConfigValueContainer* container)
+    {
+        this->bHasConfigValues_ = true;
+        this->configValues_[varname] = container;
+        this->configValues_LC_[getLowercase(varname)] = container;
+    }
+
+    /**
+        @brief Returns the ConfigValueContainer of a variable, given by the string of its name.
+        @param varname The name of the variable
+        @return The ConfigValueContainer
+    */
+    ConfigValueContainer* Identifier::getConfigValueContainer(const std::string& varname)
+    {
+        std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_.find(varname);
+        if (it != configValues_.end())
+            return ((*it).second);
+        else
+            return 0;
+    }
+
+    /**
+        @brief Returns the ConfigValueContainer of a variable, given by the string of its name in lowercase.
+        @param varname The name of the variable in lowercase
+        @return The ConfigValueContainer
+    */
+    ConfigValueContainer* Identifier::getLowercaseConfigValueContainer(const std::string& varname)
+    {
+        std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_LC_.find(varname);
+        if (it != configValues_LC_.end())
+            return ((*it).second);
+        else
+            return 0;
+    }
+
+    /**
+        @brief Adds a new console command of this class.
+        @param executor The executor of the command
+        @param bCreateShortcut If this is true a shortcut gets created so you don't have to add the classname to access this command
+        @return The executor of the command
+    */
+    ExecutorStatic& Identifier::addConsoleCommand(ExecutorStatic* executor, bool bCreateShortcut)
+    {
+        this->bHasConsoleCommands_ = true;
+        this->consoleCommands_[executor->getName()] = executor;
+        this->consoleCommands_LC_[getLowercase(executor->getName())] = executor;
+
+        if (bCreateShortcut)
+            CommandExecutor::addConsoleCommandShortcut(executor);
+
+        return (*executor);
+    }
+
+    /**
+        @brief Returns the executor of a console command with given name.
+        @brief name The name of the requested console command
+        @return The executor of the requested console command
+    */
+    ExecutorStatic* Identifier::getConsoleCommand(const std::string& name) const
+    {
+        std::map<std::string, ExecutorStatic*>::const_iterator it = this->consoleCommands_.find(name);
+        if (it != this->consoleCommands_.end())
+            return (*it).second;
+        else
+            return 0;
+    }
+
+    /**
+        @brief Returns the executor of a console command with given name in lowercase.
+        @brief name The name of the requested console command in lowercae
+        @return The executor of the requested console command
+    */
+    ExecutorStatic* Identifier::getLowercaseConsoleCommand(const std::string& name) const
+    {
+        std::map<std::string, ExecutorStatic*>::const_iterator it = this->consoleCommands_LC_.find(name);
+        if (it != this->consoleCommands_LC_.end())
+            return (*it).second;
+        else
+            return 0;
+    }
+
+    /**
+        @brief Lists the names of all Identifiers in a std::set<const Identifier*>.
+        @param out The outstream
+        @param list The list (or set) of Identifiers
+        @return The outstream
+    */
+    std::ostream& operator<<(std::ostream& out, const std::set<const Identifier*>& list)
+    {
+        for (std::set<const Identifier*>::const_iterator it = list.begin(); it != list.end(); ++it)
+            out << (*it)->getName() << " ";
+
+        return out;
+    }
+}
Index: code/trunk/src/core/Identifier.h
===================================================================
--- code/trunk/src/core/Identifier.h	(revision 1055)
+++ code/trunk/src/core/Identifier.h	(revision 1055)
@@ -0,0 +1,589 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Identifier.h
+    @brief Definition of the Identifier, ClassIdentifier and SubclassIdentifier classes, implementation of the ClassIdentifier and SubclassIdentifier classes.
+
+    The Identifier contains all needed informations about the class it belongs to:
+     - the name
+     - a list with all objects
+     - parents and children
+     - the factory (if available)
+     - the networkID that can be synchronised with the server
+     - all configurable variables (if available)
+
+    Every object has a pointer to the Identifier of its class. This allows the use isA(...),
+    isExactlyA(...), isChildOf(...) and isParentOf(...).
+
+    To create the class-hierarchy, the Identifier has some intern functions and variables.
+
+    Every Identifier is in fact a ClassIdentifier, but they are derived from Identifier.
+
+    SubclassIdentifier is a separated class, acting like an Identifier, but has a given class.
+    You can only assign Identifiers of exactly the given class or of a derivative to a SubclassIdentifier.
+*/
+
+#ifndef _Identifier_H__
+#define _Identifier_H__
+
+#include <set>
+#include <map>
+#include <string>
+#include <utility>
+
+#include "CorePrereqs.h"
+
+#include "ObjectList.h"
+#include "Debug.h"
+#include "Iterator.h"
+#include "util/String.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###       Identifier        ###
+    // ###############################
+    //! The Identifier is used to identify the class of an object and to store informations about the class.
+    /**
+        The Identifier contains all needed informations about the class it belongs to:
+         - the name
+         - a list with all objects
+         - parents and childs
+         - the factory (if available)
+         - the networkID that can be synchronised with the server
+         - all configurable variables (if available)
+
+        Every object has a pointer to the Identifier of its class. This allows the use isA(...),
+        isExactlyA(...), isChildOf(...) and isParentOf(...).
+
+        You can't directly create an Identifier, it's just the base-class for ClassIdentifier.
+    */
+    class _CoreExport Identifier
+    {
+        template <class T>
+        friend class ClassIdentifier;
+
+        template <class T>
+        friend class SubclassIdentifier;
+
+        friend class Factory;
+
+        public:
+            /** @brief Sets the Factory. @param factory The factory to assign */
+            inline void addFactory(BaseFactory* factory) { this->factory_ = factory; }
+
+            BaseObject* fabricate();
+            bool isA(const Identifier* identifier) const;
+            bool isExactlyA(const Identifier* identifier) const;
+            bool isChildOf(const Identifier* identifier) const;
+            bool isDirectChildOf(const Identifier* identifier) const;
+            bool isParentOf(const Identifier* identifier) const;
+            bool isDirectParentOf(const Identifier* identifier) const;
+
+            virtual const ObjectList<BaseObject>* getObjectList() const = 0;
+
+            virtual void updateConfigValues() const = 0;
+
+            /** @brief Returns the name of the class the Identifier belongs to. @return The name */
+            inline const std::string& getName() const { return this->name_; }
+
+
+            /** @brief Returns the parents of the class the Identifier belongs to. @return The list of all parents */
+            inline const std::set<const Identifier*>& getParents() const { return this->parents_; }
+            /** @brief Returns the begin-iterator of the parents-list. @return The begin-iterator */
+            inline std::set<const Identifier*>::const_iterator getParentsBegin() const { return this->parents_.begin(); }
+            /** @brief Returns the end-iterator of the parents-list. @return The end-iterator */
+            inline std::set<const Identifier*>::const_iterator getParentsEnd() const { return this->parents_.end(); }
+
+            /** @brief Returns the children of the class the Identifier belongs to. @return The list of all children */
+            inline const std::set<const Identifier*>& getChildren() const { return (*this->children_); }
+            /** @brief Returns the begin-iterator of the children-list. @return The begin-iterator */
+            inline std::set<const Identifier*>::const_iterator getChildrenBegin() const { return this->children_->begin(); }
+            /** @brief Returns the end-iterator of the children-list. @return The end-iterator */
+            inline std::set<const Identifier*>::const_iterator getChildrenEnd() const { return this->children_->end(); }
+
+            /** @brief Returns the direct parents of the class the Identifier belongs to. @return The list of all direct parents */
+            inline const std::set<const Identifier*>& getDirectParents() const { return this->directParents_; }
+            /** @brief Returns the begin-iterator of the direct-parents-list. @return The begin-iterator */
+            inline std::set<const Identifier*>::const_iterator getDirectParentsBegin() const { return this->directParents_.begin(); }
+            /** @brief Returns the end-iterator of the direct-parents-list. @return The end-iterator */
+            inline std::set<const Identifier*>::const_iterator getDirectParentsEnd() const { return this->directParents_.end(); }
+
+            /** @brief Returns the direct children the class the Identifier belongs to. @return The list of all direct children */
+            inline const std::set<const Identifier*>& getDirectChildren() const { return (*this->directChildren_); }
+            /** @brief Returns the begin-iterator of the direct-children-list. @return The begin-iterator */
+            inline std::set<const Identifier*>::const_iterator getDirectChildrenBegin() const { return this->directChildren_->begin(); }
+            /** @brief Returns the end-iterator of the direct-children-list. @return The end-iterator */
+            inline std::set<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_->end(); }
+
+
+            /** @brief Returns the map that stores all Identifiers. @return The map */
+            static inline const std::map<std::string, Identifier*>& getIdentifierMap() { return Identifier::getIdentifierMapIntern(); }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all Identifiers. @return The const_iterator */
+            static inline std::map<std::string, Identifier*>::const_iterator getIdentifierMapBegin() { return Identifier::getIdentifierMap().begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all Identifiers. @return The const_iterator */
+            static inline std::map<std::string, Identifier*>::const_iterator getIdentifierMapEnd() { return Identifier::getIdentifierMap().end(); }
+
+            /** @brief Returns the map that stores all Identifiers with their names in lowercase. @return The map */
+            static inline const std::map<std::string, Identifier*>& getLowercaseIdentifierMap() { return Identifier::getLowercaseIdentifierMapIntern(); }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase. @return The const_iterator */
+            static inline std::map<std::string, Identifier*>::const_iterator getLowercaseIdentifierMapBegin() { return Identifier::getLowercaseIdentifierMap().begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase. @return The const_iterator */
+            static inline std::map<std::string, Identifier*>::const_iterator getLowercaseIdentifierMapEnd() { return Identifier::getLowercaseIdentifierMap().end(); }
+
+
+            /** @brief Returns the map that stores all config values. @return The const_iterator */
+            inline const std::map<std::string, ConfigValueContainer*>& getConfigValueMap() const { return this->configValues_; }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all config values. @return The const_iterator */
+            inline std::map<std::string, ConfigValueContainer*>::const_iterator getConfigValueMapBegin() const { return this->configValues_.begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all config values. @return The const_iterator */
+            inline std::map<std::string, ConfigValueContainer*>::const_iterator getConfigValueMapEnd() const { return this->configValues_.end(); }
+
+            /** @brief Returns the map that stores all config values with their names in lowercase. @return The const_iterator */
+            inline const std::map<std::string, ConfigValueContainer*>& getLowercaseConfigValueMap() const { return this->configValues_LC_; }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all config values with their names in lowercase. @return The const_iterator */
+            inline std::map<std::string, ConfigValueContainer*>::const_iterator getLowercaseConfigValueMapBegin() const { return this->configValues_LC_.begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all config values with their names in lowercase. @return The const_iterator */
+            inline std::map<std::string, ConfigValueContainer*>::const_iterator getLowercaseConfigValueMapEnd() const { return this->configValues_LC_.end(); }
+
+
+            /** @brief Returns the map that stores all console commands. @return The const_iterator */
+            inline const std::map<std::string, ExecutorStatic*>& getConsoleCommandMap() const { return this->consoleCommands_; }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all console commands. @return The const_iterator */
+            inline std::map<std::string, ExecutorStatic*>::const_iterator getConsoleCommandMapBegin() const { return this->consoleCommands_.begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all console commands. @return The const_iterator */
+            inline std::map<std::string, ExecutorStatic*>::const_iterator getConsoleCommandMapEnd() const { return this->consoleCommands_.end(); }
+
+            /** @brief Returns the map that stores all console commands with their names in lowercase. @return The const_iterator */
+            inline const std::map<std::string, ExecutorStatic*>& getLowercaseConsoleCommandMap() const { return this->consoleCommands_LC_; }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all console commands with their names in lowercase. @return The const_iterator */
+            inline std::map<std::string, ExecutorStatic*>::const_iterator getLowercaseConsoleCommandMapBegin() const { return this->consoleCommands_LC_.begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all console commands with their names in lowercase. @return The const_iterator */
+            inline std::map<std::string, ExecutorStatic*>::const_iterator getLowercaseConsoleCommandMapEnd() const { return this->consoleCommands_LC_.end(); }
+
+
+            /** @brief Returns true if this class has at least one config value. @return True if this class has at least one config value */
+            inline bool hasConfigValues() const { return this->bHasConfigValues_; }
+            /** @brief Returns true if this class has at least one console command. @return True if this class has at least one console command */
+            inline bool hasConsoleCommands() const { return this->bHasConsoleCommands_; }
+
+            /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */
+            inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
+
+            /** @brief Returns the network ID to identify a class through the network. @return the network ID */
+            inline const unsigned int getNetworkID() const { return this->classID_; }
+
+            /** @brief Sets the network ID to a new value. @param id The new value */
+            void setNetworkID(unsigned int id);
+
+            void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container);
+            ConfigValueContainer* getConfigValueContainer(const std::string& varname);
+            ConfigValueContainer* getLowercaseConfigValueContainer(const std::string& varname);
+
+            virtual void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container) = 0;
+            virtual XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname) = 0;
+
+            virtual void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container) = 0;
+            virtual XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname) = 0;
+
+            ExecutorStatic& addConsoleCommand(ExecutorStatic* executor, bool bCreateShortcut);
+            ExecutorStatic* getConsoleCommand(const std::string& name) const;
+            ExecutorStatic* getLowercaseConsoleCommand(const std::string& name) const;
+
+        protected:
+            /** @brief Returns the map that stores all Identifiers. @return The map */
+            static std::map<std::string, Identifier*>& getIdentifierMapIntern();
+            /** @brief Returns the map that stores all Identifiers with their names in lowercase. @return The map */
+            static std::map<std::string, Identifier*>& getLowercaseIdentifierMapIntern();
+
+        private:
+            Identifier();
+            Identifier(const Identifier& identifier) {} // don't copy
+            virtual ~Identifier();
+            void initialize(std::set<const Identifier*>* parents);
+
+            /** @brief Returns the children of the class the Identifier belongs to. @return The list of all children */
+            inline std::set<const Identifier*>& getChildrenIntern() const { return (*this->children_); }
+            /** @brief Returns the direct children of the class the Identifier belongs to. @return The list of all direct children */
+            inline std::set<const Identifier*>& getDirectChildrenIntern() const { return (*this->directChildren_); }
+
+            /**
+                @brief Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.
+            */
+            inline static void startCreatingHierarchy()
+            {
+                hierarchyCreatingCounter_s++;
+                COUT(4) << "*** Identifier: Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl;
+            }
+
+            /**
+                @brief Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents.
+            */
+            inline static void stopCreatingHierarchy()
+            {
+                hierarchyCreatingCounter_s--;
+                COUT(4) << "*** Identifier: Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl;
+            }
+
+            std::set<const Identifier*> parents_;                          //!< The parents of the class the Identifier belongs to
+            std::set<const Identifier*>* children_;                        //!< The children of the class the Identifier belongs to
+
+            std::set<const Identifier*> directParents_;                    //!< The direct parents of the class the Identifier belongs to
+            std::set<const Identifier*>* directChildren_;                  //!< The direct children of the class the Identifier belongs to
+
+            std::string name_;                                             //!< The name of the class the Identifier belongs to
+
+            BaseFactory* factory_;                                         //!< The Factory, able to create new objects of the given class (if available)
+            bool bCreatedOneObject_;                                       //!< True if at least one object of the given type was created (used to determine the need of storing the parents)
+            static int hierarchyCreatingCounter_s;                         //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
+            unsigned int classID_;                                         //!< The network ID to identify a class through the network
+
+            bool bHasConfigValues_;                                        //!< True if this class has at least one assigned config value
+            std::map<std::string, ConfigValueContainer*> configValues_;    //!< A map to link the string of configurable variables with their ConfigValueContainer
+            std::map<std::string, ConfigValueContainer*> configValues_LC_; //!< A map to link the string of configurable variables with their ConfigValueContainer
+
+            bool bHasConsoleCommands_;                                     //!< True if this class has at least one assigned console command
+            std::map<std::string, ExecutorStatic*> consoleCommands_;       //!< All console commands of this class
+            std::map<std::string, ExecutorStatic*> consoleCommands_LC_;    //!< All console commands of this class with their names in lowercase
+    };
+
+    _CoreExport std::ostream& operator<<(std::ostream& out, const std::set<const Identifier*>& list);
+
+
+    // ###############################
+    // ###     ClassIdentifier     ###
+    // ###############################
+    //! The ClassIdentifier is derived from Identifier and holds all class-specific functions and variables the Identifier cannot have.
+    /**
+        ClassIdentifier is a Singleton, which means that only one object of a given type T exists.
+        This makes it possible to store informations about a class, sharing them with all
+        objects of that class without defining static variables in every class.
+
+        To be really sure that not more than exactly one object exists (even with libraries),
+        ClassIdentifiers are only created by IdentifierDistributor.
+
+        You can access the ClassIdentifiers created by IdentifierDistributor through the
+        ClassManager singletons.
+    */
+    template <class T>
+    class ClassIdentifier : public Identifier
+    {
+        template <class TT>
+        friend class ClassManager;
+
+        public:
+            ClassIdentifier<T>* registerClass(std::set<const Identifier*>* parents, const std::string& name, bool bRootClass);
+            void addObject(T* object);
+            void setName(const std::string& name);
+            /** @brief Returns the list of all existing objects of this class. @return The list */
+            inline const ObjectList<T>* getObjects() const { return this->objects_; }
+            /** @brief Returns a list of all existing objects of this class. @return The list */
+            inline const ObjectList<BaseObject>* getObjectList() const { return (ObjectList<BaseObject>*)this->objects_; }
+
+            void updateConfigValues() const;
+
+            XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname);
+            void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container);
+
+            XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname);
+            void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container);
+
+        private:
+            ClassIdentifier();
+            ClassIdentifier(const ClassIdentifier<T>& identifier) {}    // don't copy
+            ~ClassIdentifier() {}                                       // don't delete
+
+            ObjectList<T>* objects_;                                                                    //!< The ObjectList, containing all objects of type T
+            bool bSetName_;                                                                             //!< True if the name is set
+            std::map<std::string, XMLPortClassParamContainer<T>*> xmlportParamContainers_;              //!< All loadable parameters
+            std::map<std::string, XMLPortClassObjectContainer<T, class O>*> xmlportObjectContainers_;   //!< All attachable objects
+    };
+
+    /**
+        @brief Constructor: Creates the ObjectList.
+    */
+    template <class T>
+    ClassIdentifier<T>::ClassIdentifier()
+    {
+//        this->objects_ = ObjectList<T>::getList();
+        this->objects_ = new ObjectList<T>();
+        this->bSetName_ = false;
+    }
+
+    /**
+        @brief Registers a class, which means that the name and the parents get stored.
+        @param parents A list, containing the Identifiers of all parents of the class
+        @param name A string, containing exactly the name of the class
+        @param bRootClass True if the class is either an Interface or the BaseObject itself
+        @return The ClassIdentifier itself
+    */
+    template <class T>
+    ClassIdentifier<T>* ClassIdentifier<T>::registerClass(std::set<const Identifier*>* parents, const std::string& name, bool bRootClass)
+    {
+        this->setName(name);
+
+        // Check if at least one object of the given type was created
+        if (!this->bCreatedOneObject_ && Identifier::isCreatingHierarchy())
+        {
+            // If no: We have to store the informations and initialize the Identifier
+            COUT(4) << "*** ClassIdentifier: Register Class in " << name << "-Singleton -> Initialize Singleton." << std::endl;
+            if (bRootClass)
+                this->initialize(NULL); // If a class is derived from two interfaces, the second interface might think it's derived from the first because of the order of constructor-calls. Thats why we set parents to zero in that case.
+            else
+                this->initialize(parents);
+        }
+
+        return this;
+    }
+
+    /**
+        @brief Sets the name of the class.
+        @param name The name
+    */
+    template <class T>
+    void ClassIdentifier<T>::setName(const std::string& name)
+    {
+        if (!this->bSetName_)
+        {
+            this->name_ = name;
+            this->bSetName_ = true;
+            Identifier::getIdentifierMapIntern()[name] = this;
+            Identifier::getLowercaseIdentifierMapIntern()[getLowercase(name)] = this;
+        }
+    }
+
+    /**
+        @brief Adds an object of the given type to the ObjectList.
+        @param object The object to add
+    */
+    template <class T>
+    void ClassIdentifier<T>::addObject(T* object)
+    {
+        COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
+        object->getMetaList().add(this->objects_, this->objects_->add(object));
+    }
+
+    /**
+        @brief Updates the config-values of all existing objects of this class by calling their setConfigValues() function.
+    */
+    template <class T>
+    void ClassIdentifier<T>::updateConfigValues() const
+    {
+        for (Iterator<T> it = this->objects_->start(); it; ++it)
+            ((T*)*it)->setConfigValues();
+    }
+
+    /**
+        @brief Returns a XMLPortParamContainer that loads a parameter of this class.
+        @param paramname The name of the parameter
+        @return The container
+    */
+    template <class T>
+    XMLPortParamContainer* ClassIdentifier<T>::getXMLPortParamContainer(const std::string& paramname)
+    {
+        typename std::map<std::string, XMLPortClassParamContainer<T>*>::const_iterator it = xmlportParamContainers_.find(paramname);
+        if (it != xmlportParamContainers_.end())
+            return (XMLPortParamContainer*)((*it).second);
+        else
+            return 0;
+    }
+
+    /**
+        @brief Adds a new XMLPortParamContainer that loads a parameter of this class.
+        @param paramname The name of the parameter
+        @param container The container
+    */
+    template <class T>
+    void ClassIdentifier<T>::addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container)
+    {
+        this->xmlportParamContainers_[paramname] = (XMLPortClassParamContainer<T>*)container;
+    }
+
+    /**
+        @brief Returns a XMLPortObjectContainer that attaches an object to this class.
+        @param sectionname The name of the section that contains the attachable objects
+        @return The container
+    */
+    template <class T>
+    XMLPortObjectContainer* ClassIdentifier<T>::getXMLPortObjectContainer(const std::string& sectionname)
+    {
+        typename std::map<std::string, XMLPortClassObjectContainer<T, class O>*>::const_iterator it = xmlportObjectContainers_.find(sectionname);
+        if (it != xmlportObjectContainers_.end())
+            return (XMLPortObjectContainer*)((*it).second);
+        else
+            return 0;
+    }
+
+    /**
+        @brief Adds a new XMLPortObjectContainer that attaches an object to this class.
+        @param sectionname The name of the section that contains the attachable objects
+        @param container The container
+    */
+    template <class T>
+    void ClassIdentifier<T>::addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container)
+    {
+        this->xmlportObjectContainers_[sectionname] = (XMLPortClassObjectContainer<T, class O>*)container;
+    }
+
+
+    // ###############################
+    // ###   SubclassIdentifier    ###
+    // ###############################
+    //! The SubclassIdentifier acts almost like an Identifier, but has some prerequisites.
+    /**
+        You can only assign an Identifier that belongs to a class T (or derived) to a SubclassIdentifier<T>.
+        If you assign something else, the program aborts.
+        Because we know the minimal type, a dynamic_cast is done, which makes it easier to create a new object.
+    */
+    template <class T>
+    class SubclassIdentifier
+    {
+        public:
+            /**
+                @brief Constructor: Automaticaly assigns the Identifier of the given class.
+            */
+            SubclassIdentifier()
+            {
+                this->identifier_ = ClassManager<T>::getIdentifier();
+            }
+
+            /**
+                @brief Copyconstructor: Assigns the given Identifier.
+                @param identifier The Identifier
+            */
+            SubclassIdentifier(Identifier* identifier)
+            {
+                this->identifier_ = identifier;
+            }
+
+            /**
+                @brief Overloading of the = operator: assigns the identifier and checks its type.
+                @param identifier The Identifier to assign
+                @return The SubclassIdentifier itself
+            */
+            SubclassIdentifier<T>& operator=(Identifier* identifier)
+            {
+                if (!identifier->isA(ClassManager<T>::getIdentifier()))
+                {
+                    COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
+                    COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassManager<T>::getIdentifier()->getName() << "!" << std::endl;
+                    COUT(1) << "Error: SubclassIdentifier<" << ClassManager<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl;
+                    COUT(1) << "Aborting..." << std::endl;
+                    abort();
+                }
+                this->identifier_ = identifier;
+                return *this;
+            }
+
+            /**
+                @brief Overloading of the * operator: returns the assigned identifier.
+                @return The assigned identifier
+            */
+            Identifier* operator*()
+            {
+                return this->identifier_;
+            }
+
+            /**
+                @brief Overloading of the -> operator: returns the assigned identifier.
+                @return The assigned identifier
+            */
+            Identifier* operator->() const
+            {
+                return this->identifier_;
+            }
+
+            /**
+                @brief Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.
+                @return The new object
+            */
+            T* fabricate()
+            {
+                BaseObject* newObject = this->identifier_->fabricate();
+
+                // Check if the creation was successful
+                if (newObject)
+                {
+                    // Do a dynamic_cast, because an object of type T is much better than of type BaseObject
+                    return (T*)(newObject);
+                }
+                else
+                {
+                    // Something went terribly wrong
+                    if (this->identifier_)
+                    {
+                        COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
+                        COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassManager<T>::getIdentifier()->getName() << "!" << std::endl;
+                        COUT(1) << "Error: Couldn't fabricate a new Object." << std::endl;
+                        COUT(1) << "Aborting..." << std::endl;
+                    }
+                    else
+                    {
+                        COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
+                        COUT(1) << "Error: Couldn't fabricate a new Object - Identifier is undefined." << std::endl;
+                        COUT(1) << "Aborting..." << std::endl;
+                    }
+
+                    abort();
+                }
+            }
+
+            /** @brief Returns the assigned identifier. @return The identifier */
+            inline const Identifier* getIdentifier() const
+                { return this->identifier_; }
+
+            /** @brief Returns true, if the assigned identifier is at least of the given type. @param identifier The identifier to compare with */
+            inline bool isA(const Identifier* identifier) const
+                { return this->identifier_->isA(identifier); }
+
+            /** @brief Returns true, if the assigned identifier is exactly of the given type. @param identifier The identifier to compare with */
+            inline bool isExactlyA(const Identifier* identifier) const
+                { return this->identifier_->isExactlyA(identifier); }
+
+            /** @brief Returns true, if the assigned identifier is a child of the given identifier. @param identifier The identifier to compare with */
+            inline bool isChildOf(const Identifier* identifier) const
+                { return this->identifier_->isChildOf(identifier); }
+
+            /** @brief Returns true, if the assigned identifier is a direct child of the given identifier. @param identifier The identifier to compare with */
+            inline bool isDirectChildOf(const Identifier* identifier) const
+                { return this->identifier_->isDirectChildOf(identifier); }
+
+            /** @brief Returns true, if the assigned identifier is a parent of the given identifier. @param identifier The identifier to compare with */
+            inline bool isParentOf(const Identifier* identifier) const
+                { return this->identifier_->isParentOf(identifier); }
+
+            /** @brief Returns true, if the assigned identifier is a direct parent of the given identifier. @param identifier The identifier to compare with */
+            inline bool isDirectParentOf(const Identifier* identifier) const
+                { return this->identifier_->isDirectParentOf(identifier); }
+
+        private:
+            Identifier* identifier_;            //!< The assigned identifier
+    };
+}
+
+#endif /* _Identifier_H__ */
Index: code/trunk/src/core/IdentifierDistributor.cc
===================================================================
--- code/trunk/src/core/IdentifierDistributor.cc	(revision 1055)
+++ code/trunk/src/core/IdentifierDistributor.cc	(revision 1055)
@@ -0,0 +1,63 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file IdentifierDistributor.cc
+    @brief Implementation of the IdentifierDistributor class.
+*/
+
+#include "IdentifierDistributor.h"
+#include "Identifier.h"
+
+namespace orxonox
+{
+    /**
+        @brief Returns the only instance of a ClassIdentifier for a given class.
+        @param name The name of the class
+        @param proposal A proposal for the ClassIdentifier in case there is no entry yet.
+        @return The unique ClassIdentifier
+    */
+    Identifier* IdentifierDistributor::getIdentifier(const std::string& name, Identifier* proposal)
+    {
+        // Create the only instance of the IdentifierDistributor-singleton
+        static IdentifierDistributor theOneAndOnlyInstance = IdentifierDistributor();
+
+        // Look for an entry in the map
+        std::map<std::string, Identifier*>::const_iterator it = theOneAndOnlyInstance.identifiers_.find(name);
+        if (it != theOneAndOnlyInstance.identifiers_.end())
+        {
+            // There is already an entry: return it
+            return (*it).second;
+        }
+        else
+        {
+            // There is no entry: put the proposal into the map and return it
+            theOneAndOnlyInstance.identifiers_[name] = proposal;
+            return proposal;
+        }
+    }
+}
Index: code/trunk/src/core/IdentifierDistributor.h
===================================================================
--- code/trunk/src/core/IdentifierDistributor.h	(revision 1055)
+++ code/trunk/src/core/IdentifierDistributor.h	(revision 1055)
@@ -0,0 +1,61 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file IdentifierDistributor.h
+    @brief Definition of the IdentifierDistributor class
+
+    The IdentifierDistributor makes sure that only one instance of ClassIdentifier for each
+    template parameter T exists. All Identifiers are stored in a map with their name.
+    IdentifierDistributor is a singleton class, it can't be created or deleted directly.
+*/
+
+#ifndef _IdentifierDistributor_H__
+#define _IdentifierDistributor_H__
+
+#include <map>
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    //! The Identifier Distributor stores all Identifiers and makes sure there are no ambiguities.
+    class _CoreExport IdentifierDistributor
+    {
+        public:
+            static Identifier* getIdentifier(const std::string& name, Identifier* proposal);
+
+        private:
+            IdentifierDistributor() {};                                         // Don't create
+            IdentifierDistributor(const IdentifierDistributor& distributor) {}  // Don't copy
+            ~IdentifierDistributor() {}                                         // Don't delete
+
+            std::map<std::string, Identifier*> identifiers_;    //!< The map to store all Identifiers.
+    };
+}
+
+#endif /* _IdentifierDistributor_H__ */
Index: code/trunk/src/core/InputBuffer.cc
===================================================================
--- code/trunk/src/core/InputBuffer.cc	(revision 1055)
+++ code/trunk/src/core/InputBuffer.cc	(revision 1055)
@@ -0,0 +1,186 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include <iostream>
+
+#include "InputBuffer.h"
+#include "InputManager.h"
+#include "util/Clipboard.h"
+
+namespace orxonox
+{
+    InputBuffer::InputBuffer()
+    {
+        this->bActivated_ = false;
+        this->allowedChars_ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜ0123456789 \\\"().:,;_-+*/=!?<>[|]";
+        this->keyboard_ = InputManager::getSingleton().getKeyboard();
+        this->buffer_ = "";
+
+        this->keyboard_->setEventCallback(this);
+    }
+/*
+    void InputBuffer::registerListener(InputBufferListener* listener, void (InputBufferListener::*function)(), bool bOnlySingleInput)
+    {
+        struct InputBufferListenerTuple newListener = {listener, function, true, bOnlySingleInput, ' '};
+        this->listeners_.insert(this->listeners_.end(), newListener);
+    }
+
+    void InputBuffer::registerListener(InputBufferListener* listener, void (InputBufferListener::*function)(), char char_, bool bOnlySingleInput)
+    {
+        struct InputBufferListenerTuple newListener = {listener, function, false, bOnlySingleInput, char_};
+        this->listeners_.insert(this->listeners_.end(), newListener);
+    }
+*/
+    void InputBuffer::set(const std::string& input)
+    {
+        this->buffer_ = "";
+        this->append(input);
+    }
+
+    void InputBuffer::append(const std::string& input)
+    {
+        for (unsigned int i = 0; i < input.size(); i++)
+        {
+            if (this->charIsAllowed(input[i]))
+                this->buffer_ += input[i];
+
+            this->updated(input[i], false);
+        }
+        this->updated();
+    }
+
+    void InputBuffer::append(const char& input)
+    {
+        if (this->charIsAllowed(input))
+            this->buffer_ += input;
+
+        this->updated(input, true);
+    }
+
+    void InputBuffer::clear()
+    {
+        this->buffer_ = "";
+        this->updated();
+    }
+
+    void InputBuffer::removeLast()
+    {
+        this->buffer_ = this->buffer_.substr(0, this->buffer_.size() - 1);
+        this->updated();
+    }
+
+    void InputBuffer::updated()
+    {
+        for (std::list<InputBufferListenerTuple>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+        {
+            if ((*it).bListenToAllChanges_)
+                (*(*it).listener_.*(*it).function_)();
+        }
+    }
+
+    void InputBuffer::updated(const char& update, bool bSingleInput)
+    {
+        for (std::list<InputBufferListenerTuple>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+        {
+            if (((*it).bListenToAllChanges_ || ((*it).char_ == update)) && (!(*it).bOnlySingleInput_ || bSingleInput))
+                (*(*it).listener_.*(*it).function_)();
+        }
+    }
+
+    void InputBuffer::activityChanged() const
+    {
+    }
+
+    bool InputBuffer::charIsAllowed(const char& input)
+    {
+        if (this->allowedChars_ == "")
+            return true;
+        else
+            return (this->allowedChars_.find(input) != std::string::npos);
+    }
+
+    bool InputBuffer::keyPressed(const OIS::KeyEvent &e)
+    {
+        if (e.key == OIS::KC_NUMPADENTER)
+        {
+            this->setActivated(!this->isActivated());
+            this->clear();
+            return true;
+        }
+
+        if (this->keyboard_->isModifierDown(OIS::Keyboard::Ctrl))
+        {
+            if (e.key == OIS::KC_V)
+            {
+                this->append(fromClipboard());
+                return true;
+            }
+            else if (e.key == OIS::KC_C)
+            {
+                toClipboard(this->buffer_);
+                return true;
+            }
+            else if (e.key == OIS::KC_X)
+            {
+                toClipboard(this->buffer_);
+                this->clear();
+                return true;
+            }
+        }
+        else if (this->keyboard_->isModifierDown(OIS::Keyboard::Shift))
+        {
+            if (e.key == OIS::KC_INSERT)
+            {
+                this->append(fromClipboard());
+                return true;
+            }
+            else if (e.key == OIS::KC_DELETE)
+            {
+                toClipboard(this->buffer_);
+                this->clear();
+                return true;
+            }
+        }
+
+        if (this->bActivated_)
+        {
+//std::cout << this->keyboard_->getAsString(e.key) << " / " << (char)e.text << std::endl;
+/*
+            std::string input = this->keyboard_->getAsString(e.key);
+            if (input.size() >= 1)
+                this->append(input[0]);
+*/
+            this->append((char)e.text);
+        }
+        return true;
+    }
+
+    bool InputBuffer::keyReleased(const OIS::KeyEvent &e)
+    {
+        return true;
+    }
+}
Index: code/trunk/src/core/InputBuffer.h
===================================================================
--- code/trunk/src/core/InputBuffer.h	(revision 1055)
+++ code/trunk/src/core/InputBuffer.h	(revision 1055)
@@ -0,0 +1,125 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _InputBuffer_H__
+#define _InputBuffer_H__
+
+#include <string>
+#include <list>
+
+#ifdef WIN32
+#include <OIS/OISKeyboard.h>
+#else
+#include <OISKeyboard.h>
+#endif
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    class _CoreExport InputBufferListener
+    {
+    };
+
+    class _CoreExport InputBuffer : public OIS::KeyListener
+    {
+        struct InputBufferListenerTuple
+        {
+            InputBufferListener* listener_;
+            void (InputBufferListener::*function_)();
+            bool bListenToAllChanges_;
+            bool bOnlySingleInput_;
+            char char_;
+        };
+
+        public:
+            InputBuffer();
+
+            template <class T>
+            void registerListener(T* listener, void (T::*function)(), bool bOnlySingleInput)
+            {
+                struct InputBufferListenerTuple newListener = {listener, (void (InputBufferListener::*)())function, true, bOnlySingleInput, ' '};
+                this->listeners_.insert(this->listeners_.end(), newListener);
+            }
+            template <class T>
+            void registerListener(T* listener, void (T::*function)() const, bool bOnlySingleInput)
+            {
+                struct InputBufferListenerTuple newListener = {listener, (void (InputBufferListener::*)())function, true, bOnlySingleInput, ' '};
+                this->listeners_.insert(this->listeners_.end(), newListener);
+            }
+
+            template <class T>
+            void registerListener(T* listener, void (T::*function)(), char char_, bool bOnlySingleInput)
+            {
+                struct InputBufferListenerTuple newListener = {listener, (void (InputBufferListener::*)())function, false, bOnlySingleInput, char_};
+                this->listeners_.insert(this->listeners_.end(), newListener);
+            }
+            template <class T>
+            void registerListener(T* listener, void (T::*function)() const, char char_, bool bOnlySingleInput)
+            {
+                struct InputBufferListenerTuple newListener = {listener, (void (InputBufferListener::*)())function, false, bOnlySingleInput, char_};
+                this->listeners_.insert(this->listeners_.end(), newListener);
+            }
+
+            void set(const std::string& input);
+            void append(const std::string& input);
+            void append(const char& input);
+            void removeLast();
+            void clear();
+
+            void updated();
+            void updated(const char& update, bool bSingleInput);
+
+            inline std::string get() const
+                { return this->buffer_; }
+
+            inline void activate()
+                { this->setActivated(true); }
+            inline void deactivate()
+                { this->setActivated(false); }
+            inline void setActivated(bool bActivated)
+                { if (this->bActivated_ != bActivated) { this->bActivated_ = bActivated; this->activityChanged(); } else { this->bActivated_ = bActivated; } }
+            inline bool isActivated() const
+                { return this->bActivated_; }
+
+            void activityChanged() const;
+
+        private:
+            bool charIsAllowed(const char& input);
+
+            bool keyPressed(const OIS::KeyEvent &e);
+            bool keyReleased(const OIS::KeyEvent &e);
+
+            OIS::Keyboard* keyboard_;
+            bool bActivated_;
+            std::string buffer_;
+            std::list<InputBufferListenerTuple> listeners_;
+            std::string allowedChars_;
+    };
+}
+
+#endif /* _InputBuffer_H__ */
Index: code/trunk/src/core/InputEvent.h
===================================================================
--- code/trunk/src/core/InputEvent.h	(revision 1055)
+++ code/trunk/src/core/InputEvent.h	(revision 1055)
@@ -0,0 +1,52 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file
+ @brief InputEvent Structure declaration
+ */
+
+#ifndef _InputEvent_H__
+#define _InputEvent_H__
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+  /**
+    @brief Interface that any class can use to get key independent input.
+  */
+  struct InputEvent
+  {
+    unsigned char id;      //!< Event ID
+    bool bStarted;         //!< Tells whether the Event started or ended (e.g. firing started)
+    int data1, data2;      //!< Two additional integer datafields, for instance for the mouse moved event
+    void* dataRef;         //!< Additional pointer to any further data
+  };
+}
+
+#endif /* _InputEvent_H__ */
Index: code/trunk/src/core/InputEventListener.cc
===================================================================
--- code/trunk/src/core/InputEventListener.cc	(revision 1055)
+++ code/trunk/src/core/InputEventListener.cc	(revision 1055)
@@ -0,0 +1,51 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file
+ @brief Core relevant parts of InputEventListener
+ */
+
+#include "core/CoreIncludes.h"
+#include "InputEventListener.h"
+
+namespace orxonox
+{
+  /**
+    @brief standard constructor
+  */
+  InputEventListener::InputEventListener()
+  {
+    RegisterRootObject(InputEventListener);
+    this->bActive_ = true;
+  }
+
+  InputEventListener::~InputEventListener()
+  {
+  }
+
+}
Index: code/trunk/src/core/InputEventListener.h
===================================================================
--- code/trunk/src/core/InputEventListener.h	(revision 1055)
+++ code/trunk/src/core/InputEventListener.h	(revision 1055)
@@ -0,0 +1,60 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file
+ @brief InputEventListener Interface declaration
+ */
+
+#ifndef _InputEventListener_H__
+#define _InputEventListener_H__
+
+#include "CorePrereqs.h"
+
+#include "core/OrxonoxClass.h"
+#include "InputEvent.h"
+
+namespace orxonox
+{
+  /**
+    @brief Interface that any class can use to get key independent input.
+  */
+  class _CoreExport InputEventListener : virtual public OrxonoxClass
+  {
+    friend class InputHandlerGame;
+  public:
+    InputEventListener();
+    virtual ~InputEventListener();
+    /** Method is called every time an Input event occurs && bActive */
+    virtual void eventOccured(InputEvent &evt) = 0;
+
+  private:
+    bool bActive_;
+  };
+}
+
+#endif /* _InputEventListener_H__ */
Index: code/trunk/src/core/InputHandler.cc
===================================================================
--- code/trunk/src/core/InputHandler.cc	(revision 1055)
+++ code/trunk/src/core/InputHandler.cc	(revision 1055)
@@ -0,0 +1,222 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of the different input handlers.
+ */
+
+#include "Debug.h"
+#include "util/Convert.h"
+#include "InputEventListener.h"
+#include "InputEvent.h"
+#include "InputHandler.h"
+
+namespace orxonox
+{
+  // ###############################
+  // ###    InputHandlerGame     ###
+  // ###############################
+
+  /**
+    @brief standard constructor
+  */
+  InputHandlerGame::InputHandlerGame()
+  {
+  }
+
+  /**
+    @brief Destructor
+  */
+  InputHandlerGame::~InputHandlerGame()
+  {
+  }
+
+  /**
+    @brief Loads the key bindings from the ini file.
+    Currently, this is just a simple test routine that fills the list with numbers.
+  */
+  bool InputHandlerGame::loadBindings()
+  {
+    for (int i = 0; i < numberOfKeys_s; i++)
+    {
+      // simply write the key number (i) in the string
+      this->bindingsKeyPressed_[i] = getConvertedValue<int, std::string>(i);
+      this->bindingsKeyReleased_[i] = getConvertedValue<int, std::string>(i);
+    }
+    return true;
+  }
+
+  /**
+    @brief Event handler for the keyPressed Event.
+    @param e Event information
+  */
+  bool InputHandlerGame::keyPressed(const OIS::KeyEvent &e)
+  {
+    if (e.key == OIS::KC_ESCAPE)
+    {
+      InputEvent e = {1, true, 0, 0, 0};
+      InputHandlerGame::callListeners(e);
+    }
+    else
+    {
+      // find the appropriate key binding
+      std::string cmdStr = bindingsKeyPressed_[int(e.key)];
+      //COUT(3) << cmdStr << " pressed" << std::endl;
+    }
+    return true;
+  }
+
+  /**
+    @brief Event handler for the keyReleased Event.
+    @param e Event information
+  */
+  bool InputHandlerGame::keyReleased(const OIS::KeyEvent &e)
+  {
+    // find the appropriate key binding
+    std::string cmdStr = bindingsKeyReleased_[int(e.key)];
+    //COUT(3) << cmdStr << " released" << std::endl;
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mouseMoved Event.
+    @param e Event information
+  */
+  bool InputHandlerGame::mouseMoved(const OIS::MouseEvent &e)
+  {
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mousePressed Event.
+    @param e Event information
+    @param id The ID of the mouse button
+  */
+  bool InputHandlerGame::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
+  {
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mouseReleased Event.
+    @param e Event information
+    @param id The ID of the mouse button
+  */
+  bool InputHandlerGame::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
+  {
+    return true;
+  }
+
+  /**
+    @brief Calls all the objects from classes that derive from InputEventListener.
+    @param evt The input event that occured.
+  */
+  inline void InputHandlerGame::callListeners(orxonox::InputEvent &evt)
+  {
+    for (Iterator<InputEventListener> it = ObjectList<InputEventListener>::start(); it; )
+    {
+      if (it->bActive_)
+        (it++)->eventOccured(evt);
+      else
+        it++;
+    }
+  }
+
+
+  // ###############################
+  // ###     InputHandlerGUI     ###
+  // ###############################
+
+  /**
+    @brief standard constructor
+  */
+  InputHandlerGUI::InputHandlerGUI()
+  {
+  }
+
+  /**
+    @brief Destructor
+  */
+  InputHandlerGUI::~InputHandlerGUI()
+  {
+  }
+
+  /**
+    @brief Event handler for the keyPressed Event.
+    @param e Event information
+  */
+  bool InputHandlerGUI::keyPressed(const OIS::KeyEvent &e)
+  {
+		//CEGUI::System::getSingleton().injectKeyDown( arg.key );
+		//CEGUI::System::getSingleton().injectChar( arg.text );
+    return true;
+  }
+
+  /**
+    @brief Event handler for the keyReleased Event.
+    @param e Event information
+  */
+  bool InputHandlerGUI::keyReleased(const OIS::KeyEvent &e)
+  {
+		//CEGUI::System::getSingleton().injectKeyUp( arg.key );
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mouseMoved Event.
+    @param e Event information
+  */
+  bool InputHandlerGUI::mouseMoved(const OIS::MouseEvent &e)
+  {
+		//CEGUI::System::getSingleton().injectMouseMove( arg.state.X.rel, arg.state.Y.rel );
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mousePressed Event.
+    @param e Event information
+    @param id The ID of the mouse button
+  */
+  bool InputHandlerGUI::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
+  {
+		//CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id));
+    return true;
+  }
+
+  /**
+    @brief Event handler for the mouseReleased Event.
+    @param e Event information
+    @param id The ID of the mouse button
+  */
+  bool InputHandlerGUI::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
+  {
+		//CEGUI::System::getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id));
+    return true;
+  }
+
+}
Index: code/trunk/src/core/InputHandler.h
===================================================================
--- code/trunk/src/core/InputHandler.h	(revision 1055)
+++ code/trunk/src/core/InputHandler.h	(revision 1055)
@@ -0,0 +1,110 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file
+ @brief Different definitions of input processing.
+ */
+
+#ifndef _InputHandler_H__
+#define _InputHandler_H__
+
+#include <string>
+
+#include <OIS/OIS.h>
+
+#include "CorePrereqs.h"
+#include "InputEvent.h"
+
+namespace orxonox
+{
+  /**
+    @brief Captures mouse and keyboard input while in the actual game mode.
+    Manages the key bindings.
+  */
+  class _CoreExport InputHandlerGame
+        : public OIS::KeyListener, public OIS::MouseListener
+  {
+  public:
+    InputHandlerGame ();
+    ~InputHandlerGame();
+
+    bool loadBindings();
+
+  private:
+    // input events
+		bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id);
+		bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id);
+    bool mouseMoved   (const OIS::MouseEvent &arg);
+		bool keyPressed   (const OIS::KeyEvent   &arg);
+		bool keyReleased  (const OIS::KeyEvent   &arg);
+
+    // temporary hack
+    void callListeners(InputEvent &evt);
+
+    /** denotes the maximum number of different keys there are in OIS.
+        256 should be ok since the highest number in the enum is 237. */
+    static const int numberOfKeys_s = 256;
+    //! Array of input events for every pressed key
+    std::string bindingsKeyPressed_[numberOfKeys_s];
+    //! Array of input events for every released key
+    std::string bindingsKeyReleased_[numberOfKeys_s];
+
+    /** denotes the maximum number of different buttons there are in OIS.
+        16 should be ok since the highest number in the enum is 7. */
+    static const int numberOfButtons_s = 16;
+    //! Array of input events for every pressed key
+    std::string bindingsButtonPressed_[numberOfButtons_s];
+    //! Array of input events for every released key
+    std::string bindingsButtonReleased_[numberOfButtons_s];
+
+  };
+
+
+  /**
+    @brief Captures mouse and keyboard input and distributes it to the
+    GUI.
+  */
+  class _CoreExport InputHandlerGUI
+        : public OIS::KeyListener, public OIS::MouseListener
+  {
+  public:
+    InputHandlerGUI ();
+    ~InputHandlerGUI();
+
+  private:
+    // input events
+		bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id);
+		bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id);
+    bool mouseMoved   (const OIS::MouseEvent &arg);
+		bool keyPressed   (const OIS::KeyEvent   &arg);
+		bool keyReleased  (const OIS::KeyEvent   &arg);
+  };
+
+}
+
+#endif /* _InputHandler_H__ */
Index: code/trunk/src/core/InputManager.cc
===================================================================
--- code/trunk/src/core/InputManager.cc	(revision 1055)
+++ code/trunk/src/core/InputManager.cc	(revision 1055)
@@ -0,0 +1,245 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of a little Input handler that distributes everything
+        coming from OIS.
+ */
+
+#include "core/CoreIncludes.h"
+#include "core/Debug.h"
+#include "InputEventListener.h"
+#include "InputHandler.h"
+#include "InputManager.h"
+
+namespace orxonox
+{
+  /**
+    @brief The reference to the singleton
+  */
+  //InputManager* InputManager::singletonRef_s = 0;
+
+  /**
+    @brief Constructor only resets the pointer values to 0.
+  */
+  InputManager::InputManager() :
+      inputSystem_(0), keyboard_(0), mouse_(0),
+      currentMode_(IM_UNINIT), setMode_(IM_UNINIT),
+      handlerGUI_(0), handlerBuffer_(0), handlerGame_(0)
+  {
+  }
+
+  /**
+    @brief Destructor only called at the end of the program
+  */
+  InputManager::~InputManager()
+  {
+    this->destroy();
+  }
+
+  /**
+    @brief The one instance of the InputManager is stored in this function.
+    @return A reference to the only instance of the InputManager
+  */
+  InputManager& InputManager::getSingleton()
+  {
+    static InputManager theOnlyInstance;
+    return theOnlyInstance;
+  }
+
+  /**
+    @brief Creates the OIS::InputMananger, the keyboard and the mouse and
+           assigns the key bindings.
+    @param windowHnd The window handle of the render window
+    @param windowWidth The width of the render window
+    @param windowHeight The height of the render window
+  */
+  bool InputManager::initialise(size_t windowHnd, int windowWidth, int windowHeight)
+  {
+    if (!this->inputSystem_)
+    {
+      // Setup basic variables
+      OIS::ParamList paramList;
+      std::ostringstream windowHndStr;
+
+      // Fill parameter list
+      windowHndStr << (unsigned int)windowHnd;
+      paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
+
+#if defined OIS_LINUX_PLATFORM
+      paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
+#endif
+
+      try
+      {
+        // Create inputsystem
+        inputSystem_ = OIS::InputManager::createInputSystem(paramList);
+        COUT(ORX_DEBUG) << "*** InputManager: Created OIS input system" << std::endl;
+
+        // create a keyboard. If none are available the exception is caught.
+        keyboard_ = static_cast<OIS::Keyboard*>(inputSystem_->createInputObject(OIS::OISKeyboard, true));
+        COUT(ORX_DEBUG) << "*** InputManager: Created OIS mouse" << std::endl;
+
+        // create a mouse. If none are available the exception is caught.
+        mouse_ = static_cast<OIS::Mouse*>(inputSystem_->createInputObject(OIS::OISMouse, true));
+        COUT(ORX_DEBUG) << "*** InputManager: Created OIS keyboard" << std::endl;
+
+        // Set mouse region
+        this->setWindowExtents(windowWidth, windowHeight);
+      }
+      catch (OIS::Exception ex)
+      {
+        // something went wrong with the initialisation
+        COUT(ORX_ERROR) << "Error: Failed creating an input system/keyboard/mouse. Message: \"" << ex.eText << "\"" << std::endl;
+        this->inputSystem_ = 0;
+        return false;
+      }
+    }
+
+    // create the handlers
+    this->handlerGUI_ = new InputHandlerGUI();
+    this->handlerGame_ = new InputHandlerGame();
+    this->handlerGame_->loadBindings();
+
+    /*COUT(ORX_DEBUG) << "*** InputManager: Loading key bindings..." << std::endl;
+    // load the key bindings
+    InputEvent empty = {0, false, 0, 0, 0};
+    for (int i = 0; i < this->numberOfKeys_; i++)
+      this->bindingsKeyPressed_[i] = empty;
+
+    //assign 'abort' to the escape key
+    this->bindingsKeyPressed_[(int)OIS::KC_ESCAPE].id = 1;
+    COUT(ORX_DEBUG) << "*** InputManager: Loading done." << std::endl;*/
+
+    return true;
+  }
+
+  /**
+    @brief Destroys all the created input devices and handlers.
+  */
+  void InputManager::destroy()
+  {
+    COUT(ORX_DEBUG) << "*** InputManager: Destroying ..." << std::endl;
+    if (this->mouse_)
+      this->inputSystem_->destroyInputObject(mouse_);
+    if (this->keyboard_)
+      this->inputSystem_->destroyInputObject(keyboard_);
+    if (this->inputSystem_)
+      OIS::InputManager::destroyInputSystem(this->inputSystem_);
+
+    this->mouse_         = 0;
+    this->keyboard_      = 0;
+    this->inputSystem_   = 0;
+
+    if (this->handlerBuffer_)
+      delete this->handlerBuffer_;
+    if (this->handlerGame_)
+      delete this->handlerGame_;
+    if (this->handlerGUI_)
+      delete this->handlerGUI_;
+
+    this->handlerBuffer_ = 0;
+    this->handlerGame_   = 0;
+    this->handlerGUI_    = 0;
+
+    COUT(ORX_DEBUG) << "*** InputManager: Destroying done." << std::endl;
+  }
+
+  /**
+    @brief Updates the InputManager
+    @param dt Delta time
+  */
+  void InputManager::tick(float dt)
+  {
+    // reset the game if it has changed
+    if (this->currentMode_ != this->setMode_)
+    {
+      switch (this->setMode_)
+      {
+      case IM_GUI:
+        this->mouse_->setEventCallback(this->handlerGUI_);
+        this->keyboard_->setEventCallback(this->handlerGUI_);
+        break;
+      case IM_INGAME:
+        this->mouse_->setEventCallback(this->handlerGame_);
+        this->keyboard_->setEventCallback(this->handlerGame_);
+        break;
+      case IM_KEYBOARD:
+        this->mouse_->setEventCallback(this->handlerGame_);
+        this->keyboard_->setEventCallback(this->handlerBuffer_);
+        break;
+      case IM_UNINIT:
+        this->mouse_->setEventCallback(0);
+        this->keyboard_->setEventCallback(0);
+        break;
+      }
+      this->currentMode_ = this->setMode_;
+    }
+
+    // capture all the input. That calls the event handlers.
+    if (mouse_)
+      mouse_->capture();
+
+    if (keyboard_)
+      keyboard_->capture();
+  }
+
+  /**
+    @brief Adjusts the mouse window metrics.
+    This method has to be called every time the size of the window changes.
+    @param width The new width of the render window
+    @param height the new height of the render window
+  */
+  void InputManager::setWindowExtents(int width, int height)
+  {
+    // Set mouse region (if window resizes, we should alter this to reflect as well)
+    const OIS::MouseState &mouseState = mouse_->getMouseState();
+    mouseState.width  = width;
+    mouseState.height = height;
+  }
+
+  /**
+    @brief Sets the input mode to either GUI, inGame or Buffer
+    @param mode The new input mode
+    @remark Only has an affect if the mode actually changes
+  */
+  void InputManager::setInputMode(InputMode mode)
+  {
+    this->setMode_ = mode;
+  }
+
+  /**
+    @brief Returns the current input handling method
+    @return The current input mode.
+  */
+  InputMode InputManager::getInputMode()
+  {
+    return this->currentMode_;
+  }
+
+}
Index: code/trunk/src/core/InputManager.h
===================================================================
--- code/trunk/src/core/InputManager.h	(revision 1055)
+++ code/trunk/src/core/InputManager.h	(revision 1055)
@@ -0,0 +1,104 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of a little Input handler that distributes everything
+        coming from OIS.
+ */
+
+#ifndef _InputManager_H__
+#define _InputManager_H__
+
+#include <OIS/OIS.h>
+
+#include "CorePrereqs.h"
+#include "core/Tickable.h"
+#include "InputEvent.h"
+
+namespace orxonox
+{
+  /**
+    @brief Designates the way input is handled currently.
+    IM_GUI:      All the OIS input events are passed to CEGUI
+    IM_KEYBOARD: Only keyboard input is captured and passed to the InputBuffer
+    IM_INGAME:   Normal game mode. Key bindings and mouse are active.
+  */
+  enum InputMode
+  {
+    IM_GUI      = 0,
+    IM_KEYBOARD = 1,
+    IM_INGAME   = 2,
+    IM_UNINIT   = 3,
+  };
+
+  /**
+    @brief Captures and distributes mouse and keyboard input.
+    It resolves the key bindings to InputEvents which can be heard by
+    implementing the InputEventListener interface.
+  */
+  class _CoreExport InputManager
+        : public Tickable
+  {
+  public:
+    bool initialise(size_t windowHnd, int windowWidth, int windowHeight);
+    void destroy();
+    void tick(float dt);
+    void setWindowExtents(int width, int height);
+    void setInputMode(InputMode mode);
+    InputMode getInputMode();
+
+    // Temporary solutions. Will be removed soon!
+    OIS::Mouse    *getMouse()    { return this->mouse_   ; }
+    OIS::Keyboard *getKeyboard() { return this->keyboard_; }
+
+    static InputManager& getSingleton();
+    static InputManager* getSingletonPtr() { return &getSingleton(); }
+
+  private:
+    // don't mess with a Singleton
+    InputManager ();
+    InputManager (const InputManager&);
+    ~InputManager();
+
+    OIS::InputManager *inputSystem_;    //!< OIS input manager
+    OIS::Keyboard     *keyboard_;       //!< OIS mouse
+    OIS::Mouse        *mouse_;          //!< OIS keyboard
+
+    InputMode          currentMode_;    //!< Input mode currently used
+    InputMode          setMode_;        //!< Input mode that has been set lately
+    InputHandlerGUI   *handlerGUI_;     //!< Handles the input if in GUI mode
+    // FIXME: insert the InputBuffer once merged with core2
+    InputHandlerGUI   *handlerBuffer_;  //!< Handles the input if in Buffer mode
+    InputHandlerGame  *handlerGame_;    //!< Handles the input if in Game mode
+
+    //! Pointer to the instance of the singleton
+    //static InputManager *singletonRef_s;
+  };
+}
+
+#endif /* _InputManager_H__ */
Index: code/trunk/src/core/Iterator.h
===================================================================
--- code/trunk/src/core/Iterator.h	(revision 1055)
+++ code/trunk/src/core/Iterator.h	(revision 1055)
@@ -0,0 +1,171 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Iterator.h
+    @brief Definition and implementation of the Iterator class.
+
+    The Iterator of a given class allows to iterate through an ObjectList, containing all objects of that type.
+    This is the only way to access the objects stored in an ObjectList.
+
+    Usage:
+    for (Iterator<class> it = ObjectList<class>::start(); it != 0; ++it)
+    {
+        it->someFunction(...);
+        class* myObject = *it;
+    }
+
+    Warning: Don't delete objects directly through the iterator.
+*/
+
+#ifndef _Iterator_H__
+#define _Iterator_H__
+
+#include "CorePrereqs.h"
+
+#include "ObjectList.h"
+#include "Debug.h"
+
+namespace orxonox
+{
+    //! The iterator allows to iterate through an ObjectList of a given class.
+    template <class T>
+    class Iterator
+    {
+        public:
+            /**
+                @brief Constructor: Sets the element, whereon the iterator points, to zero.
+            */
+            Iterator()
+            {
+                this->element_ = 0;
+            }
+
+            /**
+                @brief Constructor: Sets the element, whereon the iterator points, to a given element.
+                @param element The element to start with
+            */
+            Iterator(ObjectListElement<T>* element)
+            {
+                this->element_ = element;
+            }
+
+            /**
+                @brief Assigns an element to the iterator.
+                @param element The element
+            */
+            Iterator<T> operator=(ObjectListElement<T>* element)
+            {
+                this->element_ = element;
+            }
+
+            /**
+                @brief Overloading of the ++it operator: Iterator points to the next object in the list.
+                @return The Iterator itself
+            */
+            Iterator<T> operator++()
+            {
+                this->element_ = this->element_->next_;
+                return *this;
+            }
+
+            /**
+                @brief Overloading of the it++ operator: Iterator points to the next object in the list.
+                @return The Iterator itself
+            */
+            Iterator<T> operator++(int i)
+            {
+                Iterator<T> copy = *this;
+                this->element_ = this->element_->next_;
+                return copy;
+            }
+
+            /**
+                @brief Overloading of the --it operator: Iterator points to the previous object in the list.
+                @return The Iterator itself
+            */
+            Iterator<T> operator--()
+            {
+                this->element_ = this->element_->prev_;
+                return *this;
+            }
+
+            /**
+                @brief Overloading of the it-- operator: Iterator points to the previous object in the list.
+                @return The Iterator itself
+            */
+            Iterator<T> operator--(int i)
+            {
+                Iterator<T> copy = *this;
+                this->element_ = this->element_->prev_;
+                return copy;
+            }
+
+            /**
+                @brief Overloading of the *it operator: returns the pointer to the object.
+                @return The object the Iterator points at
+            */
+            T* operator*()
+            {
+                return this->element_->object_;
+            }
+
+            /**
+                @brief Overloading of the it-> operator: returns the pointer to the object.
+                @return The object the Iterator points at
+            */
+            T* operator->() const
+            {
+                return this->element_->object_;
+
+            }
+
+            /**
+                @brief Overloading of the typecast-operator to bool: returns true if the iterator points to an existing object.
+                @return True if the iterator points to an existing object.
+            */
+            operator bool()
+            {
+                return (this->element_ != 0);
+            }
+
+            /**
+                @brief Overloading of the (it != int) operator: Used for (it != 0) instead of typecast-operator to bool.
+                @param compare The integer (must be zero, everything else makes no sense).
+                @return True if the iterator points to an existing object.
+            */
+            bool operator!=(ObjectListElement<T>* compare)
+            {
+                return (this->element_ != compare);
+            }
+
+        private:
+            ObjectListElement<T>* element_;     //!< The element the Iterator points at
+    };
+}
+
+#endif /* _Iterator_H__ */
Index: code/trunk/src/core/Language.cc
===================================================================
--- code/trunk/src/core/Language.cc	(revision 1055)
+++ code/trunk/src/core/Language.cc	(revision 1055)
@@ -0,0 +1,318 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Language.cc
+    @brief Implementation of the Language and the LanguageEntry classes.
+*/
+
+#include <fstream>
+
+#include "Language.h"
+#include "CoreSettings.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###      LanguageEntry      ###
+    // ###############################
+    /**
+        @brief Constructor: Sets the default entry.
+        @param fallbackEntry The default entry
+    */
+    LanguageEntry::LanguageEntry(const std::string& fallbackEntry)
+    {
+        this->fallbackEntry_ = fallbackEntry;
+        this->localisedEntry_ = fallbackEntry; // Set the localisation to the fallback entry, for the case that no translation gets assigned
+        this->bLocalisationSet_ = false;
+    }
+
+    /**
+        @brief Sets the localisation of the entry.
+        @param localisation The localisation
+    */
+    void LanguageEntry::setLocalisation(const std::string& localisation)
+    {
+        // Check if the translation is more than just an empty string
+        if ((localisation != "") && (localisation.size() > 0))
+        {
+            this->localisedEntry_ = localisation;
+            this->bLocalisationSet_ = true;
+        }
+        else
+            this->localisedEntry_ = this->fallbackEntry_;
+    }
+
+    /**
+        @brief Sets the default entry.
+        @param fallbackEntry The default entry
+    */
+    void LanguageEntry::setDefault(const std::string& fallbackEntry)
+    {
+        // If the default entry changes and the translation wasn't set yet, use the new default entry as translation
+        if (!this->bLocalisationSet_)
+            this->localisedEntry_ = fallbackEntry;
+
+        this->fallbackEntry_ = fallbackEntry;
+    }
+
+    // ###############################
+    // ###        Language         ###
+    // ###############################
+    /**
+        @brief Constructor: Reads the default language file and sets some values.
+    */
+    Language::Language()
+    {
+        this->defaultLanguage_ = "default";
+        this->defaultLocalisation_ = "ERROR: LANGUAGE ENTRY DOESN'T EXIST!";
+
+        // Read the default language file to create all known LanguageEntry objects
+        this->readDefaultLanguageFile();
+    }
+
+    /**
+        @brief Returns a reference to the only existing instance of the Language class and calls the setConfigValues() function.
+        @return The reference to the only existing instance
+    */
+    Language& Language::getLanguage()
+    {
+        static Language instance = Language();
+        return instance;
+    }
+
+    /**
+        @brief Creates a new LanguageEntry with a given label and a given default entry.
+        @param label The label of the entry
+        @param entry The default entry
+        @return The created LanguageEntry object
+    */
+    LanguageEntry* Language::createEntry(const LanguageEntryLabel& label, const std::string& entry)
+    {
+        std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(label);
+
+        // Make sure we don't create a duplicate entry
+        if (it == this->languageEntries_.end())
+        {
+            LanguageEntry* newEntry = new LanguageEntry(entry);
+            newEntry->setLabel(label);
+            this->languageEntries_[label] = newEntry;
+            return newEntry;
+        }
+
+        COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFileName(this->defaultLanguage_) << "!" << std::endl;
+        return it->second;
+    }
+
+    /**
+        @brief Adds a new LanguageEntry, if it's not already existing.
+        @param label The label of the entry
+        @param entry The default entry
+    */
+    void Language::addEntry(const LanguageEntryLabel& label, const std::string& entry)
+    {
+        COUT(5) << "Language: Called addEntry with\n  label: " << label << "\n  entry: " <<  entry << std::endl;
+        std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(label);
+        if (it == this->languageEntries_.end())
+        {
+            // The entry isn't available yet, meaning it's new, so create it
+            this->createEntry(label, entry);
+        }
+        else if (it->second->getDefault().compare(entry) == 0)
+        {
+            // The entry is available and the default string is the same, so return because everything is fine
+            return;
+        }
+        else
+        {
+            // The defined default entry is not the same as in the default language file - change it to the new entry
+            it->second->setDefault(entry);
+        }
+
+        // Write the default language file because either a new entry was created or an existing entry has changed
+        this->writeDefaultLanguageFile();
+
+    }
+
+    /**
+        @brief Returns the localisation of a given entry.
+        @param label The label of the entry
+        @return The localisation
+    */
+    const std::string& Language::getLocalisation(const LanguageEntryLabel& label) const
+    {
+        std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(label);
+        if (it != this->languageEntries_.end())
+            return it->second->getLocalisation();
+        else
+        {
+            // Uh, oh, an undefined entry was requested: return the default string
+            COUT(2) << "Warning: Language entry \"" << label << "\" not found!" << std::endl;
+            return this->defaultLocalisation_;
+        }
+    }
+
+    /**
+        @brief Creates the name of the language file out of the languages name.
+        @param language The name of the language
+        @return The filename
+    */
+    const std::string Language::getFileName(const std::string& language)
+    {
+        return std::string("translation_" + language + ".lang");
+    }
+
+    /**
+        @brief Reads the default language file and creates a LanguageEntry objects for every entry.
+    */
+    void Language::readDefaultLanguageFile()
+    {
+        COUT(4) << "Read default language file." << std::endl;
+
+        // This creates the file if it's not existing
+        std::ofstream createFile;
+        createFile.open(getFileName(this->defaultLanguage_).c_str(), std::fstream::app);
+        createFile.close();
+
+        // Open the file
+        std::ifstream file;
+        file.open(getFileName(this->defaultLanguage_).c_str(), std::fstream::in);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "An error occurred in Language.cc:" << std::endl;
+            COUT(1) << "Error: Couldn't open file " << getFileName(this->defaultLanguage_) << " to read the default language entries!" << std::endl;
+            return;
+        }
+
+        char line[1024];
+
+        // Iterate through the file and create the LanguageEntries
+        while (file.good() && !file.eof())
+        {
+            file.getline(line, 1024);
+            std::string lineString = std::string(line);
+
+            // Check if the line is empty
+            if ((lineString != "") && (lineString.size() > 0))
+            {
+                unsigned int pos = lineString.find('=');
+
+                // Check if the length is at least 3 and if there's an entry before and behind the =
+                if (pos > 0 && pos < (lineString.size() - 1) && lineString.size() >= 3)
+                    this->createEntry(lineString.substr(0, pos), lineString.substr(pos + 1));
+                else
+                {
+                    COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFileName(this->defaultLanguage_) << std::endl;
+                }
+            }
+        }
+
+        file.close();
+    }
+
+    /**
+        @brief Reads the language file of the configured language and assigns the localisation to the corresponding LanguageEntry object.
+    */
+    void Language::readTranslatedLanguageFile()
+    {
+        COUT(4) << "Read translated language file (" << CoreSettings::getLanguage() << ")." << std::endl;
+
+        // Open the file
+        std::ifstream file;
+        file.open(getFileName(CoreSettings::getLanguage()).c_str(), std::fstream::in);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "An error occurred in Language.cc:" << std::endl;
+            COUT(1) << "Error: Couldn't open file " << getFileName(CoreSettings::getLanguage()) << " to read the translated language entries!" << std::endl;
+            CoreSettings::resetLanguage();
+            COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << "." << std::endl;
+            return;
+        }
+
+        char line[1024];
+
+        // Iterate through the file and create the LanguageEntries
+        while (file.good() && !file.eof())
+        {
+            file.getline(line, 1024);
+            std::string lineString = std::string(line);
+
+            // Check if the line is empty
+            if ((lineString != "") && (lineString.size() > 0))
+            {
+                unsigned int pos = lineString.find('=');
+
+                // Check if the length is at least 3 and if there's an entry before and behind the =
+                if (pos > 0 && pos < (lineString.size() - 1) && lineString.size() >= 3)
+                {
+                    std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(lineString.substr(0, pos));
+
+                    // Check if the entry exists
+                    if (it != this->languageEntries_.end())
+                        it->second->setLocalisation(lineString.substr(pos + 1));
+                    else
+                        this->createEntry(lineString.substr(0, pos), this->defaultLocalisation_)->setLocalisation(lineString.substr(pos + 1));
+                }
+                else
+                {
+                    COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFileName(CoreSettings::getLanguage()) << std::endl;
+                }
+            }
+        }
+
+        file.close();
+    }
+
+    /**
+        @brief Writes all default entries to the default language file.
+    */
+    void Language::writeDefaultLanguageFile() const
+    {
+        COUT(4) << "Language: Write default language file." << std::endl;
+
+        // Open the file
+        std::ofstream file;
+        file.open(getFileName(this->defaultLanguage_).c_str(), std::fstream::out);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "An error occurred in Language.cc:" << std::endl;
+            COUT(1) << "Error: Couldn't open file " << getFileName(this->defaultLanguage_) << " to write the default language entries!" << std::endl;
+            return;
+        }
+
+        // Iterate through the list an write the lines into the file
+        for (std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
+        {
+            file << (*it).second->getLabel() << "=" << (*it).second->getDefault() << std::endl;
+        }
+
+        file.close();
+    }
+}
Index: code/trunk/src/core/Language.h
===================================================================
--- code/trunk/src/core/Language.h	(revision 1055)
+++ code/trunk/src/core/Language.h	(revision 1055)
@@ -0,0 +1,139 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Language.h
+    @brief Definition of the Language and the LanguageEntry class.
+
+    The Language class is used, to get a localisation of a string in the configured language.
+    The string is identified by another string, the label of the entry.
+    If the translation in the configured language isn't available, the default entry, defined in the code, is used.
+
+    Usage:
+     - Set the entry with the default string:
+       Language::getLanguage()->addEntry("label of the entry", "the string to translate");
+
+     - Get the localisation of the entry in the configured language:
+       std::cout << Language::getLanguage()->getLocalisation("name of the entry") << std::endl;
+*/
+
+#ifndef _Language_H__
+#define _Language_H__
+
+#include <map>
+#include <string>
+
+#include "CorePrereqs.h"
+
+
+#define AddLanguageEntry(label, fallbackstring) \
+    orxonox::Language::getLanguage().addEntry(label, fallbackstring)
+
+#define GetLocalisation(label) \
+    orxonox::Language::getLanguage().getLocalisation(label)
+
+
+namespace orxonox
+{
+    // ###############################
+    // ###      LanguageEntry      ###
+    // ###############################
+    //! The LanguageEntry class stores the default- and the translated string of a given entry in the language file.
+    class _CoreExport LanguageEntry
+    {
+        public:
+            explicit LanguageEntry(const std::string& fallbackEntry);
+            void setLocalisation(const std::string& localisation);
+            void setDefault(const std::string& fallbackEntry);
+
+            /**
+              @brief Returns the localised entry in the configured language.
+              @return The translated entry
+            */
+            inline const std::string& getLocalisation()
+                { return this->localisedEntry_; }
+
+            /**
+              @brief Returns the default entry.
+              @return The default entry
+            */
+            inline const std::string& getDefault()
+                { return this->fallbackEntry_; }
+
+            /**
+                @brief Sets the label of this entry.
+                @param label The label
+            */
+            inline void setLabel(const LanguageEntryLabel& label)
+                { this->label_ = label; }
+
+            /**
+                @brief Returns the label of this entry.
+                @return The label
+            */
+            inline const LanguageEntryLabel& getLabel() const
+                { return this->label_; }
+
+        private:
+            LanguageEntryLabel label_;              //!< The label of the entry
+            std::string fallbackEntry_;             //!< The default entry: Used, if no translation is available or no language configured
+            std::string localisedEntry_;            //!< The localised entry in the configured language
+            bool bLocalisationSet_;                 //!< True if the translation was set
+    };
+
+
+    // ###############################
+    // ###         Language        ###
+    // ###############################
+    //! The Language class manges the language files and entries and stores the LanguageEntry objects in a map.
+    class _CoreExport Language
+    {
+        friend class CoreSettings;
+
+        public:
+            static Language& getLanguage();
+            void addEntry(const LanguageEntryLabel& label, const std::string& entry);
+            const std::string& getLocalisation(const LanguageEntryLabel& label) const;
+
+        private:
+            Language();
+            Language(const Language& language) {}   // don't copy
+            virtual ~Language() {};                 // don't delete
+
+            void readDefaultLanguageFile();
+            void readTranslatedLanguageFile();
+            void writeDefaultLanguageFile() const;
+            static const std::string getFileName(const std::string& language);
+            LanguageEntry* createEntry(const LanguageEntryLabel& label, const std::string& entry);
+
+            std::string defaultLanguage_;                           //!< The default language
+            std::string defaultLocalisation_;                       //!< The returned string, if an entry unavailable entry is requested
+            std::map<std::string, LanguageEntry*> languageEntries_; //!< A map to store all LanguageEntry objects and their labels
+    };
+}
+
+#endif /* _Language_H__ */
Index: code/trunk/src/core/Level.h
===================================================================
--- code/trunk/src/core/Level.h	(revision 1055)
+++ code/trunk/src/core/Level.h	(revision 1055)
@@ -0,0 +1,53 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Level_H__
+#define _Level_H__
+
+#include <string>
+
+#include "CorePrereqs.h"
+#include "ClassTreeMask.h"
+
+namespace orxonox
+{
+    class _CoreExport Level
+    {
+        public:
+            Level(const std::string& file) : file_(file) {}
+            Level(const std::string& file, const ClassTreeMask& mask) : file_(file), mask_(mask) {};
+
+            const std::string& getFile() const { return this->file_; }
+            const ClassTreeMask& getMask() const { return this->mask_; }
+
+        private:
+            std::string file_;
+            ClassTreeMask mask_;
+    };
+}
+
+#endif /* _Level_H__ */
Index: code/trunk/src/core/Loader.cc
===================================================================
--- code/trunk/src/core/Loader.cc	(revision 1055)
+++ code/trunk/src/core/Loader.cc	(revision 1055)
@@ -0,0 +1,179 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Loader.h"
+#include "Level.h"
+#include "BaseObject.h"
+#include "Identifier.h"
+#include "Iterator.h"
+#include "Debug.h"
+#include "CoreIncludes.h"
+#include "Script.h"
+#include "Namespace.h"
+
+#include "util/tinyxml/ticpp.h"
+
+namespace orxonox
+{
+    std::vector<std::pair<const Level*, ClassTreeMask> > Loader::levels_s;
+    ClassTreeMask Loader::currentMask_s;
+
+    bool Loader::open(const Level* level, const ClassTreeMask& mask)
+    {
+        Loader::add(level, mask);
+        return Loader::load(level, mask);
+    }
+
+    void Loader::close()
+    {
+        Loader::unload();
+        Loader::levels_s.clear();
+    }
+
+    void Loader::close(const Level* level)
+    {
+        Loader::unload(level);
+        Loader::remove(level);
+    }
+
+    void Loader::add(const Level* level, const ClassTreeMask& mask)
+    {
+        Loader::levels_s.insert(Loader::levels_s.end(), std::pair<const Level*, ClassTreeMask>(level, mask));
+    }
+
+    void Loader::remove(const Level* level)
+    {
+        for (std::vector<std::pair<const Level*, ClassTreeMask> >::iterator it = Loader::levels_s.begin(); it != Loader::levels_s.end(); ++it)
+        {
+            if ((*it).first == level)
+            {
+                Loader::levels_s.erase(it);
+                break;
+            }
+        }
+    }
+
+    bool Loader::load(const ClassTreeMask& mask)
+    {
+        bool success = true;
+        for (std::vector<std::pair<const Level*, ClassTreeMask> >::iterator it = Loader::levels_s.begin(); it != Loader::levels_s.end(); ++it)
+            if (!Loader::load((*it).first, (*it).second * mask))
+                success = false;
+
+        return success;
+    }
+
+    void Loader::unload(const ClassTreeMask& mask)
+    {
+        for (Iterator<BaseObject> it = ObjectList<BaseObject>::begin(); it; )
+        {
+            if (mask.isIncluded(it->getIdentifier()))
+                delete (*(it++));
+            else
+                ++it;
+        }
+    }
+
+    bool Loader::reload(const ClassTreeMask& mask)
+    {
+        Loader::unload(mask);
+        return Loader::load(mask);
+    }
+
+    bool Loader::load(const Level* level, const ClassTreeMask& mask)
+    {
+        Loader::currentMask_s = level->getMask() * mask;
+
+        // let Lua work this out:
+        //Script* lua;
+        /*Script::loadFile(level->getFile(), true);
+        Script::init(Script::getLuaState());
+        Script::run();*/
+        Script* lua = Script::getInstance();
+        lua->loadFile(level->getFile(), true);
+        lua->run();
+
+        try
+        {
+            COUT(0) << "Start loading " << level->getFile() << "..." << std::endl;
+            COUT(3) << "Mask: " << Loader::currentMask_s << std::endl;
+
+            //ticpp::Document xmlfile(level->getFile());
+            //xmlfile.LoadFile();
+            //ticpp::Element myelement(*Script::getFileString());
+            ticpp::Document xmlfile;
+            //xmlfile.ToDocument();
+            xmlfile.Parse(lua->getLuaOutput(), true);
+
+            ticpp::Element rootElement;
+            rootElement.SetAttribute("name", "root");
+            rootElement.SetAttribute("bAutogenerated", true);
+
+            for (ticpp::Iterator<ticpp::Element> child = xmlfile.FirstChildElement(false); child != child.end(); child++)
+                rootElement.InsertEndChild(*child);
+
+            COUT(4) << "  creating root-namespace..." << std::endl;
+            Namespace* rootNamespace = new Namespace();
+            rootNamespace->setLoaderIndentation("    ");
+            rootNamespace->setLevel(level);
+            rootNamespace->setNamespace(rootNamespace);
+            rootNamespace->setRoot(true);
+            rootNamespace->XMLPort(rootElement, XMLPort::LoadObject);
+
+            COUT(0) << "Finished loading " << level->getFile() << "." << std::endl;
+
+            COUT(4) << "Namespace-tree:" << std::endl << rootNamespace->toString("  ") << std::endl;
+
+            return true;
+        }
+        catch(ticpp::Exception& ex)
+        {
+            COUT(1) << std::endl;
+            COUT(1) << "An error occurred in Loader.cc while loading " << level->getFile() << ":" << std::endl;
+            COUT(1) << ex.what() << std::endl;
+            COUT(1) << "Loading aborted." << std::endl;
+            return false;
+        }
+    }
+
+    void Loader::unload(const Level* level, const ClassTreeMask& mask)
+    {
+        for (Iterator<BaseObject> it = ObjectList<BaseObject>::begin(); it; )
+        {
+            if ((it->getLevel() == level) && mask.isIncluded(it->getIdentifier()))
+                delete (*(it++));
+            else
+                ++it;
+        }
+    }
+
+    bool Loader::reload(const Level* level, const ClassTreeMask& mask)
+    {
+        Loader::unload(level, mask);
+        return Loader::load(level, mask);
+    }
+}
Index: code/trunk/src/core/Loader.h
===================================================================
--- code/trunk/src/core/Loader.h	(revision 1055)
+++ code/trunk/src/core/Loader.h	(revision 1055)
@@ -0,0 +1,65 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Loader_H__
+#define _Loader_H__
+
+#include <vector>
+
+#include "ClassTreeMask.h"
+#include "Level.h"
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    class _CoreExport Loader
+    {
+        public:
+            static bool open(const Level* level, const ClassTreeMask& mask = ClassTreeMask());
+            static void close();
+            static void close(const Level* level);
+
+            static void add(const Level* level, const ClassTreeMask& mask = ClassTreeMask());
+            static void remove(const Level* level);
+
+            static bool load(const ClassTreeMask& mask = ClassTreeMask());
+            static void unload(const ClassTreeMask& mask = ClassTreeMask());
+            static bool reload(const ClassTreeMask& mask = ClassTreeMask());
+
+            static bool load(const Level* level, const ClassTreeMask& mask = ClassTreeMask());
+            static void unload(const Level* level, const ClassTreeMask& mask = ClassTreeMask());
+            static bool reload(const Level* level, const ClassTreeMask& mask = ClassTreeMask());
+
+            static ClassTreeMask currentMask_s;
+
+        private:
+            static std::vector<std::pair<const Level*, ClassTreeMask> > levels_s;
+    };
+}
+
+#endif /* _Loader_H__ */
Index: code/trunk/src/core/MetaObjectList.cc
===================================================================
--- code/trunk/src/core/MetaObjectList.cc	(revision 1055)
+++ code/trunk/src/core/MetaObjectList.cc	(revision 1055)
@@ -0,0 +1,58 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file MetaObjectList.cc
+    @brief Implementation of the MetaObjectList class.
+*/
+
+#include "MetaObjectList.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor: Sets first_ to zero.
+    */
+    MetaObjectList::MetaObjectList()
+    {
+        this->first_ = 0;
+    }
+
+    /**
+        @brief Destructor: Removes all elements from the list, causing them to remove the stored ObjectListElement from the ObjectList.
+    */
+    MetaObjectList::~MetaObjectList()
+    {
+        BaseMetaObjectListElement* temp;
+        while (this->first_)
+        {
+            temp = this->first_->next_;
+            delete this->first_;
+            this->first_ = temp;
+        }
+    }
+}
Index: code/trunk/src/core/MetaObjectList.h
===================================================================
--- code/trunk/src/core/MetaObjectList.h	(revision 1055)
+++ code/trunk/src/core/MetaObjectList.h	(revision 1055)
@@ -0,0 +1,140 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file MetaObjectList.h
+    @brief Definition of the MetaObjectList class.
+
+    The MetaObjectList is a single-linked list, containing all list-elements and their
+    lists wherein the object, owning the MetaObjectList, is registered.
+    This allows much faster deletion of objects because no iteration is needed.
+*/
+
+#ifndef _MetaObjectList_H__
+#define _MetaObjectList_H__
+
+#include "CorePrereqs.h"
+
+#include "ObjectList.h"
+#include "Identifier.h"
+#include "Debug.h"
+
+namespace orxonox
+{
+    //! Base-class of MetaObjectListElement, because those is a template
+    class BaseMetaObjectListElement
+    {
+        public:
+            /** @brief Default destructor */
+            virtual ~BaseMetaObjectListElement() {};
+
+            BaseMetaObjectListElement* next_;       //!< The next Element in the list
+    };
+
+    // ###############################
+    // ###  MetaObjectListElement  ###
+    // ###############################
+    //! The list-element of the MetaObjectList
+    template <class T>
+    class MetaObjectListElement : public BaseMetaObjectListElement
+    {
+        public:
+            MetaObjectListElement(ObjectList<T>* list, ObjectListElement<T>* element);
+            virtual ~MetaObjectListElement();
+
+            ObjectListElement<T>* element_;         //!< The list element, containing the object
+            ObjectList<T>* list_;                   //!< The list, containing the element
+    };
+
+    /**
+        @brief Constructor: Creates the list-element with given list and element.
+    */
+    template <class T>
+    MetaObjectListElement<T>::MetaObjectListElement(ObjectList<T>* list, ObjectListElement<T>* element)
+    {
+        this->element_ = element;
+        this->list_ = list;
+        this->next_ = 0;
+    }
+
+    /**
+        @brief Destructor: Removes the ObjectListElement from the ObjectList by linking next_ and prev_ of the ObjectListElement.
+    */
+    template <class T>
+    MetaObjectListElement<T>::~MetaObjectListElement()
+    {
+        if (this->element_->next_)
+            this->element_->next_->prev_ = this->element_->prev_;
+        else
+            this->list_->last_ = this->element_->prev_; // If there is no next_, we deleted the last object and have to update the last_ pointer of the list
+
+        if (this->element_->prev_)
+            this->element_->prev_->next_ = this->element_->next_;
+        else
+            this->list_->first_ = this->element_->next_; // If there is no prev_, we deleted the first object and have to update the first_ pointer of the list
+
+
+        COUT(5) << "*** MetaObjectList: Removing Object from " << ClassManager<T>::getIdentifier()->getName() << "-list." << std::endl;
+        delete this->element_;
+    }
+
+
+    // ###############################
+    // ###       ObjectList        ###
+    // ###############################
+    //!  The MetaObjectList contains ObjectListElements and their ObjectLists.
+    /**
+        The MetaObjectList is a single-linked list, containing all list-elements and their
+        lists wherein the object that owns the MetaObjectList is registered.
+        This allows much faster deletion of objects because no iteration is needed.
+    */
+    class _CoreExport MetaObjectList
+    {
+        public:
+            MetaObjectList();
+            ~MetaObjectList();
+            template <class T>
+            void add(ObjectList<T>* list, ObjectListElement<T>* element);
+
+            BaseMetaObjectListElement* first_;      //!< The first element in the list
+    };
+
+    /**
+        @brief Adds an ObjectList and an element of that list to the MetaObjectList.
+        @param list The ObjectList wherein the element is
+        @param element The element wherein the object is
+    */
+    template <class T>
+    void MetaObjectList::add(ObjectList<T>* list, ObjectListElement<T>* element)
+    {
+        BaseMetaObjectListElement* temp = this->first_;
+        this->first_ = new MetaObjectListElement<T>(list, element);
+        this->first_->next_ = temp;
+    }
+}
+
+#endif /* _MetaObjectList_H__ */
Index: code/trunk/src/core/Namespace.cc
===================================================================
--- code/trunk/src/core/Namespace.cc	(revision 1055)
+++ code/trunk/src/core/Namespace.cc	(revision 1055)
@@ -0,0 +1,179 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Namespace.h"
+#include "CoreIncludes.h"
+#include "XMLPort.h"
+#include "util/SubString.h"
+#include "NamespaceNode.h"
+
+namespace orxonox
+{
+    CreateFactory(Namespace);
+
+    Namespace::Namespace()
+    {
+        RegisterObject(Namespace);
+
+        this->bAutogeneratedFileRootNamespace_ = false;
+        this->bRoot_ = false;
+        this->operator_ = "or";
+    }
+
+    Namespace::~Namespace()
+    {
+        if (this->bRoot_)
+            for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
+                delete (*it);
+    }
+
+    /**
+        @brief XML loading and saving.
+        @param xmlelement The XML-element
+        @param loading Loading (true) or saving (false)
+        @return The XML-element
+    */
+    void Namespace::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        BaseObject::XMLPort(xmlelement, mode);
+
+        std::string name = this->getName();
+        unsigned int pos = 0;
+        while ((pos = name.find(',')) != std::string::npos)
+            name.replace(pos, 1, " ");
+        while ((pos = name.find(';')) != std::string::npos)
+            name.replace(pos, 1, " ");
+        while ((pos = name.find('\n')) != std::string::npos)
+            name.replace(pos, 1, " ");
+        while ((pos = name.find('\t')) != std::string::npos)
+            name.replace(pos, 1, " ");
+        SubString tokens(name, " ", "", false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (this->bRoot_)
+        {
+            this->representingNamespaces_.insert(new NamespaceNode(this->getName()));
+        }
+        else
+        {
+            for (unsigned int i = 0; i < tokens.size(); i++)
+            {
+                for (std::set<NamespaceNode*>::iterator it = this->getNamespace()->representingNamespaces_.begin(); it != this->getNamespace()->representingNamespaces_.end(); ++it)
+                {
+                    std::set<NamespaceNode*> temp = (*it)->getNodeRelative(tokens[i]);
+                    this->representingNamespaces_.insert(temp.begin(), temp.end());
+                }
+            }
+        }
+
+        XMLPortParam(Namespace, "operator", setOperator, getOperator, xmlelement, mode);
+        XMLPortParam(Namespace, "bAutogenerated", setAutogenerated, isAutogenerated, xmlelement, mode);
+
+        if (this->bAutogeneratedFileRootNamespace_)
+        {
+            for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
+            {
+                (*it)->setRoot(true);
+                (*it)->setHidden(true);
+            }
+        }
+
+        XMLPortObject(Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, mode, true, false);
+    }
+
+    void Namespace::loadObjects(BaseObject* object)
+    {
+        object->setNamespace(this);
+    }
+
+    const BaseObject* Namespace::saveObjects(unsigned int index) const
+    {
+        return 0; // todo
+    }
+
+    bool Namespace::includes(const Namespace* ns) const
+    {
+        for (std::set<NamespaceNode*>::const_iterator it1 = this->representingNamespaces_.begin(); it1 != this->representingNamespaces_.end(); ++it1)
+        {
+            for (std::set<NamespaceNode*>::const_iterator it2 = ns->representingNamespaces_.begin(); it2 != ns->representingNamespaces_.end(); ++it2)
+            {
+                if ((*it1)->includes(*it2))
+                {
+                    if (this->operator_ == "or")
+                        return true;
+
+                    if (this->operator_ == "not")
+                        return false;
+                }
+                else
+                {
+                    if (this->operator_ == "and")
+                        return false;
+                }
+            }
+        }
+
+        if (this->operator_ == "or")
+            return false;
+        else if (this->operator_ == "and")
+            return true;
+        else if (this->operator_ == "not")
+            return true;
+
+        return false;
+    }
+
+    std::string Namespace::toString() const
+    {
+        std::string output;
+
+        int i = 0;
+        for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
+        {
+            if (i > 0)
+                output += " / ";
+
+            output += (*it)->toString();
+        }
+
+        return output;
+    }
+
+    std::string Namespace::toString(const std::string& indentation) const
+    {
+        std::string output;
+
+        int i = 0;
+        for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
+        {
+            if (i > 0)
+                output += "\n";
+
+            output += (*it)->toString(indentation);
+        }
+
+        return output;
+    }
+}
Index: code/trunk/src/core/Namespace.h
===================================================================
--- code/trunk/src/core/Namespace.h	(revision 1055)
+++ code/trunk/src/core/Namespace.h	(revision 1055)
@@ -0,0 +1,78 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Namespace_H__
+#define _Namespace_H__
+
+#include <map>
+
+#include "BaseObject.h"
+#include "util/XMLIncludes.h"
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    class Namespace : public BaseObject
+    {
+        public:
+            Namespace();
+            virtual ~Namespace();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            void loadObjects(BaseObject* object);
+            const BaseObject* saveObjects(unsigned int index) const;
+
+            void setAutogenerated(bool bAutogenerated)
+                { this->bAutogeneratedFileRootNamespace_ = bAutogenerated; }
+            bool isAutogenerated() const
+                { return this->bAutogeneratedFileRootNamespace_; }
+
+            void setOperator(const std::string& op)
+                { this->operator_ = op; }
+            const std::string& getOperator() const
+                { return this->operator_; }
+
+            void setRoot(bool bRoot)
+                { this->bRoot_ = bRoot; }
+
+            bool includes(const Namespace* ns) const;
+            bool isIncludedIn(const Namespace* ns) const { return ns->includes(this); }
+
+            std::string toString() const;
+            std::string toString(const std::string& indentation) const;
+
+        private:
+            std::set<NamespaceNode*> representingNamespaces_;
+            bool bAutogeneratedFileRootNamespace_;
+            bool bRoot_;
+            std::string operator_;
+    };
+}
+
+#endif /* _Namespace_H__ */
Index: code/trunk/src/core/NamespaceNode.cc
===================================================================
--- code/trunk/src/core/NamespaceNode.cc	(revision 1055)
+++ code/trunk/src/core/NamespaceNode.cc	(revision 1055)
@@ -0,0 +1,173 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "NamespaceNode.h"
+#include "Debug.h"
+
+namespace orxonox
+{
+    NamespaceNode::NamespaceNode(const std::string& name, NamespaceNode* parent)
+    {
+        this->name_ = name;
+        this->parent_ = parent;
+        this->bRoot_ = false;
+        this->bHidden_ = false;
+    }
+
+    NamespaceNode::~NamespaceNode()
+    {
+        for (std::map<std::string, NamespaceNode*>::iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); )
+            delete ((*(it++)).second);
+    }
+
+    std::set<NamespaceNode*> NamespaceNode::getNodeRelative(const std::string& name)
+    {
+        std::set<NamespaceNode*> nodes;
+
+        if ((name.size() == 0) || (name == ""))
+        {
+            nodes.insert(this);
+        }
+        else
+        {
+            unsigned int pos = name.find("::");
+            std::string firstPart = name;
+            std::string secondPart;
+
+            if (pos != std::string::npos)
+            {
+                firstPart = name.substr(0, pos);
+                secondPart = name.substr(pos + 2, std::string::npos);
+            }
+
+            if (firstPart == "..")
+            {
+                if (this->bRoot_)
+                {
+                    COUT(2) << "Warning: Can't go to enclosing namespace with '..' operator in namespace " << this->name_ << ", namespace is root." << std::endl;
+                    nodes = this->getNodeRelative(secondPart);
+                }
+                else if (!this->parent_)
+                {
+                    COUT(2) << "Warning: Can't go to enclosing namespace with '..' operator in namespace " << this->name_ << ", no parent namespace set." << std::endl;
+                    nodes = this->getNodeRelative(secondPart);
+                }
+                else
+                {
+                    nodes = this->parent_->getNodeRelative(secondPart);
+                }
+            }
+            else if (name.find('@') != 0)
+            {
+                std::map<std::string, NamespaceNode*>::iterator it = this->subnodes_.find(firstPart);
+                if (it == this->subnodes_.end())
+                    it = this->subnodes_.insert(this->subnodes_.begin(), std::pair<std::string, NamespaceNode*>(firstPart, new NamespaceNode(firstPart, this)));
+
+                if ((*it).second->isHidden())
+                {
+                    COUT(2) << "Warning: Subnamespace '" << firstPart << "' in namespace '" << this->name_ << "' is hidden and can't be accessed." << std::endl;
+                    nodes.insert(this);
+                }
+                else
+                {
+                    nodes = (*it).second->getNodeRelative(secondPart);
+                }
+            }
+            else
+            {
+                bool bFoundMatchingNamespace = false;
+
+                for (std::map<std::string, NamespaceNode*>::iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
+                {
+                    if ((*it).first.find(firstPart) == ((*it).first.size() - firstPart.size()))
+                    {
+                        std::set<NamespaceNode*> temp2 = (*it).second->getNodeRelative(secondPart);
+                        nodes.insert(temp2.begin(), temp2.end());
+                        bFoundMatchingNamespace = true;
+                    }
+                }
+
+                if (!bFoundMatchingNamespace)
+                {
+                    COUT(2) << "Warning: No file included with name '" << firstPart.substr(1, std::string::npos) << "' at this part of the level file, using parent namespace instead." << std::endl;
+                    nodes = this->getNodeRelative(secondPart);
+                }
+            }
+        }
+
+        return nodes;
+    }
+
+    bool NamespaceNode::includes(const NamespaceNode* ns) const
+    {
+        if (ns == this)
+        {
+            return true;
+        }
+        else
+        {
+            for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
+                if ((*it).second->includes(ns))
+                    return true;
+        }
+
+        return false;
+    }
+
+    std::string NamespaceNode::toString() const
+    {
+        std::string output = this->name_;
+
+        if (this->subnodes_.size() > 0)
+        {
+            output += " (";
+
+            int i = 0;
+            for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); i++, ++it)
+            {
+                if (i > 0)
+                    output += ", ";
+
+                output += (*it).second->toString();
+            }
+
+            output += ")";
+        }
+
+        return output;
+    }
+
+    std::string NamespaceNode::toString(const std::string& indentation) const
+    {
+        std::string output = (indentation + this->name_ + "\n");
+
+        for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
+            output += (*it).second->toString(indentation + "  ");
+
+        return output;
+    }
+}
Index: code/trunk/src/core/NamespaceNode.h
===================================================================
--- code/trunk/src/core/NamespaceNode.h	(revision 1055)
+++ code/trunk/src/core/NamespaceNode.h	(revision 1055)
@@ -0,0 +1,67 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _NamespaceNode_H__
+#define _NamespaceNode_H__
+
+#include <map>
+#include <set>
+#include <string>
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    class NamespaceNode
+    {
+        public:
+            NamespaceNode(const std::string& name, NamespaceNode* parent = 0);
+            ~NamespaceNode();
+
+            std::set<NamespaceNode*> getNodeRelative(const std::string& name);
+
+            void setRoot(bool bRoot) { this->bRoot_ = bRoot; }
+            void setHidden(bool bHidden) { this->bHidden_ = bHidden; }
+
+            bool isRoot() const { return this->bRoot_; }
+            bool isHidden() const { return this->bHidden_; }
+
+            bool includes(const NamespaceNode*) const;
+
+            std::string toString() const;
+            std::string toString(const std::string& indentation) const;
+
+        private:
+            std::string name_;
+            NamespaceNode* parent_;
+            std::map<std::string, NamespaceNode*> subnodes_;
+            bool bHidden_;
+            bool bRoot_;
+    };
+}
+
+#endif /* _NamespaceNode_H__ */
Index: code/trunk/src/core/ObjectList.h
===================================================================
--- code/trunk/src/core/ObjectList.h	(revision 1055)
+++ code/trunk/src/core/ObjectList.h	(revision 1055)
@@ -0,0 +1,260 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file ObjectList.h
+    @brief Definition and implementation of the ObjectList class.
+
+    The ObjectList is a double-linked list, used by Identifiers to store all objects of a given class.
+    Newly created objects are added through the RegisterObject-macro in its constructor.
+    Use Iterator<class> to iterate through all objects of the class.
+*/
+
+#ifndef _ObjectList_H__
+#define _ObjectList_H__
+
+#include "CorePrereqs.h"
+#include "Iterator.h"
+#include "ClassManager.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###    ObjectListElement    ###
+    // ###############################
+    //! The list-element of the ObjectList
+    template <class T>
+    class ObjectListElement
+    {
+        public:
+            ObjectListElement(T* object);
+
+            T* object_;                     //!< The object
+            ObjectListElement* next_;       //!< The next element in the list
+            ObjectListElement* prev_;       //!< The previous element in the list
+    };
+
+    /**
+        @brief Constructor: Creates the list-element with an object.
+        @param object The object to store
+    */
+    template <class T>
+    ObjectListElement<T>::ObjectListElement(T* object)
+    {
+        this->object_ = object;
+        this->next_ = 0;
+        this->prev_ = 0;
+    }
+
+
+    // ###############################
+    // ###       ObjectList        ###
+    // ###############################
+    //! The ObjectList contains all objects of a given class.
+    /**
+        The ObjectList is used by Identifiers to store all objects of a given class.
+        Use Iterator<class> to iterate through all objects in the list.
+    */
+    template <class T>
+    class ObjectList
+    {
+        public:
+            ObjectList();
+            ~ObjectList();
+
+            ObjectListElement<T>* add(T* object);
+//            void remove(OrxonoxClass* object, bool bIterateForwards = true);
+
+            /** @brief Returns the first element in the list. @return The first element */
+            inline static Iterator<T> start()
+                { return Iterator<T>(ClassManager<T>::getIdentifier()->getObjects()->first_); }
+
+            /** @brief Returns the first element in the list. @return The first element */
+            inline static Iterator<T> begin()
+                { return Iterator<T>(ClassManager<T>::getIdentifier()->getObjects()->first_); }
+
+            /** @brief Returns the last element in the list. @return The last element */
+            inline static Iterator<T> end()
+                { return Iterator<T>(ClassManager<T>::getIdentifier()->getObjects()->last_); }
+
+            ObjectListElement<T>* first_;       //!< The first element in the list
+            ObjectListElement<T>* last_;        //!< The last element in the list
+    };
+
+    /**
+        @brief Constructor: Sets default values.
+    */
+    template <class T>
+    ObjectList<T>::ObjectList()
+    {
+        this->first_ = 0;
+        this->last_ = 0;
+    }
+
+    /**
+        @brief Destructor: Deletes all list-elements, but NOT THE OBJECTS.
+    */
+    template <class T>
+    ObjectList<T>::~ObjectList()
+    {
+        ObjectListElement<T>* temp;
+        while (this->first_)
+        {
+            temp = this->first_->next_;
+            delete this->first_;
+            this->first_ = temp;
+        }
+    }
+
+    /**
+        @brief Adds a new object to the end of the list.
+        @param object The object to add
+        @return The pointer to the new ObjectListElement, needed by the MetaObjectList of the added object
+    */
+    template <class T>
+    ObjectListElement<T>* ObjectList<T>::add(T* object)
+    {
+        if (!this->last_)
+        {
+            // If the list is empty
+            this->last_ = new ObjectListElement<T>(object);
+            this->first_ = this->last_; // There's only one object in the list now
+        }
+        else
+        {
+            // If the list isn't empty
+            ObjectListElement<T>* temp = this->last_;
+            this->last_ = new ObjectListElement<T>(object);
+            this->last_->prev_ = temp;
+            temp->next_ = this->last_;
+        }
+
+        return this->last_;
+    }
+
+
+//    /**
+//        @brief Removes an object from the list.
+//        @param object The object to remove
+//        @param bIterateForwards If true: Start searching the object at the beginning of the list
+//    */
+    /*
+    template <class T>
+    void ObjectList<T>::remove(OrxonoxClass* object, bool bIterateForwards)
+    {
+        if (!object || !this->first_ || !this->last_)
+            return;
+
+        // If there's only one object in the list, we have to set first_ and last_ to zero
+        if (this->first_ == this->last_)
+        {
+            if (this->first_->object_ == object)
+            {
+                delete this->first_;
+                this->first_ = 0;
+                this->last_ = 0;
+            }
+
+            return;
+        }
+
+        // Now we are sure we have more than one element in the list
+        if (bIterateForwards)
+        {
+            // Start at the beginning of the list
+
+            // Check if it's the first object
+            if (this->first_->object_ == object)
+            {
+                ObjectListElement<T>* temp = this->first_->next_;
+                delete this->first_;
+                this->first_ = temp;
+                this->first_->prev_ = 0;
+
+                return;
+            }
+
+            // Iterate through the whole list
+            ObjectListElement<T>* temp = this->first_;
+            while (temp->next_)
+            {
+                if (temp->next_->object_ == object)
+                {
+                    ObjectListElement<T>* temp2 = temp->next_->next_;
+                    delete temp->next_;
+                    temp->next_ = temp2;
+                    if (temp2)
+                        temp2->prev_ = temp;
+                    else
+                        this->last_ = temp; // If there is no next_, we deleted the last element and have to update the last_ pointer.
+
+                    return;
+                }
+
+                temp = temp->next_;
+            }
+        }
+        else
+        {
+            // Start at the end of the list
+
+            // Check if it's the last object
+            if (this->last_->object_ == object)
+            {
+                ObjectListElement<T>* temp = this->last_->prev_;
+                delete this->last_;
+                this->last_ = temp;
+                this->last_->next_ = 0;
+
+                return;
+            }
+
+            // Iterate through the whole list
+            ObjectListElement<T>* temp = this->last_;
+            while (temp->prev_)
+            {
+                if (temp->prev_->object_ == object)
+                {
+                    ObjectListElement<T>* temp2 = temp->prev_->prev_;
+                    delete temp->prev_;
+                    temp->prev_ = temp2;
+                    if (temp2)
+                        temp2->next_ = temp;
+                    else
+                        this->first_ = temp; // If there is no prev_, we deleted the first element and have to update the first_ pointer.
+
+                    return;
+                }
+
+                temp = temp->prev_;
+            }
+        }
+    }
+    */
+}
+
+#endif /* _ObjectList_H__ */
Index: code/trunk/src/core/OrxonoxClass.cc
===================================================================
--- code/trunk/src/core/OrxonoxClass.cc	(revision 1055)
+++ code/trunk/src/core/OrxonoxClass.cc	(revision 1055)
@@ -0,0 +1,53 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file OrxonoxClass.cc
+    @brief Implementation of the OrxonoxClass Class.
+*/
+
+#include "OrxonoxClass.h"
+
+namespace orxonox
+{
+    /** @brief Constructor: Sets the default values. */
+    OrxonoxClass::OrxonoxClass()
+    {
+        this->setConfigValues();
+
+        this->identifier_ = 0;
+        this->parents_ = 0;
+    }
+
+    /** @brief Destructor: Deletes, if existing, the list of the parents. */
+    OrxonoxClass::~OrxonoxClass()
+    {
+        // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class
+        if (this->parents_)
+            delete this->parents_;
+    }
+}
Index: code/trunk/src/core/OrxonoxClass.h
===================================================================
--- code/trunk/src/core/OrxonoxClass.h	(revision 1055)
+++ code/trunk/src/core/OrxonoxClass.h	(revision 1055)
@@ -0,0 +1,164 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file OrxonoxClass.h
+    @brief Definition of the OrxonoxClass Class.
+
+    All objects and interfaces of the game-logic (not the engine) are derived from OrxonoxClass.
+    It stores the Identifier and the MetaObjectList and has all needed functions to create and use the class-hierarchy.
+*/
+
+#ifndef _OrxonoxClass_H__
+#define _OrxonoxClass_H__
+
+#include <set>
+#include <string>
+
+#include "CorePrereqs.h"
+#include "MetaObjectList.h"
+#include "Iterator.h"
+
+namespace orxonox
+{
+    //! The class all objects and interfaces of the game-logic (not the engine) are derived from.
+    /**
+        The BaseObject and Interfaces are derived with 'virtual public OrxonoxClass' from OrxonoxClass.
+        OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the MetaObjectList.
+    */
+    class _CoreExport OrxonoxClass
+    {
+        public:
+            OrxonoxClass();
+            virtual ~OrxonoxClass();
+
+            /** @brief Function to collect the SetConfigValue-macro calls. */
+            void setConfigValues() {};
+
+            /** @brief Returns the Identifier of the object. @return The Identifier */
+            inline Identifier* getIdentifier() const { return this->identifier_; }
+
+            /** @brief Sets the Identifier of the object. Used by the RegisterObject-macro. */
+            inline void setIdentifier(Identifier* identifier) { this->identifier_ = identifier; }
+
+            /** @brief Returns the list of all parents of the object. @return The list */
+            inline std::set<const Identifier*>* getParents() const { return this->parents_; }
+
+            /** @brief Creates the parents-list. */
+            inline void createParents() { this->parents_ = new std::set<const Identifier*>(); }
+
+            /** @brief Returns the MetaObjectList of the object, containing a link to all ObjectLists and ObjectListElements the object is registered in. @return The list */
+            inline MetaObjectList& getMetaList() { return this->metaList_; }
+
+
+            /** @brief Returns true if the objects class is of the given type or a derivative. */
+            inline bool isA(const Identifier* identifier)
+                { return this->getIdentifier()->isA(identifier); }
+            /** @brief Returns true if the objects class is exactly of the given type. */
+            inline bool isExactlyA(const Identifier* identifier)
+                { return this->getIdentifier()->isExactlyA(identifier); }
+            /** @brief Returns true if the objects class is a child of the given type. */
+            inline bool isChildOf(const Identifier* identifier)
+                { return this->getIdentifier()->isChildOf(identifier); }
+            /** @brief Returns true if the objects class is a direct child of the given type. */
+            inline bool isDirectChildOf(const Identifier* identifier)
+                { return this->getIdentifier()->isDirectChildOf(identifier); }
+            /** @brief Returns true if the objects class is a parent of the given type. */
+            inline bool isParentOf(const Identifier* identifier)
+                { return this->getIdentifier()->isParentOf(identifier); }
+            /** @brief Returns true if the objects class is a direct parent of the given type. */
+            inline bool isDirectParentOf(const Identifier* identifier)
+                { return this->getIdentifier()->isDirectParentOf(identifier); }
+
+
+            /** @brief Returns true if the objects class is of the given type or a derivative. */
+            inline bool isA(const SubclassIdentifier<class B>* identifier)
+                { return this->getIdentifier()->isA(identifier->getIdentifier()); }
+            /** @brief Returns true if the objects class is exactly of the given type. */
+            inline bool isExactlyA(const SubclassIdentifier<class B>* identifier)
+                { return this->getIdentifier()->isExactlyA(identifier->getIdentifier()); }
+            /** @brief Returns true if the objects class is a child of the given type. */
+            inline bool isChildOf(const SubclassIdentifier<class B>* identifier)
+                { return this->getIdentifier()->isChildOf(identifier->getIdentifier()); }
+            /** @brief Returns true if the objects class is a direct child of the given type. */
+            inline bool isDirectChildOf(const SubclassIdentifier<class B>* identifier)
+                { return this->getIdentifier()->isDirectChildOf(identifier->getIdentifier()); }
+            /** @brief Returns true if the objects class is a parent of the given type. */
+            inline bool isParentOf(const SubclassIdentifier<class B>* identifier)
+                { return this->getIdentifier()->isParentOf(identifier->getIdentifier()); }
+            /** @brief Returns true if the objects class is a direct parent of the given type. */
+            inline bool isDirectParentOf(const SubclassIdentifier<class B>* identifier)
+                { return this->getIdentifier()->isDirectParentOf(identifier->getIdentifier()); }
+
+
+            /** @brief Returns true if the objects class is of the given type or a derivative. */
+            inline bool isA(const SubclassIdentifier<class B> identifier)
+                { return this->getIdentifier()->isA(identifier.getIdentifier()); }
+            /** @brief Returns true if the objects class is exactly of the given type. */
+            inline bool isExactlyA(const SubclassIdentifier<class B> identifier)
+                { return this->getIdentifier()->isExactlyA(identifier.getIdentifier()); }
+            /** @brief Returns true if the objects class is a child of the given type. */
+            inline bool isChildOf(const SubclassIdentifier<class B> identifier)
+                { return this->getIdentifier()->isChildOf(identifier.getIdentifier()); }
+            /** @brief Returns true if the objects class is a direct child of the given type. */
+            inline bool isDirectChildOf(const SubclassIdentifier<class B> identifier)
+                { return this->getIdentifier()->isDirectChildOf(identifier.getIdentifier()); }
+            /** @brief Returns true if the objects class is a parent of the given type. */
+            inline bool isParentOf(const SubclassIdentifier<class B> identifier)
+                { return this->getIdentifier()->isParentOf(identifier.getIdentifier()); }
+            /** @brief Returns true if the objects class is a direct parent of the given type. */
+            inline bool isDirectParentOf(const SubclassIdentifier<class B> identifier)
+                { return this->getIdentifier()->isDirectParentOf(identifier.getIdentifier()); }
+
+
+            /** @brief Returns true if the objects class is of the given type or a derivative. */
+            inline bool isA(const OrxonoxClass* object)
+                { return this->getIdentifier()->isA(object->getIdentifier()); }
+            /** @brief Returns true if the objects class is exactly of the given type. */
+            inline bool isExactlyA(const OrxonoxClass* object)
+                { return this->getIdentifier()->isExactlyA(object->getIdentifier()); }
+            /** @brief Returns true if the objects class is a child of the given type. */
+            inline bool isChildOf(const OrxonoxClass* object)
+                { return this->getIdentifier()->isChildOf(object->getIdentifier()); }
+            /** @brief Returns true if the objects class is a direct child of the given type. */
+            inline bool isDirectChildOf(const OrxonoxClass* object)
+                { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); }
+            /** @brief Returns true if the objects class is a parent of the given type. */
+            inline bool isParentOf(const OrxonoxClass* object)
+                { return this->getIdentifier()->isParentOf(object->getIdentifier()); }
+            /** @brief Returns true if the objects class is a direct child of the given type. */
+            inline bool isDirectParentOf(const OrxonoxClass* object)
+                { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); }
+
+        private:
+            Identifier* identifier_;                    //!< The Identifier of the object
+            std::set<const Identifier*>* parents_;     //!< List of all parents of the object
+            MetaObjectList metaList_;                   //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
+    };
+}
+
+#endif /* _OrxonoxClass_H__ */
Index: code/trunk/src/core/OutputHandler.cc
===================================================================
--- code/trunk/src/core/OutputHandler.cc	(revision 1055)
+++ code/trunk/src/core/OutputHandler.cc	(revision 1055)
@@ -0,0 +1,157 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file OutputHandler.cc
+    @brief Implementation of the OutputHandler class.
+*/
+
+#include "CoreSettings.h"
+#include "OutputHandler.h"
+#include "ConsoleCommand.h"
+
+namespace orxonox
+{
+    ConsoleCommandShortcutGeneric(log, createExecutor(createFunctor(&OutputHandler::log), "log", AccessLevel::None));
+
+    /**
+        @brief Constructor: Opens the logfile and writes the first line.
+        @param logfilename The name of the logfile
+    */
+    OutputHandler::OutputHandler(const std::string& logfilename)
+    {
+        this->logfilename_ = logfilename;
+        this->logfile_.open(this->logfilename_.c_str(), std::fstream::out);
+        this->logfile_ << "Started log at yyyy/mm/dd hh:mm:ss" << std::endl;
+        this->logfile_.flush();
+    }
+
+    /**
+        @brief Destructor: Writes the last line to the logfile and closes it.
+    */
+    OutputHandler::~OutputHandler()
+    {
+        this->logfile_ << "Closed log" << std::endl;
+        this->logfile_.close();
+    }
+
+    /**
+        @brief Returns a reference to the only existing instance of the OutputHandler class.
+        @return The instance
+    */
+    OutputHandler& OutputHandler::getOutStream()
+    {
+        static OutputHandler orxout("orxonox.log");
+        return orxout;
+    }
+
+    /**
+        @brief Returns the soft debug level for a given output device.
+        @param device The output device
+        @return The debug level
+    */
+    int OutputHandler::getSoftDebugLevel(OutputHandler::OutputDevice device)
+    {
+        return CoreSettings::getSoftDebugLevel(device);
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console and the logfile.
+        @param sb The streambuffer that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::streambuf* sb)
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            std::cout << sb;
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            this->logfile_ << sb;
+            this->logfile_.flush();
+        }
+
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console and the logfile.
+        @param manipulator A function, manipulating the outstream.
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::ostream& (*manipulator)(std::ostream&))
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            manipulator(std::cout);
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            manipulator(this->logfile_);
+            this->logfile_.flush();
+        }
+
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console and the logfile.
+        @param manipulator A function, manipulating the outstream.
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::ios& (*manipulator)(std::ios&))
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            manipulator(std::cout);
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            manipulator(this->logfile_);
+            this->logfile_.flush();
+        }
+
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console and the logfile.
+        @param manipulator A function, manipulating the outstream.
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            manipulator(std::cout);
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            manipulator(this->logfile_);
+            this->logfile_.flush();
+        }
+
+        return *this;
+    }
+}
Index: code/trunk/src/core/OutputHandler.h
===================================================================
--- code/trunk/src/core/OutputHandler.h	(revision 1055)
+++ code/trunk/src/core/OutputHandler.h	(revision 1055)
@@ -0,0 +1,165 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file OutputHandler.h
+    @brief Definition of the OutputHandler class.
+
+    The OutputHandler acts like std::cout, but output isn't only shown in the console,
+    but also written to the logfile.
+*/
+
+#ifndef _OutputHandler_H__
+#define _OutputHandler_H__
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    //! The OutputHandler acts like std::cout, but redirects output to the console AND the logfile.
+    class _CoreExport OutputHandler
+    {
+        public:
+            enum OutputDevice
+            {
+                LD_All,
+                LD_Console,
+                LD_Logfile,
+                LD_Shell
+            };
+
+            static OutputHandler& getOutStream();
+
+            /** @brief Puts some text on the outstream. @param text The text */
+            static inline std::string log(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(0); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Returns a reference to the logfile. @return The logfile */
+            inline std::ofstream& getLogfile()
+                { return this->logfile_; }
+
+            /** @brief Sets the level of the incoming output. @param level The level of the incoming output @return The OutputHandler itself */
+            inline OutputHandler& setOutputLevel(int level)
+                { this->outputLevel_ = level; return *this; }
+
+            /** @brief Returns the level of the incoming output. @return The level */
+            inline int getOutputLevel() const
+                { return this->outputLevel_; }
+
+            static int getSoftDebugLevel(OutputHandler::OutputDevice device);
+
+            template <class T>
+            OutputHandler& output(const T& output);
+
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned char val)   { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(short val)           { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned short val)  { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(int val)             { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned int val)    { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(long val)            { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned long val)   { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(float val)           { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(double val)          { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(long double val)     { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(const void* val)     { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(bool val)            { return this->output(val); }
+
+            OutputHandler& operator<<(std::streambuf* sb);
+
+            OutputHandler& operator<<(std::ostream& (*manipulator)(std::ostream&));
+            OutputHandler& operator<<(std::ios& (*manipulator)(std::ios&));
+            OutputHandler& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
+
+        private:
+            explicit OutputHandler(const std::string& logfilename);
+            OutputHandler(const OutputHandler& oh) {}; // don't copy
+            virtual ~OutputHandler();
+            std::ofstream logfile_;     //!< The logfile where the output is logged
+            std::string logfilename_;   //!< The name of the logfile
+            int outputLevel_;           //!< The level of the incoming output
+    };
+
+    /**
+        @brief Redirects the output to the console and the logfile.
+        @param output The value that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    template<class T>
+    OutputHandler& OutputHandler::output(const T& output)
+    {
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            std::cout << output;
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            this->logfile_ << output;
+            this->logfile_.flush();
+        }
+
+        return *this;
+    }
+
+    /**
+        @brief Overloading of the non-member << operator to redirect the output of classes with self defined '<< to std::ostream' operators to the console and the logfile.
+        @param out The OutputHandler itself
+        @param output The class that should be shown in the console
+        @return The OutputHandler itself
+    */
+    template<class T>
+    OutputHandler& operator<<(OutputHandler& out, const T& output)
+    {
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Console) >= out.getOutputLevel())
+            std::cout << output;
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Logfile) >= out.getOutputLevel())
+        {
+            out.getLogfile() << output;
+            out.getLogfile().flush();
+        }
+
+        return out;
+    }
+
+}
+
+#endif /* _OutputHandler_H__ */
Index: code/trunk/src/core/Script.cc
===================================================================
--- code/trunk/src/core/Script.cc	(revision 1055)
+++ code/trunk/src/core/Script.cc	(revision 1055)
@@ -0,0 +1,276 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Script.h"
+
+#include <fstream>
+#include <map>
+
+#include "CoreIncludes.h"
+
+extern "C" {
+#include <lualib.h>
+#include <lauxlib.h>
+}
+
+#include "util/tolua/tolua++.h"
+#include "ToLuaBind.h"
+
+namespace orxonox
+{
+  Script* Script::singletonRef = NULL;
+
+  Script::Script()
+  {
+    luaState_ = lua_open();
+    luaSource_ = "";
+#if LUA_VERSION_NUM == 501
+    luaL_openlibs(luaState_);
+#else
+    luaopen_base(luaState_);
+    luaopen_string(luaState_);
+    luaopen_table(luaState_);
+    luaopen_math(luaState_);
+    luaopen_io(luaState_);
+    luaopen_debug(luaState_);
+#endif
+    tolua_orxonox_open(luaState_);
+    output_ = "";
+  }
+
+  void Script::luaPrint(std::string str)
+  {
+    output_ += str;
+    COUT(4) << "Lua_output!:" << std::endl << str << std::endl << "***" << std::endl;
+  }
+
+  /**
+      @brief Loads the specified file line by line
+      @param filename The filename of the file
+      @param luaTags if true, the loaded file gets stripped off luaTags
+  */
+  void Script::loadFile(std::string filename, bool luaTags)
+  {
+    std::ifstream file;
+    file.open(filename.c_str(), std::fstream::in);
+
+    if (!file.is_open())
+    {
+      // some error msg
+    }
+
+    char line[1024];
+    std::string levelString = "";
+
+    while (file.good() && !file.eof())
+    {
+      file.getline(line, 1024);
+      levelString += line;
+      levelString += "\n";
+    }
+
+    file.close();
+    //std::string output;
+
+    if (luaTags) luaSource_ = replaceLuaTags(levelString);
+    COUT(4) << "ParsedSourceCode: " << luaSource_ << std::endl;
+  }
+
+  void Script::run()
+  {
+    int error = 0;
+    std::string init = "local scr = orxonox.Script:getInstance()\nprint = function(s)\nscr:luaPrint(s)\nend\n";
+    init += luaSource_;
+#if LUA_VERSION_NUM == 501
+    error = luaL_loadstring(luaState_, init.c_str());
+#else
+    error = lua_load(luaState_, &orxonox::Script::lua_Chunkreader, (void*)init.c_str(), "init");
+#endif
+    if (error == 0)
+      error = lua_pcall(luaState_, 0, 0, 0);
+    if (error != 0) COUT(2) << "Error in Lua-script: " << lua_tostring(luaState_, -1) << std::endl;
+  }
+
+  unsigned int Script::getNextQuote(const std::string& text, unsigned int start)
+  {
+    unsigned int quote = start - 1;
+
+    while ((quote = text.find('\"', quote + 1)) != std::string::npos)
+    {
+      unsigned int backslash = quote;
+      unsigned int numbackslashes = 0;
+      for (; backslash > 0; backslash--, numbackslashes++)
+        if (text[backslash - 1] != '\\')
+          break;
+
+      if (numbackslashes % 2 == 0)
+        break;
+    }
+
+    return quote;
+  }
+
+  std::string Script::replaceLuaTags(const std::string& text)
+  {
+    // chreate map with all Lua tags
+    std::map<unsigned int, bool> luaTags;
+    {
+      unsigned int pos = 0;
+      while ((pos = text.find("<?lua", pos)) != std::string::npos)
+        luaTags[pos++] = true;
+    }
+    {
+      unsigned int pos = 0;
+      while ((pos = text.find("?>", pos)) != std::string::npos)
+        luaTags[pos++] = false;
+    }
+
+    // erase all tags from the map that are between two quotes
+    {
+      std::map<unsigned int, bool>::iterator it = luaTags.begin();
+      std::map<unsigned int, bool>::iterator it2 = it;
+      bool bBetweenQuotes = false;
+      unsigned int pos = 0;
+      while ((pos = getNextQuote(text, pos)) != std::string::npos)
+      {
+        while ((it != luaTags.end()) && (it->first < pos))
+        {
+          if (bBetweenQuotes) {
+            it2++;
+            if(it->second && !(it2->second) && it2->first < pos)
+              it = ++it2;
+            else
+              luaTags.erase(it++);
+          }
+          else
+            ++it;
+        }
+        bBetweenQuotes = !bBetweenQuotes;
+        pos++;
+      }
+    }
+
+    // check whether on every opening <?lua tag a closing ?> tag follows
+    {
+      bool expectedValue = true;
+      for (std::map<unsigned int, bool>::iterator it = luaTags.begin(); it != luaTags.end(); ++it)
+      {
+        if ((*it).second == expectedValue)
+          expectedValue = !expectedValue;
+        else
+        {
+          expectedValue = false;
+          break;
+        }
+      }
+      if (!expectedValue) {
+        // todo: errorhandling
+        return "";
+      }
+    }
+
+    // cut the original string into pieces and put them together with print() instead of lua tags
+    std::string output;
+    {
+      std::map<unsigned int, bool>::iterator it = luaTags.begin();
+      bool bInPrintFunction = true;
+      unsigned int start = 0;
+      unsigned int end = 0;
+
+      do
+      {
+        if (it != luaTags.end())
+          end = (*(it++)).first;
+        else
+          end = std::string::npos;
+
+        unsigned int equalSignCounter = 0;
+
+        if (bInPrintFunction)
+        {
+          // count ['='[ and ]'='] and replace tags with print([[ and ]])
+          std::string temp = text.substr(start, end - start);
+          {
+            unsigned int pos = 0;
+            while ((pos = temp.find('[', pos)) != std::string::npos)
+            {
+              unsigned int tempCounter = 1;
+              unsigned int tempPos = pos++;
+              while(temp[++tempPos] == '=') {
+                tempCounter++;
+              }
+              if(temp[tempPos] != '[') {
+                tempCounter = 0;
+              }
+              else if(tempCounter == 0) {
+                tempCounter = 1;
+              }
+              if (tempCounter > equalSignCounter)
+                equalSignCounter = tempCounter;
+            }
+          }
+          {
+            unsigned int pos = 0;
+            while ((pos = temp.find(']', pos)) != std::string::npos)
+            {
+              unsigned int tempCounter = 1;
+              unsigned int tempPos = pos++;
+              while(temp[++tempPos] == '=') {
+                tempCounter++;
+              }
+              if(temp[tempPos] != ']') {
+                tempCounter = 0;
+              }
+              else if(tempCounter == 0) {
+                tempCounter = 1;
+              }
+              if (tempCounter > equalSignCounter)
+                equalSignCounter = tempCounter;
+            }
+          }
+          std::string equalSigns = "";
+          for(unsigned int i = 0; i < equalSignCounter; i++) {
+            equalSigns += "=";
+          }
+          output += "print([" + equalSigns + "[" + temp + "]" + equalSigns +"])";
+          start = end + 5;
+        }
+        else
+        {
+          output += text.substr(start, end - start);
+          start = end + 2;
+        }
+
+        bInPrintFunction = !bInPrintFunction;
+      }
+      while (end != std::string::npos);
+    }
+
+    return output;
+  }
+
+}
Index: code/trunk/src/core/Script.h
===================================================================
--- code/trunk/src/core/Script.h	(revision 1055)
+++ code/trunk/src/core/Script.h	(revision 1055)
@@ -0,0 +1,55 @@
+/**
+ @file  script.h
+ @brief Representation of an interface to lua
+ @author Benjamin Knecht <beni_at_orxonox.net>
+ */
+
+#ifndef _Script_H__
+#define _Script_H__
+
+#include "CorePrereqs.h"
+
+extern "C" {
+#include <lua.h>
+}
+
+#include <list>
+#include <string>
+
+namespace orxonox // tolua_export
+{ // tolua_export
+
+  class _CoreExport Script // tolua_export
+  { // tolua_export
+    public:
+      inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export
+      inline ~Script() { Script::singletonRef = NULL; };
+
+    void loadFile(std::string filename, bool luaTags);
+    //void init(lua_State *state_);
+    //void xmlToLua();
+    void run();
+    void luaPrint(std::string str); // tolua_export
+
+#if LUA_VERSION_NUM != 501
+    inline static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size) { return NULL;};
+#endif
+
+    inline lua_State* getLuaState() { return luaState_; };
+    inline std::string getLuaOutput() { return output_; };
+    //inline std::string* getFileString() { return &fileString_; };
+
+    unsigned int getNextQuote(const std::string& text, unsigned int start);
+    std::string replaceLuaTags(const std::string& text);
+
+    private:
+      Script();
+      static Script* singletonRef;
+
+      std::string luaSource_;
+      std::string output_;
+      lua_State* luaState_;
+
+  }; // tolua_export
+} // tolua_export
+#endif /* _Script_H__ */
Index: code/trunk/src/core/SignalHandler.cc
===================================================================
--- code/trunk/src/core/SignalHandler.cc	(revision 1055)
+++ code/trunk/src/core/SignalHandler.cc	(revision 1055)
@@ -0,0 +1,315 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Christoph Renner
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file SignalHandler.cc
+    @brief Implementation of the SignalHandler class.
+*/
+
+#include <assert.h>
+
+#include "Debug.h"
+#include "SignalHandler.h"
+
+SignalHandler * SignalHandler::singletonRef = NULL;
+
+#ifndef __WIN32__
+
+#include <wait.h>
+
+SignalHandler::SignalHandler()
+{
+}
+
+/**
+ * register signal handlers for SIGSEGV and SIGABRT
+ * @param appName path to executable eg argv[0]
+ * @param fileName filename to append backtrace to
+ */
+void SignalHandler::doCatch( const std::string & appName, const std::string & fileName )
+{
+  this->appName = appName;
+  this->fileName = fileName;
+
+  // make sure doCatch is only called once without calling dontCatch
+  assert( sigRecList.size() == 0 );
+
+  catchSignal( SIGSEGV );
+  catchSignal( SIGABRT );
+  catchSignal( SIGILL );
+}
+
+/**
+ * restore previous signal handlers
+ */
+void SignalHandler::dontCatch()
+{
+  for ( SignalRecList::iterator it = sigRecList.begin(); it != sigRecList.end(); it++ )
+  {
+    signal( it->signal, it->handler );
+  }
+
+  sigRecList.clear();
+}
+
+/**
+ * catch signal sig
+ * @param sig signal to catch
+ */
+void SignalHandler::catchSignal( int sig )
+{
+  sig_t handler = signal( sig, SignalHandler::sigHandler );
+
+  assert( handler != SIG_ERR );
+
+  SignalRec rec;
+  rec.signal = sig;
+  rec.handler = handler;
+
+  sigRecList.push_front( rec );
+}
+
+/**
+ * sigHandler is called when receiving signals
+ * @param sig
+ */
+void SignalHandler::sigHandler( int sig )
+{
+  for ( SignalCallbackList::iterator it = SignalHandler::getInstance()->callbackList.begin(); it != SignalHandler::getInstance()->callbackList.end(); it++  )
+  {
+    (*(it->cb))( it->someData );
+  }
+
+  std::string sigName = "UNKNOWN";
+
+  switch ( sig )
+  {
+    case SIGSEGV:
+      sigName = "SIGSEGV";
+      break;
+    case SIGABRT:
+      sigName = "SIGABRT";
+      break;
+    case SIGILL:
+      sigName = "SIGILL";
+      break;
+  }
+
+  PRINTF(0)( "recieved signal %s\ntry to write backtrace to file orxonox.log\n", sigName.c_str() );
+
+  int sigPipe[2];
+  if ( pipe(sigPipe) == -1 )
+  {
+    perror("pipe failed!\n");
+    exit(EXIT_FAILURE);
+  }
+
+  int sigPid = fork();
+
+  if ( sigPid == -1 )
+  {
+    perror("fork failed!\n");
+    exit(EXIT_FAILURE);
+  }
+
+  // gdb will be attached to this process
+  if ( sigPid == 0 )
+  {
+    getInstance()->dontCatch();
+    // wait for message from parent when it has attached gdb
+    int someData;
+
+    read( sigPipe[0], &someData, sizeof(someData) );
+
+    if ( someData != 0x12345678 )
+    {
+      PRINTF(0)("something went wrong :(\n");
+    }
+
+    return;
+  }
+
+  int gdbIn[2];
+  int gdbOut[2];
+  int gdbErr[2];
+
+  if ( pipe(gdbIn) == -1 || pipe(gdbOut) == -1 || pipe(gdbErr) == -1 )
+  {
+    perror("pipe failed!\n");
+    kill( sigPid, SIGTERM );
+    waitpid( sigPid, NULL, 0 );
+    exit(EXIT_FAILURE);
+  }
+
+  int gdbPid = fork();
+  // this process will run gdb
+
+  if ( gdbPid == -1 )
+  {
+    perror("fork failed\n");
+    kill( sigPid, SIGTERM );
+    waitpid( sigPid, NULL, 0 );
+    exit(EXIT_FAILURE);
+  }
+
+  if ( gdbPid == 0 )
+  {
+    // start gdb
+
+    close(gdbIn[1]);
+    close(gdbOut[0]);
+    close(gdbErr[0]);
+
+    dup2( gdbIn[0], STDIN_FILENO );
+    dup2( gdbOut[1], STDOUT_FILENO );
+    dup2( gdbErr[1], STDERR_FILENO );
+
+    execlp( "sh", "sh", "-c", "gdb", (void*)NULL);
+  }
+
+  char cmd[256];
+  snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance()->appName.c_str(), sigPid );
+  write( gdbIn[1], cmd, strlen(cmd) );
+
+  int charsFound = 0;
+  int promptFound = 0;
+  char byte;
+  while ( read( gdbOut[0], &byte, 1 ) == 1 )
+  {
+    if (
+      charsFound == 0 && byte == '(' ||
+      charsFound == 1 && byte == 'g' ||
+      charsFound == 2 && byte == 'd' ||
+      charsFound == 3 && byte == 'b' ||
+      charsFound == 4 && byte == ')' ||
+      charsFound == 5 && byte == ' '
+        )
+          charsFound++;
+    else
+      charsFound = 0;
+
+    if ( charsFound == 6 )
+    {
+      promptFound++;
+      charsFound = 0;
+    }
+
+    if ( promptFound == 3 )
+    {
+      break;
+    }
+  }
+
+  int someData = 0x12345678;
+  write( sigPipe[1], &someData, sizeof(someData) );
+
+  write( gdbIn[1], "bt\nk\nq\n", 7 );
+
+
+  charsFound = 0;
+  promptFound = 0;
+  std::string bt;
+  while ( read( gdbOut[0], &byte, 1 ) == 1 )
+  {
+    bt += std::string( &byte, 1 );
+
+    if (
+      charsFound == 0 && byte == '(' ||
+      charsFound == 1 && byte == 'g' ||
+      charsFound == 2 && byte == 'd' ||
+      charsFound == 3 && byte == 'b' ||
+      charsFound == 4 && byte == ')' ||
+      charsFound == 5 && byte == ' '
+        )
+          charsFound++;
+    else
+      charsFound = 0;
+
+    if ( charsFound == 6 )
+    {
+      promptFound++;
+      charsFound = 0;
+      bt += "\n";
+    }
+
+    if ( promptFound == 3 )
+    {
+      break;
+    }
+  }
+
+
+  waitpid( sigPid, NULL, 0 );
+  waitpid( gdbPid, NULL, 0 );
+
+  int wsRemoved = 0;
+
+  while ( wsRemoved < 2 && bt.length() > 0 )
+  {
+    if ( bt[1] == '\n' )
+      wsRemoved++;
+    bt.erase(0, 1);
+  }
+
+  if ( bt.length() > 0 )
+    bt.erase(0, 1);
+
+  time_t now = time(NULL);
+
+  std::string timeString = "\n\n\n\n"
+	                   "=======================================================\n"
+	                   "= time: " + std::string(ctime(&now)) +
+			   "=======================================================\n";
+  bt.insert(0, timeString);
+
+  FILE * f = fopen( getInstance()->fileName.c_str(), "a" );
+
+  if ( !f )
+  {
+    perror( ( std::string( "could not append to " ) + getInstance()->fileName ).c_str() );
+    exit(EXIT_FAILURE);
+  }
+
+  if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
+  {
+    PRINTF(0)( ( std::string("could not write %d byte to ") + getInstance()->fileName ).c_str(), bt.length());
+    exit(EXIT_FAILURE);
+  }
+
+  exit(EXIT_FAILURE);
+}
+
+void SignalHandler::registerCallback( SignalCallback cb, void * someData )
+{
+  SignalCallbackRec rec;
+  rec.cb = cb;
+  rec.someData = someData;
+
+  callbackList.push_back(rec);
+}
+
+#endif /* __WIN32__ */
Index: code/trunk/src/core/SignalHandler.h
===================================================================
--- code/trunk/src/core/SignalHandler.h	(revision 1055)
+++ code/trunk/src/core/SignalHandler.h	(revision 1055)
@@ -0,0 +1,104 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Christoph Renner
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file SignalHandler.h
+    @brief Definition of the SignalHandler class.
+*/
+
+#ifndef _SignalHandler_H__
+#define _SignalHandler_H__
+
+#include <list>
+#include <string>
+
+#include "CorePrereqs.h"
+
+typedef int (*SignalCallback)( void * someData );
+
+#ifndef __WIN32__
+#include <signal.h>
+
+struct SignalRec
+{
+  int signal;
+  sig_t handler;
+};
+
+struct SignalCallbackRec
+{
+  SignalCallback cb;
+  void * someData;
+};
+
+
+typedef std::list<SignalRec> SignalRecList;
+typedef std::list<SignalCallbackRec> SignalCallbackList;
+
+class SignalHandler
+{
+  private:
+    SignalHandler();
+  public:
+    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }
+    ~SignalHandler(){ SignalHandler::singletonRef = NULL; }
+
+    void registerCallback( SignalCallback cb, void * someData );
+
+    void doCatch( const std::string & appName, const std::string & fileName );
+    void dontCatch();
+
+  private:
+    static void sigHandler( int sig );
+
+    void catchSignal( int sig );
+    SignalRecList sigRecList;
+
+    SignalCallbackList callbackList;
+
+    static SignalHandler * singletonRef;
+
+    std::string appName;
+    std::string fileName;
+};
+
+#else /* #ifndef __WIN32__ */
+
+class _CoreExport SignalHandler
+{
+ public:
+   inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; };
+   void doCatch( const std::string & appName, const std::string & fileName ) {};
+  void dontCatch() {};
+  void registerCallback( SignalCallback cb, void * someData ) {};
+
+ private:
+    static SignalHandler * singletonRef;
+};
+#endif /* #ifndef __WIN32__ */
+
+#endif /* _SignalHandler_H__ */
Index: code/trunk/src/core/Tickable.cc
===================================================================
--- code/trunk/src/core/Tickable.cc	(revision 1055)
+++ code/trunk/src/core/Tickable.cc	(revision 1055)
@@ -0,0 +1,41 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "core/CoreIncludes.h"
+#include "core/ConsoleCommand.h"
+#include "Tickable.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor: Registers the object in the Tickable-list
+    */
+    Tickable::Tickable()
+    {
+        RegisterRootObject(Tickable);
+    }
+}
Index: code/trunk/src/core/Tickable.h
===================================================================
--- code/trunk/src/core/Tickable.h	(revision 1055)
+++ code/trunk/src/core/Tickable.h	(revision 1055)
@@ -0,0 +1,64 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/*!
+    @file Tickable.h
+    @brief Definition of the Tickable interface.
+
+    The Tickable interface provides a tick(dt) function, that gets called every frame.
+    float dt is the time since the last frame in seconds.
+
+    Attention:
+    Classes derived from a Tickable that want to have a tick(dt) function on their part, MUST call the
+    parent::tick(dt) function explicitly in their implementation of tick(dt) because it's a virtual function.
+*/
+
+#ifndef _Tickable_H__
+#define _Tickable_H__
+
+#include "CorePrereqs.h"
+#include "core/OrxonoxClass.h"
+
+namespace orxonox
+{
+    //! The Tickable interface provides a tick(dt) function, that gets called every frame.
+    class _CoreExport Tickable : virtual public OrxonoxClass
+    {
+        public:
+            /**
+                @brief Gets called every frame.
+                @param dt The time since the last frame in seconds
+            */
+            virtual void tick(float dt) = 0;
+
+        protected:
+            Tickable();
+    };
+
+}
+
+#endif /* _Tickable_H__ */
Index: code/trunk/src/core/ToLuaBind.cc
===================================================================
--- code/trunk/src/core/ToLuaBind.cc	(revision 1055)
+++ code/trunk/src/core/ToLuaBind.cc	(revision 1055)
@@ -0,0 +1,110 @@
+/*
+** Lua binding: orxonox
+** Generated automatically by tolua++-1.0.92 on Sun Apr  6 15:44:17 2008.
+*/
+
+#ifndef __cplusplus
+#include "stdlib.h"
+#endif
+#include "string.h"
+
+#include "util/tolua/tolua++.h"
+
+/* Exported function */
+TOLUA_API int  tolua_orxonox_open (lua_State* tolua_S);
+
+#include "Script.h"
+
+/* function to register type */
+static void tolua_reg_types (lua_State* tolua_S)
+{
+ tolua_usertype(tolua_S,"orxonox::Script");
+}
+
+/* method: getInstance of class  orxonox::Script */
+#ifndef TOLUA_DISABLE_tolua_orxonox_orxonox_Script_getInstance00
+static int tolua_orxonox_orxonox_Script_getInstance00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+     !tolua_isusertable(tolua_S,1,"orxonox::Script",0,&tolua_err) ||
+     !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+  goto tolua_lerror;
+ else
+#endif
+ {
+  {
+   orxonox::Script* tolua_ret = (orxonox::Script*)  orxonox::Script::getInstance();
+    tolua_pushusertype(tolua_S,(void*)tolua_ret,"orxonox::Script");
+  }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'getInstance'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: luaPrint of class  orxonox::Script */
+#ifndef TOLUA_DISABLE_tolua_orxonox_orxonox_Script_luaPrint00
+static int tolua_orxonox_orxonox_Script_luaPrint00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+     !tolua_isusertype(tolua_S,1,"orxonox::Script",0,&tolua_err) ||
+     !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
+     !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+  goto tolua_lerror;
+ else
+#endif
+ {
+  orxonox::Script* self = (orxonox::Script*)  tolua_tousertype(tolua_S,1,0);
+  std::string str = ((std::string)  tolua_tocppstring(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'luaPrint'",NULL);
+#endif
+  {
+   self->luaPrint(str);
+  }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'luaPrint'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* Open function */
+TOLUA_API int tolua_orxonox_open (lua_State* tolua_S)
+{
+ tolua_open(tolua_S);
+ tolua_reg_types(tolua_S);
+ tolua_module(tolua_S,NULL,0);
+ tolua_beginmodule(tolua_S,NULL);
+  tolua_module(tolua_S,"orxonox",0);
+  tolua_beginmodule(tolua_S,"orxonox");
+   tolua_cclass(tolua_S,"Script","orxonox::Script","",NULL);
+   tolua_beginmodule(tolua_S,"Script");
+    tolua_function(tolua_S,"getInstance",tolua_orxonox_orxonox_Script_getInstance00);
+    tolua_function(tolua_S,"luaPrint",tolua_orxonox_orxonox_Script_luaPrint00);
+   tolua_endmodule(tolua_S);
+  tolua_endmodule(tolua_S);
+ tolua_endmodule(tolua_S);
+ return 1;
+}
+
+
+#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
+ TOLUA_API int luaopen_orxonox (lua_State* tolua_S) {
+ return tolua_orxonox_open(tolua_S);
+};
+#endif
+
Index: code/trunk/src/core/ToLuaBind.h
===================================================================
--- code/trunk/src/core/ToLuaBind.h	(revision 1055)
+++ code/trunk/src/core/ToLuaBind.h	(revision 1055)
@@ -0,0 +1,8 @@
+/*
+** Lua binding: orxonox
+** Generated automatically by tolua++-1.0.92 on Sun Apr  6 15:44:17 2008.
+*/
+
+/* Exported function */
+TOLUA_API int  tolua_orxonox_open (lua_State* tolua_S);
+
Index: code/trunk/src/core/XMLPort.cc
===================================================================
--- code/trunk/src/core/XMLPort.cc	(revision 1055)
+++ code/trunk/src/core/XMLPort.cc	(revision 1055)
@@ -0,0 +1,43 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "XMLPort.h"
+#include "Language.h"
+#include "Loader.h"
+#include "Namespace.h"
+#include "CoreIncludes.h"
+
+namespace orxonox
+{
+    // ################################
+    // ###  XMLPortObjectContainer  ###
+    // ################################
+    bool XMLPortObjectContainer::identifierIsIncludedInLoaderMask(const Identifier* identifier)
+    {
+        return ((!this->bApplyLoaderMask_) || identifier->isA(Class(Namespace)) || Loader::currentMask_s.isIncluded(identifier));
+    }
+}
Index: code/trunk/src/core/XMLPort.h
===================================================================
--- code/trunk/src/core/XMLPort.h	(revision 1055)
+++ code/trunk/src/core/XMLPort.h	(revision 1055)
@@ -0,0 +1,369 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _XMLPort_H__
+#define _XMLPort_H__
+
+#include "util/XMLIncludes.h"
+#include "util/MultiTypeMath.h"
+#include "util/tinyxml/ticpp.h"
+#include "Executor.h"
+#include "Debug.h"
+#include "CoreIncludes.h"
+#include "BaseObject.h"
+
+#include "CorePrereqs.h"
+
+
+#define XMLPortParam(classname, paramname, loadfunction, savefunction, xmlelement, mode) \
+    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, paramname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), #savefunction), xmlelement, mode)
+#define XMLPortParam_Template(classname, paramname, loadtemplate, loadfunction, savetemplate, savefunction, xmlelement, mode) \
+    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, paramname, orxonox::createExecutor(orxonox::createFunctor loadtemplate (&classname::loadfunction), #loadfunction), orxonox::createExecutor(orxonox::createFunctor savetemplate (&classname::savefunction), #savefunction), xmlelement, mode)
+
+#define XMLPortParamLoadOnly(classname, paramname, loadfunction, xmlelement, mode) \
+    XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, paramname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), #loadfunction), 0, xmlelement, mode)
+#define XMLPortParamLoadOnly_Template(classname, paramname, loadtemplate, loadfunction, xmlelement, mode) \
+    XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, paramname, orxonox::createExecutor(orxonox::createFunctor loadtemplate (&classname::loadfunction), #loadfunction), 0, xmlelement, mode)
+
+#define XMLPortParamGeneric(containername, classname, paramname, loadexecutor, saveexecutor, xmlelement, mode) \
+    orxonox::XMLPortClassParamContainer<classname>* containername = (orxonox::XMLPortClassParamContainer<classname>*)(this->getIdentifier()->getXMLPortParamContainer(paramname)); \
+    if (!containername) \
+    { \
+        containername = new orxonox::XMLPortClassParamContainer<classname>(std::string(paramname), loadexecutor, saveexecutor); \
+        this->getIdentifier()->addXMLPortParamContainer(paramname, containername); \
+    } \
+    containername->port(this, xmlelement, mode)
+
+
+#define XMLPortObject(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \
+    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), #savefunction), xmlelement, mode, bApplyLoaderMask, bLoadBefore)
+#define XMLPortObject_Template(classname, objectclass, sectionname, loadtemplate, loadfunction, savetemplate, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \
+    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor loadtemplate (&classname::loadfunction), #loadfunction), orxonox::createExecutor(orxonox::createFunctor savetemplate (&classname::savefunction), #savefunction), xmlelement, mode, bApplyLoaderMask, bLoadBefore)
+
+#define XMLPortObjectGeneric(containername, classname, objectclass, sectionname, loadexecutor, saveexecutor, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \
+    orxonox::XMLPortClassObjectContainer<classname, objectclass>* containername = (orxonox::XMLPortClassObjectContainer<classname, objectclass>*)(this->getIdentifier()->getXMLPortObjectContainer(sectionname)); \
+    if (!containername) \
+    { \
+        containername = new orxonox::XMLPortClassObjectContainer<classname, objectclass>(std::string(sectionname), loadexecutor, saveexecutor, bApplyLoaderMask, bLoadBefore); \
+        this->getIdentifier()->addXMLPortObjectContainer(sectionname, containername); \
+    } \
+    containername->port(this, xmlelement, mode)
+
+
+namespace orxonox
+{
+
+#ifndef _XMLPort_Mode__
+#define _XMLPort_Mode__
+    namespace XMLPort
+    {
+        enum Mode
+        {
+            LoadObject,
+            SaveObject
+        };
+    }
+#endif
+
+    // ###############################
+    // ###  XMLPortParamContainer  ###
+    // ###############################
+    class _CoreExport XMLPortParamContainer
+    {
+        enum ParseResult
+        {
+            PR_not_started,
+            PR_finished,
+            PR_waiting_for_default_values
+        };
+
+        public:
+            XMLPortParamContainer()
+                { this->parseResult_ = PR_not_started; }
+            virtual ~XMLPortParamContainer() {}
+
+            inline const std::string& getName() const
+                { return this->paramname_; }
+
+            virtual XMLPortParamContainer& description(const std::string description) = 0;
+            virtual const std::string& getDescription() = 0;
+
+            virtual XMLPortParamContainer& defaultValue(unsigned int index, const MultiTypeMath& param) = 0;
+            virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1) = 0;
+            virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2) = 0;
+            virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3) = 0;
+            virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4) = 0;
+            virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4, const MultiTypeMath& param5) = 0;
+
+        protected:
+            std::string paramname_;
+            ParseResult parseResult_;
+
+    };
+
+    template <class T>
+    class XMLPortClassParamContainer : public XMLPortParamContainer
+    {
+        struct ParseParams
+        {
+            T* object;
+            Element* xmlelement;
+            XMLPort::Mode mode;
+        };
+
+        public:
+            XMLPortClassParamContainer(const std::string paramname, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor)
+            {
+                this->paramname_ = paramname;
+                this->loadexecutor_ = loadexecutor;
+                this->saveexecutor_ = saveexecutor;
+            }
+
+            XMLPortParamContainer& port(T* object, Element& xmlelement, XMLPort::Mode mode)
+            {
+                this->parseParams_.object = object;
+                this->parseParams_.xmlelement = &xmlelement;
+                this->parseParams_.mode = mode;
+
+                if (mode == XMLPort::LoadObject)
+                {
+                    try
+                    {
+                        std::string attribute = xmlelement.GetAttribute(this->paramname_);
+                        if ((attribute.size() > 0) || (this->loadexecutor_->allDefaultValuesSet()))
+                        {
+                            COUT(5) << object->getLoaderIndentation() << "Loading parameter " << this->paramname_ << " in " << object->getIdentifier()->getName() << " (objectname " << object->getName() << ")." << std::endl << object->getLoaderIndentation();
+                            if (this->loadexecutor_->parse(object, attribute, ","))
+                                this->parseResult_ = PR_finished;
+                            else
+                                this->parseResult_ = PR_waiting_for_default_values;
+                        }
+                    }
+                    catch(ticpp::Exception& ex)
+                    {
+                        COUT(1) << std::endl;
+                        COUT(1) << "An error occurred in XMLPort.h while loading attribute '" << this->paramname_ << "' of '" << object->getIdentifier()->getName() << "' (objectname: " << object->getName() << ") in " << object->getLevelfile() << ":" << std::endl;
+                        COUT(1) << ex.what() << std::endl;
+                    }
+                }
+                else
+                {
+                    if (this->saveexecutor_)
+                    {
+//                        xmlelement.SetAttribute(this->paramname_, "...");
+                    }
+                }
+
+                return (*this);
+            }
+
+            XMLPortParamContainer& port(const ParseParams& parseParams)
+            {
+                return this->port(parseParams.object, *parseParams.xmlelement, parseParams.mode);
+            }
+
+            XMLPortParamContainer& portIfWaitingForDefaultValues(const ParseResult& result, const ParseParams& params)
+            {
+                if (result == PR_waiting_for_default_values)
+                    return this->port(params);
+                else
+                    return (*this);
+            }
+
+            virtual XMLPortParamContainer& description(const std::string description)
+                { this->loadexecutor_->setDescription(description); return (*this); }
+            virtual const std::string& getDescription()
+                { return this->loadexecutor_->getDescription(); }
+
+            virtual XMLPortParamContainer& defaultValue(unsigned int index, const MultiTypeMath& param)
+            {
+                if (!this->loadexecutor_->defaultValueSet(index))
+                    this->loadexecutor_->setDefaultValue(index, param);
+                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
+            }
+            virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1)
+            {
+                if (!this->loadexecutor_->defaultValueSet(0))
+                    this->loadexecutor_->setDefaultValues(param1);
+                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
+            }
+            virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2)
+            {
+                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)))
+                    this->loadexecutor_->setDefaultValues(param1, param2);
+                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
+            }
+            virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3)
+            {
+                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)) || (!this->loadexecutor_->defaultValueSet(2)))
+                    this->loadexecutor_->setDefaultValues(param1, param2, param3);
+                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
+            }
+            virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4)
+            {
+                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)) || (!this->loadexecutor_->defaultValueSet(2)) || (!this->loadexecutor_->defaultValueSet(3)))
+                    this->loadexecutor_->setDefaultValues(param1, param2, param3, param4);
+                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
+            }
+            virtual XMLPortParamContainer& defaultValues(const MultiTypeMath& param1, const MultiTypeMath& param2, const MultiTypeMath& param3, const MultiTypeMath& param4, const MultiTypeMath& param5)
+            {
+                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)) || (!this->loadexecutor_->defaultValueSet(2)) || (!this->loadexecutor_->defaultValueSet(3)) || (!this->loadexecutor_->defaultValueSet(4)))
+                    this->loadexecutor_->setDefaultValues(param1, param2, param3, param4, param5);
+                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
+            }
+
+        private:
+            ExecutorMember<T>* loadexecutor_;
+            ExecutorMember<T>* saveexecutor_;
+            ParseParams parseParams_;
+    };
+
+
+    // ################################
+    // ###  XMLPortObjectContainer  ###
+    // ################################
+    class _CoreExport XMLPortObjectContainer
+    {
+        public:
+            XMLPortObjectContainer()
+                { this->bApplyLoaderMask_ = false; }
+            virtual ~XMLPortObjectContainer() {}
+
+            inline const std::string& getName() const
+                { return this->sectionname_; }
+
+            virtual XMLPortObjectContainer& description(const std::string description) = 0;
+            virtual const std::string& getDescription() = 0;
+
+            bool identifierIsIncludedInLoaderMask(const Identifier* identifier);
+
+        protected:
+            std::string sectionname_;
+            bool bApplyLoaderMask_;
+            bool bLoadBefore_;
+    };
+
+    template <class T, class O>
+    class XMLPortClassObjectContainer : public XMLPortObjectContainer
+    {
+        public:
+            XMLPortClassObjectContainer(const std::string sectionname, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor, bool bApplyLoaderMask, bool bLoadBefore)
+            {
+                this->sectionname_ = sectionname;
+                this->loadexecutor_ = loadexecutor;
+                this->saveexecutor_ = saveexecutor;
+                this->bApplyLoaderMask_ = bApplyLoaderMask;
+                this->bLoadBefore_ = bLoadBefore;
+            }
+
+            XMLPortObjectContainer& port(T* object, Element& xmlelement, XMLPort::Mode mode)
+            {
+                if (mode == XMLPort::LoadObject)
+                {
+                    try
+                    {
+                        Element* xmlsubelement;
+                        if ((this->sectionname_ != "") && (this->sectionname_.size() > 0))
+                            xmlsubelement = xmlelement.FirstChildElement(this->sectionname_, false);
+                        else
+                            xmlsubelement = &xmlelement;
+
+                        if (xmlsubelement)
+                        {
+                            for (ticpp::Iterator<ticpp::Element> child = xmlsubelement->FirstChildElement(false); child != child.end(); child++)
+                            {
+                                Identifier* identifier = ID(child->Value());
+                                if (identifier)
+                                {
+                                    if (identifier->isA(Class(O)))
+                                    {
+                                        if (this->identifierIsIncludedInLoaderMask(identifier))
+                                        {
+                                            COUT(4) << object->getLoaderIndentation() << "fabricating " << child->Value() << "..." << std::endl;
+
+                                            O* newObject = (O*)identifier->fabricate();
+                                            newObject->setLoaderIndentation(object->getLoaderIndentation() + "  ");
+                                            newObject->setLevel(object->getLevel());
+                                            newObject->setNamespace(object->getNamespace());
+
+                                            if (this->bLoadBefore_)
+                                            {
+                                                newObject->XMLPort(*child, XMLPort::LoadObject);
+                                                COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << object->getIdentifier()->getName() << " (objectname " << object->getName() << ")" << std::endl;
+                                            }
+                                            else
+                                            {
+                                                COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << object->getIdentifier()->getName() << " (objectname " << object->getName() << ")" << std::endl;
+                                            }
+
+                                            COUT(5) << object->getLoaderIndentation();
+                                            (*this->loadexecutor_)(object, newObject);
+
+                                            if (!this->bLoadBefore_)
+                                                newObject->XMLPort(*child, XMLPort::LoadObject);
+
+                                            COUT(5) << object->getLoaderIndentation() << "...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl;
+                                        }
+                                    }
+                                    else
+                                    {
+                                        COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a '" << Class(O)->getName() << "'." << std::endl;
+                                    }
+                                }
+                                else
+                                {
+                                    COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a valid classname." << std::endl;
+                                }
+                            }
+                        }
+                    }
+                    catch(ticpp::Exception& ex)
+                    {
+                        COUT(1) << std::endl;
+                        COUT(1) << "An error occurred in XMLPort.h while loading a '" << Class(O)->getName() << "' in '" << this->sectionname_ << "' of '" << object->getIdentifier()->getName() << "' (objectname: " << object->getName() << ") in " << object->getLevelfile() << ":" << std::endl;
+                        COUT(1) << ex.what() << std::endl;
+                    }
+                }
+                else
+                {
+                }
+
+                return (*this);
+            }
+
+            virtual XMLPortObjectContainer& description(const std::string description)
+                { this->loadexecutor_->setDescription(description); return (*this); }
+            virtual const std::string& getDescription()
+                { return this->loadexecutor_->getDescription(); }
+
+        private:
+            ExecutorMember<T>* loadexecutor_;
+            ExecutorMember<T>* saveexecutor_;
+    };
+}
+
+#endif /* _XMLPort_H__ */
Index: code/trunk/src/core/tolua.pkg
===================================================================
--- code/trunk/src/core/tolua.pkg	(revision 1055)
+++ code/trunk/src/core/tolua.pkg	(revision 1055)
@@ -0,0 +1,1 @@
+$cfile "../../orxonox/core/Script.h"
Index: code/trunk/src/network/ClientConnection.cc
===================================================================
--- code/trunk/src/network/ClientConnection.cc	(revision 1054)
+++ code/trunk/src/network/ClientConnection.cc	(revision 1055)
@@ -43,5 +43,5 @@
 
 #include "util/Sleep.h"
-#include "orxonox/core/Debug.h"
+#include "core/Debug.h"
 #include "ClientConnection.h"
 
Index: code/trunk/src/network/PacketDecoder.cc
===================================================================
--- code/trunk/src/network/PacketDecoder.cc	(revision 1054)
+++ code/trunk/src/network/PacketDecoder.cc	(revision 1055)
@@ -38,5 +38,5 @@
 #include "PacketTypes.h"
 #include "PacketManager.h"
-#include "orxonox/core/Debug.h"
+#include "core/Debug.h"
 
 namespace network
Index: code/trunk/src/orxonox/objects/NPC.cc
===================================================================
--- code/trunk/src/orxonox/objects/NPC.cc	(revision 1054)
+++ code/trunk/src/orxonox/objects/NPC.cc	(revision 1055)
@@ -29,5 +29,5 @@
 #include "NPC.h"
 
-#include "../core/CoreIncludes.h"
+#include "core/CoreIncludes.h"
 
 namespace orxonox {
