Index: code/branches/libraries2/src/libraries/util/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/libraries/util/CMakeLists.txt	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/CMakeLists.txt	(revision 5714)
@@ -0,0 +1,79 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        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.
+ #
+
+SET_SOURCE_FILES(UTIL_SRC_FILES
+  Clipboard.cc
+  CRC32.cc
+  Exception.cc
+  ExprParser.cc
+  Math.cc
+  MultiType.cc
+  OutputBuffer.cc
+  OutputHandler.cc
+  Scope.cc
+  SignalHandler.cc
+  Sleep.cc
+  StringUtils.cc
+  SubString.cc
+)
+
+SET_SOURCE_FILES(UTIL_HDR_FILES
+  CRC32.h
+  Clipboard.h
+  Convert.h
+  Debug.h
+  Exception.h
+  ExprParser.h
+  Math.h
+  MathConvert.h
+  mbool.h
+  MultiType.h
+  MultiTypeValue.h
+  OgreForwardRefs.h
+  OrxAssert.h
+  OrxEnum.h
+  OutputBuffer.h
+  OutputHandler.h
+  RefToValue.h
+  ScopeGuard.h
+  Serialise.h
+  SignalHandler.h
+  Singleton.h
+  Sleep.h
+  StringUtils.h
+  SubString.h
+  TemplateUtils.h
+  TypeTraits.h
+  UTFStringConversions.h
+  UtilPrereqs.h
+)
+
+IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
+  # Get around displaying a few hundred lines of warning code
+  SET_SOURCE_FILES_PROPERTIES(MultiType.cc PROPERTIES COMPILE_FLAGS "-w")
+ENDIF()
+
+ORXONOX_ADD_LIBRARY(util
+  DEFINE_SYMBOL
+    "UTIL_SHARED_BUILD"
+  LINK_LIBRARIES
+    ${OGRE_LIBRARY}
+  SOURCE_FILES
+    ${UTIL_SRC_FILES} ${UTIL_HDR_FILES}
+)
Index: code/branches/libraries2/src/libraries/util/CRC32.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/CRC32.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/CRC32.cc	(revision 5714)
@@ -0,0 +1,59 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      ...
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "CRC32.h"
+
+namespace orxonox
+{
+    void calcCRCBit(uint32_t &crc32, int bit)
+    {
+        int hbit = (crc32 & 0x80000000) ? 1 : 0;
+        if (hbit != bit)
+            crc32 = (crc32 << 1) ^ UTIL_CRC32POLY;
+        else
+            crc32 = crc32 << 1;
+      }
+
+    uint32_t calcCRC(unsigned char *data, unsigned int dataLength)
+    {
+        uint32_t crc32 = 0;
+        for(unsigned int i = 0; i < dataLength; i++)
+        {
+            calcCRCBit(crc32, (data[i] & 0x1) >> 0); // 1st bit
+            calcCRCBit(crc32, (data[i] & 0x2) >> 1); // 2nd bit
+            calcCRCBit(crc32, (data[i] & 0x3) >> 2); // 3rd bit
+            calcCRCBit(crc32, (data[i] & 0x4) >> 3); // 4th bit
+            calcCRCBit(crc32, (data[i] & 0x5) >> 4); // 5th bit
+            calcCRCBit(crc32, (data[i] & 0x6) >> 5); // 6th bit
+            calcCRCBit(crc32, (data[i] & 0x7) >> 6); // 7th bit
+            calcCRCBit(crc32, (data[i] & 0x8) >> 7); // 8th bit
+        }
+        return crc32;
+    }
+}
+
Index: code/branches/libraries2/src/libraries/util/CRC32.h
===================================================================
--- code/branches/libraries2/src/libraries/util/CRC32.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/CRC32.h	(revision 5714)
@@ -0,0 +1,43 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      ...
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Util_CRC_H__
+#define _Util_CRC_H__
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    const unsigned int UTIL_CRC32POLY = 0x04C11DB7; /* CRC-32 Polynom */
+
+    _UtilExport void calcCRCBit(uint32_t &crc32, int bit);
+
+    _UtilExport uint32_t calcCRC(unsigned char *data, unsigned int dataLength);
+}
+
+#endif /* _Util_CRC_H__ */
Index: code/branches/libraries2/src/libraries/util/Clipboard.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/Clipboard.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Clipboard.cc	(revision 5714)
@@ -0,0 +1,142 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      ...
+ *
+ *   Windows version inspired by "Copy Text To Clipboard" by Laszlo Szathmary, 2007
+ *      http://www.loria.fr/~szathmar/off/projects/C/CopyTextToClipboard/index.php
+ */
+
+/**
+    @file
+    @brief OS-specific implementations of the clipboard functions.
+*/
+
+#include "Clipboard.h"
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+
+/////////////
+// Windows //
+/////////////
+
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#undef min
+#undef max
+#include "Debug.h"
+
+namespace orxonox
+{
+
+    /**
+        @brief Puts text into the windows-clipboard
+        @param text The text
+        @return True if the action was successful
+    */
+    bool toClipboard(const std::string& text)
+    {
+        try
+        {
+            if (OpenClipboard(0))
+            {
+                EmptyClipboard();
+                HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, text.size() + 1);
+                char* buffer = static_cast<char*>(GlobalLock(clipbuffer));
+                strcpy(buffer, text.c_str());
+                GlobalUnlock(clipbuffer);
+                SetClipboardData(CF_TEXT, clipbuffer);
+                CloseClipboard();
+
+                return true;
+            }
+        }
+        catch (...)
+        {
+            COUT(1) << "Error: Unable to copy the following text to the clipboard:" << std::endl;
+            COUT(1) << "       \"" << text << "\"" << std::endl;
+        }
+        return false;
+    }
+
+    /**
+        @brief Gets text from the windows-clipboard if there is any text.
+        @return The retrieved text
+    */
+    std::string fromClipboard()
+    {
+        try
+        {
+            if (OpenClipboard(0))
+            {
+                HANDLE hData = GetClipboardData(CF_TEXT);
+                std::string output = static_cast<char*>(GlobalLock(hData));
+                GlobalUnlock(hData);
+                CloseClipboard();
+
+                return output;
+            }
+        }
+        catch (...)
+        {
+            COUT(1) << "Error: Unable to retrieve text from the clipboard." << std::endl;
+        }
+        return "";
+    }
+}
+
+#else /* ORXONOX_PLATFORM_WINDOWS */
+
+/////////////
+// Default //
+/////////////
+
+namespace orxonox
+{
+    static std::string clipboard = ""; //!< Keeps the text of our internal clipboard
+
+    /**
+        @brief Default implementation if there is no OS-specific implementation or no clipboard. Copies the text into an internal clipboard.
+        @param text The text
+        @return True
+    */
+    bool toClipboard(const std::string& text)
+    {
+        clipboard = text;
+        return true;
+    }
+
+    /**
+        @brief Default implementation if there is no OS-specific implementation or no clipboard. Gets the text from the internal clipboard.
+        @return The text
+    */
+    std::string fromClipboard()
+    {
+        return clipboard;
+    }
+}
+
+#endif /* ORXONOX_PLATFORM_WINDOWS */
Index: code/branches/libraries2/src/libraries/util/Clipboard.h
===================================================================
--- code/branches/libraries2/src/libraries/util/Clipboard.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Clipboard.h	(revision 5714)
@@ -0,0 +1,54 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 Some functions to exchange text between the OS clipboard and Orxonox.
+
+    Use fromClipboard() to get text from the clipboard (if there is any text) and
+    toClipboard(text) to put text into the clipboard.
+
+    Those functions can only work properly if there's an OS-specific implementation.
+    If an OS isn't supported, the clipboard only works within Orxonox, but exchange
+    with other programs isn't possible.
+*/
+
+#ifndef _Clipboard_H__
+#define _Clipboard_H__
+
+#include "UtilPrereqs.h"
+#include <string>
+
+namespace orxonox
+{
+    _UtilExport bool toClipboard(const std::string& text);
+    _UtilExport std::string fromClipboard();
+}
+
+#endif /* _Clipboard_H__ */
+
Index: code/branches/libraries2/src/libraries/util/Convert.h
===================================================================
--- code/branches/libraries2/src/libraries/util/Convert.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Convert.h	(revision 5714)
@@ -0,0 +1,418 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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
+ *      Fabian 'x3n' Landau
+ *      Benjamin Grauer
+ *   Co-authors:
+ *      ...
+ */
+
+/*!
+    @file
+    @brief Definition and Implementation of the Convert class.
+*/
+
+#ifndef _Converter_H__
+#define _Converter_H__
+
+#include "UtilPrereqs.h"
+
+#include <string>
+#include <sstream>
+#include <typeinfo>
+
+#include "Debug.h"
+#include "StringUtils.h"
+#include "TemplateUtils.h"
+
+////////////////////////////////////
+//// ACTUAL CONVERSION SEQUENCE ////
+////////////////////////////////////
+/*
+    There is a distinct priority when choosing the right conversion function:
+    Overwrite:
+    1. (Partial) template specialisation of ConverterExplicit::convert()
+    Fallbacks:
+    2. Any possible implicit conversion. This includes 'FooBar' --> 'int' if FooBar defines operator float().
+    3. Global or member operators for stringstream when converting from or to std::string (or FROM const char*)
+    4. (Partial) template specialisation of ConverterFallback::convert()
+    5. Function that simply displays "Could not convert value" with type information obtained from typeid().
+
+    Notes:
+    There has to be an exact type match when using template specialisations.
+    Template specialisations can be defined after including this file. Any implicit cast function or iostream
+    operator has to be declared BEFORE this file gets parsed.
+
+    Defining your own functions:
+    There are obviously 4 ways to specifiy a user defined conversion. What should I use?
+
+    Usually, ConverterFallback fits quite well. You won't have to deal with the conversion from
+    'MyClass' to 'MyClass' by using another explicit template specialisation to avoid ambiguities.
+
+    However if you want to overwrite an implicit conversion or an iostream operator, you really need to
+    make use of ConverterExplicit.
+*/
+
+namespace orxonox
+{
+    namespace detail
+    {
+        //! Little template that maps integers to entire types (Alexandrescu 2001)
+        template <int I>
+        struct Int2Type { };
+    }
+
+
+    ///////////////////
+    // No Conversion //
+    ///////////////////
+
+    // Default template. No conversion available at all.
+    template <class FromType, class ToType>
+    struct ConverterFallback
+    {
+        FORCEINLINE static bool convert(ToType* output, const FromType& input)
+        {
+            COUT(2) << "Could not convert value of type " << typeid(FromType).name()
+                    << " to type " << typeid(ToType).name() << std::endl;
+            return false;
+        }
+    };
+
+    // If all else fails, try a dynamic_cast for pointer types.
+    template <class FromType, class ToType>
+    struct ConverterFallback<FromType*, ToType*>
+    {
+        FORCEINLINE static bool convert(ToType** output, FromType* const input)
+        {
+            ToType* temp = dynamic_cast<ToType*>(input);
+            if (temp)
+            {
+                *output = temp;
+                return true;
+            }
+            else
+                return false;
+        }
+    };
+}
+
+
+///////////////////////
+// ConverterFallback //
+///////////////////////
+
+// Default template for stringstream
+template <class FromType, class ToType>
+struct ConverterStringStream
+{
+    FORCEINLINE static bool convert(ToType* output, const FromType& input)
+    {
+        return orxonox::ConverterFallback<FromType, ToType>::convert(output, input);
+    }
+};
+
+
+/////////////
+// OStream //
+/////////////
+
+namespace fallbackTemplates
+{
+    template <class FromType>
+    FORCEINLINE bool operator <<(std::ostream& outstream,  const FromType& input)
+    {
+        std::string temp;
+        if (orxonox::ConverterFallback<FromType, std::string>::convert(&temp, input))
+        {
+            std::operator <<(outstream, temp);
+            return true;
+        }
+        else
+            return false;
+    }
+}
+
+// template that evaluates whether we can convert to std::string via ostringstream
+template <class FromType>
+struct ConverterStringStream<FromType, std::string>
+{
+    FORCEINLINE static bool convert(std::string* output, const FromType& input)
+    {
+        using namespace fallbackTemplates;
+        // this operator call only chooses fallbackTemplates::operator<< if there's no other fitting function
+        std::ostringstream oss;
+        if (oss << input)
+        {
+            (*output) = oss.str();
+            return true;
+        }
+        else
+            return false;
+    }
+};
+
+
+/////////////
+// IStream //
+/////////////
+
+namespace fallbackTemplates
+{
+    template <class ToType>
+    FORCEINLINE bool operator >>(std::istream& instream, ToType& output)
+    {
+        return orxonox::ConverterFallback<std::string, ToType>
+            ::convert(&output, static_cast<std::istringstream&>(instream).str());
+    }
+}
+
+// template that evaluates whether we can convert from std::string via ostringstream
+template <class ToType>
+struct ConverterStringStream<std::string, ToType>
+{
+    FORCEINLINE static bool convert(ToType* output, const std::string& input)
+    {
+        using namespace fallbackTemplates;
+        std::istringstream iss(input);
+        // this operator call only chooses fallbackTemplates::operator>> if there's no other fitting function
+        if (iss >> (*output))
+        {
+            return true;
+        }
+        else
+            return false;
+    }
+};
+
+namespace orxonox
+{
+
+    ///////////////////
+    // Implicit Cast //
+    ///////////////////
+
+    // implicit cast not possible, try stringstream conversion next
+    template <class FromType, class ToType>
+    FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, detail::Int2Type<false>)
+    {
+        return ConverterStringStream<FromType, ToType>::convert(output, input);
+    }
+
+    // We can cast implicitely
+    template <class FromType, class ToType>
+    FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, detail::Int2Type<true>)
+    {
+        (*output) = static_cast<ToType>(input);
+        return true;
+    }
+
+
+    ////////////////////////////////
+    // ConverterExplicit Fallback //
+    ////////////////////////////////
+
+    // Default template if no specialisation is available
+    template <class FromType, class ToType>
+    struct ConverterExplicit
+    {
+        enum { probe = ImplicitConversion<FromType, ToType>::exists };
+        FORCEINLINE static bool convert(ToType* output, const FromType& input)
+        {
+            // Try implict cast and probe first. If a simple cast is not possible, it will not compile
+            // We therefore have to out source it into another template function
+            return convertImplicitely(output, input, detail::Int2Type<probe>());
+        }
+    };
+
+
+    //////////////////////
+    // Public Functions //
+    //////////////////////
+
+    /**
+    @brief
+        Converts any value to any other as long as there exists a conversion.
+        Otherwise, the conversion will generate a runtime warning and return false.
+        For information about the different conversion methods (user defined too), see the section
+        'Actual conversion sequence' in this file above.
+    */
+    template <class FromType, class ToType>
+    FORCEINLINE bool convertValue(ToType* output, const FromType& input)
+    {
+        return ConverterExplicit<FromType, ToType>::convert(output, input);
+    }
+
+    // Calls convertValue and returns true if the conversion was successful.
+    // Otherwise the fallback is used.
+    /**
+    @brief
+        Converts any value to any other as long as there exists a conversion.
+        Otherwise, the conversion will generate a runtime warning and return false.
+        For information about the different conversion methods (user defined too), see the section
+        'Actual conversion sequence' in this file above.
+        If the conversion doesn't succeed, 'fallback' is written to '*output'.
+    @param fallback
+        A default value that gets written to '*output' if there is no conversion.
+    */
+    template<class FromType, class ToType>
+    FORCEINLINE bool convertValue(ToType* output, const FromType& input, const ToType& fallback)
+    {
+        if (convertValue(output, input))
+            return true;
+        else
+        {
+            (*output) = fallback;
+            return false;
+        }
+    }
+
+    // Directly returns the converted value, even if the conversion was not successful.
+    template<class FromType, class ToType>
+    FORCEINLINE ToType getConvertedValue(const FromType& input)
+    {
+        ToType output;
+        convertValue(&output, input);
+        return output;
+    }
+
+    // Directly returns the converted value, but uses the fallback on failure.
+    template<class FromType, class ToType>
+    FORCEINLINE ToType getConvertedValue(const FromType& input, const ToType& fallback)
+    {
+        ToType output;
+        convertValue(&output, input, fallback);
+        return output;
+    }
+
+    // Like getConvertedValue, but the template argument order is in reverse.
+    // That means you can call it exactly like static_cast<ToType>(fromTypeValue).
+    template<class ToType, class FromType>
+    FORCEINLINE ToType multi_cast(const FromType& input)
+    {
+        ToType output;
+        convertValue(&output, input);
+        return output;
+    }
+
+    ////////////////////////////////
+    // Special string conversions //
+    ////////////////////////////////
+
+    // Delegate conversion from const char* to std::string
+    template <class ToType>
+    struct ConverterExplicit<const char*, ToType>
+    {
+        FORCEINLINE static bool convert(ToType* output, const char* input)
+        {
+            return convertValue<std::string, ToType>(output, input);
+        }
+    };
+
+    // These conversions would exhibit ambiguous << or >> operators when using stringstream
+    template <>
+    struct ConverterExplicit<char, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const char input)
+        {
+            *output = std::string(1, input);
+            return true;
+        }
+    };
+    template <>
+    struct ConverterExplicit<unsigned char, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const unsigned char input)
+        {
+            *output = std::string(1, input);
+            return true;
+        }
+    };
+    template <>
+    struct ConverterExplicit<std::string, char>
+    {
+        FORCEINLINE static bool convert(char* output, const std::string input)
+        {
+            if (input != "")
+                *output = input[0];
+            else
+                *output = '\0';
+            return true;
+        }
+    };
+    template <>
+    struct ConverterExplicit<std::string, unsigned char>
+    {
+        FORCEINLINE static bool convert(unsigned char* output, const std::string input)
+        {
+            if (input != "")
+                *output = input[0];
+            else
+                *output = '\0';
+            return true;
+        }
+    };
+
+
+    // bool to std::string
+    template <>
+    struct ConverterExplicit<bool, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const bool& input)
+        {
+            if (input)
+              *output = "true";
+            else
+              *output = "false";
+            return true;
+        }
+    };
+
+    // std::string to bool
+    template <>
+    struct ConverterExplicit<std::string, bool>
+    {
+        static bool convert(bool* output, const std::string& input)
+        {
+            std::string stripped = getLowercase(removeTrailingWhitespaces(input));
+            if (stripped == "true" || stripped == "on" || stripped == "yes")
+            {
+              *output = true;
+              return true;
+            }
+            else if (stripped == "false" || stripped == "off" || stripped == "no")
+            {
+              *output = false;
+              return true;
+            }
+
+            std::istringstream iss(input);
+            if (iss >> (*output))
+                return true;
+            else
+                return false;
+        }
+    };
+}
+
+#endif /* _Convert_H__ */
Index: code/branches/libraries2/src/libraries/util/Debug.h
===================================================================
--- code/branches/libraries2/src/libraries/util/Debug.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Debug.h	(revision 5714)
@@ -0,0 +1,259 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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
+    @brief Handles different output-levels of errors, warnings, infos and debug information.
+
+    The COUT(level) macro acts like std::cout, but the output is only performed if the given
+    level is <= the soft debug level.
+
+    There are two used values in this file:
+     - The hard debug level is used during compiletime. It describes the highest allowed output level.
+     - The soft debug level is used during runtime and is the maximum of the three configurable
+       output-levels for console, logfile and ingame shell.
+
+    The separation between the three devices is done by the OutputHandler.
+
+    Possible levels are:
+     0: Very important output
+     1: Errors
+     2: Warnings
+     3: Information
+     4: Debug information
+     5: More debug information
+     6: Crazy debug information
+
+    @example
+    COUT(0) << "Very important output" << std::endl;
+    COUT(1) << "Error: Something went wrong!" << std::endl;
+    COUT(2) << "Warning: There might be a problem." << std::endl;
+    COUT(3) << "Info: It's monday" << std::endl;
+    COUT(4) << "Debug: x is 1.23456" << std::endl;
+ */
+
+#ifndef _Debug_H__
+#define _Debug_H__
+
+#include "UtilPrereqs.h"
+
+#include "OutputHandler.h"
+
+namespace orxonox
+{
+    /**
+        @brief Returns the soft debug level, stored in the only existing instance of the OutputHandler class, configured in the config-file.
+        @return The soft debug level
+    */
+    inline int getSoftDebugLevel()
+    {
+        return OutputHandler::getSoftDebugLevel();
+    }
+
+    using std::endl;
+}
+
+// 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_VERBOSE         5
+#define ORX_ULTRA           6
+
+//definitions
+#define ORX_PRINT_DEBUG_OUTPUT 1
+#define ORX_HARD_DEBUG_LEVEL ORX_VERBOSE
+
+#define COUT_EXEC(x) orxonox::OutputHandler::getOutStream().setOutputLevel(x)
+
+////////////////////////////////////////////////////////
+///  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_VERBOSE COUT5
+#define COUTORX_ULTRA   COUT6
+
+#ifndef COUT
+ #if ORX_PRINT_DEBUG_OUTPUT
+  #define COUT(x) \
+   COUT ## x
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_NONE
+   #define COUT0 \
+   (orxonox::getSoftDebugLevel() < ORX_NONE) ? COUT_EXEC(0) : COUT_EXEC(0)
+  #else
+   #define COUT0 \
+    false ? COUT_EXEC(0) : COUT_EXEC(0)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
+   #define COUT1 \
+    (orxonox::getSoftDebugLevel() < ORX_ERROR) ? COUT_EXEC(1) : COUT_EXEC(1)
+  #else
+   #define COUT1 \
+    false ? COUT_EXEC(1) : COUT_EXEC(1)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
+   #define COUT2 \
+    (orxonox::getSoftDebugLevel() < ORX_WARNING) ? COUT_EXEC(2) : COUT_EXEC(2)
+  #else
+   #define COUT2 \
+    false ? COUT_EXEC(2) : COUT_EXEC(2)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
+   #define COUT3 \
+    (orxonox::getSoftDebugLevel() < ORX_INFO) ? COUT_EXEC(3) : COUT_EXEC(3)
+  #else
+   #define COUT3 \
+    false ? COUT_EXEC(3) : COUT_EXEC(3)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
+   #define COUT4 \
+    (orxonox::getSoftDebugLevel() < ORX_DEBUG) ? COUT_EXEC(4) : COUT_EXEC(4)
+  #else
+   #define COUT4 \
+    false ? COUT_EXEC(4) : COUT_EXEC(4)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_VERBOSE
+   #define COUT5 \
+    (orxonox::getSoftDebugLevel() < ORX_VERBOSE) ? COUT_EXEC(5) : COUT_EXEC(5)
+  #else
+   #define COUT5 \
+    false ? COUT_EXEC(5) : COUT_EXEC(5)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ULTRA
+   #define COUT6 \
+    (orxonox::getSoftDebugLevel() < ORX_ULTRA) ? COUT_EXEC(6) : COUT_EXEC(6)
+  #else
+   #define COUT6 \
+    false ? COUT_EXEC(6) : COUT_EXEC(6)
+  #endif
+
+ #else /* if ORX_PRINT_DEBUG_OUTPUT */
+  #define COUT(x) \
+    false ? COUT_EXEC(6) : COUT_EXEC(6)
+ #endif /* if ORX_PRINT_DEBUG_OUTPUT */
+
+#endif /* ifndef COUT */
+
+
+/////////////////////////////////////////////////////////////////////
+///  CCOUT: Prints output with std::cout and adds the classname   ///
+/////////////////////////////////////////////////////////////////////
+#define CCOUTORX_NONE    CCOUT0
+#define CCOUTORX_ERROR   CCOUT1
+#define CCOUTORX_WARNING CCOUT2
+#define CCOUTORX_INFO    CCOUT3
+#define CCOUTORX_DEBUG   CCOUT4
+#define CCOUTORX_VERBOSE CCOUT5
+#define CCOUTORX_ULTRA   CCOUT6
+
+#define CCOUT_EXEC(x) \
+  orxonox::OutputHandler::getOutStream().setOutputLevel(x) \
+  << this->getIdentifier()->getName() << ": "
+
+#ifndef CCOUT
+ #if ORX_PRINT_DEBUG_OUTPUT
+  #define CCOUT(x) \
+   CCOUT ## x
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_NONE
+   #define CCOUT0 \
+    (orxonox::getSoftDebugLevel() < ORX_NONE) ? COUT_EXEC(0) : CCOUT_EXEC(0)
+  #else
+   #define CCOUT0 \
+    false ? COUT_EXEC(0) : CCOUT_EXEC(0)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
+   #define CCOUT1 \
+    (orxonox::getSoftDebugLevel() < ORX_ERROR) ? COUT_EXEC(1) : CCOUT_EXEC(1)
+  #else
+   #define CCOUT1 \
+    false ? COUT_EXEC(1) : CCOUT_EXEC(1)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
+   #define CCOUT2 \
+    (orxonox::getSoftDebugLevel() < ORX_WARNING) ? COUT_EXEC(2) : CCOUT_EXEC(2)
+  #else
+   #define CCOUT2 \
+    false ? COUT_EXEC(2) : CCOUT_EXEC(2)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
+   #define CCOUT3 \
+    (orxonox::getSoftDebugLevel() < ORX_INFO) ? COUT_EXEC(3) : CCOUT_EXEC(3)
+  #else
+   #define CCOUT3 \
+    false ? COUT_EXEC(3) : CCOUT_EXEC(3)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
+   #define CCOUT4 \
+    (orxonox::getSoftDebugLevel() < ORX_DEBUG) ? COUT_EXEC(4) : CCOUT_EXEC(4)
+  #else
+   #define CCOUT4 \
+    false ? COUT_EXEC(4) : CCOUT_EXEC(4)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_VERBOSE
+   #define CCOUT5 \
+    (orxonox::getSoftDebugLevel() < ORX_VERBOSE) ? COUT_EXEC(5) : CCOUT_EXEC(5)
+  #else
+   #define CCOUT5 \
+    false ? COUT_EXEC(5) : CCOUT_EXEC(5)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ULTRA
+   #define CCOUT6 \
+    (orxonox::getSoftDebugLevel() < ORX_ULTRA) ? COUT_EXEC(6) : CCOUT_EXEC(6)
+  #else
+   #define CCOUT6 \
+    false ? COUT_EXEC(6) : CCOUT_EXEC(6)
+  #endif
+
+ #else /* if ORX_PRINT_DEBUG_OUTPUT */
+  #define CCOUT(x) \
+   false ? CCOUT_EXEC(6) : CCOUT_EXEC(6)
+ #endif /* if ORX_PRINT_DEBUG_OUTPUT */
+
+#endif /* ifndef CCOUT */
+
+#endif /* _Debug_H__ */
Index: code/branches/libraries2/src/libraries/util/Exception.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/Exception.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Exception.cc	(revision 5714)
@@ -0,0 +1,95 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 Exception class.
+*/
+
+#include "Exception.h"
+
+namespace orxonox
+{
+    Exception::Exception(const std::string& description, unsigned int lineNumber,
+                         const char* filename, const char* functionName)
+        : description_(description)
+        , lineNumber_(lineNumber)
+        , functionName_(functionName)
+        , filename_(filename)
+    { }
+
+    Exception::Exception(const std::string& description)
+        : description_(description)
+        , lineNumber_(0)
+        , functionName_("")
+        , filename_("")
+    { }
+
+    /**
+    @remarks
+        The composed full description gets stored to fullDescription_. But for compliance
+        with std::exception, this method has to be const. Hence fullDescription_ is declared
+        as mutable.
+    */
+    const std::string& Exception::getFullDescription() const
+    {
+        if (fullDescription_ == "")
+        {
+            std::ostringstream fullDesc;
+
+            fullDesc << this->getTypeName() << "Exception";
+
+            if (this->filename_ != "")
+            {
+                fullDesc << " in " << this->filename_;
+                if (this->lineNumber_)
+                    fullDesc << "(" << this->lineNumber_ << ")";
+            }
+
+            if (this->functionName_ != "")
+                fullDesc << " in function '" << this->functionName_ << "'";
+
+            fullDesc << ": ";
+            if (this->description_ != "")
+                fullDesc << this->description_;
+            else
+                fullDesc << "No description available.";
+
+            this->fullDescription_ = std::string(fullDesc.str());
+        }
+
+        return fullDescription_;
+    }
+
+    //! Returns the error description
+    const char* Exception::what() const throw()
+    {
+        return getDescription().c_str();
+    }
+}
Index: code/branches/libraries2/src/libraries/util/Exception.h
===================================================================
--- code/branches/libraries2/src/libraries/util/Exception.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Exception.h	(revision 5714)
@@ -0,0 +1,157 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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
+    Declaration of facilities to handle exceptions.
+*/
+
+#ifndef _Exception_H__
+#define _Exception_H__
+
+#include "UtilPrereqs.h"
+
+#include <exception>
+#include <sstream>
+#include <string>
+#include "Debug.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Base class for all exceptions (derived from std::exception).
+    @details
+        This class provides support for information about the file, the line
+        and the function the error occured.
+    */
+    class _UtilExport Exception : public std::exception
+    {
+    public:
+        /**
+        @brief
+            Creates the exception but doesn't yet compose the full descrption (because of the virtual functions)
+        @param description
+            Exception description as string. This message is supposed to help developers!
+        */
+        Exception(const std::string& description, unsigned int lineNumber,
+                  const char* filename, const char* functionName);
+        //! Simplified constructor with just a description. If you need more, use the other one.
+        Exception(const std::string& description);
+
+        //! Needed for compatibility with std::exception
+        virtual ~Exception() throw() { }
+        const char* what() const throw();
+
+        //! Returns a full description with type, line, file and function
+        virtual const std::string& getFullDescription() const;
+        //! Returns the string name of the exception type
+        virtual std::string        getTypeName()        const = 0;
+        //! Returns the short developer written exception
+        virtual const std::string& getDescription()     const { return this->description_; }
+        //! Returns the line number on which the exception occurred.
+        virtual const unsigned int getLineNumber()      const { return this->lineNumber_; }
+        //! Returns the function in which the exception occurred.
+        virtual const std::string& getFunctionName()    const { return this->functionName_; }
+        //! Returns the filename in which the exception occurred.
+        virtual const std::string& getFilename()        const { return this->filename_; }
+
+    protected:
+        std::string description_;             //!< User typed text about why the exception occurred
+        unsigned int lineNumber_;             //!< Line on which the exception occurred
+        std::string functionName_;            //!< Function (including namespace and class) where the exception occurred
+        std::string filename_;                //!< File where the exception occurred
+        // mutable because "what()" is a const method
+        mutable std::string fullDescription_; //!< Full description with line, file and function
+    };
+
+//! Creates a new type of exception that inherits from tracker::Exception
+#define CREATE_ORXONOX_EXCEPTION(ExceptionName)                                     \
+    class ExceptionName##Exception : public Exception                               \
+    {                                                                               \
+    public:                                                                         \
+        ExceptionName##Exception(const std::string& description,                    \
+                unsigned int lineNumber, const char* filename,                      \
+                const char* functionName)                                           \
+            : Exception(description, lineNumber, filename, functionName)            \
+        { }                                                                         \
+                                                                                    \
+        ExceptionName##Exception(const std::string& description)                    \
+            : Exception(description)                                                \
+        { }                                                                         \
+                                                                                    \
+        ~ExceptionName##Exception() throw() { }                                     \
+                                                                                    \
+        std::string getTypeName() const { return #ExceptionName; }                  \
+    }
+
+    // Creates all possible exception types.
+    // If you want to add a new type, simply copy and adjust a new line here.
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+    CREATE_ORXONOX_EXCEPTION(General);
+    CREATE_ORXONOX_EXCEPTION(FileNotFound);
+    CREATE_ORXONOX_EXCEPTION(Argument);
+    CREATE_ORXONOX_EXCEPTION(PhysicsViolation);
+    CREATE_ORXONOX_EXCEPTION(ParseError);
+    CREATE_ORXONOX_EXCEPTION(PluginsNotFound);
+    CREATE_ORXONOX_EXCEPTION(InitialisationFailed);
+    CREATE_ORXONOX_EXCEPTION(NotImplemented);
+    CREATE_ORXONOX_EXCEPTION(GameState);
+    CREATE_ORXONOX_EXCEPTION(NoGraphics);
+    CREATE_ORXONOX_EXCEPTION(AbortLoading);
+#endif
+
+    /**
+    @brief
+        Helper function that forwards an exception and displays the message.
+    @details
+        This is necessary because only when using 'throw' the objects storage is managed.
+    */
+    template <class T>
+    inline const T& exceptionThrowerHelper(const T& exception)
+    {
+        // let the catcher decide whether to display the message below level 4
+        COUT(4) << exception.getFullDescription() << std::endl;
+        return exception;
+    }
+
+/**
+@brief
+    Throws an exception and logs a message beforehand.
+@param type
+    Type of the exception as literal (General, Initialisation, etc.)
+@param description
+    Exception description as string
+*/
+#define ThrowException(type, description) \
+    throw orxonox::exceptionThrowerHelper(type##Exception(static_cast<std::ostringstream&>(std::ostringstream().flush() << description).str(), __LINE__, __FILE__, __FUNCTIONNAME__))
+
+} /* namespace orxonox */
+
+#endif /* _Exception_H__ */
Index: code/branches/libraries2/src/libraries/util/ExprParser.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/ExprParser.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/ExprParser.cc	(revision 5714)
@@ -0,0 +1,453 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 Declaration of FloatParser
+*/
+
+#include "ExprParser.h"
+#include <cmath>
+#include <cstring>
+#include <cstdlib>
+
+// macros for easier if, else statements
+#define CASE_1(var) if (!strcmp(SWITCH,var))
+#define CASE(var) else if (!strcmp(SWITCH,var))
+#define CASE_ELSE else
+
+//! skip white spaces
+#define PARSE_BLANKS while (*reading_stream == ' ') ++reading_stream
+
+namespace orxonox
+{
+    ExprParser::ExprParser(const std::string& str)
+    {
+        this->failed_ = false;
+        this->reading_stream = str.c_str();
+        if (str.size() == 0 || *reading_stream == '\0')
+        {
+            this->failed_ = true;
+            this->result_ = 0.0;
+        }
+        else
+        {
+            this->result_ = parse_expr_8();
+            this->remains_ = reading_stream;
+        }
+    }
+
+    //Private functions:
+    /******************/
+    double ExprParser::parse_argument()
+    {
+        double value = parse_expr_8();
+        if (*reading_stream == ',')
+        {
+            ++reading_stream;
+            return value;
+        }
+        else
+        {
+            this->failed_ = true;
+            return 0;
+        }
+    }
+
+    double ExprParser::parse_last_argument()
+    {
+        double value = parse_expr_8();
+        if (*reading_stream == ')')
+        {
+            ++reading_stream;
+            return value;
+        }
+        else
+        {
+            this->failed_ = true;
+            return 0;
+        }
+    }
+
+    double ExprParser::parse_expr_8()
+    {
+        double value = parse_expr_7();
+        for(;;)
+        {
+            switch (op)
+            {
+            case oder:
+                value = parse_expr_7() || value;
+                break;
+            default: return value;
+            }
+        };
+    }
+
+
+    double ExprParser::parse_expr_7()
+    {
+        double value = parse_expr_6();
+        for(;;)
+        {
+            switch (op)
+            {
+            case und:
+                value = value && parse_expr_6();
+                break;
+            default: return value;
+            }
+        };
+    }
+
+    double ExprParser::parse_expr_6()
+    {
+        double value = parse_expr_5();
+        for(;;)
+        {
+            switch (op)
+            {
+            case gleich:
+                value = (value == parse_expr_5());
+                break;
+            case ungleich:
+                value = (value != parse_expr_5());
+                break;
+            default:
+                return value;
+            }
+        };
+    }
+
+    double ExprParser::parse_expr_5()
+    {
+        double value = parse_expr_4();
+        for(;;)
+        {
+            switch (op)
+            {
+            case kleiner:
+                value = (value < parse_expr_4());
+                break;
+            case kleinergleich:
+                value = (value <= parse_expr_4());
+                break;
+            case groesser:
+                value = (value > parse_expr_4());
+                break;
+            case groessergleich:
+                value = (value >= parse_expr_4());
+                break;
+            default:
+                return value;
+            }
+        };
+    }
+
+    double ExprParser::parse_expr_4()
+    {
+        double value = parse_expr_3();
+        for(;;)
+        {
+            switch (op)
+            {
+            case b_plus:
+                value += parse_expr_3();
+                break;
+            case b_minus:
+                value -= parse_expr_3();
+                break;
+            default:
+                return value;
+            }
+        };
+    }
+
+    double ExprParser::parse_expr_3()
+    {
+        double value = parse_expr_2();
+        for(;;)
+        {
+            switch (op)
+            {
+            case mal:
+                value *= parse_expr_2();
+                break;
+            case durch:
+                value /= parse_expr_2();
+                break;
+            case modulo:
+                {
+                    double temp = parse_expr_2();
+                    value = value - floor(value/temp)*temp;
+                    break;
+                }
+            default:
+                return value;
+            }
+        };
+    }
+
+    double ExprParser::parse_expr_2()
+    {
+        double value = parse_expr_1();
+        while (*reading_stream != '\0')
+        {
+            op = parse_binary_operator();
+            switch (op)
+            {
+            case hoch:
+                value = pow(value,parse_expr_1());
+                break;
+            default:
+                return value;
+            }
+        };
+        op = undef;
+        return value;
+    }
+
+    double ExprParser::parse_expr_1()
+    {
+        PARSE_BLANKS;
+        double value;
+
+        unary_operator op = parse_unary_operator();
+        PARSE_BLANKS;
+
+        if (*reading_stream == '\0')
+        {
+            // end of string
+            this->failed_ = true;
+            return 0;
+        }
+        else if ((*reading_stream > 47 && *reading_stream < 59) || *reading_stream == 46)
+        {  // number
+            value = strtod(reading_stream, const_cast<char**>(&reading_stream));
+        }
+        else if ((*reading_stream > 64 && *reading_stream < 91) || (*reading_stream > 96 && *reading_stream < 123) || *reading_stream == 46)
+        {  // variable or function
+            char* word = new char[256];
+            parse_word(word);
+            PARSE_BLANKS;
+            if (*reading_stream == '(')
+            {
+                ++reading_stream;
+#define SWITCH word
+                CASE_1("sin")
+                    value = sin(parse_last_argument());
+                CASE("asin")
+                    value = asin(parse_last_argument());
+                CASE("sinh")
+                    value = sinh(parse_last_argument());
+                CASE("asinh")
+                {
+                    value = parse_last_argument();
+                    value = log(sqrt(pow(value, 2) + 1) + value);
+                }
+                CASE("cos")
+                    value = cos(parse_last_argument());
+                CASE("acos")
+                    value = acos(parse_last_argument());
+                CASE("cosh")
+                    value = cosh(parse_last_argument());
+                CASE("acosh")
+                {
+                    value = parse_last_argument();
+                    value = log(sqrt(pow(value, 2) - 1) + value);
+                }
+                CASE("tan")
+                    value = tan(parse_last_argument());
+                CASE("atan")
+                    value = atan(parse_last_argument());
+                CASE("atan2")
+                    value = atan2(parse_argument(),parse_last_argument());
+                CASE("tanh")
+                    value = tanh(parse_last_argument());
+                CASE("atanh")
+                {
+                    value = parse_last_argument();
+                    value = 0.5*log((value + 1)/(value - 1));
+                }
+                CASE("int")
+                    value = floor(parse_last_argument());
+                CASE("floor")
+                    value = floor(parse_last_argument());
+                CASE("ceil")
+                    value = ceil(parse_last_argument());
+                CASE("abs")
+                    value = fabs(parse_last_argument());
+                CASE("exp")
+                    value = exp(parse_last_argument());
+                CASE("log")
+                    value = log10(parse_last_argument());
+                CASE("ln")
+                    value = log(parse_last_argument());
+                CASE("sign")
+                {
+                    value = parse_last_argument();
+                    value = (value>0 ? 1 : (value<0 ? -1 : 0));
+                }
+                CASE("sqrt")
+                    value = sqrt(parse_last_argument());
+                CASE("degrees")
+                    value = parse_last_argument()*180/3.1415926535897932;
+                CASE("radians")
+                    value = parse_last_argument()*3.1415926535897932/180;
+                CASE("mod")
+                {
+                    value = parse_argument();
+                    double value2 = parse_last_argument();
+                    value = value - floor(value/value2)*value2;
+                }
+                CASE("pow")
+                    value = pow(parse_argument(),parse_last_argument());
+                CASE("div")
+                    value = floor(parse_argument()/parse_last_argument());
+                CASE("max")
+                    value = std::max(parse_argument(),parse_last_argument());
+                CASE("min")
+                    value = std::min(parse_argument(),parse_last_argument());
+                CASE_ELSE
+                {
+                    this->failed_ = true;
+                    delete[] word;
+                    return 0;
+                }
+            }
+            else
+            {
+#define SWITCH word
+                CASE_1("pi")
+                    value = 3.1415926535897932;
+                CASE("e")
+                    value = 2.7182818284590452;
+                CASE_ELSE
+                {
+                    this->failed_ = true;
+                    delete[] word;
+                    return 0;
+                }
+            }
+            delete[] word;
+        }
+        else if (*reading_stream == 40)
+        {  // expresion in paranthesis
+            ++reading_stream;
+            value = parse_last_argument();
+        }
+        else
+        {
+            this->failed_ = true;
+            return 0;
+        }
+
+        PARSE_BLANKS;
+        switch (op)
+        {
+        case u_nicht: return !value;
+        case u_plus:  return  value;
+        case u_minus: return -value;
+        default:
+            this->failed_ = true;
+            return 0;
+        }
+    }
+
+    char* ExprParser::parse_word(char* str)
+    {
+        char* word = str;
+        int counter = 0;
+        while ((*reading_stream > 47 && *reading_stream < 58) || (*reading_stream > 64 && *reading_stream < 91) || (*reading_stream > 96 && *reading_stream < 123) || *reading_stream == 46)
+        {
+            *word++ = *reading_stream++;
+            counter++;
+            if (counter > 255)
+            {
+                this->failed_ = true;
+                return '\0';
+            }
+        };
+        *word = '\0';
+        return str;
+    }
+
+    ExprParser::binary_operator ExprParser::parse_binary_operator()
+    {
+        binary_operator op;
+        switch (*reading_stream)
+        {
+        case '+': op = b_plus; break;
+        case '-': op = b_minus; break;
+        case '*': op = mal; break;
+        case '/': op = durch; break;
+        case '^': op = hoch; break;
+        case '%': op = modulo; break;
+        case '&': op = und; break;
+        case '|': op = oder; break;
+        case '=': op = gleich; break;
+        case '!': op = b_nicht; break;
+        case '<': op = kleiner; break;
+        case '>': op = groesser; break;
+        default: return undef;
+        }
+        if (*++reading_stream == '=')
+        {
+            if (op > 9)
+            {
+                ++reading_stream;
+                return (binary_operator)(op + 3);
+            }
+            else
+            {
+                --reading_stream;
+                return undef;
+            }
+        }
+        else
+            return op;
+    }
+
+    ExprParser::unary_operator ExprParser::parse_unary_operator()
+    {
+        switch (*reading_stream)
+        {
+        case '!':
+            ++reading_stream;
+            return u_nicht;
+        case '+':
+            ++reading_stream;
+            return u_plus;
+        case '-':
+            ++reading_stream;
+            return u_minus;
+        default :
+            return u_plus;
+        }
+    }
+}
Index: code/branches/libraries2/src/libraries/util/ExprParser.h
===================================================================
--- code/branches/libraries2/src/libraries/util/ExprParser.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/ExprParser.h	(revision 5714)
@@ -0,0 +1,110 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 Declaration of FloatParser
+*/
+
+#ifndef _FloatParser_H__
+#define _FloatParser_H__
+
+#include "UtilPrereqs.h"
+#include <string>
+
+namespace orxonox
+{
+    class _UtilExport ExprParser
+    {
+    public:
+        enum binary_operator
+        {
+            b_plus,
+            b_minus,
+            mal,
+            durch,
+            modulo,
+            hoch,
+            undef,
+            oder,
+            und,
+            gleich,
+            b_nicht,
+            kleiner,
+            groesser,
+            ungleich,
+            kleinergleich,
+            groessergleich
+        };
+
+        enum unary_operator
+        {
+            u_plus,
+            u_minus,
+            u_nicht
+        };
+
+
+        ExprParser(const std::string& str);
+        const std::string& getRemains() { return  this->remains_; }
+        double             getResult()  { return  this->result_; }
+        bool               getSuccess() { return !this->failed_; }
+
+    private:
+        double parse_expr_1();
+        double parse_expr_2();
+        double parse_expr_3();
+        double parse_expr_4();
+        double parse_expr_5();
+        double parse_expr_6();
+        double parse_expr_7();
+        double parse_expr_8();
+        char* parse_word(char* str);
+        binary_operator parse_binary_operator();
+        unary_operator parse_unary_operator();
+
+        double parse_argument();
+        double parse_last_argument();
+
+        binary_operator op;
+        const char* reading_stream;
+        bool failed_;
+        double result_;
+        std::string remains_;
+
+    };
+
+    //Endzeichen für float expression: ')', '}', ']', ',', ';'
+    _UtilExport bool parse_float(char* const, char**, double*);
+    //Endzeichen angegeben
+    _UtilExport bool parse_float(char* const, char**, char, double*);
+    //Letzter Teil-float eines Vektors parsen (keine Vergleichs- und Logikoperationen)
+    _UtilExport bool parse_vector_float(char* const, char**, bool, double*);
+}
+
+#endif /* _FloatParser_H__ */
Index: code/branches/libraries2/src/libraries/util/Math.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/Math.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Math.cc	(revision 5714)
@@ -0,0 +1,356 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 several math-functions.
+*/
+
+#include "Math.h"
+
+#include <OgrePlane.h>
+
+#include "MathConvert.h"
+#include "SubString.h"
+// Do not remove this include, it avoids linker errors.
+#include "mbool.h"
+
+namespace orxonox
+{
+    /**
+        @brief Function for writing a Radian to a stream.
+    */
+    std::ostream& operator<<(std::ostream& out, const orxonox::Radian& radian)
+    {
+        out << radian.valueRadians();
+        return out;
+    }
+
+    /**
+        @brief Function for reading a Radian from a stream.
+    */
+    std::istream& operator>>(std::istream& in, orxonox::Radian& radian)
+    {
+        float temp;
+        in >> temp;
+        radian = temp;
+        return in;
+    }
+
+    /**
+        @brief Function for writing a Degree to a stream.
+    */
+    std::ostream& operator<<(std::ostream& out, const orxonox::Degree& degree)
+    {
+        out << degree.valueDegrees();
+        return out;
+    }
+
+    /**
+        @brief Function for reading a Degree from a stream.
+    */
+    std::istream& operator>>(std::istream& in, orxonox::Degree& degree)
+    {
+        float temp;
+        in >> temp;
+        degree = temp;
+        return in;
+    }
+
+
+    /**
+        @brief Gets the angle between my viewing direction and the direction to the position of the other object.
+        @param myposition My position
+        @param mydirection My viewing direction
+        @param otherposition The position of the other object
+        @return The angle
+
+        @example
+        If the other object is exactly in front of me, the function returns 0.
+        If the other object is exactly behind me, the function returns pi.
+        If the other object is exactly right/left to me (or above/below), the function returns pi/2.
+    */
+    float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition)
+    {
+        orxonox::Vector3 distance = otherposition - myposition;
+        float distancelength = distance.length();
+        if (distancelength == 0)
+            return 0;
+        else
+            return acos(clamp<float>(mydirection.dotProduct(distance) / distancelength, -1, 1));
+    }
+
+    /**
+        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object.
+        @param myposition My position
+        @param mydirection My viewing direction
+        @param myorthonormal My orthonormalvector (pointing upwards through my head)
+        @param otherposition The position of the other object
+        @return The viewing direction
+
+        @example
+        If the other object is exactly in front of me, the function returns Vector2(0, 0).
+        If the other object is exactly at my left, the function returns Vector2(-1, 0).
+        If the other object is exactly at my right, the function returns Vector2(1, 0).
+        If the other object is only a bit at my right, the function still returns Vector2(1, 0).
+        If the other object is exactly above me, the function returns Vector2(0, 1).
+    */
+    orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
+    {
+        orxonox::Vector3 distance = otherposition - myposition;
+
+        // project difference vector on our plane
+        orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
+
+        float projectionlength = projection.length();
+        if (projectionlength == 0)
+        {
+            if (myposition.dotProduct(otherposition) >= 0)
+                return orxonox::Vector2(0, 0);
+            else
+                return orxonox::Vector2(0, 1);
+        }
+        
+        float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
+        float sin_value = sqrt( 1 - cos_value*cos_value );
+        
+        if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
+            return orxonox::Vector2( sin_value, cos_value );
+        else
+            return orxonox::Vector2( -sin_value, cos_value );
+    }
+
+    /**
+        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1).
+        @param myposition My position
+        @param mydirection My viewing direction
+        @param myorthonormal My orthonormalvector (pointing upwards through my head)
+        @param otherposition The position of the other object
+        @return The viewing direction
+
+        @example
+        If the other object is exactly in front of me, the function returns Vector2(0, 0).
+        If the other object is exactly at my left, the function returns Vector2(-0.5, 0).
+        If the other object is exactly at my right, the function returns Vector2(0.5, 0).
+        If the other object is only a bit at my right, the function still returns Vector2(0.01, 0).
+        If the other object is exactly above me, the function returns Vector2(0, 0.5).
+    */
+    orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
+    {
+        orxonox::Vector3 distance = otherposition - myposition;
+
+        // project difference vector on our plane
+        orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
+
+        float projectionlength = projection.length();
+        if (projectionlength == 0)
+        {
+            if (myposition.dotProduct(otherposition) >= 0)
+                return orxonox::Vector2(0, 0);
+            else
+                return orxonox::Vector2(0, 1);
+        }
+        //float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
+        
+        float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
+        float sin_value = sqrt( 1 - cos_value*cos_value );
+
+        float distancelength = distance.length();
+        if (distancelength == 0) return orxonox::Vector2(0, 0);
+        float radius = acos(clamp<float>(mydirection.dotProduct(distance) / distancelength, -1, 1)) / Ogre::Math::PI;
+
+        if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
+            return orxonox::Vector2( sin_value * radius, cos_value * radius);
+        else
+            return orxonox::Vector2( -sin_value * radius, cos_value * radius);
+    }
+
+    /**
+        @brief Returns the predicted position I have to aim at, if I want to hit a moving target with a moving projectile.
+        @param myposition My position
+        @param projectilespeed The speed of my projectile
+        @param targetposition The position of my target
+        @param targetvelocity The velocity of my target
+        @return The predicted position
+
+        The function predicts the position based on a linear velocity of the target. If the target changes speed or direction, the projectile will miss.
+    */
+    orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity)
+    {
+        float squaredProjectilespeed = projectilespeed * projectilespeed;
+        orxonox::Vector3 distance = targetposition - myposition;
+        float a = distance.squaredLength();
+        float b = 2 * (distance.x + distance.y + distance.z) * (targetvelocity.x + targetvelocity.y + targetvelocity.z);
+        float c = targetvelocity.squaredLength();
+
+        float temp = 4*squaredProjectilespeed*c + a*a - 4*b*c;
+        if (temp < 0)
+            return orxonox::Vector3::ZERO;
+
+        temp = sqrt(temp);
+        float time = (temp + a) / (2 * (squaredProjectilespeed - b));
+        return (targetposition + targetvelocity * time);
+    }
+
+    unsigned long getUniqueNumber()
+    {
+        static unsigned long aNumber = 135;
+        return aNumber++;
+    }
+
+
+    //////////////////////////
+    // Conversion functions //
+    //////////////////////////
+
+    // std::string to Vector2
+    bool ConverterFallback<std::string, orxonox::Vector2>::convert(orxonox::Vector2* output, const std::string& input)
+    {
+        size_t opening_parenthesis, closing_parenthesis = input.find(')');
+        if ((opening_parenthesis = input.find('(')) == std::string::npos)
+            opening_parenthesis = 0;
+        else
+            opening_parenthesis++;
+
+        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
+                         ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (tokens.size() >= 2)
+        {
+            if (!convertValue(&(output->x), tokens[0]))
+                return false;
+            if (!convertValue(&(output->y), tokens[1]))
+                return false;
+
+            return true;
+        }
+        return false;
+    }
+
+    // std::string to Vector3
+    bool ConverterFallback<std::string, orxonox::Vector3>::convert(orxonox::Vector3* output, const std::string& input)
+    {
+        size_t opening_parenthesis, closing_parenthesis = input.find(')');
+        if ((opening_parenthesis = input.find('(')) == std::string::npos)
+            opening_parenthesis = 0;
+        else
+            opening_parenthesis++;
+
+        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
+                         ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (tokens.size() >= 3)
+        {
+            if (!convertValue(&(output->x), tokens[0]))
+                return false;
+            if (!convertValue(&(output->y), tokens[1]))
+                return false;
+            if (!convertValue(&(output->z), tokens[2]))
+                return false;
+
+            return true;
+        }
+        return false;
+    }
+
+    // std::string to Vector4
+    bool ConverterFallback<std::string, orxonox::Vector4>::convert(orxonox::Vector4* output, const std::string& input)
+    {
+        size_t opening_parenthesis, closing_parenthesis = input.find(')');
+        if ((opening_parenthesis = input.find('(')) == std::string::npos)
+            opening_parenthesis = 0;
+        else
+            opening_parenthesis++;
+
+        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
+                         ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (tokens.size() >= 4)
+        {
+            if (!convertValue(&(output->x), tokens[0]))
+                return false;
+            if (!convertValue(&(output->y), tokens[1]))
+                return false;
+            if (!convertValue(&(output->z), tokens[2]))
+                return false;
+            if (!convertValue(&(output->w), tokens[3]))
+                return false;
+
+            return true;
+        }
+        return false;
+    }
+
+    // std::string to Quaternion
+    bool ConverterFallback<std::string, orxonox::Quaternion>::convert(orxonox::Quaternion* output, const std::string& input)
+    {
+        size_t opening_parenthesis, closing_parenthesis = input.find(')');
+        if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
+
+        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (tokens.size() >= 4)
+        {
+            if (!convertValue(&(output->w), tokens[0]))
+                return false;
+            if (!convertValue(&(output->x), tokens[1]))
+                return false;
+            if (!convertValue(&(output->y), tokens[2]))
+                return false;
+            if (!convertValue(&(output->z), tokens[3]))
+                return false;
+
+            return true;
+        }
+        return false;
+    }
+
+    // std::string to ColourValue
+    bool ConverterFallback<std::string, orxonox::ColourValue>::convert(orxonox::ColourValue* output, const std::string& input)
+    {
+        size_t opening_parenthesis, closing_parenthesis = input.find(')');
+        if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
+
+        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (tokens.size() >= 3)
+        {
+            if (!convertValue(&(output->r), tokens[0]))
+                return false;
+            if (!convertValue(&(output->g), tokens[1]))
+                return false;
+            if (!convertValue(&(output->b), tokens[2]))
+                return false;
+            if (tokens.size() >= 4)
+            {
+                if (!convertValue(&(output->a), tokens[3]))
+                    return false;
+            }
+            else
+                output->a = 1.0;
+
+            return true;
+        }
+        return false;
+    }
+}
Index: code/branches/libraries2/src/libraries/util/Math.h
===================================================================
--- code/branches/libraries2/src/libraries/util/Math.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Math.h	(revision 5714)
@@ -0,0 +1,270 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 Declaration and implementation of several math-functions, typedefs of some Ogre::Math classes to the orxonox namespace.
+*/
+
+#ifndef _Util_Math_H__
+#define _Util_Math_H__
+
+#include "UtilPrereqs.h"
+
+#include <string>
+#include <cmath>
+
+#include <OgreMath.h>
+#include <OgreVector2.h>
+#include <OgreVector3.h>
+#include <OgreVector4.h>
+#include <OgreQuaternion.h>
+#include <OgreColourValue.h>
+
+// Certain headers might define unwanted macros...
+#undef max
+#undef min
+#undef sgn
+#undef clamp
+#undef sqrt
+#undef square
+#undef mod
+#undef rnd
+
+namespace orxonox
+{
+    _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Radian& radian);
+    _UtilExport std::istream& operator>>(std::istream& in, orxonox::Radian& radian);
+    _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Degree& degree);
+    _UtilExport std::istream& operator>>(std::istream& in, orxonox::Degree& degree);
+
+    _UtilExport float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition);
+    _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
+    _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
+    _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity);
+
+    /**
+        @brief Returns the sign of the given value.
+        @param x The value
+        @return 1 if the value is positive or zero, -1 if the value is negative
+    */
+    template <typename T>
+    inline T sgn(T x)
+    {
+        return (x >= 0) ? 1 : -1;
+    }
+
+    /**
+        @brief Keeps a value between a lower and an upper limit.
+        @param x The value
+        @param min The lower limit
+        @param max The upper limit
+    */
+    template <typename T>
+    inline T clamp(T x, T min, T max)
+    {
+        if (x < min)
+            return min;
+
+        if (x > max)
+            return max;
+
+        return x;
+    }
+
+    /**
+        @brief Returns the square value (x^2).
+    */
+    template <typename T>
+    inline T square(T x)
+    {
+        return x*x;
+    }
+
+    /**
+        @brief Returns the cube value (x^3).
+    */
+    template <typename T>
+    inline T cube(T x)
+    {
+        return x*x*x;
+    }
+
+    /**
+        @brief Rounds the value.
+    */
+    template <typename T>
+    inline int round(T x)
+    {
+        return static_cast<int>(x + 0.5);
+    }
+
+    /**
+        @brief The modulo operation, enhanced to work properly with negative values.
+        @param x The value
+        @param max The operand
+    */
+    template <typename T>
+    inline int mod(T x, int max)
+    {
+        if (x >= 0)
+            return (x % max);
+        else
+            return ((x % max) + max);
+    }
+
+    template <typename T>
+    inline T zeroise()
+    {
+        // Default, raise a compiler error without including large boost header cascade.
+        T temp();
+        *********temp; // If you reach this code, you abused zeroise()!
+        return temp;
+    }
+
+    template <> inline char                 zeroise<char>()                 { return 0; }
+    template <> inline unsigned char        zeroise<unsigned char>()        { return 0; }
+    template <> inline short                zeroise<short>()                { return 0; }
+    template <> inline unsigned short       zeroise<unsigned short>()       { return 0; }
+    template <> inline int                  zeroise<int>()                  { return 0; }
+    template <> inline unsigned int         zeroise<unsigned int>()         { return 0; }
+    template <> inline long                 zeroise<long>()                 { return 0; }
+    template <> inline unsigned long        zeroise<unsigned long>()        { return 0; }
+    template <> inline long long            zeroise<long long>()            { return 0; }
+    template <> inline unsigned long long   zeroise<unsigned long long>()   { return 0; }
+    template <> inline float                zeroise<float>()                { return 0; }
+    template <> inline double               zeroise<double>()               { return 0; }
+    template <> inline long double          zeroise<long double>()          { return 0; }
+    template <> inline bool                 zeroise<bool>()                 { return 0; }
+    template <> inline void*                zeroise<void*>()                { return 0; }
+    template <> inline std::string          zeroise<std::string>()          { return ""; }
+    template <> inline orxonox::Radian      zeroise<orxonox::Radian>()      { return orxonox::Radian(0.0f); }
+    template <> inline orxonox::Degree      zeroise<orxonox::Degree>()      { return orxonox::Degree(0.0f); }
+    template <> inline orxonox::Vector2     zeroise<orxonox::Vector2>()     { return orxonox::Vector2    (0, 0)      ; }
+    template <> inline orxonox::Vector3     zeroise<orxonox::Vector3>()     { return orxonox::Vector3    (0, 0, 0)   ; }
+    template <> inline orxonox::Vector4     zeroise<orxonox::Vector4>()     { return orxonox::Vector4    (0, 0, 0, 0); }
+    template <> inline orxonox::ColourValue zeroise<orxonox::ColourValue>() { return orxonox::ColourValue(0, 0, 0, 0); }
+    template <> inline orxonox::Quaternion  zeroise<orxonox::Quaternion>()  { return orxonox::Quaternion (0, 0, 0, 0); }
+
+    //! Provides zero value symbols that can be returned as reference
+    template <typename T>
+    struct NilValue
+    {
+        inline operator const T&() const
+        {
+            return value;
+        }
+        static T value;
+    };
+    template <typename T>
+    T NilValue<T>::value = zeroise<T>();
+
+    /**
+        @brief Interpolates between two values for a time between 0 and 1.
+        @param time The time is a value between 0 and 1 - the function returns start if time is 0 and end if time is 1 and interpolates if time is between 0 and 1.
+        @param start The value at time = 0
+        @param end The value at time = 1
+        @return The interpolation at a given time
+    */
+    template <typename T>
+    inline T interpolate(float time, const T& start, const T& end)
+    {
+        return time * (end - start) + start;
+    }
+
+    /**
+        @brief Interpolates smoothly between two values for a time between 0 and 1. The function starts slowly, increases faster and stops slowly again.
+        @param time The time is a value between 0 and 1 - the function returns start if time is 0 and end if time is 1 and interpolates if time is between 0 and 1.
+        @param start The value at time = 0
+        @param end The value at time = 1
+        @return The smoothed interpolation at a given time
+    */
+    template <typename T>
+    inline T interpolateSmooth(float time, const T& start, const T& end)
+    {
+        return (-2 * (end - start) * cube(time)) + (3 * (end - start) * square(time)) + start;
+    }
+
+    /**
+        @brief Returns a random number between 0 and almost 1: 0 <= rnd < 1.
+    */
+    inline float rnd()
+    {
+        return rand() / (RAND_MAX + 1.0f);
+    }
+
+    /**
+        @brief Returns a random number between 0 and almost max: 0 <= rnd < max.
+        @param max The maximum
+    */
+    inline float rnd(float max)
+    {
+        return rnd() * max;
+    }
+
+    /**
+        @brief Returns a random number between min and almost max: min <= rnd < max.
+        @param min The minimum
+        @param max The maximum
+    */
+    inline float rnd(float min, float max)
+    {
+        return rnd(max - min) + min;
+    }
+
+    /**
+        @brief Returns randomly 1 or -1 with equal probability.
+    */
+    inline float rndsgn()
+    {
+        return static_cast<float>((rand() & 0x2) - 1); // rand() & 0x2 is either 2 or 0
+    }
+
+    _UtilExport unsigned long getUniqueNumber();
+
+    class IntVector2
+    {
+    public:
+        IntVector2() : x(0), y(0) { }
+        IntVector2(int _x, int _y) : x(_x), y(_y) { }
+        int x;
+        int y;
+    };
+
+    class IntVector3
+    {
+    public:
+        IntVector3() : x(0), y(0), z(0) { }
+        IntVector3(int _x, int _y, int _z) : x(_x), y(_y), z(_z) { }
+        int x;
+        int y;
+        int z;
+    };
+}
+
+#endif /* _Util_Math_H__ */
Index: code/branches/libraries2/src/libraries/util/MathConvert.h
===================================================================
--- code/branches/libraries2/src/libraries/util/MathConvert.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/MathConvert.h	(revision 5714)
@@ -0,0 +1,209 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ */
+
+/**
+    @file
+    @brief
+        Math conversion functions. Definitions are in Math.cc
+*/
+
+#ifndef _MathConvert_H__
+#define _MathConvert_H__
+
+#include "UtilPrereqs.h"
+#include "Math.h"
+#include "Convert.h"
+
+namespace orxonox
+{
+    ////////////////////
+    // Math to string //
+    ////////////////////
+
+    // Vector2 to std::string
+    template <>
+    struct ConverterExplicit<orxonox::Vector2, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const orxonox::Vector2& input)
+        {
+            std::ostringstream ostream;
+            if (ostream << input.x << "," << input.y)
+            {
+                (*output) = ostream.str();
+                return true;
+            }
+            return false;
+        }
+    };
+
+    // Vector3 to std::string
+    template <>
+    struct ConverterExplicit<orxonox::Vector3, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const orxonox::Vector3& input)
+        {
+            std::ostringstream ostream;
+            if (ostream << input.x << "," << input.y << "," << input.z)
+            {
+                (*output) = ostream.str();
+                return true;
+            }
+            return false;
+        }
+    };
+
+    // Vector4 to std::string
+    template <>
+    struct ConverterExplicit<orxonox::Vector4, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const orxonox::Vector4& input)
+        {
+            std::ostringstream ostream;
+            if (ostream << input.x << "," << input.y << "," << input.z << "," << input.w)
+            {
+                (*output) = ostream.str();
+                return true;
+            }
+            return false;
+        }
+    };
+
+    // Quaternion to std::string
+    template <>
+    struct ConverterExplicit<orxonox::Quaternion, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const orxonox::Quaternion& input)
+        {
+            std::ostringstream ostream;
+            if (ostream << input.w << "," << input.x << "," << input.y << "," << input.z)
+            {
+                (*output) = ostream.str();
+                return true;
+            }
+            return false;
+        }
+    };
+
+    // ColourValue to std::string
+    template <>
+    struct ConverterExplicit<orxonox::ColourValue, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const orxonox::ColourValue& input)
+        {
+            std::ostringstream ostream;
+            if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a)
+            {
+                (*output) = ostream.str();
+                return true;
+            }
+            return false;
+        }
+    };
+
+
+    ////////////////////
+    // string to Math //
+    ////////////////////
+
+    // std::string to Vector2
+    template <> struct _UtilExport ConverterFallback<std::string, orxonox::Vector2>
+    { static bool convert(orxonox::Vector2*     output, const std::string& input); };
+    // std::string to Vector3
+    template <> struct _UtilExport ConverterFallback<std::string, orxonox::Vector3>
+    { static bool convert(orxonox::Vector3*     output, const std::string& input); };
+    // std::string to Vector4
+    template <> struct _UtilExport ConverterFallback<std::string, orxonox::Vector4>
+    { static bool convert(orxonox::Vector4*     output, const std::string& input); };
+    // std::string to Quaternion
+    template <> struct _UtilExport ConverterFallback<std::string, orxonox::Quaternion>
+    { static bool convert(orxonox::Quaternion*  output, const std::string& input); };
+    // std::string to ColourValue
+    template <> struct _UtilExport ConverterFallback<std::string, orxonox::ColourValue>
+    { static bool convert(orxonox::ColourValue* output, const std::string& input); };
+
+
+    ///////////////////////////////
+    // From and to Radian/Degree //
+    ///////////////////////////////
+
+    // From Radian
+    template <class ToType>
+    struct ConverterFallback<orxonox::Radian, ToType>
+    {
+        FORCEINLINE static bool convert(ToType* output, const orxonox::Radian& input)
+        {
+            return convertValue<Ogre::Real, ToType>(output, input.valueRadians());
+        }
+    };
+
+    // From Degree
+    template <class ToType>
+    struct ConverterFallback<orxonox::Degree, ToType>
+    {
+        FORCEINLINE static bool convert(ToType* output, const orxonox::Degree& input)
+        {
+            return convertValue<Ogre::Real, ToType>(output, input.valueDegrees());
+        }
+    };
+
+    // To Radian
+    template <class FromType>
+    struct ConverterFallback<FromType, orxonox::Radian>
+    {
+        FORCEINLINE static bool convert(orxonox::Radian* output, const FromType& input)
+        {
+            float temp;
+            if (convertValue(&temp, input))
+            {
+                *output = temp;
+                return true;
+            }
+            else
+                return false;
+        }
+    };
+
+    // To Degree
+    template <class FromType>
+    struct ConverterFallback<FromType, orxonox::Degree>
+    {
+        FORCEINLINE static bool convert(orxonox::Degree* output, const FromType& input)
+        {
+            float temp;
+            if (convertValue(&temp, input))
+            {
+                *output = temp;
+                return true;
+            }
+            else
+                return false;
+        }
+    };
+}
+
+#endif /* _MathConvert_H__ */
Index: code/branches/libraries2/src/libraries/util/MultiType.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/MultiType.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/MultiType.cc	(revision 5714)
@@ -0,0 +1,208 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 MultiType.
+*/
+
+#include "MultiType.h"
+#include "MultiTypeValue.h"
+
+namespace orxonox
+{
+    /**
+        @brief Converts the current value of the MultiType to a new type.
+        @param type The type
+    */
+    bool MultiType::convert(MT_Type::Value type)
+    {
+        switch (type)
+        {
+            case MT_Type::Null:
+                this->reset(); return true;
+            case MT_Type::Char:
+                return this->convert<char>(); break;
+            case MT_Type::UnsignedChar:
+                return this->convert<unsigned char>(); break;
+            case MT_Type::Short:
+                return this->convert<short>(); break;
+            case MT_Type::UnsignedShort:
+                return this->convert<unsigned short>(); break;
+            case MT_Type::Int:
+                return this->convert<int>(); break;
+            case MT_Type::UnsignedInt:
+                return this->convert<unsigned int>(); break;
+            case MT_Type::Long:
+                return this->convert<long>(); break;
+            case MT_Type::UnsignedLong:
+                return this->convert<unsigned long>(); break;
+            case MT_Type::LongLong:
+                return this->convert<long long>(); break;
+            case MT_Type::UnsignedLongLong:
+                return this->convert<unsigned long long>(); break;
+            case MT_Type::Float:
+                return this->convert<float>(); break;
+            case MT_Type::Double:
+                return this->convert<double>(); break;
+            case MT_Type::LongDouble:
+                return this->convert<long double>(); break;
+            case MT_Type::Bool:
+                return this->convert<bool>(); break;
+            case MT_Type::VoidPointer:
+                return this->convert<void*>(); break;
+            case MT_Type::String:
+                return this->convert<std::string>(); break;
+            case MT_Type::Vector2:
+                return this->convert<orxonox::Vector2>(); break;
+            case MT_Type::Vector3:
+                return this->convert<orxonox::Vector3>(); break;
+            case MT_Type::Vector4:
+                return this->convert<orxonox::Vector4>(); break;
+            case MT_Type::ColourValue:
+                return this->convert<orxonox::ColourValue>(); break;
+            case MT_Type::Quaternion:
+                return this->convert<orxonox::Quaternion>(); break;
+            case MT_Type::Radian:
+                return this->convert<orxonox::Radian>(); break;
+            case MT_Type::Degree:
+                return this->convert<orxonox::Degree>(); break;
+            default:
+                this->reset(); return false; break;
+        };
+    }
+
+    /**
+        @brief Returns the name of the current type.
+        @return The name
+    */
+    std::string MultiType::getTypename() const
+    {
+        MT_Type::Value type = (this->value_) ? this->value_->type_ : MT_Type::Null;
+
+        switch (type)
+        {
+            case MT_Type::Char:
+                return "char"; break;
+            case MT_Type::UnsignedChar:
+                return "unsigned char"; break;
+            case MT_Type::Short:
+                return "short"; break;
+            case MT_Type::UnsignedShort:
+                return "unsigned short"; break;
+            case MT_Type::Int:
+                return "int"; break;
+            case MT_Type::UnsignedInt:
+                return "unsigned int"; break;
+            case MT_Type::Long:
+                return "long"; break;
+            case MT_Type::UnsignedLong:
+                return "unsigned long"; break;
+            case MT_Type::LongLong:
+                return "long long"; break;
+            case MT_Type::UnsignedLongLong:
+                return "unsigned long long"; break;
+            case MT_Type::Float:
+                return "float"; break;
+            case MT_Type::Double:
+                return "double"; break;
+            case MT_Type::LongDouble:
+                return "long double"; break;
+            case MT_Type::Bool:
+                return "bool"; break;
+            case MT_Type::VoidPointer:
+                return "void*"; break;
+            case MT_Type::String:
+                return "std::string"; break;
+            case MT_Type::Vector2:
+                return "orxonox::Vector2"; break;
+            case MT_Type::Vector3:
+                return "orxonox::Vector3"; break;
+            case MT_Type::Vector4:
+                return "orxonox::Vector4"; break;
+            case MT_Type::ColourValue:
+                return "orxonox::ColourValue"; break;
+            case MT_Type::Quaternion:
+                return "orxonox::Quaternion"; break;
+            case MT_Type::Radian:
+                return "orxonox::Radian"; break;
+            case MT_Type::Degree:
+                return "orxonox::Degree"; break;
+            default:
+                return "unknown"; break;
+        };
+    }
+
+    MultiType::operator char()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Char            ) ? (static_cast<MT_Value<char>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned char()        const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedChar    ) ? (static_cast<MT_Value<unsigned char>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator short()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::Short           ) ? (static_cast<MT_Value<short>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned short()       const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedShort   ) ? (static_cast<MT_Value<unsigned short>      *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator int()                  const { return (this->value_) ? ((this->value_->type_ == MT_Type::Int             ) ? (static_cast<MT_Value<int>                 *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned int()         const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedInt     ) ? (static_cast<MT_Value<unsigned int>        *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator long()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Long            ) ? (static_cast<MT_Value<long>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned long()        const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedLong    ) ? (static_cast<MT_Value<unsigned long>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator long long()            const { return (this->value_) ? ((this->value_->type_ == MT_Type::LongLong        ) ? (static_cast<MT_Value<long long>           *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned long long()   const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedLongLong) ? (static_cast<MT_Value<unsigned long long>  *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator float()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::Float           ) ? (static_cast<MT_Value<float>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator double()               const { return (this->value_) ? ((this->value_->type_ == MT_Type::Double          ) ? (static_cast<MT_Value<double>              *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator long double()          const { return (this->value_) ? ((this->value_->type_ == MT_Type::LongDouble      ) ? (static_cast<MT_Value<long double>         *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator bool()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Bool            ) ? (static_cast<MT_Value<bool>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator void*()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::VoidPointer     ) ? (static_cast<MT_Value<void*>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator std::string()          const { return (this->value_) ? ((this->value_->type_ == MT_Type::String          ) ? (static_cast<MT_Value<std::string>         *>(this->value_))->value_ : (*this->value_)) : NilValue<std::string>();          } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Vector2()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector2         ) ? (static_cast<MT_Value<orxonox::Vector2>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector2>();     } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Vector3()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector3         ) ? (static_cast<MT_Value<orxonox::Vector3>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector3>();     } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Vector4()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector4         ) ? (static_cast<MT_Value<orxonox::Vector4>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector4>();     } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_Type::ColourValue     ) ? (static_cast<MT_Value<orxonox::ColourValue>*>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::ColourValue>(); } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Quaternion()  const { return (this->value_) ? ((this->value_->type_ == MT_Type::Quaternion      ) ? (static_cast<MT_Value<orxonox::Quaternion> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Quaternion>();  } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Radian()      const { return (this->value_) ? ((this->value_->type_ == MT_Type::Radian          ) ? (static_cast<MT_Value<orxonox::Radian>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Radian>();      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Degree()      const { return (this->value_) ? ((this->value_->type_ == MT_Type::Degree          ) ? (static_cast<MT_Value<orxonox::Degree>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Degree>();      } /** @brief Returns the current value, converted to the requested type. */
+
+    template <> void MultiType::createNewValueContainer(const char& value)                 { this->value_ = new MT_Value<char>                (value, MT_Type::Char            ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned char& value)        { this->value_ = new MT_Value<unsigned char>       (value, MT_Type::UnsignedChar    ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const short& value)                { this->value_ = new MT_Value<short>               (value, MT_Type::Short           ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned short& value)       { this->value_ = new MT_Value<unsigned short>      (value, MT_Type::UnsignedShort   ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const int& value)                  { this->value_ = new MT_Value<int>                 (value, MT_Type::Int             ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned int& value)         { this->value_ = new MT_Value<unsigned int>        (value, MT_Type::UnsignedInt     ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const long& value)                 { this->value_ = new MT_Value<long>                (value, MT_Type::Long            ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned long& value)        { this->value_ = new MT_Value<unsigned long>       (value, MT_Type::UnsignedLong    ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const long long& value)            { this->value_ = new MT_Value<long long>           (value, MT_Type::LongLong        ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned long long& value)   { this->value_ = new MT_Value<unsigned long long>  (value, MT_Type::UnsignedLongLong); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const float& value)                { this->value_ = new MT_Value<float>               (value, MT_Type::Float           ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const double& value)               { this->value_ = new MT_Value<double>              (value, MT_Type::Double          ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const long double& value)          { this->value_ = new MT_Value<long double>         (value, MT_Type::LongDouble      ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const bool& value)                 { this->value_ = new MT_Value<bool>                (value, MT_Type::Bool            ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(      void* const& value)          { this->value_ = new MT_Value<void*>               (value, MT_Type::VoidPointer     ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const std::string& value)          { this->value_ = new MT_Value<std::string>         (value, MT_Type::String          ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector2& value)     { this->value_ = new MT_Value<orxonox::Vector2>    (value, MT_Type::Vector2         ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector3& value)     { this->value_ = new MT_Value<orxonox::Vector3>    (value, MT_Type::Vector3         ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector4& value)     { this->value_ = new MT_Value<orxonox::Vector4>    (value, MT_Type::Vector4         ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::ColourValue& value) { this->value_ = new MT_Value<orxonox::ColourValue>(value, MT_Type::ColourValue     ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Quaternion& value)  { this->value_ = new MT_Value<orxonox::Quaternion> (value, MT_Type::Quaternion      ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Radian& value)      { this->value_ = new MT_Value<orxonox::Radian>     (value, MT_Type::Radian          ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Degree& value)      { this->value_ = new MT_Value<orxonox::Degree>     (value, MT_Type::Degree          ); } /** @brief Creates a new value container for the given type. */
+}
Index: code/branches/libraries2/src/libraries/util/MultiType.h
===================================================================
--- code/branches/libraries2/src/libraries/util/MultiType.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/MultiType.h	(revision 5714)
@@ -0,0 +1,561 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 Declaration of the MultiType and some helper constructs.
+
+    The MultiType can hold a value of one of the following types:
+     - all primitives
+     - all pointers
+     - string
+     - Vector2, Vector3, Vector4
+     - Quaternion
+     - ColourValue
+     - Radian, Degree
+
+    The MultiType has a "type" determined by the first assigned value, either through
+     - the constructor,
+     - the assignment operator= or
+     - setValue(value).
+    If you assign another value of another type, the MultiType keeps "it's" type and
+    converts the new value to this type.
+
+    If you want to change the type, there are three possibilities:
+     - convert<T>() set's the type to T and converts the currently assigned value
+     - setType<T>() set's the type to T and resets the value
+     - setValue<T>(value) assigns a new value and changes the type to T.
+
+    @example
+    MultiType a = 10;;         // a has now the type int and the value 10
+    a.setValue("3.14");        // a has still the type int and "3.14" gets converted, therefore the value is now 3
+    a.setValue<float>("3.14"); // a has now the type float and "3.14" gets converted to 3.14
+    a.convert<bool>();         // converts 3.14 to bool, which is true
+    a = false;                 // assigns false, this is equivalent to a.setValue(false)
+
+    @note
+    Whenever a value gets converted, there is a boolean return value telling you whether it was
+    successful or not. If it wasn't a zero value is assigned with the help of zeroise<T>().
+*/
+
+#ifndef _MultiType_H__
+#define _MultiType_H__
+
+#include "UtilPrereqs.h"
+
+#include <cassert>
+#include <string>
+#include <OgreVector2.h>
+#include <OgreVector3.h>
+#include <OgreVector4.h>
+#include <OgreQuaternion.h>
+#include <OgreColourValue.h>
+
+#include "TypeTraits.h"
+
+namespace orxonox
+{
+    /**
+        @brief Enum of all possible types of a MultiType.
+    */
+    namespace MT_Type
+    {
+        enum Value
+        {
+            Null,
+            Char,
+            UnsignedChar,
+            Short,
+            UnsignedShort,
+            Int,
+            UnsignedInt,
+            Long,
+            UnsignedLong,
+            LongLong,
+            UnsignedLongLong,
+            Float,
+            Double,
+            LongDouble,
+            Bool,
+            VoidPointer,
+            String,
+            Vector2,
+            Vector3,
+            Vector4,
+            ColourValue,
+            Quaternion,
+            Radian,
+            Degree
+        };
+    }
+
+    /**
+        @brief The MultiType can hold a value of many possible types and convert them to other types.
+
+        The following types are supported by the MultiType:
+         - all primitves
+         - all pointers
+         - string
+         - Vector2, Vector3, Vector4
+         - Quaternion
+         - ColourValue
+         - Radian, Degree
+
+        The internal type of a MultiType is determined by the first assigned value, but can be
+        changed by using setType<T>(), convert<T>() or setValue<T>(value). If a value gets assigned
+        the normal way (operator=, setValue(value)), the value gets converted to the current internal
+        type of the MultiType.
+    */
+    class _UtilExport MultiType
+    {
+        _UtilExport friend std::ostream& operator<<(std::ostream& outstream, const MultiType& mt);
+        template <typename T> friend class MT_Value;
+
+    public:
+        /**
+            @brief MT_ValueBase is an almost pure virtual baseclass of MT_Value<T>, which holds the value of the MultiType.
+            This class is only used within the MultiType.
+        */
+        class _UtilExport MT_ValueBase
+        {
+        public:
+            MT_ValueBase(MT_Type::Value type) : type_(type), bHasDefaultValue_(false) {}
+            virtual ~MT_ValueBase() {}
+
+            virtual MT_ValueBase* clone() const = 0;
+
+            virtual void reset() = 0;
+            virtual bool assimilate(const MultiType& other) = 0;
+
+            /** @brief Returns the type of the current value. */
+            const MT_Type::Value& getType() const { return this->type_; }
+
+            /** @brief Checks whether the value is a default one. */
+            bool hasDefaultValue()   const { return this->bHasDefaultValue_; }
+
+            virtual bool setValue(const char& value)                 = 0;
+            virtual bool setValue(const unsigned char& value)        = 0;
+            virtual bool setValue(const short& value)                = 0;
+            virtual bool setValue(const unsigned short& value)       = 0;
+            virtual bool setValue(const int& value)                  = 0;
+            virtual bool setValue(const unsigned int& value)         = 0;
+            virtual bool setValue(const long& value)                 = 0;
+            virtual bool setValue(const unsigned long& value)        = 0;
+            virtual bool setValue(const long long& value)            = 0;
+            virtual bool setValue(const unsigned long long& value)   = 0;
+            virtual bool setValue(const float& value)                = 0;
+            virtual bool setValue(const double& value)               = 0;
+            virtual bool setValue(const long double& value)          = 0;
+            virtual bool setValue(const bool& value)                 = 0;
+            virtual bool setValue(      void* const& value)          = 0;
+            virtual bool setValue(const std::string& value)          = 0;
+            virtual bool setValue(const orxonox::Vector2& value)     = 0;
+            virtual bool setValue(const orxonox::Vector3& value)     = 0;
+            virtual bool setValue(const orxonox::Vector4& value)     = 0;
+            virtual bool setValue(const orxonox::ColourValue& value) = 0;
+            virtual bool setValue(const orxonox::Quaternion& value)  = 0;
+            virtual bool setValue(const orxonox::Radian& value)      = 0;
+            virtual bool setValue(const orxonox::Degree& value)      = 0;
+
+            virtual bool getValue(char*                 value) const = 0;
+            virtual bool getValue(unsigned char*        value) const = 0;
+            virtual bool getValue(short*                value) const = 0;
+            virtual bool getValue(unsigned short*       value) const = 0;
+            virtual bool getValue(int*                  value) const = 0;
+            virtual bool getValue(unsigned int*         value) const = 0;
+            virtual bool getValue(long*                 value) const = 0;
+            virtual bool getValue(unsigned long*        value) const = 0;
+            virtual bool getValue(long long*            value) const = 0;
+            virtual bool getValue(unsigned long long*   value) const = 0;
+            virtual bool getValue(float*                value) const = 0;
+            virtual bool getValue(double*               value) const = 0;
+            virtual bool getValue(long double*          value) const = 0;
+            virtual bool getValue(bool*                 value) const = 0;
+            virtual bool getValue(void**                value) const = 0;
+            virtual bool getValue(std::string*          value) const = 0;
+            virtual bool getValue(orxonox::Vector2*     value) const = 0;
+            virtual bool getValue(orxonox::Vector3*     value) const = 0;
+            virtual bool getValue(orxonox::Vector4*     value) const = 0;
+            virtual bool getValue(orxonox::ColourValue* value) const = 0;
+            virtual bool getValue(orxonox::Quaternion*  value) const = 0;
+            virtual bool getValue(orxonox::Radian*      value) const = 0;
+            virtual bool getValue(orxonox::Degree*      value) const = 0;
+
+            virtual operator char()                 const = 0;
+            virtual operator unsigned char()        const = 0;
+            virtual operator short()                const = 0;
+            virtual operator unsigned short()       const = 0;
+            virtual operator int()                  const = 0;
+            virtual operator unsigned int()         const = 0;
+            virtual operator long()                 const = 0;
+            virtual operator unsigned long()        const = 0;
+            virtual operator long long()            const = 0;
+            virtual operator unsigned long long()   const = 0;
+            virtual operator float()                const = 0;
+            virtual operator double()               const = 0;
+            virtual operator long double()          const = 0;
+            virtual operator bool()                 const = 0;
+            virtual operator void*()                const = 0;
+            virtual operator std::string()          const = 0;
+            virtual operator orxonox::Vector2()     const = 0;
+            virtual operator orxonox::Vector3()     const = 0;
+            virtual operator orxonox::Vector4()     const = 0;
+            virtual operator orxonox::ColourValue() const = 0;
+            virtual operator orxonox::Quaternion()  const = 0;
+            virtual operator orxonox::Radian()      const = 0;
+            virtual operator orxonox::Degree()      const = 0;
+
+            virtual void toString(std::ostream& outstream) const = 0;
+            
+            virtual void importData( uint8_t*& mem )=0;
+            virtual void exportData( uint8_t*& mem ) const=0;
+            virtual uint8_t getSize() const=0;
+
+            MT_Type::Value type_;   //!< The type of the current value
+            bool bHasDefaultValue_; //!< True if the last conversion wasn't successful
+        };
+
+        public:
+            inline MultiType()                                  : value_(0) {}                                      /** @brief Default constructor: Assigns no value and no type. The type will be determined by the first assignment of a value. */
+            inline MultiType(const char& value)                 : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const unsigned char& value)        : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const short& value)                : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const unsigned short& value)       : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const int& value)                  : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const unsigned int& value)         : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const long& value)                 : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const unsigned long& value)        : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const long long& value)            : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const unsigned long long& value)   : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const float& value)                : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const double& value)               : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const long double& value)          : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const bool& value)                 : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(      void* const& value)          : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const std::string& value)          : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Vector2& value)     : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Vector3& value)     : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Vector4& value)     : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::ColourValue& value) : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Quaternion& value)  : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Radian& value)      : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Degree& value)      : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const char* value)                 : value_(0) { this->setValue(std::string(value)); } /** @brief Constructor: Converts the char array to a std::string, assigns the value and sets the type. */
+            inline MultiType(const MultiType& other)            : value_(0) { this->setValue(other); }              /** @brief Copyconstructor: Assigns value and type of the other MultiType. */
+            inline MultiType(MT_Type::Value type)               : value_(0) { this->setType(type); }                /** @brief Constructor: Sets the type, the next assignment will determine the value. */
+
+            /** @brief Destructor: Deletes the MT_Value. */
+            inline ~MultiType() { if (this->value_) { delete this->value_; } }
+
+            template <typename V> inline const MultiType& operator=(const V& value)         { this->setValue(value); return (*this); } /** @brief Assigns a new value. The value will be converted to the current type of the MultiType. */
+            template <typename V> inline const MultiType& operator=(V* value)               { this->setValue(value); return (*this); } /** @brief Assigns a pointer. */
+            inline                       const MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } /** @brief Assigns the value of the other MultiType and converts it to the current type of the MultiType. */
+            inline                       const MultiType& operator=(MT_Type::Value type)    { this->setType(type);   return (*this); } /** @brief Resets the value and changes the type. */
+
+            inline bool                                   setValue(const char& value);
+            inline bool                                   setValue(const unsigned char& value);
+            inline bool                                   setValue(const short& value);
+            inline bool                                   setValue(const unsigned short& value);
+            inline bool                                   setValue(const int& value);
+            inline bool                                   setValue(const unsigned int& value);
+            inline bool                                   setValue(const long& value);
+            inline bool                                   setValue(const unsigned long& value);
+            inline bool                                   setValue(const long long& value);
+            inline bool                                   setValue(const unsigned long long& value);
+            inline bool                                   setValue(const float& value);
+            inline bool                                   setValue(const double& value);
+            inline bool                                   setValue(const long double& value);
+            inline bool                                   setValue(const bool& value);
+            inline bool                                   setValue(      void* const& value);
+            inline bool                                   setValue(const std::string& value);
+            inline bool                                   setValue(const orxonox::Vector2& value);
+            inline bool                                   setValue(const orxonox::Vector3& value);
+            inline bool                                   setValue(const orxonox::Vector4& value);
+            inline bool                                   setValue(const orxonox::ColourValue& value);
+            inline bool                                   setValue(const orxonox::Quaternion& value);
+            inline bool                                   setValue(const orxonox::Radian& value);
+            inline bool                                   setValue(const orxonox::Degree& value);
+            inline bool                                   setValue(const char* value);
+            /** @brief Assigns a pointer. */
+            template <typename V> inline bool setValue(V* value)
+            {
+                if (this->value_)
+                    return this->value_->setValue(static_cast<void*>(const_cast<typename Loki::TypeTraits<V>::UnqualifiedType*>(value)));
+                else
+                    return this->assignValue     (static_cast<void*>(const_cast<typename Loki::TypeTraits<V>::UnqualifiedType*>(value)));
+            }
+            /** @brief Assigns the value of the other MultiType and converts it to the current type. */
+            bool                                          setValue(const MultiType& other) { if (this->value_) { return this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } return true; } }
+            /** @brief Changes the type to T and assigns the new value (which might be of another type than T - it gets converted). */
+            template <typename T, typename V> inline bool setValue(const V& value) { this->setType<T>(); return this->setValue(value); }
+
+
+            /** @brief Copies the other MultiType by assigning value and type. */
+            inline void                       copy(const MultiType& other)    { if (this == &other) { return; } if (this->value_) { delete this->value_; } this->value_ = (other.value_) ? other.value_->clone() : 0; }
+
+            template <typename T> inline bool convert()                       { return this->setValue<T>((T)(*this));  } /** @brief Converts the current value to type T. */
+            inline bool                       convert(const MultiType& other) { return this->convert(other.getType()); } /** @brief Converts the current value to the type of the other MultiType. */
+            bool                              convert(MT_Type::Value type);
+
+            /** @brief Current content gets deleted. New type is MT_Type::Null */
+            inline void                       reset()                         { if (this->value_) delete this->value_; this->value_ = 0; }
+            /** @brief Current content gets overridden with default zero value */
+            inline void                       resetValue()                    { if (this->value_) this->value_->reset(); }
+
+            template <typename T> inline void setType()                       { this->assignValue(typename Loki::TypeTraits<T>::UnqualifiedReferredType()); } /** @brief Resets the value and changes the internal type to T. */
+            inline void                       setType(const MultiType& other) { this->setType(other.getType());                                             } /** @brief Resets the value and changes the internal type to the type of the other MultiType. */
+            inline void                       setType(MT_Type::Value type)    { this->reset(); this->convert(type); this->resetValue();                     } /** @brief Resets the value and changes the internal type to the given type. */
+
+            /** @brief Returns the current type. */
+            inline MT_Type::Value             getType()                   const { return (this->value_) ? this->value_->type_ : MT_Type::Null; }
+            /** @brief Returns true if the current type equals the given type. */
+            inline bool                       isType(MT_Type::Value type) const { return (this->value_) ? (this->value_->type_ == type) : (type == MT_Type::Null); }
+            /** @brief Returns true if the current type is T. */
+            template <typename T> inline bool isType()                    const { return false; } // Only works for specialized values - see below
+            std::string                       getTypename()               const;
+            
+            /** @brief Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT */
+            inline void                       exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *static_cast<uint8_t*>(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }
+            /** @brief Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT */
+            inline void                       importData(uint8_t*& mem) { assert(sizeof(MT_Type::Value)<=8); this->setType(static_cast<MT_Type::Value>(*static_cast<uint8_t*>(mem))); mem+=sizeof(uint8_t); this->value_->importData(mem); }
+            /** @brief Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT */
+            inline uint8_t*&                  operator << (uint8_t*& mem) { importData(mem); return mem; }
+            /** @brief Loads the value of the MT to a bytestream and increases pointer to bytestream by size of MT */
+            inline void                       operator >> (uint8_t*& mem) const { exportData(mem); }
+            inline uint32_t                   getNetworkSize() const { assert(this->value_); return this->value_->getSize() + sizeof(uint8_t); }
+
+            /** @brief Checks whether the value is a default one. */
+            bool                              hasDefaultValue()         const { return this->value_->hasDefaultValue(); }
+
+            operator char()                  const;
+            operator unsigned char()         const;
+            operator short()                 const;
+            operator unsigned short()        const;
+            operator int()                   const;
+            operator unsigned int()          const;
+            operator long()                  const;
+            operator unsigned long()         const;
+            operator long long()             const;
+            operator unsigned long long()    const;
+            operator float()                 const;
+            operator double()                const;
+            operator long double()           const;
+            operator bool()                  const;
+            operator void*()                 const;
+            operator std::string()           const;
+            operator orxonox::Vector2()      const;
+            operator orxonox::Vector3()      const;
+            operator orxonox::Vector4()      const;
+            operator orxonox::ColourValue()  const;
+            operator orxonox::Quaternion()   const;
+            operator orxonox::Radian()       const;
+            operator orxonox::Degree()       const;
+            /** @brief Returns the current value, converted to a T* pointer. */
+            template <class T> operator T*() const { return (static_cast<T*>(this->operator void*())); }
+
+            inline bool getValue(char*                 value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(unsigned char*        value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(short*                value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(unsigned short*       value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(int*                  value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(unsigned int*         value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(long*                 value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(unsigned long*        value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(long long*            value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(unsigned long long*   value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(float*                value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(double*               value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(long double*          value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(bool*                 value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(void**                value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(std::string*          value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Vector2*     value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Vector3*     value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Vector4*     value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::ColourValue* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Quaternion*  value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Radian*      value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Degree*      value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+
+            inline char                     getChar()             const { return this->operator char();                 } /** @brief Returns the current value, converted to the requested type. */
+            inline unsigned char            getUnsignedChar()     const { return this->operator unsigned char();        } /** @brief Returns the current value, converted to the requested type. */
+            inline short                    getShort()            const { return this->operator short();                } /** @brief Returns the current value, converted to the requested type. */
+            inline unsigned short           getUnsignedShort()    const { return this->operator unsigned short();       } /** @brief Returns the current value, converted to the requested type. */
+            inline int                      getInt()              const { return this->operator int();                  } /** @brief Returns the current value, converted to the requested type. */
+            inline unsigned int             getUnsignedInt()      const { return this->operator unsigned int();         } /** @brief Returns the current value, converted to the requested type. */
+            inline long                     getLong()             const { return this->operator long();                 } /** @brief Returns the current value, converted to the requested type. */
+            inline unsigned long            getUnsignedLong()     const { return this->operator unsigned long();        } /** @brief Returns the current value, converted to the requested type. */
+            inline long long                getLongLong()         const { return this->operator long long();            } /** @brief Returns the current value, converted to the requested type. */
+            inline unsigned long long       getUnsignedLongLong() const { return this->operator unsigned long long();   } /** @brief Returns the current value, converted to the requested type. */
+            inline float                    getFloat()            const { return this->operator float();                } /** @brief Returns the current value, converted to the requested type. */
+            inline double                   getDouble()           const { return this->operator double();               } /** @brief Returns the current value, converted to the requested type. */
+            inline long double              getLongDouble()       const { return this->operator long double();          } /** @brief Returns the current value, converted to the requested type. */
+            inline bool                     getBool()             const { return this->operator bool();                 } /** @brief Returns the current value, converted to the requested type. */
+            inline void*                    getVoid()             const { return this->operator void*();                } /** @brief Returns the current value, converted to the requested type. */
+            inline std::string              getString()           const { return this->operator std::string();          } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Vector2         getVector2()          const { return this->operator orxonox::Vector2();     } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Vector3         getVector3()          const { return this->operator orxonox::Vector3();     } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Vector4         getVector4()          const { return this->operator orxonox::Vector4();     } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::ColourValue     getColourValue()      const { return this->operator orxonox::ColourValue(); } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Quaternion      getQuaternion()       const { return this->operator orxonox::Quaternion();  } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Radian          getRadian()           const { return this->operator orxonox::Radian();      } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Degree          getDegree()           const { return this->operator orxonox::Degree();      } /** @brief Returns the current value, converted to the requested type. */
+            template <typename T> inline T* getPointer()          const { return static_cast<T*>(this->getVoid());      } /** @brief Returns the current value, converted to a T* pointer. */
+
+        private:
+            inline bool assignValue(const char& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Char)             { return this->value_->setValue(value); } else { this->changeValueContainer<char>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned char& value)        { if (this->value_ && this->value_->type_ == MT_Type::UnsignedChar)     { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);        return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const short& value)                { if (this->value_ && this->value_->type_ == MT_Type::Short)            { return this->value_->setValue(value); } else { this->changeValueContainer<short>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned short& value)       { if (this->value_ && this->value_->type_ == MT_Type::UnsignedShort)    { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);       return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const int& value)                  { if (this->value_ && this->value_->type_ == MT_Type::Int)              { return this->value_->setValue(value); } else { this->changeValueContainer<int>(value);                  return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned int& value)         { if (this->value_ && this->value_->type_ == MT_Type::UnsignedInt)      { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);         return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const long& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Long)             { return this->value_->setValue(value); } else { this->changeValueContainer<long>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned long& value)        { if (this->value_ && this->value_->type_ == MT_Type::UnsignedLong)     { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);        return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const long long& value)            { if (this->value_ && this->value_->type_ == MT_Type::LongLong)         { return this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);            return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned long long& value)   { if (this->value_ && this->value_->type_ == MT_Type::UnsignedLongLong) { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);   return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const float& value)                { if (this->value_ && this->value_->type_ == MT_Type::Float)            { return this->value_->setValue(value); } else { this->changeValueContainer<float>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const double& value)               { if (this->value_ && this->value_->type_ == MT_Type::Double)           { return this->value_->setValue(value); } else { this->changeValueContainer<double>(value);               return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const long double& value)          { if (this->value_ && this->value_->type_ == MT_Type::LongDouble)       { return this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);          return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const bool& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Bool)             { return this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(      void* const& value)          { if (this->value_ && this->value_->type_ == MT_Type::VoidPointer)      { return this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const std::string& value)          { if (this->value_ && this->value_->type_ == MT_Type::String)           { return this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);          return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Vector2& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector2)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Vector3& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector3)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Vector4& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector4)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_Type::ColourValue)      { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Quaternion& value)  { if (this->value_ && this->value_->type_ == MT_Type::Quaternion)       { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);  return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Radian& value)      { if (this->value_ && this->value_->type_ == MT_Type::Radian)           { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);      return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Degree& value)      { if (this->value_ && this->value_->type_ == MT_Type::Degree)           { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);      return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+
+            /** @brief Changes the value container. */
+            template <typename T> inline void changeValueContainer(const T& value) { if (this->value_) { delete this->value_; } this->createNewValueContainer<T>(value); }
+            /** @brief Creates a new value container (works only with specialized types). */
+            template <typename T>        void createNewValueContainer(const T& value) { /* STATIC ASSERT */ *****value; return false; }
+
+            MT_ValueBase* value_; //!< A pointer to the value container
+    };
+
+    /** @brief Puts the MultiType on a stream by using the native << operator of the current type. */
+    _UtilExport inline std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; }
+
+    template <> inline bool MultiType::isType<char>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Char);             } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned char>()        const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedChar);     } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<short>()                const { return (this->value_ && this->value_->type_ == MT_Type::Short);            } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned short>()       const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedShort);    } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<int>()                  const { return (this->value_ && this->value_->type_ == MT_Type::Int);              } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned int>()         const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedInt);      } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<long>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Long);             } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned long>()        const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedLong);     } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<long long>()            const { return (this->value_ && this->value_->type_ == MT_Type::LongLong);         } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned long long>()   const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedLongLong); } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<float>()                const { return (this->value_ && this->value_->type_ == MT_Type::Float);            } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<double>()               const { return (this->value_ && this->value_->type_ == MT_Type::Double);           } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<long double>()          const { return (this->value_ && this->value_->type_ == MT_Type::LongDouble);       } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<bool>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Bool);             } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<void*>()                const { return (this->value_ && this->value_->type_ == MT_Type::VoidPointer);      } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<std::string>()          const { return (this->value_ && this->value_->type_ == MT_Type::String);           } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Vector2>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector2);          } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Vector3>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector3);          } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Vector4>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector4);          } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->value_ && this->value_->type_ == MT_Type::ColourValue);      } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Quaternion>()  const { return (this->value_ && this->value_->type_ == MT_Type::Quaternion);       } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Radian>()      const { return (this->value_ && this->value_->type_ == MT_Type::Radian);           } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Degree>()      const { return (this->value_ && this->value_->type_ == MT_Type::Degree);           } /** @brief Returns true if the current type equals the given type. */
+
+    // Specialization to avoid ambiguities with the conversion operator
+    template <> inline bool MultiType::convert<std::string>()          { return this->setValue<std::string>         (this->operator std::string());          } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Vector2>()     { return this->setValue<orxonox::Vector2>    (this->operator orxonox::Vector2());     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Vector3>()     { return this->setValue<orxonox::Vector3>    (this->operator orxonox::Vector3());     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Vector4>()     { return this->setValue<orxonox::Vector4>    (this->operator orxonox::Vector4());     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::ColourValue>() { return this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Quaternion>()  { return this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion());  } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Radian>()      { return this->setValue<orxonox::Radian>     (this->operator orxonox::Radian());      } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Degree>()      { return this->setValue<orxonox::Degree>     (this->operator orxonox::Degree());      } /** @brief Converts the current value to the given type. */
+
+    // Specialization to avoid ambiguities with the conversion operator
+    template <> inline bool MultiType::convert<const std::string&>()          { return this->convert<std::string>();          } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Vector2&>()     { return this->convert<orxonox::Vector2>();     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Vector3&>()     { return this->convert<orxonox::Vector3>();     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Vector4&>()     { return this->convert<orxonox::Vector4>();     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::ColourValue&>() { return this->convert<orxonox::ColourValue>(); } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Quaternion&>()  { return this->convert<orxonox::Quaternion>();  } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Radian&>()      { return this->convert<orxonox::Radian>();      } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Degree&>()      { return this->convert<orxonox::Degree>();      } /** @brief Converts the current value to the given type. */
+
+    template <> void MultiType::createNewValueContainer(const char& value);
+    template <> void MultiType::createNewValueContainer(const unsigned char& value);
+    template <> void MultiType::createNewValueContainer(const short& value);
+    template <> void MultiType::createNewValueContainer(const unsigned short& value);
+    template <> void MultiType::createNewValueContainer(const int& value);
+    template <> void MultiType::createNewValueContainer(const unsigned int& value);
+    template <> void MultiType::createNewValueContainer(const long& value);
+    template <> void MultiType::createNewValueContainer(const unsigned long& value);
+    template <> void MultiType::createNewValueContainer(const long long& value);
+    template <> void MultiType::createNewValueContainer(const unsigned long long& value);
+    template <> void MultiType::createNewValueContainer(const float& value);
+    template <> void MultiType::createNewValueContainer(const double& value);
+    template <> void MultiType::createNewValueContainer(const bool& value);
+    template <> void MultiType::createNewValueContainer(const long double& value);
+    template <> void MultiType::createNewValueContainer(      void* const& value);
+    template <> void MultiType::createNewValueContainer(const std::string& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector2& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector3& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector4& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::ColourValue& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Quaternion& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Radian& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Degree& value);
+
+    inline bool MultiType::setValue(const char& value)                  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const unsigned char& value)         { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const short& value)                 { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const unsigned short& value)        { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const int& value)                   { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const unsigned int& value)          { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const long& value)                  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const unsigned long& value)         { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const long long& value)             { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const unsigned long long& value)    { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const float& value)                 { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const double& value)                { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const long double& value)           { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const bool& value)                  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(      void* const& value)           { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const std::string& value)           { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Vector2& value)      { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Vector3& value)      { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Vector4& value)      { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::ColourValue& value)  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Quaternion& value)   { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Radian& value)       { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Degree& value)       { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+
+    inline bool MultiType::setValue(const char* value)                  { if (this->value_) { return this->value_->setValue(std::string(value)); } else { return this->assignValue(std::string(value)); } }  /** @brief Assigns the given value and converts it to the current type. */
+}
+
+#endif /* _MultiType_H__ */
Index: code/branches/libraries2/src/libraries/util/MultiTypeValue.h
===================================================================
--- code/branches/libraries2/src/libraries/util/MultiTypeValue.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/MultiTypeValue.h	(revision 5714)
@@ -0,0 +1,267 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 Declaration and Implementation of the MT_Value<T> class.
+
+    The MT_Value<T> class is used to hold a value of type T within a MultiType.
+*/
+
+#ifndef _MultiTypeValue_H__
+#define _MultiTypeValue_H__
+
+#include "UtilPrereqs.h"
+
+#include <cassert>
+#include "MathConvert.h"
+#include "MultiType.h"
+#include "Serialise.h"
+
+namespace orxonox
+{
+    /**
+        @brief The MT_Value<T> class is used to hold a value of type T within a MultiType.
+    */
+    template <typename T>
+    class MT_Value : public MultiType::MT_ValueBase
+    {
+    public:
+        /** @brief Constructor: Assigns the value and the type identifier. */
+        MT_Value(const T& value, MT_Type::Value type) : MT_ValueBase(type), value_(value) {}
+
+        /** @brief Creates a copy of itself. */
+        inline MT_ValueBase* clone() const { return new MT_Value<T>(this->value_, this->type_); }
+
+        /** @brief Resets the current value to the default. */
+        inline void reset() { this->value_ = zeroise<T>(); bHasDefaultValue_ = true; }
+
+        /** @brief Assigns the value of the other MultiType, converted to T. @param other The other MultiType */
+        inline bool assimilate(const MultiType& other)
+        {
+            if (other.value_)
+            {
+                return !(bHasDefaultValue_ = !other.value_->getValue(&value_));
+            }
+            else
+            {
+                this->value_ = zeroise<T>();
+                return !(bHasDefaultValue_ = true);
+            }
+        }
+
+        inline bool getValue(char*                 value) const { return convertValue<T, char                >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned char*        value) const { return convertValue<T, unsigned char       >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(short*                value) const { return convertValue<T, short               >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned short*       value) const { return convertValue<T, unsigned short      >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(int*                  value) const { return convertValue<T, int                 >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned int*         value) const { return convertValue<T, unsigned int        >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(long*                 value) const { return convertValue<T, long                >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned long*        value) const { return convertValue<T, unsigned long       >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(long long*            value) const { return convertValue<T, long long           >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned long long*   value) const { return convertValue<T, unsigned long long  >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(float*                value) const { return convertValue<T, float               >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(double*               value) const { return convertValue<T, double              >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(long double*          value) const { return convertValue<T, long double         >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(bool*                 value) const { return convertValue<T, bool                >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(void**                value) const { return convertValue<T, void*               >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(std::string*          value) const { return convertValue<T, std::string         >(value, value_, zeroise<std::string>         ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Vector2*     value) const { return convertValue<T, orxonox::Vector2    >(value, value_, zeroise<orxonox::Vector2>    ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Vector3*     value) const { return convertValue<T, orxonox::Vector3    >(value, value_, zeroise<orxonox::Vector3>    ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Vector4*     value) const { return convertValue<T, orxonox::Vector4    >(value, value_, zeroise<orxonox::Vector4>    ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::ColourValue* value) const { return convertValue<T, orxonox::ColourValue>(value, value_, zeroise<orxonox::ColourValue>()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Quaternion*  value) const { return convertValue<T, orxonox::Quaternion >(value, value_, zeroise<orxonox::Quaternion> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Radian*      value) const { return convertValue<T, orxonox::Radian     >(value, value_, zeroise<orxonox::Radian>     ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Degree*      value) const { return convertValue<T, orxonox::Degree     >(value, value_, zeroise<orxonox::Degree>     ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+
+        inline bool setValue(const char& value)                 { return !(bHasDefaultValue_ = !convertValue<char                , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const unsigned char& value)        { return !(bHasDefaultValue_ = !convertValue<unsigned char       , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const short& value)                { return !(bHasDefaultValue_ = !convertValue<short               , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const unsigned short& value)       { return !(bHasDefaultValue_ = !convertValue<unsigned short      , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const int& value)                  { return !(bHasDefaultValue_ = !convertValue<int                 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const unsigned int& value)         { return !(bHasDefaultValue_ = !convertValue<unsigned int        , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const long& value)                 { return !(bHasDefaultValue_ = !convertValue<long                , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const unsigned long& value)        { return !(bHasDefaultValue_ = !convertValue<unsigned long       , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const long long& value)            { return !(bHasDefaultValue_ = !convertValue<long long           , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const unsigned long long& value)   { return !(bHasDefaultValue_ = !convertValue<unsigned long long  , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const float& value)                { return !(bHasDefaultValue_ = !convertValue<float               , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const double& value)               { return !(bHasDefaultValue_ = !convertValue<double              , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const long double& value)          { return !(bHasDefaultValue_ = !convertValue<long double         , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const bool& value)                 { return !(bHasDefaultValue_ = !convertValue<bool                , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(      void* const& value)          { return !(bHasDefaultValue_ = !convertValue<void*               , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const std::string& value)          { return !(bHasDefaultValue_ = !convertValue<std::string         , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Vector2& value)     { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector2    , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Vector3& value)     { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector3    , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Vector4& value)     { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector4    , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::ColourValue& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::ColourValue, T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Quaternion& value)  { return !(bHasDefaultValue_ = !convertValue<orxonox::Quaternion , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Radian& value)      { return !(bHasDefaultValue_ = !convertValue<orxonox::Radian     , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Degree& value)      { return !(bHasDefaultValue_ = !convertValue<orxonox::Degree     , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+
+        inline operator char()                 const { return getConvertedValue<T, char>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator unsigned char()        const { return getConvertedValue<T, unsigned char>       (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator short()                const { return getConvertedValue<T, short>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator unsigned short()       const { return getConvertedValue<T, unsigned short>      (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator int()                  const { return getConvertedValue<T, int>                 (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator unsigned int()         const { return getConvertedValue<T, unsigned int>        (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator long()                 const { return getConvertedValue<T, long>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator unsigned long()        const { return getConvertedValue<T, unsigned long>       (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator long long()            const { return getConvertedValue<T, long long>           (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator unsigned long long()   const { return getConvertedValue<T, unsigned long long>  (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator float()                const { return getConvertedValue<T, float>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator double()               const { return getConvertedValue<T, double>              (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator long double()          const { return getConvertedValue<T, long double>         (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator bool()                 const { return getConvertedValue<T, bool>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator void*()                const { return getConvertedValue<T, void*>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator std::string()          const { return getConvertedValue<T, std::string>         (this->value_, NilValue<std::string         >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Vector2()     const { return getConvertedValue<T, orxonox::Vector2>    (this->value_, NilValue<orxonox::Vector2    >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Vector3()     const { return getConvertedValue<T, orxonox::Vector3>    (this->value_, NilValue<orxonox::Vector3    >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Vector4()     const { return getConvertedValue<T, orxonox::Vector4>    (this->value_, NilValue<orxonox::Vector4    >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::ColourValue() const { return getConvertedValue<T, orxonox::ColourValue>(this->value_, NilValue<orxonox::ColourValue>()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Quaternion()  const { return getConvertedValue<T, orxonox::Quaternion> (this->value_, NilValue<orxonox::Quaternion >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Radian()      const { return getConvertedValue<T, orxonox::Radian>     (this->value_, NilValue<orxonox::Radian     >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Degree()      const { return getConvertedValue<T, orxonox::Degree>     (this->value_, NilValue<orxonox::Degree     >()); } /** @brief Returns the current value, converted to the requested type. */
+
+        /** @brief Puts the current value on the stream */
+        inline void toString(std::ostream& outstream) const { outstream << this->value_; }
+        
+        /** @brief loads data from the bytestream (mem) into the MT and increases the bytestream pointer by the size of the data */
+        inline void importData( uint8_t*& mem )         { loadAndIncrease( /*(const T&)*/this->value_, mem ); }
+        /** @brief saves data from the MT into the bytestream (mem) and increases the bytestream pointer by the size of the data */
+        inline void exportData( uint8_t*& mem ) const   { saveAndIncrease( /*(const T&)*/this->value_, mem ); }
+        /** @brief returns the size of the data that would be saved by exportData */
+        inline uint8_t getSize() const { return returnSize( this->value_ ); }
+
+        T value_; //!< The stored value
+    };
+    
+    // Import / Export specialisation
+    // ColourValue
+    template <> inline void MT_Value<ColourValue>::importData( uint8_t*& mem )
+    {
+        loadAndIncrease( this->value_.r, mem );
+        loadAndIncrease( this->value_.g, mem );
+        loadAndIncrease( this->value_.b, mem );
+        loadAndIncrease( this->value_.a, mem );
+    }
+    template <> inline void MT_Value<ColourValue>::exportData( uint8_t*& mem ) const
+    {
+        saveAndIncrease( this->value_.r, mem );
+        saveAndIncrease( this->value_.g, mem );
+        saveAndIncrease( this->value_.b, mem );
+        saveAndIncrease( this->value_.a, mem );
+    }
+    template <> inline uint8_t MT_Value<ColourValue>::getSize() const
+    {
+        return 4*returnSize(this->value_.r);
+    }
+    // Ogre::Quaternion
+    template <> inline void MT_Value<Ogre::Quaternion>::importData( uint8_t*& mem )
+    {
+        loadAndIncrease( this->value_.x, mem );
+        loadAndIncrease( this->value_.y, mem );
+        loadAndIncrease( this->value_.z, mem );
+        loadAndIncrease( this->value_.w, mem );
+    }
+    template <> inline void MT_Value<Ogre::Quaternion>::exportData( uint8_t*& mem ) const
+    {
+        saveAndIncrease( this->value_.x, mem );
+        saveAndIncrease( this->value_.y, mem );
+        saveAndIncrease( this->value_.z, mem );
+        saveAndIncrease( this->value_.w, mem );
+    }
+    template <> inline uint8_t MT_Value<Ogre::Quaternion>::getSize() const
+    {
+        return 4*returnSize(this->value_.x);
+    }
+    // Ogre::Vector2
+    template <> inline void MT_Value<Ogre::Vector2>::importData( uint8_t*& mem )
+    {
+        loadAndIncrease( this->value_.x, mem );
+        loadAndIncrease( this->value_.y, mem );
+    }
+    template <> inline void MT_Value<Ogre::Vector2>::exportData( uint8_t*& mem ) const
+    {
+        saveAndIncrease( this->value_.x, mem );
+        saveAndIncrease( this->value_.y, mem );
+    }
+    template <> inline uint8_t MT_Value<Ogre::Vector2>::getSize() const
+    {
+        return 2*returnSize(this->value_.x);
+    }
+    // Ogre::Vector3
+    template <> inline void MT_Value<Ogre::Vector3>::importData( uint8_t*& mem )
+    {
+        loadAndIncrease( this->value_.x, mem );
+        loadAndIncrease( this->value_.y, mem );
+        loadAndIncrease( this->value_.z, mem );
+    }
+    template <> inline void MT_Value<Ogre::Vector3>::exportData( uint8_t*& mem ) const
+    {
+        saveAndIncrease( this->value_.x, mem );
+        saveAndIncrease( this->value_.y, mem );
+        saveAndIncrease( this->value_.z, mem );
+    }
+    template <> inline uint8_t MT_Value<Ogre::Vector3>::getSize() const
+    {
+        return 3*returnSize(this->value_.x);
+    }
+    // Ogre::Vector4
+    template <> inline void MT_Value<Ogre::Vector4>::importData( uint8_t*& mem )
+    {
+        loadAndIncrease( this->value_.x, mem );
+        loadAndIncrease( this->value_.y, mem );
+        loadAndIncrease( this->value_.z, mem );
+        loadAndIncrease( this->value_.w, mem );
+    }
+    template <> inline void MT_Value<Ogre::Vector4>::exportData( uint8_t*& mem ) const
+    {
+        saveAndIncrease( this->value_.x, mem );
+        saveAndIncrease( this->value_.y, mem );
+        saveAndIncrease( this->value_.z, mem );
+        saveAndIncrease( this->value_.w, mem );
+    }
+    template <> inline uint8_t MT_Value<Ogre::Vector4>::getSize() const
+    {
+        return 4*returnSize(this->value_.x);
+    }
+    template <> inline void MT_Value<void*>::importData( uint8_t*& mem )
+    {
+        assert(0);
+    }
+    template <> inline void MT_Value<void*>::exportData( uint8_t*& mem ) const
+    {
+        assert(0);
+    }
+    template <> inline uint8_t MT_Value<void*>::getSize() const
+    {
+        assert(0); return 0;
+    }
+}
+
+#endif /* _MultiTypeValue_H__ */
Index: code/branches/libraries2/src/libraries/util/OgreForwardRefs.h
===================================================================
--- code/branches/libraries2/src/libraries/util/OgreForwardRefs.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/OgreForwardRefs.h	(revision 5714)
@@ -0,0 +1,227 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      ...
+ *
+ */
+
+#ifndef _OgreForwardRefs_H__
+#define _OgreForwardRefs_H__
+
+#include "UtilPrereqs.h"
+
+namespace Ogre
+{
+    class Angle;
+    class Animation;
+    class AnimationState;
+    class AnimationStateSet;
+    class AnimationTrack;
+    class Archive;
+    class ArchiveFactory;
+    class ArchiveManager;
+    class AutoParamDataSource;
+    class AxisAlignedBox;
+    class AxisAlignedBoxSceneQuery;
+    class Billboard;
+    class BillboardChain;
+    class BillboardSet;
+    class Bone;
+    class Camera;
+    class Codec;
+    class ColourValue;
+    class ConfigDialog;
+    template <typename T> class Controller;
+    template <typename T> class ControllerFunction;
+    class ControllerManager;
+    template <typename T> class ControllerValue;
+    class Degree;
+    class DynLib;
+    class DynLibManager;
+    class EdgeData;
+    class EdgeListBuilder;
+    class Entity;
+    class ErrorDialog;
+    class ExternalTextureSourceManager;
+    class Factory;
+    class Font;
+    class FontPtr;
+    class FontManager;
+    struct FrameEvent;
+    class FrameListener;
+    class Frustum;
+    class GpuProgram;
+    class GpuProgramPtr;
+    class GpuProgramManager;
+	class GpuProgramUsage;
+    class HardwareIndexBuffer;
+    class HardwareOcclusionQuery;
+    class HardwareVertexBuffer;
+	class HardwarePixelBuffer;
+    class HardwarePixelBufferSharedPtr;
+	class HighLevelGpuProgram;
+    class HighLevelGpuProgramPtr;
+	class HighLevelGpuProgramManager;
+	class HighLevelGpuProgramFactory;
+    class IndexData;
+    class IntersectionSceneQuery;
+    class IntersectionSceneQueryListener;
+    class Image;
+    class KeyFrame;
+    class Light;
+    class Log;
+    class LogManager;
+	class ManualResourceLoader;
+	class ManualObject;
+    class Material;
+    class MaterialPtr;
+    class MaterialManager;
+    class MaterialScriptCompiler;
+    class Math;
+    class Matrix3;
+    class Matrix4;
+    class MemoryManager;
+    class Mesh;
+    class MeshPtr;
+    class MeshSerializer;
+    class MeshSerializerImpl;
+    class MeshManager;
+    class MovableObject;
+    class MovablePlane;
+    class Node;
+	class NodeAnimationTrack;
+	class NodeKeyFrame;
+	class NumericAnimationTrack;
+	class NumericKeyFrame;
+    class Overlay;
+    class OverlayContainer;
+    class OverlayElement;
+    class OverlayElementFactory;
+    class OverlayManager;
+    class Particle;
+    class ParticleAffector;
+    class ParticleAffectorFactory;
+    class ParticleEmitter;
+    class ParticleEmitterFactory;
+    class ParticleSystem;
+    class ParticleSystemManager;
+    class ParticleSystemRenderer;
+    class ParticleSystemRendererFactory;
+    class ParticleVisualData;
+    class Pass;
+    class PatchMesh;
+    class PixelBox;
+    class Plane;
+    class PlaneBoundedVolume;
+	class Plugin;
+    class Pose;
+    class ProgressiveMesh;
+    class Profile;
+	class Profiler;
+    class Quaternion;
+	class Radian;
+    class Ray;
+    class RaySceneQuery;
+    class RaySceneQueryListener;
+    class Renderable;
+    class RenderPriorityGroup;
+    class RenderQueue;
+    class RenderQueueGroup;
+	class RenderQueueInvocation;
+	class RenderQueueInvocationSequence;
+    class RenderQueueListener;
+    class RenderSystem;
+    class RenderSystemCapabilities;
+    class RenderTarget;
+    class RenderTargetListener;
+    class RenderTexture;
+	class MultiRenderTarget;
+    class RenderWindow;
+    class RenderOperation;
+    class Resource;
+	class ResourceBackgroundQueue;
+	class ResourceGroupManager;
+    class ResourceManager;
+    class RibbonTrail;
+	class Root;
+    class SceneManager;
+    class SceneManagerEnumerator;
+    class SceneNode;
+    class SceneQuery;
+    class SceneQueryListener;
+	class ScriptLoader;
+    class Serializer;
+    class ShadowCaster;
+    class ShadowRenderable;
+	class ShadowTextureManager;
+    class SimpleRenderable;
+    class SimpleSpline;
+    class Skeleton;
+    class SkeletonPtr;
+    class SkeletonInstance;
+    class SkeletonManager;
+    class Sphere;
+    class SphereSceneQuery;
+	class StaticGeometry;
+    class StringConverter;
+    class StringInterface;
+    class SubEntity;
+    class SubMesh;
+	class TagPoint;
+    class Technique;
+	class TempBlendedBufferInfo;
+	class ExternalTextureSource;
+    class TextureUnitState;
+    class Texture;
+    class TexturePtr;
+	class TextureFont;
+    class TextureManager;
+    class TransformKeyFrame;
+	class Timer;
+    class UserDefinedObject;
+    class Vector2;
+    class Vector3;
+    class Vector4;
+    class Viewport;
+	class VertexAnimationTrack;
+    class VertexBufferBinding;
+    class VertexData;
+    class VertexDeclaration;
+	class VertexMorphKeyFrame;
+    class WireBoundingBox;
+    class Compositor;
+    class CompositorManager;
+    class CompositorChain;
+    class CompositorInstance;
+    class CompositionTechnique;
+    class CompositionPass;
+    class CompositionTargetPass;
+
+    // Originally not in OgrePrerequisites.h
+    class BorderPanelOverlayElement;
+    class PanelOverlayElement;
+    class TextAreaOverlayElement;
+}
+
+#endif /* _OgreForwardRefs_H__ */
Index: code/branches/libraries2/src/libraries/util/OrxAssert.h
===================================================================
--- code/branches/libraries2/src/libraries/util/OrxAssert.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/OrxAssert.h	(revision 5714)
@@ -0,0 +1,52 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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
+    Declaration of custom assertion facilities
+*/
+
+#ifndef _OrxAssert_H__
+#define _OrxAssert_H__
+
+#include "UtilPrereqs.h"
+
+#include <cassert>
+#include "OutputHandler.h"
+
+// define an assert macro that can display a message
+#ifndef NDEBUG
+#define OrxAssert(Assertion, ErrorMessage) \
+    Assertion ? ((void)0) : (void)(orxonox::OutputHandler::getOutStream().setOutputLevel(1) << ErrorMessage << std::endl); \
+    assert(Assertion)
+#else
+#define OrxAssert(condition, errorMessage)  ((void)0)
+#endif
+
+#endif /* _OrxAssert_H__ */
Index: code/branches/libraries2/src/libraries/util/OrxEnum.h
===================================================================
--- code/branches/libraries2/src/libraries/util/OrxEnum.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/OrxEnum.h	(revision 5714)
@@ -0,0 +1,67 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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
+    Declaration of the OrxEnum class.
+*/
+
+#ifndef _OrxEnum_H__
+#define _OrxEnum_H__
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    template <class T>
+    struct OrxEnum
+    {
+        public:
+            OrxEnum() { }
+            OrxEnum(int type)                  { type_ = type; }
+            OrxEnum(const T& instance)   { type_ = instance.type_; }
+
+            operator int()                     { return type_; }
+            T& operator =(int type)      { type_ = type; return *this; }
+            bool operator <(const T& right) const { return (type_ < right.type_); }
+            bool operator >(const T& right) const { return (type_ > right.type_); }
+
+        private:
+            OrxEnum(const OrxEnum& instance);
+            int type_;
+    };
+}
+
+#define OrxEnumConstructors(enumName)                        \
+enumName() { }                                               \
+enumName(int type) : OrxEnum<enumName>(type)             { } \
+enumName(const enumName& inst) : OrxEnum<enumName>(inst) { } \
+void dummyFunction()
+
+#endif /* _OrxEnum_H__ */
Index: code/branches/libraries2/src/libraries/util/OutputBuffer.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/OutputBuffer.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/OutputBuffer.cc	(revision 5714)
@@ -0,0 +1,127 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 OutputBuffer.
+*/
+
+#include "OutputBuffer.h"
+
+namespace orxonox
+{
+    /**
+        @brief Adds a new listener to the list.
+        @param listener The new listener
+    */
+    void OutputBuffer::registerListener(OutputBufferListener* listener)
+    {
+        this->listeners_.push_back(listener);
+    }
+
+    /**
+        @brief Removes a listener from the list.
+        @param listener The listener
+    */
+    void OutputBuffer::unregisterListener(OutputBufferListener* listener)
+    {
+        for (std::vector<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); )
+        {
+            if ((*it) == listener)
+                it = this->listeners_.erase(it);
+            else
+                ++it;
+        }
+    }
+
+    /**
+        @brief Puts a stream manipulator to the stream.
+        @param manipulator The manipulator
+    */
+    OutputBuffer& OutputBuffer::operator<<(std::ostream& (*manipulator)(std::ostream&))
+    {
+        this->stream_ << manipulator;
+        this->callListeners();
+        return *this;
+    }
+
+    /**
+        @brief Puts a stream manipulator to the stream.
+        @param manipulator The manipulator
+    */
+    OutputBuffer& OutputBuffer::operator<<(std::ios& (*manipulator)(std::ios&))
+    {
+        this->stream_ << manipulator;
+        this->callListeners();
+        return *this;
+    }
+
+    /**
+        @brief Puts a stream manipulator to the stream.
+        @param manipulator The manipulator
+    */
+    OutputBuffer& OutputBuffer::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
+    {
+        this->stream_ << manipulator;
+        this->callListeners();
+        return *this;
+    }
+
+    /**
+        @brief Removes the first line from the stream and assigns it to a given string object.
+        @param output The string object to assign the first line
+        @return True if there was at least one line in the stream and this line was successfully assigned
+
+        It's important to know the returned line will be removed from the stream. If there are more than one
+        listener, they have to cooperate to avoid conflicts.
+    */
+    bool OutputBuffer::getLine(std::string* output)
+    {
+        std::getline(this->stream_, *output);
+
+        bool eof = this->stream_.eof();
+        bool fail = this->stream_.fail();
+
+        if (eof)
+            this->stream_.flush();
+
+        if (eof || fail)
+            this->stream_.clear();
+
+        return (!eof && !fail);
+    }
+
+    /**
+        @brief Calls the outputChanged() function of all registered listeners.
+    */
+    void OutputBuffer::callListeners()
+    {
+        for (std::vector<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+            (*it)->outputChanged();
+    }
+}
Index: code/branches/libraries2/src/libraries/util/OutputBuffer.h
===================================================================
--- code/branches/libraries2/src/libraries/util/OutputBuffer.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/OutputBuffer.h	(revision 5714)
@@ -0,0 +1,173 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 Declaration of the OutputBuffer class.
+
+    The OutputBuffer acts almost like std::ostream. You can put text and other values to the
+    OutputBuffer by using the << operator. The OutputBuffer stores the text and calls registerd
+    listeners if new text gets assigned.
+    The listeners are then able to retrieve the text line by line.
+
+    It's important to know that getLine actually removes the line from the OutputBuffer, so it's
+    better to only have one "active" listener.
+*/
+
+#ifndef _OutputBuffer_H__
+#define _OutputBuffer_H__
+
+#include "UtilPrereqs.h"
+
+#include <vector>
+#include <sstream>
+
+namespace orxonox
+{
+    /**
+        @brief A pure virtual baseclass for classes that want to register as listener to an OutputBuffer.
+
+        This class is pure virtual, so an inheriting class has to implement the function on it's own.
+        The function get's called, if an instance of the inheriting class registers as a listener at
+        an OutputBuffer and this buffer changes.
+    */
+    class OutputBufferListener
+    {
+        friend class OutputBuffer;
+
+        public:
+            virtual ~OutputBufferListener() {}
+
+        private:
+            virtual void outputChanged() = 0;
+    };
+
+    /**
+        @brief The OutputBuffer acts almost like std::ostream and stores the assigned text.
+
+        If text gets assigned by using the << operator or another function, the OutputBuffer
+        calls it's listeners, allowing them to retrieve the text line by line.
+
+        It's important to know that getLine actually removes the line from the OutputBuffer, so it's
+        better to only have one "active" listener.
+    */
+    class _UtilExport OutputBuffer
+    {
+        public:
+            OutputBuffer() {}
+            ~OutputBuffer() {}
+
+            /**
+                @brief Puts some object/value to the OutputBuffer. The text gets assigned and the OutputBuffer calls it's listeners.
+                @param object The object/value to assign
+            */
+            template <class T>
+            inline OutputBuffer& operator<<(T object)
+            {
+                this->stream_ << object;
+                this->callListeners();
+                return *this;
+            }
+
+            /**
+                @brief Reads the stored text of the other OutputBuffer and calls the listeners.
+                @param object The other OutputBuffer
+            */
+            template <const OutputBuffer&>
+            inline OutputBuffer& operator<<(const OutputBuffer& object)
+            {
+                this->stream_ << object.stream_.rdbuf();
+                this->callListeners();
+                return *this;
+            }
+
+            OutputBuffer& operator<<(std::ostream& (*manipulator)(std::ostream&));
+            OutputBuffer& operator<<(std::ios& (*manipulator)(std::ios&));
+            OutputBuffer& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
+
+            /**
+                @brief Does the same like operator<<: Assigns the object to the stream and calls the listeners.
+                @param object The object/value
+            */
+            template <class T>
+            inline void add(T object)
+            {
+                this->stream_ << object;
+                this->callListeners();
+            }
+
+            /**
+                @brief Assigns an object/value and adds std::endl.
+                @param object The object/value
+            */
+            template <class T>
+            inline void addLine(T object)
+            {
+                this->stream_ << object << std::endl;
+                this->callListeners();
+            }
+
+            /**
+                @brief Puts std::endl to the stream and calls the listeners.
+            */
+            inline void newline()
+            {
+                this->stream_ << std::endl;
+                this->callListeners();
+            }
+
+            /**
+                @brief Flushes the stored text (~empties the OutputBuffer).
+            */
+            inline void flush()
+            {
+                this->stream_.flush();
+            }
+
+            bool getLine(std::string* output);
+
+            void registerListener(OutputBufferListener* listener);
+            void unregisterListener(OutputBufferListener* listener);
+
+            /**
+                @brief Returns the internal stringstream object.
+            */
+            inline std::stringstream& getStream()
+            {
+                return this->stream_;
+            }
+
+        private:
+            void callListeners();
+
+            std::stringstream stream_;                     //!< The stringstream that stores the assigned text
+            std::vector<OutputBufferListener*> listeners_; //!< A list of all listeners
+    };
+}
+
+#endif /* _OutputBuffer_H__ */
Index: code/branches/libraries2/src/libraries/util/OutputHandler.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/OutputHandler.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/OutputHandler.cc	(revision 5714)
@@ -0,0 +1,231 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 OutputHandler class.
+*/
+
+#include "OutputHandler.h"
+
+#include <ctime>
+#include <cstdlib>
+
+namespace orxonox
+{
+    /**
+        @brief Constructor: Opens the logfile and writes the first line.
+        @param logfilename The name of the logfile
+    */
+    OutputHandler::OutputHandler()
+    {
+#ifdef ORXONOX_PLATFORM_WINDOWS
+        char* pTempDir = getenv("TEMP");
+        this->logfilename_ = std::string(pTempDir) + "/orxonox.log";
+#else
+        this->logfilename_ = "/tmp/orxonox.log";
+#endif
+#ifdef NDEBUG
+        this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 2;
+        this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 1;
+#else
+        this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 3;
+        this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 2;
+#endif
+
+        this->outputBuffer_ = &this->fallbackBuffer_;
+        this->logfile_.open(this->logfilename_.c_str(), std::fstream::out);
+
+        time_t rawtime;
+        struct tm* timeinfo;
+        time(&rawtime);
+        timeinfo = localtime(&rawtime);
+
+        this->logfile_ << "Started log on " << asctime(timeinfo) << 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;
+        return orxout;
+    }
+
+    /**
+        @brief Sets the soft debug level for a given output device.
+        @param device The output device
+        @param level The debug level
+    */
+    void OutputHandler::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
+    {
+        OutputHandler::getOutStream().softDebugLevel_[static_cast<unsigned int>(device)] = level;
+    }
+
+    /**
+        @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 OutputHandler::getOutStream().softDebugLevel_[static_cast<unsigned int>(device)];
+    }
+
+    /**
+        @brief Sets the OutputBuffer, representing the third output stream.
+        @param buffer The OutputBuffer
+    */
+    void OutputHandler::setOutputBuffer(OutputBuffer* buffer)
+    {
+        if (buffer == NULL)
+            this->outputBuffer_ = &this->fallbackBuffer_;
+        else
+        {
+            buffer->getStream() >> this->outputBuffer_->getStream().rdbuf();
+            this->outputBuffer_ = buffer;
+        }
+    }
+
+    /**
+        @brief Sets the path where to create orxonox.log
+        @param Path string with trailing slash
+    */
+    void OutputHandler::setLogPath(const std::string& path)
+    {
+        OutputHandler::getOutStream().logfile_.close();
+        // store old content
+        std::ifstream old;
+        old.open(OutputHandler::getOutStream().logfilename_.c_str());
+        OutputHandler::getOutStream().logfilename_ = path + "orxonox.log";
+        OutputHandler::getOutStream().logfile_.open(OutputHandler::getOutStream().logfilename_.c_str(), std::fstream::out);
+        OutputHandler::getOutStream().logfile_ << old.rdbuf();
+        old.close();
+        OutputHandler::getOutStream().logfile_.flush();
+    }
+
+    /**
+        @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();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << sb;
+
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console, the logfile and the ingame shell.
+        @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();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << manipulator;
+
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console, the logfile and the ingame shell.
+        @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();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << manipulator;
+
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console, the logfile and the ingame shell.
+        @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();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << manipulator;
+
+        return *this;
+    }
+}
Index: code/branches/libraries2/src/libraries/util/OutputHandler.h
===================================================================
--- code/branches/libraries2/src/libraries/util/OutputHandler.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/OutputHandler.h	(revision 5714)
@@ -0,0 +1,206 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 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 and the ingame shell.
+*/
+
+#ifndef _OutputHandler_H__
+#define _OutputHandler_H__
+
+#include "UtilPrereqs.h"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#include "OutputBuffer.h"
+
+namespace orxonox
+{
+    //! The OutputHandler acts like std::cout, but redirects output to the console, the logfile and the ingame shell.
+    class _UtilExport OutputHandler
+    {
+        public:
+            enum OutputDevice
+            {
+                LD_All = 0,
+                LD_Console = 1,
+                LD_Logfile = 2,
+                LD_Shell = 3
+            };
+
+            static OutputHandler& getOutStream();
+
+            /** @brief Puts some text on the outstream. @param text The text */
+            static inline const std::string& log(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(0); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts an error on the outstream. @param text The text */
+            static inline const std::string& error(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(1); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts a warning on the outstream. @param text The text */
+            static inline const std::string& warning(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(2); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts an info on the outstream. @param text The text */
+            static inline const std::string& info(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(3); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts some debug output on the outstream. @param text The text */
+            static inline const std::string& debug(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(4); 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 Returns a pointer to the OutputBuffer. @return The OutputBuffer */
+            inline OutputBuffer* getOutputBuffer()
+                { return this->outputBuffer_; }
+
+            /** @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 void setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
+            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
+
+            static void setLogPath(const std::string& path);
+
+            void setOutputBuffer(OutputBuffer* buffer);
+
+            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<<(long 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 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();
+            OutputHandler(const OutputHandler& oh);
+            virtual ~OutputHandler();
+
+            std::ofstream logfile_;              //!< The logfile where the output is logged
+            std::string logfilename_;            //!< The name of the logfile
+            OutputBuffer fallbackBuffer_;        //!< The OutputBuffer that gets used if there is no other OutputBuffer
+            OutputBuffer* outputBuffer_;         //!< The OutputBuffer to put output in (usually used by the Shell)
+            int outputLevel_;                    //!< The level of the incoming output
+            int softDebugLevel_[4];              //!< The soft debug level for each OutputDevice - the configurable maximal output level
+    };
+
+    /**
+        @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();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << output;
+
+        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();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= out.getOutputLevel())
+            (*out.getOutputBuffer()) << output;
+
+        return out;
+    }
+}
+
+#endif /* _OutputHandler_H__ */
Index: code/branches/libraries2/src/libraries/util/RefToValue.h
===================================================================
--- code/branches/libraries2/src/libraries/util/RefToValue.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/RefToValue.h	(revision 5714)
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2006 Richard Sposato
+// Copyright (c) 2006 Peter Kümmel
+// Permission to use, copy, modify, distribute and sell this software for any 
+//     purpose is hereby granted without fee, provided that the above copyright 
+//     notice appear in all copies and that both that copyright notice and this 
+//     permission notice appear in supporting documentation.
+// The authors make no representations about the 
+//     suitability of this software for any purpose. It is provided "as is" 
+//     without express or implied warranty.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_REFTOVALUE_INC_
+#define LOKI_REFTOVALUE_INC_
+
+// $Id: RefToValue.h 751 2006-10-17 19:50:37Z syntheticpp $
+
+
+namespace Loki
+{
+
+    ////////////////////////////////////////////////////////////////////////////////
+    ///  \class RefToValue
+    ///
+    ///  \ingroup SmartPointerGroup 
+    ///  Transports a reference as a value
+    ///  Serves to implement the Colvin/Gibbons trick for SmartPtr/ScopeGuard
+    ////////////////////////////////////////////////////////////////////////////////
+
+    template <class T>
+    class RefToValue
+    {   
+    public:
+    
+        RefToValue(T& ref) : ref_(ref) 
+        {}
+
+        RefToValue(const RefToValue& rhs) : ref_(rhs.ref_)
+        {}
+
+        operator T& () const 
+        {
+            return ref_;
+        }
+
+    private:
+        // Disable - not implemented
+        RefToValue();
+        RefToValue& operator=(const RefToValue&);
+        
+        T& ref_;
+    };
+
+
+    ////////////////////////////////////////////////////////////////////////////////
+    ///  \ingroup ExceptionGroup 
+    ///  RefToValue creator.
+    ////////////////////////////////////////////////////////////////////////////////
+
+    template <class T>
+    inline RefToValue<T> ByRef(T& t)
+    {
+        return RefToValue<T>(t);
+    }    
+    
+}
+
+
+#endif // end file guardian
+
Index: code/branches/libraries2/src/libraries/util/Scope.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/Scope.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Scope.cc	(revision 5714)
@@ -0,0 +1,35 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 "Scope.h"
+
+namespace orxonox
+{
+    std::map<ScopeID::Value, int> ScopeManager::instanceCounts_s;
+    std::map<ScopeID::Value, std::set<ScopeListener*> > ScopeManager::listeners_s;
+}
Index: code/branches/libraries2/src/libraries/util/Scope.h
===================================================================
--- code/branches/libraries2/src/libraries/util/Scope.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Scope.h	(revision 5714)
@@ -0,0 +1,141 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 __Util_Scope_H__
+#define __Util_Scope_H__
+
+#include "UtilPrereqs.h"
+#include <cassert>
+#include <set>
+#include <map>
+#include "Debug.h"
+
+namespace orxonox
+{
+    namespace ScopeID
+    {
+        /**
+            @brief A list of available scopes for the Scope template.
+        */
+        enum Value
+        {
+            GSRoot,
+            GSGraphics,
+            GSLevel
+        };
+    }
+
+    class ScopeListener; // Forward declaration
+
+    /**
+        @brief The ScopeManager stores the variables of the scope templates in a statically linked context.
+    */
+    class _UtilExport ScopeManager
+    {
+        template <ScopeID::Value scope>
+        friend class Scope;
+        friend class ScopeListener;
+
+        private:
+            static std::map<ScopeID::Value, int> instanceCounts_s;                  //!< Counts the number of active instances (>0 means active) for a scope
+            static std::map<ScopeID::Value, std::set<ScopeListener*> > listeners_s; //!< Stores all listeners for a scope
+    };
+
+    /**
+        @brief ScopeListeners register themselves in the corresponding scope and wait for notifications.
+    */
+    class _UtilExport ScopeListener
+    {
+        template <ScopeID::Value scope>
+        friend class Scope;
+
+        protected:
+            //! Constructor: Registers the instance.
+            ScopeListener(ScopeID::Value scope) : scope_(scope)
+                { ScopeManager::listeners_s[this->scope_].insert(this); }
+            //! Destructor: Unregisters the instance.
+            virtual ~ScopeListener()
+                { ScopeManager::listeners_s[this->scope_].erase(this); }
+
+            //! Gets called if the scope is activated
+            virtual void activated() = 0;
+            //! Gets called if the scope is deactivated
+            virtual void deactivated() = 0;
+
+        private:
+            ScopeID::Value scope_; //!< Store the scope to unregister on destruction
+    };
+
+    /**
+        @brief A scope for a given template argument is either active or not.
+
+        Objects inheriting from a ScopeListener are registered in a list (different for each scope).
+        If the scope gets activated or deactivated, all objects in this list are notified.
+    */
+    template <ScopeID::Value scope>
+    class Scope
+    {
+        public:
+            //! Constructor: Increases the instance counter and activates the scope if the count went from 0 to 1. Counts >1 don't change anything.
+            Scope()
+            {
+                ScopeManager::instanceCounts_s[scope]++;
+                assert(ScopeManager::instanceCounts_s[scope] > 0);
+                if (ScopeManager::instanceCounts_s[scope] == 1)
+                {
+                    for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); )
+                        (*(it++))->activated();
+                }
+            }
+
+            //! Destructor: Decreases the instance counter and deactivates the scope if the count went from 1 to 0. Counts >0 don't change anything.
+            ~Scope()
+            {
+                ScopeManager::instanceCounts_s[scope]--;
+
+                // This shouldn't happen but just to be sure: check if the count is positive
+                assert(ScopeManager::instanceCounts_s[scope] >= 0);
+                if (ScopeManager::instanceCounts_s[scope] < 0)
+                    ScopeManager::instanceCounts_s[scope] = 0;
+
+                if (ScopeManager::instanceCounts_s[scope] == 0)
+                {
+                    for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); )
+                        (*(it++))->deactivated();
+                }
+            }
+
+            //! Returns true if the scope is active.
+            static bool isActive()
+            {
+                return (ScopeManager::instanceCounts_s[scope] > 0);
+            }
+    };
+}
+
+#endif /* __Util_Scope_H__ */
Index: code/branches/libraries2/src/libraries/util/ScopeGuard.h
===================================================================
--- code/branches/libraries2/src/libraries/util/ScopeGuard.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/ScopeGuard.h	(revision 5714)
@@ -0,0 +1,666 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2000 Andrei Alexandrescu
+// Copyright (c) 2000 Petru Marginean
+// Copyright (c) 2005 Joshua Lehrer
+//
+// Permission to use, copy, modify, distribute and sell this software for any 
+//     purpose is hereby granted without fee, provided that the above copyright 
+//     notice appear in all copies and that both that copyright notice and this 
+//     permission notice appear in supporting documentation.
+// The author makes no representations about the 
+//     suitability of this software for any purpose. It is provided "as is" 
+//     without express or implied warranty.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_SCOPEGUARD_INC_
+#define LOKI_SCOPEGUARD_INC_
+
+// $Id: ScopeGuard.h 799 2006-12-20 00:37:13Z rich_sposato $
+
+
+#include "RefToValue.h"
+
+/// \defgroup ExceptionGroup Exception-safe code
+
+namespace Loki
+{
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImplBase
+    /// \ingroup ExceptionGroup
+    ///
+    /// Base class used by all ScopeGuard implementations.  All commonly used
+    /// functions are in this class (e.g. - Dismiss and SafeExecute).
+    ///
+    /// See Andrei's and Petru Marginean's CUJ article
+    /// http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/alexandr.htm
+    ///
+    /// Changes to the original code by Joshua Lehrer:
+    /// http://www.lehrerfamily.com/scopeguard.html
+    ////////////////////////////////////////////////////////////////
+
+    class ScopeGuardImplBase
+    {
+        /// Copy-assignment operator is not implemented and private.
+        ScopeGuardImplBase& operator =(const ScopeGuardImplBase&);
+
+    protected:
+
+        ~ScopeGuardImplBase()
+        {}
+
+        /// Copy-constructor takes over responsibility from other ScopeGuard.
+        ScopeGuardImplBase(const ScopeGuardImplBase& other) throw() 
+            : dismissed_(other.dismissed_)
+        {
+            other.Dismiss();
+        }
+
+        template <typename J>
+        static void SafeExecute(J& j) throw() 
+        {
+            if (!j.dismissed_)
+                try
+                {
+                    j.Execute();
+                }
+                catch(...)
+                {}
+        }
+        
+        mutable bool dismissed_;
+
+    public:
+        ScopeGuardImplBase() throw() : dismissed_(false) 
+        {}
+
+        void Dismiss() const throw() 
+        {
+            dismissed_ = true;
+        }
+    };
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \typedef typedef const ScopeGuardImplBase& ScopeGuard
+    /// \ingroup ExceptionGroup
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    typedef const ScopeGuardImplBase& ScopeGuard;
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl0
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with no parameters.  ScopeGuard ignores any value returned from the
+    /// call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F>
+    class ScopeGuardImpl0 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl0<F> MakeGuard(F fun)
+        {
+            return ScopeGuardImpl0<F>(fun);
+        }
+
+        ~ScopeGuardImpl0() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            fun_();
+        }
+
+        ScopeGuardImpl0(F fun) : fun_(fun) 
+        {}
+
+    protected:
+        F fun_;
+    };
+
+    template <typename F> 
+    inline ScopeGuardImpl0<F> MakeGuard(F fun)
+    {
+        return ScopeGuardImpl0<F>::MakeGuard(fun);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl1
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with one parameter.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F, typename P1>
+    class ScopeGuardImpl1 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
+        {
+            return ScopeGuardImpl1<F, P1>(fun, p1);
+        }
+
+        ~ScopeGuardImpl1() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute()
+        {
+            fun_(p1_);
+        }
+
+        ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1) 
+        {}
+
+    protected:
+        F fun_;
+        const P1 p1_;
+    };
+
+    template <typename F, typename P1> 
+    inline ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
+    {
+        return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl2
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with two parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F, typename P1, typename P2>
+    class ScopeGuardImpl2: public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
+        {
+            return ScopeGuardImpl2<F, P1, P2>(fun, p1, p2);
+        }
+
+        ~ScopeGuardImpl2() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute()
+        {
+            fun_(p1_, p2_);
+        }
+
+        ScopeGuardImpl2(F fun, P1 p1, P2 p2) : fun_(fun), p1_(p1), p2_(p2) 
+        {}
+
+    protected:
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+    };
+
+    template <typename F, typename P1, typename P2>
+    inline ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
+    {
+        return ScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl3
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with three parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F, typename P1, typename P2, typename P3>
+    class ScopeGuardImpl3 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
+        {
+            return ScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3);
+        }
+
+        ~ScopeGuardImpl3() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute()
+        {
+            fun_(p1_, p2_, p3_);
+        }
+
+        ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) : fun_(fun), p1_(p1), p2_(p2), p3_(p3) 
+        {}
+
+    protected:
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+    };
+
+    template <typename F, typename P1, typename P2, typename P3>
+    inline ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
+    {
+        return ScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl4
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with four parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4 >
+    class ScopeGuardImpl4 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard(
+            F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
+        {
+            return ScopeGuardImpl4< F, P1, P2, P3, P4 >( fun, p1, p2, p3, p4 );
+        }
+
+        ~ScopeGuardImpl4() throw() 
+        {
+            SafeExecute( *this );
+        }
+
+        void Execute()
+        {
+            fun_( p1_, p2_, p3_, p4_ );
+        }
+
+        ScopeGuardImpl4( F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) :
+             fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 )
+        {}
+
+    protected:
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+        const P4 p4_;
+    };
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4 >
+    inline ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
+    {
+        return ScopeGuardImpl4< F, P1, P2, P3, P4 >::MakeGuard( fun, p1, p2, p3, p4 );
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl5
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with five parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 >
+    class ScopeGuardImpl5 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard(
+            F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
+        {
+            return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >( fun, p1, p2, p3, p4, p5 );
+        }
+
+        ~ScopeGuardImpl5() throw() 
+        {
+            SafeExecute( *this );
+        }
+
+        void Execute()
+        {
+            fun_( p1_, p2_, p3_, p4_, p5_ );
+        }
+
+        ScopeGuardImpl5( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) :
+             fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ), p5_( p5 )
+        {}
+
+    protected:
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+        const P4 p4_;
+        const P5 p5_;
+    };
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 >
+    inline ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
+    {
+        return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >::MakeGuard( fun, p1, p2, p3, p4, p5 );
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl0
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with no
+    /// parameters.  ScopeGuard ignores any value returned from the call within
+    /// the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <class Obj, typename MemFun>
+    class ObjScopeGuardImpl0 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
+        {
+            return ObjScopeGuardImpl0<Obj, MemFun>(obj, memFun);
+        }
+
+        ~ObjScopeGuardImpl0() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            (obj_.*memFun_)();
+        }
+
+        ObjScopeGuardImpl0(Obj& obj, MemFun memFun) : obj_(obj), memFun_(memFun) 
+        {}
+
+    protected:
+        Obj& obj_;
+        MemFun memFun_;
+    };
+
+    template <class Obj, typename MemFun>
+    inline ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
+    {
+        return ObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun);
+    }
+
+    template <typename Ret, class Obj1, class Obj2>
+    inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 &obj) 
+    {
+      return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(obj,memFun);
+    }
+
+    template <typename Ret, class Obj1, class Obj2>
+    inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 *obj) 
+    {
+      return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(*obj,memFun);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl1
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with one
+    /// parameter.  The parameter is copied by value - use ::Loki::ByRef if you
+    /// must use a reference instead.  ScopeGuard ignores any value returned
+    /// from the call within the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <class Obj, typename MemFun, typename P1>
+    class ObjScopeGuardImpl1 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
+        {
+            return ObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1);
+        }
+
+        ~ObjScopeGuardImpl1() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            (obj_.*memFun_)(p1_);
+        }
+
+        ObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) : obj_(obj), memFun_(memFun), p1_(p1) 
+        {}
+        
+    protected:
+        Obj& obj_;
+        MemFun memFun_;
+        const P1 p1_;
+    };
+
+    template <class Obj, typename MemFun, typename P1>
+    inline ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
+    {
+        return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
+    inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 &obj, P1b p1) 
+    {
+      return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(obj,memFun,p1);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
+    inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 *obj, P1b p1) 
+    {
+      return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(*obj,memFun,p1);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl2
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with two
+    /// parameters.  Each parameter is copied by value - use ::Loki::ByRef if you
+    /// must use a reference instead.  ScopeGuard ignores any value returned
+    /// from the call within the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <class Obj, typename MemFun, typename P1, typename P2>
+    class ObjScopeGuardImpl2 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+        {
+            return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2);
+        }
+
+        ~ObjScopeGuardImpl2() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            (obj_.*memFun_)(p1_, p2_);
+        }
+
+        ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2) 
+        {}
+
+    protected:
+        Obj& obj_;
+        MemFun memFun_;
+        const P1 p1_;
+        const P2 p2_;
+    };
+
+    template <class Obj, typename MemFun, typename P1, typename P2>
+    inline ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+    {
+        return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>::MakeObjGuard(obj, memFun, p1, p2);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
+    inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 &obj, P1b p1, P2b p2) 
+    {
+      return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(obj,memFun,p1,p2);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
+    inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 *obj, P1b p1, P2b p2) 
+    {
+      return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(*obj,memFun,p1,p2);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl3
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with three
+    /// parameters.  Each parameter is copied by value - use ::Loki::ByRef if you
+    /// must use a reference instead.  ScopeGuard ignores any value returned
+    /// from the call within the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template < class Obj, typename MemFun, typename P1, typename P2, typename P3 >
+    class ObjScopeGuardImpl3 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(
+            Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
+        {
+            return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >( obj, memFun, p1, p2, p3 );
+        }
+
+        ~ObjScopeGuardImpl3() throw() 
+        {
+            SafeExecute( *this );
+        }
+
+        void Execute() 
+        {
+            ( obj_.*memFun_ )( p1_, p2_, p3_ );
+        }
+
+        ObjScopeGuardImpl3( Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) :
+             obj_( obj ), memFun_( memFun ), p1_( p1 ), p2_( p2 ), p3_( p3 )
+        {}
+
+    protected:
+        Obj& obj_;
+        MemFun memFun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+    };
+
+    template < class Obj, typename MemFun, typename P1, typename P2, typename P3 >
+    inline ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(
+        Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
+    {
+        return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >::MakeObjGuard(
+            obj, memFun, p1, p2, p3 );
+    }
+
+    template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b,
+        typename P2a, typename P2b, typename P3a, typename P3b >
+    inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+        MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 & obj, P1b p1, P2b p2, P3b p3 )
+    {
+      return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+          ::MakeObjGuard( obj, memFun, p1, p2, p3 );
+    }
+
+    template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b,
+        typename P2a, typename P2b, typename P3a, typename P3b >
+    inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+        MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 * obj, P1b p1, P2b p2, P3b p3 )
+    {
+      return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+          ::MakeObjGuard( *obj, memFun, p1, p2, p3 );
+    }
+
+} // namespace Loki
+
+#define LOKI_CONCATENATE_DIRECT(s1, s2)  s1##s2
+#define LOKI_CONCATENATE(s1, s2)         LOKI_CONCATENATE_DIRECT(s1, s2)
+#define LOKI_ANONYMOUS_VARIABLE(str)     LOKI_CONCATENATE(str, __LINE__)
+
+#define LOKI_ON_BLOCK_EXIT      ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeGuard
+#define LOKI_ON_BLOCK_EXIT_OBJ  ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeObjGuard
+
+#endif // end file guardian
+
Index: code/branches/libraries2/src/libraries/util/ScopedSingleton.h
===================================================================
--- code/branches/libraries2/src/libraries/util/ScopedSingleton.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/ScopedSingleton.h	(revision 5714)
@@ -0,0 +1,102 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 __Util_ScopedSingleton_H__
+#define __Util_ScopedSingleton_H__
+
+#include "UtilPrereqs.h"
+#include <cassert>
+
+#include "Scope.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Base for scoped singleton classes.
+        A Scoped singleton creates itself if the scope is active and getInstance() is called.
+        Destroys itself if the scope is deactivated.
+
+        Usage:
+        Inherit publicly from ScopedSingleton<MyClass, scope> and provide access to
+        MyClass::singletonPtr_s.
+        This can easily be done with a friend declaration.
+
+        See @ref UtilPrereqs.h for a list of scopes (ScopeID::Value).
+    */
+    template <class T, ScopeID::Value scope>
+    class ScopedSingleton : public ScopeListener
+    {
+        public:
+            //! Returns a reference to the singleton instance
+            static T& getInstance()
+            {
+                assert(Scope<scope>::isActive());
+
+                if (!T::singletonPtr_s && Scope<scope>::isActive())
+                    T::singletonPtr_s = new T();
+
+                return *T::singletonPtr_s;
+            }
+
+        protected:
+            //! Constructor sets the singleton instance pointer
+            ScopedSingleton() : ScopeListener(scope)
+            {
+                assert(T::singletonPtr_s == 0);
+                T::singletonPtr_s = static_cast<T*>(this);
+            }
+
+            //! Constructor resets the singleton instance pointer
+            ~ScopedSingleton()
+            {
+                assert(T::singletonPtr_s != 0);
+                T::singletonPtr_s = 0;
+            }
+
+        private:
+            //! Called if the Scope of this Singleton gets active (no instance should be active then)
+            void activated()
+            {
+                // The ScopedSingleton shouldn't be active bevor the scope is activated -> always assertion failed
+                assert(T::singletonPtr_s == 0 && false);
+            }
+
+            //! Called if the Scope of this Singleton gets deactivated (destroys the instance)
+            void deactivated()
+            {
+                if (T::singletonPtr_s)
+                {
+                    delete T::singletonPtr_s;
+                    T::singletonPtr_s = 0;
+                }
+            }
+    };
+}
+
+#endif /* __Util_ScopedSingleton_H__ */
Index: code/branches/libraries2/src/libraries/util/Serialise.h
===================================================================
--- code/branches/libraries2/src/libraries/util/Serialise.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Serialise.h	(revision 5714)
@@ -0,0 +1,478 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Functions to serialise most of the types/classed used in Orxonox
+*/
+
+#ifndef _Serialise_H__
+#define _Serialise_H__
+
+#include <cstring>
+#include "util/Math.h"
+
+namespace orxonox{
+    
+// general template declaration
+    
+    /** @brief returns the size of the variable in a datastream */
+    template <class T> inline uint32_t returnSize( const T& );
+    /** @brief loads the value of a variable out of the bytestream and increases the mem pointer */
+    template <class T> inline void loadAndIncrease( const T&, uint8_t*& );
+    /** @brief saves the value of a variable into the bytestream and increases the mem pointer */
+    template <class T> inline void saveAndIncrease( const T&, uint8_t*& );
+    /** @brief checks whether the variable of type T is the same as in the bytestream */
+    template <class T> inline  bool checkEquality( const T&, uint8_t* );
+
+// =================== Template specialisation stuff =============
+
+// =========== bool
+
+    template <> inline uint32_t returnSize( const bool& variable )
+    {
+        return sizeof(uint8_t);
+    }
+
+    template <> inline void loadAndIncrease( const bool& variable, uint8_t*& mem )
+    {
+        *(uint8_t*)( &variable ) = *static_cast<uint8_t*>(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const bool& variable, uint8_t*& mem )
+    {
+        *static_cast<uint8_t*>(mem) = *(uint8_t*)( &variable );
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const bool& variable, uint8_t* mem )
+    {
+        return *static_cast<uint8_t*>(mem) == *(uint8_t*)( &variable );
+    }
+
+// =========== char
+
+    template <> inline uint32_t returnSize( const char& variable )
+    {
+        return sizeof(uint8_t);
+    }
+
+    template <> inline void loadAndIncrease( const char& variable, uint8_t*& mem )
+    {
+        *(uint8_t*)( &variable ) = *static_cast<uint8_t*>(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const char& variable, uint8_t*& mem )
+    {
+        *static_cast<uint8_t*>(mem) = *(uint8_t*)( &variable );
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const char& variable, uint8_t* mem )
+    {
+        return *static_cast<uint8_t*>(mem) == *(uint8_t*)( &variable );
+    }
+
+// =========== unsigned char
+
+    template <> inline uint32_t returnSize( const unsigned char& variable )
+    {
+        return sizeof(uint8_t);
+    }
+
+    template <> inline void loadAndIncrease( const unsigned char& variable, uint8_t*& mem )
+    {
+        *(uint8_t*)( &variable ) = *static_cast<uint8_t*>(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const unsigned char& variable, uint8_t*& mem )
+    {
+        *static_cast<uint8_t*>(mem) = *(uint8_t*)( &variable );
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const unsigned char& variable, uint8_t* mem )
+    {
+        return *static_cast<uint8_t*>(mem) == *(uint8_t*)( &variable );
+    }
+
+// =========== short
+
+    template <> inline uint32_t returnSize( const short& variable )
+    {
+        return sizeof(int16_t);
+    }
+
+    template <> inline void loadAndIncrease( const short& variable, uint8_t*& mem )
+    {
+        *(short*)( &variable ) = *(int16_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const short& variable, uint8_t*& mem )
+    {
+        *(int16_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const short& variable, uint8_t* mem )
+    {
+        return *(int16_t*)(mem) == static_cast<int16_t>(variable);
+    }
+
+// =========== unsigned short
+
+    template <> inline uint32_t returnSize( const unsigned short& variable )
+    {
+        return sizeof(uint16_t);
+    }
+
+    template <> inline void loadAndIncrease( const unsigned short& variable, uint8_t*& mem )
+    {
+        *(unsigned short*)( &variable ) = *(uint16_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const unsigned short& variable, uint8_t*& mem )
+    {
+        *(uint16_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const unsigned short& variable, uint8_t* mem )
+    {
+        return *(uint16_t*)(mem) == variable;
+    }
+
+// =========== int
+
+    template <> inline uint32_t returnSize( const int& variable )
+    {
+        return sizeof(int32_t);
+    }
+
+    template <> inline void loadAndIncrease( const int& variable, uint8_t*& mem )
+    {
+        *(int *)( &variable ) = *(int32_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const int& variable, uint8_t*& mem )
+    {
+        *(int32_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const int& variable, uint8_t* mem )
+    {
+        return *(int32_t*)(mem) == variable;
+    }
+
+// =========== unsigned int
+
+    template <> inline uint32_t returnSize( const unsigned int& variable )
+    {
+        return sizeof(uint32_t);
+    }
+    
+    template <> inline void loadAndIncrease( const unsigned int& variable, uint8_t*& mem )
+    {
+        *(unsigned int*)( &variable ) = *(uint32_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const unsigned int& variable, uint8_t*& mem )
+    {
+        *(uint32_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const unsigned int& variable, uint8_t* mem )
+    {
+        return *(uint32_t*)(mem) == variable;
+    }
+
+// =========== long
+
+    template <> inline uint32_t returnSize( const long& variable )
+    {
+        return sizeof(int32_t);
+    }
+
+    template <> inline void loadAndIncrease( const long& variable, uint8_t*& mem )
+    {
+        *(long*)( &variable ) = *(int32_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const long& variable, uint8_t*& mem )
+    {
+        *(int32_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const long& variable, uint8_t* mem )
+    {
+        return *(int32_t*)(mem) == variable;
+    }
+
+// =========== unsigned long
+
+    template <> inline uint32_t returnSize( const unsigned long& variable )
+    {
+        return sizeof(uint32_t);
+    }
+
+    template <> inline void loadAndIncrease( const unsigned long& variable, uint8_t*& mem )
+    {
+        *(unsigned long*)( &variable ) = *(uint32_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const unsigned long& variable, uint8_t*& mem )
+    {
+        *(uint32_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const unsigned long& variable, uint8_t* mem )
+    {
+        return *(uint32_t*)(mem) == variable;
+    }
+
+// =========== long long
+
+    template <> inline uint32_t returnSize( const long long& variable )
+    {
+        return sizeof(int64_t);
+    }
+
+    template <> inline void loadAndIncrease( const long long& variable, uint8_t*& mem )
+    {
+        *(long long*)( &variable ) = *(int64_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const long long& variable, uint8_t*& mem )
+    {
+        *(int64_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const long long& variable, uint8_t* mem )
+    {
+        return *(int64_t*)(mem) == variable;
+    }
+
+// =========== unsigned long long
+
+    template <> inline uint32_t returnSize( const unsigned long long& variable )
+    {
+        return sizeof(uint64_t);
+    }
+
+    template <> inline void loadAndIncrease( const unsigned long long& variable, uint8_t*& mem )
+    {
+        *(unsigned long long*)( &variable ) = *(uint64_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const unsigned long long& variable, uint8_t*& mem )
+    {
+        *(uint64_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const unsigned long long& variable, uint8_t* mem )
+    {
+        return *(uint64_t*)(mem) == variable;
+    }
+
+// =========== float
+
+    template <> inline uint32_t returnSize( const float& variable )
+    {
+        return sizeof(uint32_t);
+    }
+
+    template <> inline void loadAndIncrease( const float& variable, uint8_t*& mem )
+    {
+        *(uint32_t*)( &variable ) = *(uint32_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const float& variable, uint8_t*& mem )
+    {
+        *(uint32_t*)(mem) = *(uint32_t*)( &variable );
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const float& variable, uint8_t* mem )
+    {
+        return *(uint32_t*)(mem) == *(uint32_t*)( &variable );
+    }
+
+// =========== double
+
+    template <> inline uint32_t returnSize( const double& variable )
+    {
+        return sizeof(uint64_t);
+    }
+
+    template <> inline void loadAndIncrease( const double& variable, uint8_t*& mem )
+    {
+        *(uint64_t*)( &variable ) = *(uint64_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const double& variable, uint8_t*& mem )
+    {
+        *(uint64_t*)(mem) = *(uint64_t*)( &variable );
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const double& variable, uint8_t* mem )
+    {
+        return *(uint64_t*)(mem) == *(uint64_t*)( &variable );
+    }
+
+// =========== long double
+
+    template <> inline uint32_t returnSize( const long double& variable )
+    {
+        return sizeof(uint64_t);
+    }
+
+    template <> inline void loadAndIncrease( const long double& variable, uint8_t*& mem )
+    {
+        double temp;
+        memcpy(&temp, mem, sizeof(uint64_t));
+        *(long double*)( &variable ) = static_cast<const long double>(temp);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const long double& variable, uint8_t*& mem )
+    {
+        double temp = static_cast<double>(variable);
+        memcpy(mem, &temp, sizeof(uint64_t));
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const long double& variable, uint8_t* mem )
+    {
+        double temp = static_cast<double>(variable);
+        return memcmp(&temp, mem, sizeof(uint64_t))==0;
+    }
+
+// =========== string
+
+    template <> inline uint32_t returnSize( const std::string& variable )
+    {
+        return variable.length()+1;
+    }
+
+    template <> inline void saveAndIncrease( const std::string& variable, uint8_t*& mem )
+    {
+        memcpy(mem, variable.c_str(), variable.length()+1);
+        mem += variable.length()+1;
+    }
+
+    template <> inline void loadAndIncrease( const std::string& variable, uint8_t*& mem )
+    {
+        *(std::string*)( &variable ) = (const char *)mem;
+        mem += variable.length()+1;
+    }
+
+    template <> inline bool checkEquality( const std::string& variable, uint8_t* mem )
+    {
+        //return std::string((const char*)mem)==variable;
+        return (const char*)mem==variable;
+    }
+
+// =========== Degree
+
+    template <> inline uint32_t returnSize( const Degree& variable )
+    {
+        return sizeof(Ogre::Real);
+    }
+
+    template <> inline void saveAndIncrease( const Degree& variable, uint8_t*& mem )
+    {
+        Ogre::Real r = variable.valueDegrees();
+        memcpy(mem, &r, returnSize( variable ));
+        mem += returnSize( variable );
+    }
+
+    template <> inline void loadAndIncrease( const Degree& variable, uint8_t*& mem )
+    {
+        Ogre::Real* r = (Ogre::Real*)mem;
+        (Degree&)variable = *r;
+        mem += returnSize( variable );
+    }
+
+     template <> inline bool checkEquality( const Degree& variable, uint8_t* mem )
+    {
+        Ogre::Real* r = (Ogre::Real*)mem;
+        return variable==Degree(*r);
+    }
+
+// =========== Radian
+
+    template <> inline uint32_t returnSize( const Radian& variable )
+    {
+        return sizeof(Ogre::Real);
+    }
+
+    template <> inline void saveAndIncrease( const Radian& variable, uint8_t*& mem )
+    {
+        Ogre::Real r = variable.valueRadians();
+        memcpy(mem, &r, returnSize( variable ));
+        mem += returnSize( variable );
+    }
+
+    template <> inline void loadAndIncrease( const Radian& variable, uint8_t*& mem )
+    {
+        Ogre::Real* r = (Ogre::Real*)mem;
+        (Radian&)variable = *r;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const Radian& variable, uint8_t* mem )
+    {
+        Ogre::Real* r = (Ogre::Real*)mem;
+        return variable==Degree(*r);
+    }
+    
+    
+}
+
+
+#endif
Index: code/branches/libraries2/src/libraries/util/SignalHandler.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/SignalHandler.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/SignalHandler.cc	(revision 5714)
@@ -0,0 +1,330 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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
+    @brief Implementation of the SignalHandler class.
+*/
+
+#include "SignalHandler.h"
+
+#include <iostream>
+#include <cstdlib>
+#include <cstring>
+#include "Debug.h"
+
+namespace orxonox
+{
+    SignalHandler* SignalHandler::singletonPtr_s = NULL;
+}
+
+#ifdef ORXONOX_PLATFORM_LINUX
+
+#include <wait.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+
+namespace orxonox
+{
+    /**
+     * 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 )
+    {
+      std::string sigName = "UNKNOWN";
+
+      switch ( sig )
+      {
+        case SIGSEGV:
+          sigName = "SIGSEGV";
+          break;
+        case SIGABRT:
+          sigName = "SIGABRT";
+          break;
+        case SIGILL:
+          sigName = "SIGILL";
+          break;
+      }
+      // if the signalhandler has already been destroyed then don't do anything
+      if( SignalHandler::singletonPtr_s == 0 )
+      {
+        COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "can't write backtrace because SignalHandler already destroyed" << std::endl;
+        exit(EXIT_FAILURE);
+      }
+
+      for ( SignalCallbackList::iterator it = SignalHandler::getInstance().callbackList.begin(); it != SignalHandler::getInstance().callbackList.end(); it++  )
+      {
+        (*(it->cb))( it->someData );
+      }
+
+
+      COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox_crash.log" << std::endl;
+
+      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 )
+        {
+          COUT(0) << "something went wrong :(" << std::endl;
+        }
+
+        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", static_cast<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"
+                         "= time: " + std::string(ctime(&now)) +
+                         "=======================================================\n";
+      bt.insert(0, timeString);
+
+      FILE * f = fopen( getInstance().filename.c_str(), "w" );
+
+      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() )
+      {
+        COUT(0) << "could not write " << bt.length() << " byte to " << getInstance().filename << std::endl;
+        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 /* ORXONOX_PLATFORM_LINUX */
Index: code/branches/libraries2/src/libraries/util/SignalHandler.h
===================================================================
--- code/branches/libraries2/src/libraries/util/SignalHandler.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/SignalHandler.h	(revision 5714)
@@ -0,0 +1,118 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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
+    @brief Declaration of the SignalHandler class.
+*/
+
+#ifndef _SignalHandler_H__
+#define _SignalHandler_H__
+
+#include "UtilPrereqs.h"
+
+#include <cassert>
+#include <list>
+#include <string>
+#include "Singleton.h"
+
+namespace orxonox
+{
+    typedef int (*SignalCallback)( void * someData );
+}
+
+#ifdef ORXONOX_PLATFORM_LINUX
+#include <signal.h>
+
+namespace orxonox
+{
+    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 : public Singleton<SignalHandler>
+    {
+        friend class Singleton<SignalHandler>;
+    public:
+        SignalHandler()  { }
+        ~SignalHandler() { }
+
+        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* singletonPtr_s;
+
+        std::string appName;
+        std::string filename;
+    };
+}
+
+#else /* ORXONOX_PLATFORM_LINUX */
+
+namespace orxonox
+{
+    class _UtilExport SignalHandler : public Singleton<SignalHandler>
+    {
+        friend class Singleton<SignalHandler>;
+    public:
+        SignalHandler()  { }
+        ~SignalHandler() { }
+        void doCatch( const std::string & appName, const std::string & filename ) {}
+        void dontCatch() {}
+        void registerCallback( SignalCallback cb, void * someData ) {}
+
+    private:
+        static SignalHandler* singletonPtr_s;
+    };
+}
+
+#endif /* ORXONOX_PLATFORM_LINUX */
+
+#endif /* _SignalHandler_H__ */
Index: code/branches/libraries2/src/libraries/util/Singleton.h
===================================================================
--- code/branches/libraries2/src/libraries/util/Singleton.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Singleton.h	(revision 5714)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      ...
+ *
+ */
+
+#ifndef __Util_Singleton_H__
+#define __Util_Singleton_H__
+
+#include "UtilPrereqs.h"
+#include <cassert>
+
+namespace orxonox
+{
+    /**
+    @brief
+        Base for singleton classes.
+
+        Usage:
+        Inherit publicly from Singleton<MyClass> and provide access to
+        MyClass::singletonPtr_s.
+        This can easily be done with a friend declaration.
+    */
+    template <class T>
+    class Singleton
+    {
+    public:
+        //! Returns a reference to the singleton instance
+        static T& getInstance()
+        {
+            assert(T::singletonPtr_s != 0);
+            return *T::singletonPtr_s;
+        }
+
+    protected:
+        //! Constructor sets the singleton instance pointer
+        Singleton()
+        {
+            assert(T::singletonPtr_s == 0);
+            T::singletonPtr_s = static_cast<T*>(this);
+        }
+
+        //! Constructor resets the singleton instance pointer
+        ~Singleton()
+        {
+            assert(T::singletonPtr_s != 0);
+            T::singletonPtr_s = 0;
+        }
+
+    private:
+        Singleton(const Singleton& rhs); //!< Don't use (undefined)
+    };
+}
+
+#endif /* __Util_Singleton_H__ */
Index: code/branches/libraries2/src/libraries/util/Sleep.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/Sleep.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Sleep.cc	(revision 5714)
@@ -0,0 +1,85 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 three sleep functions. Avoids including windows.h
+*/
+
+#include "Sleep.h"
+#include "Debug.h"
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#undef min
+#undef max
+
+namespace orxonox
+{
+    void usleep(unsigned long microseconds)
+    {
+        //if (microseconds < 1000)
+        //    COUT(2) << "Warning: Windows cannot sleep less than 1ms, ignoring" << std::endl;
+        Sleep(microseconds / 1000);
+    }
+
+    void msleep(unsigned long milliseconds)
+    {
+        Sleep(milliseconds);
+    }
+
+    void sleep(unsigned long seconds)
+    {
+        Sleep(seconds * 1000);
+    }
+}
+
+#else /* Linux/Apple */
+#include <unistd.h>
+
+namespace orxonox
+{
+    void usleep(unsigned long usec)
+    {
+        ::usleep(usec);
+    }
+    void msleep(unsigned long msec)
+    {
+        ::usleep(msec * 1000);
+    }
+    void sleep(unsigned long sec)
+    {
+        ::usleep(sec * 1000000);
+    }
+}
+
+#endif
Index: code/branches/libraries2/src/libraries/util/Sleep.h
===================================================================
--- code/branches/libraries2/src/libraries/util/Sleep.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/Sleep.h	(revision 5714)
@@ -0,0 +1,50 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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
+    Functions declarations to make the current thread sleep.
+ */
+
+#ifndef _Sleep_H__
+#define _Sleep_H__
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    //! Makes the thread sleep for a few @a microseconds
+    _UtilExport void usleep(unsigned long microseconds);
+    //! Makes the thread sleep for a few @a milliseconds
+    _UtilExport void msleep(unsigned long milliseconds);
+    //! Makes the thread sleep for a few @a seconds
+    _UtilExport void sleep (unsigned long seconds);
+}
+
+#endif /* _Sleep_H__ */
Index: code/branches/libraries2/src/libraries/util/StringUtils.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/StringUtils.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/StringUtils.cc	(revision 5714)
@@ -0,0 +1,513 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      Benjamin Grauer
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of several string manipulation functions.
+*/
+
+#include "StringUtils.h"
+
+#include <cctype>
+#include "Convert.h"
+#include "Math.h"
+
+namespace orxonox
+{
+    std::string BLANKSTRING("");
+
+    std::string getUniqueNumberString()
+    {
+        return multi_cast<std::string>(getUniqueNumber());
+    }
+
+    /**
+        @brief Removes all whitespaces from a string.
+        @param str The string to strip
+    */
+    void strip(std::string* str)
+    {
+        size_t pos;
+        while ((pos = (*str).find(" ")) < (*str).length())
+            (*str).erase(pos, 1);
+        while ((pos = (*str).find("\t")) < (*str).length())
+            (*str).erase(pos, 1);
+        while ((pos = (*str).find("\n")) < (*str).length())
+            (*str).erase(pos, 1);
+    }
+
+    /**
+        @brief Returns a copy of a string without whitespaces.
+        @param str The string to strip
+        @return The stripped line
+    */
+    std::string getStripped(const std::string& str)
+    {
+        std::string output = std::string(str);
+        strip(&output);
+        return output;
+    }
+
+    /**
+        @brief Returns a copy of a string without trailing whitespaces.
+        @param str The string
+        @return The modified copy
+    */
+    std::string removeTrailingWhitespaces(const std::string& str)
+    {
+        size_t pos1 = 0;
+        int pos2 = static_cast<int>(str.size() - 1);
+        for (; pos1 < str.size() && (str[pos1] == ' ' || str[pos1] == '\t' || str[pos1] == '\n'); pos1++);
+        for (; pos2 > 0         && (str[pos2] == ' ' || str[pos2] == '\t' || str[pos2] == '\n'); pos2--);
+        return str.substr(pos1, pos2 - pos1 + 1);
+    }
+
+    /**
+        @brief Returns the position of the next quote in the string, starting with start.
+        @param str The string
+        @param start The startposition
+        @return The position of the next quote (std::string::npos if there is no next quote)
+    */
+    size_t getNextQuote(const std::string& str, size_t start)
+    {
+        size_t quote = start - 1;
+
+        while ((quote = str.find('\"', quote + 1)) != std::string::npos)
+        {
+            size_t backslash = quote;
+            size_t numbackslashes = 0;
+            for (; backslash > 0; backslash--, numbackslashes++)
+                if (str[backslash - 1] != '\\')
+                    break;
+
+            if (numbackslashes % 2 == 0)
+                break;
+        }
+
+        return quote;
+    }
+
+    /**
+        @brief Returns true if pos is between two quotes.
+        @param str The string
+        @param pos The position to check
+        @return True if pos is between two quotes
+    */
+    bool isBetweenQuotes(const std::string& str, size_t pos)
+    {
+        if (pos == std::string::npos)
+            return false;
+
+        size_t quotecount = 0;
+        size_t quote = static_cast<size_t>(-1);
+        while ((quote = getNextQuote(str, quote + 1)) < pos)
+        {
+            if (quote == pos)
+                return false;
+            quotecount++;
+        }
+
+        if (quote == std::string::npos)
+            return false;
+
+        return ((quotecount % 2) == 1);
+    }
+
+    /**
+        @brief Returns true if the string contains something like '..."between quotes"...'.
+        @param The string
+        @return True if there is something between quotes
+    */
+    bool hasStringBetweenQuotes(const std::string& str)
+    {
+        size_t pos1 = getNextQuote(str, 0);
+        size_t pos2 = getNextQuote(str, pos1 + 1);
+        return (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1);
+    }
+
+    /**
+        @brief If the string contains something like '..."between quotes"...' then 'between quotes' gets returned (without quotes).
+        @param The string
+        @param The string between the quotes
+    */
+    std::string getStringBetweenQuotes(const std::string& str)
+    {
+        size_t pos1 = getNextQuote(str, 0);
+        size_t pos2 = getNextQuote(str, pos1 + 1);
+        if (pos1 != std::string::npos && pos2 != std::string::npos)
+            return str.substr(pos1, pos2 - pos1 + 1);
+        else
+            return "";
+    }
+
+    /**
+        @brief Removes enclosing quotes if available (including whitespaces at the outside of the quotes).
+        @brief str The string to strip
+        @return The string with removed quotes
+    */
+    std::string stripEnclosingQuotes(const std::string& str)
+    {
+        size_t start = std::string::npos;
+        size_t end = 0;
+
+        for (size_t pos = 0; (pos < str.size()) && (pos < std::string::npos); pos++)
+        {
+            if (str[pos] == '"')
+            {
+                start = pos;
+                break;
+            }
+
+            if ((str[pos] != ' ') && (str[pos] != '\t') && (str[pos] != '\n'))
+                return str;
+        }
+
+        for (size_t pos = str.size() - 1; pos < std::string::npos; pos--)
+        {
+            if (str[pos] == '"')
+            {
+                end = pos;
+                break;
+            }
+
+            if ((str[pos] != ' ') && (str[pos] != '\t') && (str[pos] != '\n'))
+                return str;
+        }
+
+        if ((start != std::string::npos) && (end != 0))
+            return str.substr(start + 1, end - start - 1);
+        else
+            return str;
+    }
+
+    /**
+        @brief Removes enclosing {braces} (braces must be exactly on the beginning and the end of the string).
+        @param str The string to strip
+        @return The striped string
+    */
+    std::string stripEnclosingBraces(const std::string& str)
+    {
+        std::string output = str;
+
+        while (output.size() >= 2 && output[0] == '{' && output[output.size() - 1] == '}')
+            output = output.substr(1, output.size() - 2);
+
+        return output;
+    }
+
+    /**
+        @brief Determines if a string is a comment (starts with a comment-symbol).
+        @param str The string to check
+        @return True = it's a comment
+
+        A comment is defined by a leading '#', '%', ';' or '//'.
+    */
+    bool isComment(const std::string& str)
+    {
+        // Strip the line, whitespaces are disturbing
+        std::string teststring = getStripped(str);
+
+        // There are four possible comment-symbols:
+        //  1) #comment in script-language style
+        //  2) %comment in matlab style
+        //  3) ;comment in unreal tournament config-file style
+        //  4) //comment in code style
+        if (teststring.size() >= 2)
+        {
+            if (teststring[0] == '#' || teststring[0] == '%' || teststring[0] == ';' || (teststring[0] == '/' && teststring[1] == '/'))
+                return true;
+        }
+        else if (teststring.size() == 1)
+        {
+            if (teststring[0] == '#' || teststring[0] == '%' || teststring[0] == ';')
+                return true;
+        }
+
+        return false;
+    }
+
+    /**
+        @brief Determines if a string is empty (contains only whitespaces).
+        @param str The string to check
+        @return True = it's empty
+    */
+    bool isEmpty(const std::string& str)
+    {
+        std::string temp = getStripped(str);
+        return ((temp == "") || (temp.size() == 0));
+    }
+
+    /**
+        @brief Determines if a string contains only numbers and maximal one '.'.
+        @param str The string to check
+        @return True = it's a number
+    */
+    bool isNumeric(const std::string& str)
+    {
+        bool foundPoint = false;
+
+        for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)
+        {
+            if (((*it) < '0' || (*it) > '9'))
+            {
+                if ((*it) != '.' && !foundPoint)
+                    foundPoint = true;
+                else
+                    return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+        @brief Adds backslashes to the given string which makes special chars visible. Existing slashes will be doubled.
+        @param str The string to manipulate
+        @return The string with added slashes
+    */
+    std::string addSlashes(const std::string& str)
+    {
+        std::string output = str;
+
+        for (size_t pos = 0; (pos = output.find('\\', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\\"); }
+        for (size_t pos = 0; (pos = output.find('\n', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\n"); }
+        for (size_t pos = 0; (pos = output.find('\t', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\t"); }
+        for (size_t pos = 0; (pos = output.find('\v', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\v"); }
+        for (size_t pos = 0; (pos = output.find('\b', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\b"); }
+        for (size_t pos = 0; (pos = output.find('\r', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\r"); }
+        for (size_t pos = 0; (pos = output.find('\f', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\f"); }
+        for (size_t pos = 0; (pos = output.find('\a', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\a"); }
+        for (size_t pos = 0; (pos = output.find('"', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\""); }
+        for (size_t pos = 0; (pos = output.find('\0', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\0"); }
+
+        return output;
+    }
+
+    /**
+        @brief Removes backslashes from the given string. Double backslashes are interpreted as one backslash.
+        @param str The string to manipulate
+        @return The string with removed slashes
+    */
+    std::string removeSlashes(const std::string& str)
+    {
+        if (str.size() <= 1)
+            return str;
+
+        std::string output = "";
+        for (size_t pos = 0; pos < str.size() - 1; )
+        {
+            if (str[pos] == '\\')
+            {
+                if (str[pos + 1] == '\\') { output += '\\'; pos += 2; continue; }
+                else if (str[pos + 1] == 'n') { output += '\n'; pos += 2; continue; }
+                else if (str[pos + 1] == 't') { output += '\t'; pos += 2; continue; }
+                else if (str[pos + 1] == 'v') { output += '\v'; pos += 2; continue; }
+                else if (str[pos + 1] == 'b') { output += '\b'; pos += 2; continue; }
+                else if (str[pos + 1] == 'r') { output += '\r'; pos += 2; continue; }
+                else if (str[pos + 1] == 'f') { output += '\f'; pos += 2; continue; }
+                else if (str[pos + 1] == 'a') { output += '\a'; pos += 2; continue; }
+                else if (str[pos + 1] == '"') { output += '"'; pos += 2; continue; }
+                else if (str[pos + 1] == '0') { output += '\0'; pos += 2; continue; }
+            }
+            output += str[pos];
+            pos++;
+            if (pos == str.size() - 1)
+                output += str[pos];
+        }
+
+        return output;
+    }
+
+    /**
+        @brief Replaces each char between A and Z with its lowercase equivalent.
+        @param str The string to convert
+    */
+    void lowercase(std::string* str)
+    {
+        for (size_t i = 0; i < str->size(); ++i)
+        {
+            (*str)[i] = static_cast<char>(tolower((*str)[i]));
+        }
+    }
+
+    /**
+        @brief Returns a copy of the given string without uppercase chars.
+        @param str The string
+        @return The copy
+    */
+    std::string getLowercase(const std::string& str)
+    {
+        std::string output = std::string(str);
+        lowercase(&output);
+        return output;
+    }
+
+    /**
+        @brief Replaces each char between a and z with its uppercase equivalent.
+        @param str The string to convert
+    */
+    void uppercase(std::string* str)
+    {
+        for (size_t i = 0; i < str->size(); ++i)
+        {
+            (*str)[i] = static_cast<char>(toupper((*str)[i]));
+        }
+    }
+
+    /**
+        @brief Returns a copy of the given string without lowercase chars.
+        @param str The string
+        @return The copy
+    */
+    std::string getUppercase(const std::string& str)
+    {
+        std::string output = std::string(str);
+        uppercase(&output);
+        return output;
+    }
+
+    /**
+        @brief Compares two strings ignoring different casing.
+        @param s1 First string
+        @param s2 Second string
+    */
+    int nocaseCmp(const std::string& s1, const std::string& s2)
+    {
+        std::string::const_iterator it1=s1.begin();
+        std::string::const_iterator it2=s2.begin();
+
+        //stop when either string's end has been reached
+        while ( (it1!=s1.end()) && (it2!=s2.end()) )
+        {
+            if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
+                // return -1 to indicate smaller than, 1 otherwise
+                return (::toupper(*it1)  < ::toupper(*it2)) ? -1 : 1;
+            //proceed to the next character in each string
+            ++it1;
+            ++it2;
+        }
+        size_t size1=s1.size(), size2=s2.size();// cache lengths
+        //return -1,0 or 1 according to strings' lengths
+        if (size1==size2)
+            return 0;
+        return (size1<size2) ? -1 : 1;
+    }
+
+
+    /**
+        @brief Compares the first 'len' chars of two strings ignoring different casing.
+        @param s1 First string
+        @param s2 Second string
+        @param len Maximal number of chars to compare
+    */
+    int nocaseCmp(const std::string& s1, const std::string& s2, size_t len)
+    {
+        if (len == 0)
+            return 0;
+        std::string::const_iterator it1=s1.begin();
+        std::string::const_iterator it2=s2.begin();
+
+        //stop when either string's end has been reached
+        while ( (it1!=s1.end()) && (it2!=s2.end()) && len-- > 0)
+        {
+            if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
+                // return -1 to indicate smaller than, 1 otherwise
+                return (::toupper(*it1)  < ::toupper(*it2)) ? -1 : 1;
+            //proceed to the next character in each string
+            ++it1;
+            ++it2;
+        }
+        return 0;
+    }
+
+    /**
+        @brief Returns true if the string contains a comment, introduced by #, %, ; or //.
+        @param str The string
+        @return True if the string contains a comment
+    */
+    bool hasComment(const std::string& str)
+    {
+        return (getCommentPosition(str) != std::string::npos);
+    }
+
+    /**
+        @brief If the string contains a comment, the comment gets returned (including the comment symbol), an empty string otherwise.
+        @param str The string
+        @return The comment
+    */
+    std::string getComment(const std::string& str)
+    {
+        return str.substr(getCommentPosition(str));
+    }
+
+    /**
+        @brief If the string contains a comment, the position of the comment-symbol gets returned, std::string::npos otherwise.
+        @param str The string
+        @return The position
+    */
+    size_t getCommentPosition(const std::string& str)
+    {
+        return getNextCommentPosition(str, 0);
+    }
+
+    /**
+        @brief Returns the position of the next comment-symbol, starting with start.
+        @param str The string
+        @param start The startposition
+        @return The position
+    */
+    size_t getNextCommentPosition(const std::string& str, size_t start)
+    {
+        for (size_t i = start; i < str.size(); i++)
+            if (isComment(str.substr(i)))
+                return i;
+
+        return std::string::npos;
+    }
+
+    /**
+        @brief Replaces individual charaters
+        @param str String to be manipulated
+        @param target Character to be replaced
+        @param replacement Replacement character
+        @return Number of replacements
+    */
+    _UtilExport size_t replaceCharacters(std::string& str, char target, char replacement)
+    {
+        size_t j = 0;
+        for (size_t i = 0; i < str.size(); ++i)
+        {
+            if (str[i] == target)
+            {
+                str[i] = replacement;
+                ++j;
+            }
+        }
+        return j;
+    }
+}
Index: code/branches/libraries2/src/libraries/util/StringUtils.h
===================================================================
--- code/branches/libraries2/src/libraries/util/StringUtils.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/StringUtils.h	(revision 5714)
@@ -0,0 +1,83 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 Declaration of several string manipulation functions, used in many parts of the game.
+*/
+
+#ifndef _StringUtils_H__
+#define _StringUtils_H__
+
+#include "UtilPrereqs.h"
+#include <string>
+
+namespace orxonox
+{
+    extern _UtilExport std::string BLANKSTRING;
+    _UtilExport std::string getUniqueNumberString();
+
+    _UtilExport void        strip(std::string* str);
+    _UtilExport std::string getStripped(const std::string& str);
+
+    _UtilExport std::string removeTrailingWhitespaces(const std::string& str);
+
+    _UtilExport size_t      getNextQuote(const std::string& str, size_t start);
+    _UtilExport bool        isBetweenQuotes(const std::string& str, size_t pos);
+
+    _UtilExport bool        hasStringBetweenQuotes(const std::string& str);
+    _UtilExport std::string getStringBetweenQuotes(const std::string& str);
+
+    _UtilExport std::string stripEnclosingQuotes(const std::string& str);
+    _UtilExport std::string stripEnclosingBraces(const std::string& str);
+
+    _UtilExport bool        isEmpty(const std::string& str);
+    _UtilExport bool        isComment(const std::string& str);
+    _UtilExport bool        isNumeric(const std::string& str);
+
+    _UtilExport std::string addSlashes(const std::string& str);
+    _UtilExport std::string removeSlashes(const std::string& str);
+
+    _UtilExport void        lowercase(std::string* str);
+    _UtilExport std::string getLowercase(const std::string& str);
+
+    _UtilExport void        uppercase(std::string* str);
+    _UtilExport std::string getUppercase(const std::string& str);
+
+    _UtilExport int         nocaseCmp(const std::string& s1, const std::string& s2);
+    _UtilExport int         nocaseCmp(const std::string& s1, const std::string& s2, size_t len);
+
+    _UtilExport bool        hasComment(const std::string& str);
+    _UtilExport std::string getComment(const std::string& str);
+    _UtilExport size_t      getCommentPosition(const std::string& str);
+    _UtilExport size_t      getNextCommentPosition(const std::string& str, size_t start = 0);
+
+    _UtilExport size_t      replaceCharacters(std::string& str, char target, char replacement);
+}
+
+#endif /* _StringUtils_H__ */
Index: code/branches/libraries2/src/libraries/util/SubString.cc
===================================================================
--- code/branches/libraries2/src/libraries/util/SubString.cc	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/SubString.cc	(revision 5714)
@@ -0,0 +1,564 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      Christian Meyer
+ *   Co-authors:
+ *      Benjamin Grauer
+ *
+
+//
+//  splitLine
+//  STL string tokenizer
+//
+//  Created by Clemens Wacha.
+//  Version 1.0
+//  Copyright (c) 2005 Clemens Wacha. All rights reserved.
+//
+
+ *   Extended by Fabian 'x3n' Landau by the SL_PARENTHESES mode.
+ */
+
+#include "SubString.h"
+#include <cstdio>
+
+namespace orxonox
+{
+    /**
+     * @brief default constructor
+     */
+    SubString::SubString()
+    {}
+
+
+    /**
+     * @brief create a SubString from
+     * @param string the String to Split
+     * @param delimiter the Character at which to split string (delimiter)
+     */
+    SubString::SubString(const std::string& string, char delimiter)
+    {
+        this->split(string, delimiter);
+    }
+
+
+    /**
+     * @brief Splits a String into multiple splitters.
+     * @param string the String to split
+     * @param delimiters multiple set of characters at what to split. (delimiters)
+     * @param delimiterNeighbours neighbours of the delimiters, that will be erased only when near a delimiter.
+     * @param emptyEntries If empty entries should be allewed or removed.
+     * @param escapeChar The Escape Character that overrides splitters commends and so on...
+     * @param safemode_char within these characters splitting won't happen
+     * @param comment_char the Comment character.
+     */
+    SubString::SubString(const std::string& string,
+                         const std::string& delimiters, const std::string& delimiterNeighbours, bool emptyEntries,
+                         char escapeChar, bool removeEscapeChar, char safemode_char, bool removeSafemodeChar,
+                         char openparenthesis_char, char closeparenthesis_char, bool removeParenthesisChars, char comment_char)
+    {
+        SubString::splitLine(this->strings, this->bInSafemode, string, delimiters, delimiterNeighbours, emptyEntries, escapeChar, removeEscapeChar, safemode_char, removeSafemodeChar, openparenthesis_char, closeparenthesis_char, removeParenthesisChars, comment_char);
+    }
+
+    /**
+     * @brief creates a SubSet of a SubString.
+     * @param subString the SubString to take a set from.
+     * @param subSetBegin the beginning to the end
+     */
+    SubString::SubString(const SubString& subString, unsigned int subSetBegin)
+    {
+        for (unsigned int i = subSetBegin; i < subString.size(); i++)
+        {
+            this->strings.push_back(subString[i]);
+            this->bInSafemode.push_back(subString.isInSafemode(i));
+        }
+    }
+
+
+    /**
+     * @brief creates a SubSet of a SubString.
+     * @param subString the SubString to take a Set from
+     * @param subSetBegin the beginning to the end
+     * @param subSetEnd the end of the SubSet (max subString.size() will be checked internaly)
+     */
+    SubString::SubString(const SubString& subString, unsigned int subSetBegin, unsigned int subSetEnd)
+    {
+        for (unsigned int i = subSetBegin; i < subString.size() && i < subSetEnd; i++)
+        {
+            this->strings.push_back(subString[i]);
+            this->bInSafemode.push_back(subString.isInSafemode(i));
+        }
+    }
+
+    /**
+     * @brief creates a Substring from a count and values set.
+     * @param argc: the Arguments Count.
+     * @param argv: Argument Values.
+     */
+    SubString::SubString(unsigned int argc, const char** argv)
+    {
+        for(unsigned int i = 0; i < argc; ++i)
+        {
+            this->strings.push_back(std::string(argv[i]));
+            this->bInSafemode.push_back(false);
+        }
+    }
+
+    /**
+     * @brief removes the object from memory
+     */
+    SubString::~SubString()
+    { }
+
+    /** @brief An empty String */
+    // const std::string SubString::emptyString = "";
+    /** @brief Helper that gets you a String consisting of all White Spaces */
+    const std::string SubString::WhiteSpaces = " \n\t";
+    /** @brief Helper that gets you a String consisting of all WhiteSpaces and the Comma */
+    const std::string SubString::WhiteSpacesWithComma = " \n\t,";
+    /** An Empty SubString */
+    const SubString SubString::NullSubString = SubString();
+
+    /**
+     * @brief stores the Value of subString in this SubString
+     * @param subString will be copied into this String.
+     * @returns this SubString.
+     */
+    SubString& SubString::operator=(const SubString& subString)
+    {
+        this->strings = subString.strings;
+        this->bInSafemode = subString.bInSafemode;
+        return *this;
+    }
+
+
+    /**
+     * @brief comparator.
+     * @param subString the SubString to compare against this one.
+     * @returns true if the Stored Strings match
+     */
+    bool SubString::operator==(const SubString& subString) const
+    {
+        return ((this->strings == subString.strings) && (this->bInSafemode == subString.bInSafemode));
+    }
+
+    /**
+     * @brief comparator.
+     * @param subString the SubString to compare against this one.
+     * @returns true if the Stored Strings match
+     */
+    bool SubString::compare(const SubString& subString) const
+    {
+        return (*this == subString);
+    }
+
+    /**
+     * @brief comparator.
+     * @param subString the SubString to compare against this one.
+     * @param length how many entries to compare. (from 0 to length)
+     * @returns true if the Stored Strings match
+     */
+    bool SubString::compare(const SubString& subString, unsigned int length) const
+    {
+        if (length > this->size() || length > subString.size())
+            return false;
+
+        for (unsigned int i = 0; i < length; i++)
+            if ((this->strings[i] != subString.strings[i]) || (this->bInSafemode[i] != subString.bInSafemode[i]))
+                return false;
+        return true;
+    }
+
+
+    /**
+     * @brief append operator
+     * @param subString the String to append.
+     * @returns a SubString where this and subString are appended.
+     */
+    SubString SubString::operator+(const SubString& subString) const
+    {
+        return SubString(*this) += subString;
+    }
+
+
+    /**
+     * @brief append operator.
+     * @param subString append subString to this SubString.
+     * @returns this substring appended with subString
+     */
+    SubString& SubString::operator+=(const SubString& subString)
+    {
+        for (unsigned int i = 0; i < subString.size(); i++)
+        {
+            this->strings.push_back(subString[i]);
+            this->bInSafemode.push_back(subString.isInSafemode(i));
+        }
+        return *this;
+    }
+
+
+    /**
+     * @brief Split the String at
+     * @param string where to split
+     * @param splitter delimiter.
+     */
+    unsigned int SubString::split(const std::string& string, char splitter)
+    {
+        this->strings.clear();
+        this->bInSafemode.clear();
+        char split[2];
+        split[0] = splitter;
+        split[1] = '\0';
+        SubString::splitLine(this->strings, this->bInSafemode, string, split);
+        return strings.size();
+    }
+
+
+    /**
+     * @brief Splits a String into multiple splitters.
+     * @param string the String to split
+     * @param delimiters multiple set of characters at what to split. (delimiters)
+     * @param delimiterNeighbours: Neighbours to the Delimiters that will be erased too.
+     * @param emptyEntries: If empty entries are added to the List of SubStrings
+     * @param escapeChar The Escape Character that overrides splitters commends and so on...
+     * @param safemode_char within these characters splitting won't happen
+     * @param comment_char the Comment character.
+     */
+    unsigned int SubString::split(const std::string& string,
+                                  const std::string& delimiters, const std::string& delimiterNeighbours, bool emptyEntries,
+                                  char escapeChar, bool removeExcapeChar, char safemode_char, bool removeSafemodeChar,
+                                  char openparenthesis_char, char closeparenthesis_char, bool removeParenthesisChars, char comment_char)
+    {
+        this->strings.clear();
+        this->bInSafemode.clear();
+        SubString::splitLine(this->strings, this->bInSafemode, string, delimiters, delimiterNeighbours, emptyEntries, escapeChar, removeExcapeChar, safemode_char, removeSafemodeChar, openparenthesis_char, closeparenthesis_char, removeParenthesisChars, comment_char);
+        return this->strings.size();
+    }
+
+
+    /**
+     * @brief joins together all Strings of this Substring.
+     * @param delimiter the String between the subStrings.
+     * @returns the joined String.
+     */
+    std::string SubString::join(const std::string& delimiter) const
+    {
+        if (!this->strings.empty())
+        {
+            std::string retVal = this->strings[0];
+            for (unsigned int i = 1; i < this->strings.size(); i++)
+                retVal += delimiter + this->strings[i];
+            return retVal;
+        }
+        else
+        {
+            static std::string empty;
+            return empty;
+        }
+    }
+
+
+    /**
+     * @brief creates a SubSet of a SubString.
+     * @param subSetBegin the beginning to the end
+     * @returns the SubSet
+     *
+     * This function is added for your convenience, and does the same as
+     * SubString::SubString(const SubString& subString, unsigned int subSetBegin)
+     */
+    SubString SubString::subSet(unsigned int subSetBegin) const
+    {
+        return SubString(*this, subSetBegin);
+    }
+
+
+    /**
+     * @brief creates a SubSet of a SubString.
+     * @param subSetBegin the beginning to
+     * @param subSetEnd the end of the SubSet to select (if bigger than subString.size() it will be downset.)
+     * @returns the SubSet
+     *
+     * This function is added for your convenience, and does the same as
+     * SubString::SubString(const SubString& subString, unsigned int subSetBegin)
+     */
+    SubString SubString::subSet(unsigned int subSetBegin, unsigned int subSetEnd) const
+    {
+        return SubString(*this, subSetBegin, subSetEnd);
+    }
+
+
+    /**
+     * @brief splits line into tokens and stores them in ret.
+     * @param ret the Array, where the Splitted strings will be stored in
+     * to the beginning of the current token is stored
+     * @param line the inputLine to split
+     * @param delimiters a String of Delimiters (here the input will be splitted)
+     * @param delimiterNeighbours Naighbours to the Delimitter, that will be removed if they are to the left or the right of a Delimiter.
+     * @param emptyEntries: if empty Strings are added to the List of Strings.
+     * @param escape_char: Escape carater (escapes splitters)
+     * @param safemode_char: the beginning of the safemode is marked with this
+     * @param removeSafemodeChar removes the safemode_char from the beginning and the ending of a token
+     * @param openparenthesis_char the beginning of a safemode is marked with this
+     * @param closeparenthesis_char the ending of a safemode is marked with this
+     * @param removeParenthesisChars removes the parenthesis from the beginning and the ending of a token
+     * @param comment_char: the beginning of a comment is marked with this: (until the end of a Line)
+     * @param start_state: the Initial state on how to parse the String.
+     * @return SPLIT_LINE_STATE the parser was in when returning
+     *
+     * This is the Actual Splitting Algorithm from Clemens Wacha
+     * Supports delimiters, escape characters,
+     * ignores special  characters between safemode_char and between comment_char and linend '\n'.
+     */
+    SubString::SPLIT_LINE_STATE
+    SubString::splitLine(std::vector<std::string>& ret,
+                         std::vector<bool>& bInSafemode,
+                         const std::string& line,
+                         const std::string& delimiters,
+                         const std::string& delimiterNeighbours,
+                         bool emptyEntries,
+                         char escape_char,
+                         bool removeExcapeChar,
+                         char safemode_char,
+                         bool removeSafemodeChar,
+                         char openparenthesis_char,
+                         char closeparenthesis_char,
+                         bool removeParenthesisChars,
+                         char comment_char,
+                         SPLIT_LINE_STATE start_state)
+    {
+        SPLIT_LINE_STATE state = start_state;
+        unsigned int i = 0;
+        unsigned int fallBackNeighbours = 0;
+
+        std::string token;
+        bool inSafemode = false;
+
+        if(start_state != SL_NORMAL && ret.size() > 0)
+        {
+            token = ret[ret.size()-1];
+            ret.pop_back();
+        }
+        if(start_state != SL_NORMAL && bInSafemode.size() > 0)
+        {
+            inSafemode = bInSafemode[bInSafemode.size()-1];
+            bInSafemode.pop_back();
+        }
+
+        while(i < line.size())
+        {
+            switch(state)
+            {
+            case SL_NORMAL:
+                if(line[i] == escape_char)
+                {
+                    state = SL_ESCAPE;
+                    if (!removeExcapeChar)
+                        token += line[i];
+                }
+                else if(line[i] == safemode_char)
+                {
+                    state = SL_SAFEMODE;
+                    inSafemode = true;
+                    if (!removeSafemodeChar)
+                        token += line[i];
+                }
+                else if(line[i] == openparenthesis_char)
+                {
+                    state = SL_PARENTHESES;
+                    inSafemode = true;
+                    if (!removeParenthesisChars)
+                        token += line[i];
+                }
+                else if(line[i] == comment_char)
+                {
+                    if (fallBackNeighbours > 0)
+                        token = token.substr(0, token.size() - fallBackNeighbours);
+                    /// FINISH
+                    if(emptyEntries || token.size() > 0)
+                    {
+                        ret.push_back(token);
+                        token.clear();
+                        bInSafemode.push_back(inSafemode);
+                        inSafemode = false;
+                    }
+                    token += line[i];       // EAT
+                    state = SL_COMMENT;
+                }
+                else if(delimiters.find(line[i]) != std::string::npos)
+                {
+                    // line[i] is a delimiter
+                    if (fallBackNeighbours > 0)
+                        token = token.substr(0, token.size() - fallBackNeighbours);
+                    /// FINISH
+                    if(emptyEntries || token.size() > 0)
+                    {
+                        ret.push_back(token);
+                        token.clear();
+                        bInSafemode.push_back(inSafemode);
+                        inSafemode = false;
+                    }
+                    state = SL_NORMAL;
+                }
+                else
+                {
+                    if (delimiterNeighbours.find(line[i]) != std::string::npos)
+                    {
+                        if (token.size() > 0)
+                            ++fallBackNeighbours;
+                        else
+                        {
+                            i++;
+                            continue;
+                        }
+                    }
+                    else
+                        fallBackNeighbours = 0;
+                    token += line[i];       // EAT
+                }
+                break;
+            case SL_ESCAPE:
+                if (!removeSafemodeChar)
+                    token += line[i];
+                else
+                {
+                    if(line[i] == 'n') token += '\n';
+                    else if(line[i] == 't') token += '\t';
+                    else if(line[i] == 'v') token += '\v';
+                    else if(line[i] == 'b') token += '\b';
+                    else if(line[i] == 'r') token += '\r';
+                    else if(line[i] == 'f') token += '\f';
+                    else if(line[i] == 'a') token += '\a';
+                    else if(line[i] == '?') token += '\?';
+                    else token += line[i];  // EAT
+                }
+                state = SL_NORMAL;
+                break;
+            case SL_SAFEMODE:
+                if(line[i] == safemode_char)
+                {
+                    state = SL_NORMAL;
+                    if (!removeSafemodeChar)
+                        token += line[i];
+                }
+                else if(line[i] == escape_char)
+                {
+                    state = SL_SAFEESCAPE;
+                }
+                else
+                {
+                    token += line[i];       // EAT
+                }
+                break;
+
+            case SL_SAFEESCAPE:
+                if(line[i] == 'n') token += '\n';
+                else if(line[i] == 't') token += '\t';
+                else if(line[i] == 'v') token += '\v';
+                else if(line[i] == 'b') token += '\b';
+                else if(line[i] == 'r') token += '\r';
+                else if(line[i] == 'f') token += '\f';
+                else if(line[i] == 'a') token += '\a';
+                else if(line[i] == '?') token += '\?';
+                else token += line[i];  // EAT
+                state = SL_SAFEMODE;
+                break;
+
+            case SL_PARENTHESES:
+                if(line[i] == closeparenthesis_char)
+                {
+                    state = SL_NORMAL;
+                    if (!removeParenthesisChars)
+                        token += line[i];
+                }
+                else if(line[i] == escape_char)
+                {
+                    state = SL_PARENTHESESESCAPE;
+                }
+                else
+                {
+                    token += line[i];       // EAT
+                }
+                break;
+
+            case SL_PARENTHESESESCAPE:
+                if(line[i] == 'n') token += '\n';
+                else if(line[i] == 't') token += '\t';
+                else if(line[i] == 'v') token += '\v';
+                else if(line[i] == 'b') token += '\b';
+                else if(line[i] == 'r') token += '\r';
+                else if(line[i] == 'f') token += '\f';
+                else if(line[i] == 'a') token += '\a';
+                else if(line[i] == '?') token += '\?';
+                else token += line[i];  // EAT
+                state = SL_PARENTHESES;
+                break;
+
+            case SL_COMMENT:
+                if(line[i] == '\n')
+                {
+                    /// FINISH
+                    if(token.size() > 0)
+                    {
+                        ret.push_back(token);
+                        token.clear();
+                        bInSafemode.push_back(inSafemode);
+                        inSafemode = false;
+                    }
+                    state = SL_NORMAL;
+                }
+                else
+                {
+                    token += line[i];       // EAT
+                }
+                break;
+
+            default:
+                // nothing
+                break;
+            }
+            i++;
+        }
+
+        /// FINISH
+        if (fallBackNeighbours > 0)
+            token = token.substr(0, token.size() - fallBackNeighbours);
+        if(emptyEntries || token.size() > 0)
+        {
+            ret.push_back(token);
+            token.clear();
+            bInSafemode.push_back(inSafemode);
+            inSafemode = false;
+        }
+        return(state);
+    }
+
+
+    /**
+     * @brief Some nice debug information about this SubString
+     */
+    void SubString::debug() const
+    {
+        printf("Substring-information::count=%d ::", this->strings.size());
+        for (unsigned int i = 0; i < this->strings.size(); i++)
+            printf("s%d='%s'::", i, this->strings[i].c_str());
+        printf("\n");
+    }
+}
Index: code/branches/libraries2/src/libraries/util/SubString.h
===================================================================
--- code/branches/libraries2/src/libraries/util/SubString.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/SubString.h	(revision 5714)
@@ -0,0 +1,176 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      Christian Meyer
+ *   Co-authors:
+ *      Benjamin Grauer
+ *      Fabian 'x3n' Landau
+ *
+
+//  splitLine
+//  STL string tokenizer
+//
+//  Created by Clemens Wacha.
+//  Version 1.0
+//  Copyright (c) 2005 Clemens Wacha. All rights reserved.
+
+ *   Extended by Fabian 'x3n' Landau by the SL_PARENTHESES mode.
+ */
+
+ /*!
+ * @file
+ * @brief a small class to get the parts of a string separated by commas
+ *
+ * This class is also identified as a Tokenizer. It splits up one long
+ * String into multiple small ones by a designated Delimiter.
+ *
+ * Substring is Advanced, and it is possible, to split a string by ','
+ * but also removing leading and trailing spaces around the comma.
+ *
+ * @example
+ * Split the String std::string st = "1345, The new empire   , is , orxonox"
+ * is splitted with:
+ * SubString(st, ',', " \n\t")
+ * into
+ * "1345", "The new empire", "is", "orxonox"
+ * As you can see, the useless spaces around ',' were removed.
+ */
+
+#ifndef __SubString_H__
+#define __SubString_H__
+
+#include "UtilPrereqs.h"
+
+#include <vector>
+#include <string>
+
+namespace orxonox
+{
+    //! A class that can load one string and split it in multipe ones
+    /**
+     * SubString is a very Powerfull way to create a SubSet from a String
+     * It can be used, to Split strings append them and join them again.
+     */
+    class _UtilExport SubString
+    {
+    public:
+        //! An enumerator for the State the Parser is in
+        typedef enum {
+            SL_NORMAL,            //!< Normal state
+            SL_ESCAPE,            //!< After an escape character
+            SL_SAFEMODE,          //!< In safe mode (between "" mostly).
+            SL_SAFEESCAPE,        //!< In safe mode with the internal escape character, that escapes even the savemode character.
+            SL_COMMENT,           //!< In Comment mode.
+            SL_PARENTHESES,       //!< Between parentheses (usually '(' and ')')
+            SL_PARENTHESESESCAPE, //!< Between parentheses with the internal escape character, that escapes even the closing paranthesis character.
+        } SPLIT_LINE_STATE;
+
+
+    public:
+        SubString();
+        SubString(const std::string& string, char delimiter = ',');
+        SubString(const std::string& string,
+                  const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries=false,
+                  char escapeChar ='\\', bool removeEscapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true,
+                  char openparenthesis_char = '(', char closeparenthesis_char = ')',  bool removeParenthesisChars = true, char comment_char = '\0');
+        SubString(unsigned int argc, const char** argv);
+        /** @brief create a Substring as a copy of another one. @param subString the SubString to copy. */
+        SubString(const SubString& subString) { *this = subString; };
+        SubString(const SubString& subString, unsigned int subSetBegin);
+        SubString(const SubString& subString, unsigned int subSetBegin, unsigned int subSetEnd);
+        ~SubString();
+
+        // operate on the SubString
+        SubString& operator=(const SubString& subString);
+        bool operator==(const SubString& subString) const;
+        bool compare(const SubString& subString) const;
+        bool compare(const SubString& subString, unsigned int length) const;
+        SubString operator+(const SubString& subString) const;
+        SubString& operator+=(const SubString& subString);
+        /** @param subString the String to append @returns appended String. @brief added for convenience */
+        SubString& append(const SubString subString) { return (*this += subString); };
+
+        /////////////////////////////////////////
+        // Split and Join the any String. ///////
+        unsigned int split(const std::string& string = "", char delimiter = ',');
+        unsigned int split(const std::string& string,
+                           const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries = false,
+                           char escapeChar ='\\', bool removeExcapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true,
+                           char openparenthesis_char = '(', char closeparenthesis_char = ')',  bool removeParenthesisChars = true, char comment_char = '\0');
+        std::string join(const std::string& delimiter = " ") const;
+        ////////////////////////////////////////
+
+        // retrieve a SubSet from the String
+        SubString subSet(unsigned int subSetBegin) const;
+        SubString subSet(unsigned int subSetBegin, unsigned int subSetEnd) const;
+
+        // retrieve Information from within
+        /** @brief Returns true if the SubString is empty */
+        inline bool empty() const { return this->strings.empty(); };
+        /** @brief Returns the count of Strings stored in this substring */
+        inline unsigned int size() const { return this->strings.size(); };
+        /** @brief Returns the i'th string from the subset of Strings @param i the i'th String */
+        inline const std::string& operator[](unsigned int i) const { return this->strings[i]; };
+        /** @brief Returns the i'th string from the subset of Strings @param i the i'th String */
+        inline const std::string& getString(unsigned int i) const { return (*this)[i]; };
+        /** @brief Returns all Strings as std::vector */
+        inline const std::vector<std::string>& getAllStrings() const { return this->strings; }
+        /** @brief Returns true if the token is in safemode. @param i the i'th token */
+        inline bool isInSafemode(unsigned int i) const { return this->bInSafemode[i]; }
+        /** @brief Returns the front of the StringList. */
+        inline const std::string& front() const { return this->strings.front(); };
+        /** @brief Returns the back of the StringList. */
+        inline const std::string& back() const { return this->strings.back(); };
+        /** @brief removes the back of the strings list. */
+        inline void pop_back() { this->strings.pop_back(); this->bInSafemode.pop_back(); };
+
+        // the almighty algorithm.
+        static SPLIT_LINE_STATE splitLine(std::vector<std::string>& ret,
+                                          std::vector<bool>& bInSafemode,
+                                          const std::string& line,
+                                          const std::string& delimiters = SubString::WhiteSpaces,
+                                          const std::string& delimiterNeighbours = "",
+                                          bool emptyEntries = false,
+                                          char escape_char = '\\',
+                                          bool removeExcapeChar = true,
+                                          char safemode_char = '"',
+                                          bool removeSafemodeChar = true,
+                                          char openparenthesis_char = '(',
+                                          char closeparenthesis_char = ')',
+                                          bool removeParenthesisChars = true,
+                                          char comment_char = '\0',
+                                          SPLIT_LINE_STATE start_state = SL_NORMAL);
+        // debugging.
+        void debug() const;
+
+    public:
+        static const std::string WhiteSpaces;
+        static const std::string WhiteSpacesWithComma;
+        static const SubString   NullSubString;
+
+    private:
+        std::vector<std::string>  strings;                      //!< strings produced from a single string splitted in multiple strings
+        std::vector<bool>         bInSafemode;
+    };
+}
+
+#endif /* __SubString_H__ */
Index: code/branches/libraries2/src/libraries/util/TemplateUtils.h
===================================================================
--- code/branches/libraries2/src/libraries/util/TemplateUtils.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/TemplateUtils.h	(revision 5714)
@@ -0,0 +1,88 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 Declaration of various helper templates.
+*/
+
+#ifndef _TemplateUtils_H__
+#define _TemplateUtils_H__
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    ///////////////////////////////////////////////////
+    // Static detection of implicit type conversions //
+    ///////////////////////////////////////////////////
+
+// disable warnings about possible loss of data
+#ifdef ORXONOX_COMPILER_MSVC
+#  pragma warning(push)
+#  pragma warning(disable:4244)
+#endif
+// GCC generates warnings when implicitely casting from float to int for instance.
+#ifdef ORXONOX_COMPILER_GCC
+#  pragma GCC system_header
+#endif
+
+    /**
+    @brief
+        Detects whether you can implicitely cast FromType to ToType.
+
+        Usage: ImplicitConversion<FromType, ToType>::exists
+        This gives you a compile time constant boolean in the form of an enum value.
+    @note
+        The idea to use the sizeof() operator on return values to determine function existance
+        is described in 'Modern C++ design' by Alexandrescu (2001).
+    */
+    template <class FromType, class ToType>
+    class ImplicitConversion
+    {
+    private:
+        ImplicitConversion(); ImplicitConversion(const ImplicitConversion&); ~ImplicitConversion();
+        // Gets chosen only if there is an implicit conversion from FromType to ToType.
+        static char test(ToType);
+        // Accepts any argument. Why do we not use a template? The reason is that with templates,
+        // the function above is only taken iff it is an exact type match. But since we want to
+        // check for implicit conversion, we have to use the ellipsis.
+        static long long test(...);
+        static FromType object; // helper object to handle private c'tor and d'tor
+    public:
+        // test(object) only has 'long long' return type iff the compiler doesn't choose test(...)
+        enum { exists = (sizeof(test(object)) == sizeof(char)) };
+    };
+
+#ifdef ORXONOX_COMPILER_MSVC
+#  pragma warning(pop)
+#endif
+
+}
+
+#endif /* _TemplateUtils_H__ */
Index: code/branches/libraries2/src/libraries/util/TypeTraits.h
===================================================================
--- code/branches/libraries2/src/libraries/util/TypeTraits.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/TypeTraits.h	(revision 5714)
@@ -0,0 +1,285 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2001 by Andrei Alexandrescu
+// This code accompanies the book:
+// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design 
+//     Patterns Applied". Copyright (c) 2001. Addison-Wesley.
+// Permission to use, copy, modify, distribute and sell this software for any 
+//     purpose is hereby granted without fee, provided that the above copyright 
+//     notice appear in all copies and that both that copyright notice and this 
+//     permission notice appear in supporting documentation.
+// The author or Addison-Wesley Longman make no representations about the 
+//     suitability of this software for any purpose. It is provided "as is" 
+//     without express or implied warranty.
+//
+// Changes by Orxonox (Reto)
+//     Removed all stdInt, etc. type traits and function pointer traits
+//     and added UnqualifiedReferredType.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_TYPETRAITS_INC_
+#define LOKI_TYPETRAITS_INC_
+
+// $Id: TypeTraits.h 835 2007-08-02 19:39:02Z syntheticpp $
+
+
+#if (defined _MSC_VER) && (_MSC_VER < 1400)
+#include <string>
+#endif
+
+
+#ifdef _MSC_VER
+#pragma warning( push ) 
+#pragma warning( disable : 4180 ) //qualifier applied to function type has no meaning; ignored
+#endif
+
+namespace Loki
+{
+////////////////////////////////////////////////////////////////////////////////
+// class NullType
+// Used as a placeholder for "no type here"
+// Useful as an end marker in typelists 
+////////////////////////////////////////////////////////////////////////////////
+
+    class NullType {};
+
+////////////////////////////////////////////////////////////////////////////////
+// class template IsCustomUnsignedInt
+// Offers a means to integrate nonstandard built-in unsigned integral types
+// (such as unsigned __int64 or unsigned long long int) with the TypeTraits 
+//     class template defined below.
+// Invocation: IsCustomUnsignedInt<T> where T is any type
+// Defines 'value', an enum that is 1 iff T is a custom built-in unsigned
+//     integral type
+// Specialize this class template for nonstandard unsigned integral types
+//     and define value = 1 in those specializations
+////////////////////////////////////////////////////////////////////////////////
+
+    template <typename T>
+    struct IsCustomUnsignedInt
+    {
+        enum { value = 0 };
+    };        
+
+////////////////////////////////////////////////////////////////////////////////
+// class template IsCustomSignedInt
+// Offers a means to integrate nonstandard built-in unsigned integral types
+// (such as unsigned __int64 or unsigned long long int) with the TypeTraits 
+//     class template defined below.
+// Invocation: IsCustomSignedInt<T> where T is any type
+// Defines 'value', an enum that is 1 iff T is a custom built-in signed
+//     integral type
+// Specialize this class template for nonstandard unsigned integral types
+//     and define value = 1 in those specializations
+////////////////////////////////////////////////////////////////////////////////
+
+    template <typename T>
+    struct IsCustomSignedInt
+    {
+        enum { value = 0 };
+    };        
+
+////////////////////////////////////////////////////////////////////////////////
+// class template IsCustomFloat
+// Offers a means to integrate nonstandard floating point types with the
+//     TypeTraits class template defined below.
+// Invocation: IsCustomFloat<T> where T is any type
+// Defines 'value', an enum that is 1 iff T is a custom built-in
+//     floating point type
+// Specialize this class template for nonstandard unsigned integral types
+//     and define value = 1 in those specializations
+////////////////////////////////////////////////////////////////////////////////
+
+    template <typename T>
+    struct IsCustomFloat
+    {
+        enum { value = 0 };
+    };        
+
+////////////////////////////////////////////////////////////////////////////////
+// Helper types for class template TypeTraits defined below
+////////////////////////////////////////////////////////////////////////////////
+
+    namespace Private
+    {
+        template <typename U> struct AddPointer
+        {
+            typedef U* Result;
+        };
+
+        template <typename U> struct AddPointer<U&>
+        {
+            typedef U* Result;
+        };
+
+        template <class U> struct AddReference
+        {
+            typedef U & Result;
+        };
+
+        template <class U> struct AddReference<U &>
+        {
+            typedef U & Result;
+        };
+
+        template <> struct AddReference<void>
+        {
+            typedef NullType Result;
+        };
+
+        template <class U> struct AddParameterType
+        {
+            typedef const U & Result;
+        };
+
+        template <class U> struct AddParameterType<U &>
+        {
+            typedef U & Result;
+        };
+
+        template <> struct AddParameterType<void>
+        {
+            typedef NullType Result;
+        };
+    }// namespace Private
+        
+////////////////////////////////////////////////////////////////////////////////
+// class template TypeTraits
+//
+// Figures out at compile time various properties of any given type
+// Invocations (T is a type, TypeTraits<T>::Property):
+//
+// - isPointer       : returns true if T is a pointer type
+// - PointeeType     : returns the type to which T points if T is a pointer 
+//                     type, NullType otherwise
+// - isReference     : returns true if T is a reference type
+// - ReferredType    : returns the type to which T refers if T is a reference 
+//                     type, NullType otherwise
+// - ParameterType   : returns the optimal type to be used as a parameter for 
+//                     functions that take Ts
+// - isConst         : returns true if T is a const-qualified type
+// - NonConstType    : Type with removed 'const' qualifier from T, if any
+// - isVolatile      : returns true if T is a volatile-qualified type
+// - NonVolatileType : Type with removed 'volatile' qualifier from T, if any
+// - UnqualifiedType : Type with removed 'const' and 'volatile' qualifiers from 
+//                     T, if any
+// - ParameterType   : returns the optimal type to be used as a parameter 
+//                       for functions that take 'const T's
+//
+////////////////////////////////////////////////////////////////////////////////
+
+    template <typename T>
+    class TypeTraits
+    {
+    private:
+    
+        template <class U> struct ReferenceTraits
+        {
+            enum { result = false };
+            typedef U ReferredType;
+        };
+        
+        template <class U> struct ReferenceTraits<U&>
+        {
+            enum { result = true };
+            typedef U ReferredType;
+        };
+               
+        template <class U> struct PointerTraits
+        {
+            enum { result = false };
+            typedef NullType PointeeType;
+        };
+        
+        template <class U> struct PointerTraits<U*>
+        {
+            enum { result = true };
+            typedef U PointeeType;
+        };
+        
+        template <class U> struct PointerTraits<U*&>
+        {
+            enum { result = true };
+            typedef U PointeeType;
+        };
+          
+        template <class U> struct PToMTraits
+        {
+            enum { result = false };
+        };
+        
+        template <class U, class V> struct PToMTraits<U V::*>
+        {
+            enum { result = true };
+        };
+        
+        template <class U, class V> struct PToMTraits<U V::*&>
+        {
+            enum { result = true };
+        };
+        
+        template <class U> struct UnConst
+        {
+            typedef U Result;
+            enum { isConst = 0 };
+        };
+        
+        template <class U> struct UnConst<const U>
+        {
+            typedef U Result;
+            enum { isConst = 1 };
+        };
+
+        template <class U> struct UnConst<const U&>
+        {
+            typedef U& Result;
+            enum { isConst = 1 };
+        };
+  
+        template <class U> struct UnVolatile
+        {
+            typedef U Result;
+            enum { isVolatile = 0 };
+        };
+       
+        template <class U> struct UnVolatile<volatile U>
+        {
+            typedef U Result;
+            enum { isVolatile = 1 };
+        };
+
+        template <class U> struct UnVolatile<volatile U&>
+        {
+            typedef U& Result;
+            enum { isVolatile = 1 };
+        };
+        
+    public:
+        typedef typename UnConst<T>::Result 
+            NonConstType;
+        typedef typename UnVolatile<T>::Result 
+            NonVolatileType;
+        typedef typename UnVolatile<typename UnConst<T>::Result>::Result 
+            UnqualifiedType;
+        typedef typename PointerTraits<UnqualifiedType>::PointeeType 
+            PointeeType;
+        typedef typename ReferenceTraits<T>::ReferredType 
+            ReferredType;
+        typedef typename ReferenceTraits<typename UnVolatile<typename UnConst<T>::Result>::Result>::ReferredType
+            UnqualifiedReferredType;
+
+        enum { isConst          = UnConst<T>::isConst };
+        enum { isVolatile       = UnVolatile<T>::isVolatile };
+        enum { isReference      = ReferenceTraits<UnqualifiedType>::result };
+        enum { isPointer        = PointerTraits<
+                                        typename ReferenceTraits<UnqualifiedType>::ReferredType >::result};
+                
+    };
+}
+
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif // _MSC_VER
+
+
+#endif // end file guardian
+
Index: code/branches/libraries2/src/libraries/util/UTFStringConversions.h
===================================================================
--- code/branches/libraries2/src/libraries/util/UTFStringConversions.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/UTFStringConversions.h	(revision 5714)
@@ -0,0 +1,61 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ */
+
+/**
+@file
+@brief
+    std::sring to Ogre::UTFString conversion functions
+*/
+
+#ifndef _UTFStringConversions_H__
+#define _UTFStringConversions_H__
+
+#include "UtilPrereqs.h"
+#include <OgreUTFString.h>
+
+namespace orxonox
+{
+    template <>
+    struct ConverterExplicit<std::string, Ogre::UTFString>
+    {
+        //! Converts an std::string into an Ogre::UTFString
+        inline static bool convert(Ogre::UTFString* output, const std::string& input)
+        {
+            Ogre::UTFString::code_point cp;
+            for (unsigned int i = 0; i < input.size(); ++i)
+            {
+              cp = input[i];
+              cp &= 0xFF;
+              output->append(1, cp);
+            }
+            return true;
+        }
+    };
+}
+
+#endif /* _UTFStringConversions_H__ */
Index: code/branches/libraries2/src/libraries/util/UtilPrereqs.h
===================================================================
--- code/branches/libraries2/src/libraries/util/UtilPrereqs.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/UtilPrereqs.h	(revision 5714)
@@ -0,0 +1,108 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      Fabian 'x3n' Landau
+ *
+ */
+
+/**
+  @file
+  @brief Contains all the necessary forward declarations for all classes and structs.
+*/
+
+#ifndef _UtilPrereqs_H__
+#define _UtilPrereqs_H__
+
+#include "OrxonoxConfig.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( UTIL_STATIC_BUILD )
+#  ifdef UTIL_SHARED_BUILD
+#    define _UtilExport __declspec(dllexport)
+#  else
+#    if defined( __MINGW32__ )
+#      define _UtilExport
+#    else
+#      define _UtilExport __declspec(dllimport)
+#    endif
+#  endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+#  define _UtilExport  __attribute__ ((visibility("default")))
+#else
+#  define _UtilExport
+#endif
+
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    class Exception;
+    class ExprParser;
+    class IntVector2;
+    class IntVector3;
+    class MultiType;
+    class OutputBuffer;
+    class OutputBufferListener;
+    class OutputHandler;
+    class SignalHandler;
+    class SubString;
+}
+
+namespace Ogre
+{
+    class Radian;
+    class Degree;
+    class Vector2;
+    class Vector3;
+    class Vector4;
+    class Matrix3;
+    class Matrix4;
+    class Quaternion;
+    class ColourValue;
+}
+namespace orxonox
+{
+    using Ogre::Radian;
+    using Ogre::Degree;
+    using Ogre::Vector2;
+    using Ogre::Vector3;
+    using Ogre::Vector4;
+    using Ogre::Matrix3;
+    using Ogre::Matrix4;
+    using Ogre::Quaternion;
+    using Ogre::ColourValue;
+}
+
+namespace Loki
+{
+    class ScopeGuardImplBase;
+    typedef const ScopeGuardImplBase& ScopeGuard;
+}
+
+#endif /* _UtilPrereqs_H__ */
Index: code/branches/libraries2/src/libraries/util/mbool.h
===================================================================
--- code/branches/libraries2/src/libraries/util/mbool.h	(revision 5714)
+++ code/branches/libraries2/src/libraries/util/mbool.h	(revision 5714)
@@ -0,0 +1,81 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 _mbool_H__
+#define _mbool_H__
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    struct _UtilExport mbool
+    {
+        public:
+            inline mbool(bool value = false)
+                { this->value_.memory_ = 0; this->value_.bool_ = value; }
+            inline mbool(const mbool& value)
+                { this->value_.memory_ = value.value_.memory_; }
+
+            inline const mbool& operator=(bool value)
+                { if (value != this->value_.bool_) { ++this->value_.memory_; } return (*this); }
+            inline const mbool& operator=(const mbool& value)
+                { this->value_.memory_ = value.value_.memory_; return (*this); }
+
+            inline mbool& operator++()
+                { ++this->value_.memory_; return (*this); }
+            inline mbool operator++(int i)
+                { mbool temp = (*this); ++this->value_.memory_; return temp; }
+
+            inline operator bool() const
+                { return this->value_.bool_; }
+
+            inline bool operator==(bool other) const
+                { return this->value_.bool_ == other; }
+            inline bool operator!=(bool other) const
+                { return this->value_.bool_ != other; }
+
+            inline bool operator==(const mbool& other) const
+                { return this->value_.memory_ == other.value_.memory_; }
+            inline bool operator!=(const mbool& other) const
+                { return this->value_.memory_ != other.value_.memory_; }
+
+            inline bool operator!() const
+                { return (!this->value_.bool_); }
+            
+            inline unsigned char& getMemory(){ return value_.memory_; }
+
+        private:
+            union
+            {
+                bool bool_ : 1;
+                unsigned char memory_;
+            } value_;
+    };
+}
+
+#endif /* _mbool_H__ */
