Index: sandbox_light/bin/vld.ini.in
===================================================================
--- sandbox_light/bin/vld.ini.in	(revision 5790)
+++ sandbox_light/bin/vld.ini.in	(revision 6040)
@@ -56,5 +56,5 @@
 ;   Default: None.
 ;
-ForceIncludeModules =
+ForceIncludeModules = boost_date_time-vc80-mt-gd-1_39.dll, boost_filesystem-vc80-mt-gd-1_39.dll, boost_system-vc80-mt-gd-1_39.dll, boost_thread-vc80-mt-gd-1_39.dll, enet_d.dll, lua_d.dll, ogg_d.dll, vorbis_d.dll, vorbifile_d.dll
 
 ; Maximum number of data bytes to display for each leaked block. If zero, then
@@ -66,5 +66,5 @@
 ;   Default: 4294967295
 ;
-MaxDataDump = 
+MaxDataDump = 0
 
 ; Maximum number of call stack frames to trace back during leak detection.
Index: sandbox_light/cmake/CompilerConfigMSVC.cmake
===================================================================
--- sandbox_light/cmake/CompilerConfigMSVC.cmake	(revision 5790)
+++ sandbox_light/cmake/CompilerConfigMSVC.cmake	(revision 6040)
@@ -70,8 +70,8 @@
 
 # Overwrite CMake default flags here.
-SET_COMPILER_FLAGS("-MDd -Od -Zi -D_DEBUG -Gm -RTC1" Debug          CACHE)
-SET_COMPILER_FLAGS("-MD  -O2     -DNDEBUG -MP2"      Release        CACHE)
-SET_COMPILER_FLAGS("-MD  -O2 -Zi -DNDEBUG -MP2"      RelWithDebInfo CACHE)
-SET_COMPILER_FLAGS("-MD  -O1     -DNDEBUG -MP2"      MinSizeRel     CACHE)
+SET_COMPILER_FLAGS("-MDd -Od -Zi -D_DEBUG -MP2 -RTC1" Debug          CACHE)
+SET_COMPILER_FLAGS("-MD  -O2     -DNDEBUG -MP2"       Release        CACHE)
+SET_COMPILER_FLAGS("-MD  -O2 -Zi -DNDEBUG -MP2"       RelWithDebInfo CACHE)
+SET_COMPILER_FLAGS("-MD  -O1     -DNDEBUG -MP2"       MinSizeRel     CACHE)
 
 # Use Link time code generation for Release config if ORXONOX_RELEASE is defined
Index: sandbox_light/cmake/LibraryConfig.cmake
===================================================================
--- sandbox_light/cmake/LibraryConfig.cmake	(revision 5790)
+++ sandbox_light/cmake/LibraryConfig.cmake	(revision 6040)
@@ -88,5 +88,5 @@
 ##### Boost #####
 # Expand the next statement if newer boost versions than 1.36.1 are released
-SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 1.38 1.38.0 1.39 1.39.0)
+SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 1.38 1.38.0 1.39 1.39.0 1.40 1.40.0)
 FIND_PACKAGE(Boost 1.35 REQUIRED thread filesystem system date_time)
 # No auto linking, so this option is useless anyway
Index: sandbox_light/cmake/PackageConfig.cmake
===================================================================
--- sandbox_light/cmake/PackageConfig.cmake	(revision 5790)
+++ sandbox_light/cmake/PackageConfig.cmake	(revision 6040)
@@ -26,7 +26,11 @@
 
 # Check package version info
-# MAJOR: Interface breaking change somewhere (library version changed, etc.)
-# MINOR: Bug fix or small conformant changes
-SET(DEPENDENCY_VERSION_REQUIRED 3)
+# MAJOR: Breaking change
+# MINOR: No breaking changes by the dependency package
+#        For example any code running on 3.0 should still run on 3.1
+#        But you can specify that the code only runs on 3.1 and higher
+#        or 4.0 and higher (so both 3.1 and 4.0 will work).
+SET(ALLOWED_MINIMUM_VERSIONS 3.1 4.0)
+
 IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
   SET(DEPENDENCY_VERSION 1.0)
@@ -44,9 +48,20 @@
 
 INCLUDE(CompareVersionStrings)
-COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${DEPENDENCY_VERSION_REQUIRED} _result TRUE)
-IF(NOT _result EQUAL 0)
+SET(_version_match FALSE)
+FOREACH(_version ${ALLOWED_MINIMUM_VERSIONS})
+  # Get major version
+  STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}")
+  COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE)
+  IF(_result EQUAL 0)
+    COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE)
+    IF(NOT _result LESS 0)
+      SET(_version_match TRUE)
+    ENDIF()
+  ENDIF()
+ENDFOREACH(_version)
+IF(NOT _version_match)
   MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n"
-          "Required version: ${DEPENDENCY_VERSION_REQUIRED}\n"
-	  "You can get a new version from www.orxonox.net")
+          "Possible required versions: ${ALLOWED_MINIMUM_VERSIONS}\n"
+          "You can get a new version from www.orxonox.net")
 ENDIF()
 
Index: sandbox_light/cmake/ParseMacroArguments.cmake
===================================================================
--- sandbox_light/cmake/ParseMacroArguments.cmake	(revision 5790)
+++ sandbox_light/cmake/ParseMacroArguments.cmake	(revision 6040)
@@ -39,4 +39,9 @@
   # Using LIST(FIND ...) speeds up the process
   SET(_keywords ${_switches} ${_list_names})
+
+  # Reset all arguments
+  FOREACH(_arg ${_switches} ${_list_names})
+    SET(_arg_${_arg})
+  ENDFOREACH(_arg)
 
   # Parse all the arguments and set the corresponding variable
Index: sandbox_light/cmake/PrecompiledHeaderFiles.cmake
===================================================================
--- sandbox_light/cmake/PrecompiledHeaderFiles.cmake	(revision 5790)
+++ sandbox_light/cmake/PrecompiledHeaderFiles.cmake	(revision 6040)
@@ -110,5 +110,5 @@
     GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags)
     # Make sure we recompile the pch file even if only the flags change
-    IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}")
+    IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" OR NOT EXISTS "${_pch_dep_helper_file}")
       SET(_INTERNAL_${_target_name}_PCH_GCC_FLAGS "${_pch_gcc_flags}" CACHE INTERNAL "")
       FILE(WRITE ${_pch_dep_helper_file} "/* ${_pch_gcc_flags} */")
Index: sandbox_light/cmake/SourceFileUtilities.cmake
===================================================================
--- sandbox_light/cmake/SourceFileUtilities.cmake	(revision 5790)
+++ sandbox_light/cmake/SourceFileUtilities.cmake	(revision 6040)
@@ -24,16 +24,66 @@
  #    [ADD/SET]_SOURCE_FILES - Writes source files to the cache by force and
  #                             adds the current directory.
- #    GET_ALL_HEADER_FILES - Finds all header files recursively.
+ #                             Also compiles multiple source files into a single
+ #                             one by including them
+ #                             Use COMPILATION_[BEGIN|END] in
+ #                             [ADD|SET]_SOURCE_FILES and specify the name of
+ #                             the new source file after COMPILATION_BEGIN
+ #    GET_ALL_HEADER_FILES   - Finds all header files recursively.
  #    GENERATE_SOURCE_GROUPS - Set Visual Studio source groups.
  #
 
+FUNCTION(PREPARE_SOURCE_FILES)
+  SET(_fullpath_sources)
+  FOREACH(_file ${ARGN})
+    IF(_file STREQUAL "COMPILATION_BEGIN")
+      SET(_compile TRUE)
+      # Next file is the name of the compilation
+      SET(_get_name TRUE)
+    ELSEIF(_get_name)
+      SET(_get_name FALSE)
+      SET(_compilation_name ${_file})
+    ELSEIF(_file STREQUAL "COMPILATION_END")
+      IF(NOT _compilation_name)
+        MESSAGE(FATAL_ERROR "No name provided for source file compilation")
+      ENDIF()
+      IF(NOT DISABLE_COMPILATIONS)
+        SET(_compilation_file ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
+        SET(_include_string)
+        FOREACH(_file2 ${_compilation})
+          SET(_include_string "${_include_string}#include \"${_file2}\"\n")
+        ENDFOREACH(_file2)
+        IF(EXISTS )
+          FILE(READ ${_compilation_file} _include_string_file)
+        ENDIF()
+        IF(NOT _include_string STREQUAL "${_include_string_file}")
+          FILE(WRITE ${_compilation_file} "${_include_string}")
+        ENDIF()
+        LIST(APPEND _fullpath_sources ${_compilation_file})
+        # MSVC hack that excludes the compilations from the intellisense database
+        # (There is a bug with the "-" instead of "/". Only works for "Zm#" argument)
+        IF(MSVC)
+          SET_SOURCE_FILES_PROPERTIES(${_compilation_file} PROPERTIES COMPILE_FLAGS "-Zm1000")
+        ENDIF()
+      ENDIF()
+      SET(_compilation_name)
+      SET(_compilation)
+      SET(_compile FALSE)
+    ELSE()
+      # Prefix the full path
+      GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
+      LIST(APPEND _fullpath_sources ${_filepath})
+      IF(_compile AND NOT DISABLE_COMPILATIONS)
+        LIST(APPEND _compilation ${_filepath})
+	LIST(APPEND _fullpath_sources "H")
+      ENDIF()
+    ENDIF()
+  ENDFOREACH(_file)
+  SET(_fullpath_sources ${_fullpath_sources} PARENT_SCOPE)
+ENDFUNCTION(PREPARE_SOURCE_FILES)
+
+
 # Adds source files with the full path to a list
 FUNCTION(ADD_SOURCE_FILES _varname)
-  # Prefix the full path
-  SET(_fullpath_sources)
-  FOREACH(_file ${ARGN})
-    GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
-    LIST(APPEND _fullpath_sources ${_filepath})
-  ENDFOREACH(_file)
+  PREPARE_SOURCE_FILES(${ARGN})
   # Write into the cache to avoid variable scoping in subdirs
   SET(${_varname} ${${_varname}} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
@@ -43,10 +93,5 @@
 # Sets source files with the full path
 FUNCTION(SET_SOURCE_FILES _varname)
-  # Prefix the full path
-  SET(_fullpath_sources)
-  FOREACH(_file ${ARGN})
-    GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
-    LIST(APPEND _fullpath_sources ${_filepath})
-  ENDFOREACH(_file)
+  PREPARE_SOURCE_FILES(${ARGN})
   # Write into the cache to avoid variable scoping in subdirs
   SET(${_varname} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
@@ -66,7 +111,12 @@
     GET_SOURCE_FILE_PROPERTY(_full_filepath ${_file} LOCATION)
     FILE(RELATIVE_PATH _relative_path ${CMAKE_CURRENT_SOURCE_DIR} ${_full_filepath})
-    GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH)
-    STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}")
-    SOURCE_GROUP("Source\\${_group_path}" FILES ${_file})
+    IF(NOT _relative_path MATCHES "^\\.\\.")
+      GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH)
+      STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}")
+      SOURCE_GROUP("Source\\${_group_path}" FILES ${_file})
+    ELSE()
+      # Has to be a compilation
+      SOURCE_GROUP("Compilations" FILES ${_file})
+    ENDIF()
   ENDFOREACH(_file)
 
Index: sandbox_light/cmake/TargetUtilities.cmake
===================================================================
--- sandbox_light/cmake/TargetUtilities.cmake	(revision 5790)
+++ sandbox_light/cmake/TargetUtilities.cmake	(revision 6040)
@@ -67,14 +67,14 @@
 ENDIF()
 
-FUNCTION(ORXONOX_ADD_LIBRARY _target_name)
+MACRO(ORXONOX_ADD_LIBRARY _target_name)
   TU_ADD_TARGET(${_target_name} LIBRARY "STATIC;SHARED" ${ARGN})
-ENDFUNCTION(ORXONOX_ADD_LIBRARY)
-
-FUNCTION(ORXONOX_ADD_EXECUTABLE _target_name)
+ENDMACRO(ORXONOX_ADD_LIBRARY)
+
+MACRO(ORXONOX_ADD_EXECUTABLE _target_name)
   TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN})
-ENDFUNCTION(ORXONOX_ADD_EXECUTABLE)
-
-
-FUNCTION(TU_ADD_TARGET _target_name _target_type _additional_switches)
+ENDMACRO(ORXONOX_ADD_EXECUTABLE)
+
+
+MACRO(TU_ADD_TARGET _target_name _target_type _additional_switches)
   CAPITALISE_NAME(${_target_name} _target_name_capitalised)
 
@@ -88,11 +88,22 @@
 
 
-  # GET_HEADER_FILES
+  # Workaround: Source file properties get lost when leaving a subdirectory
+  # Therefore an "H" after a file means we have to set it as HEADER_FILE_ONLY
+  FOREACH(_file ${_arg_SOURCE_FILES})
+    IF(_file STREQUAL "H")
+      SET_SOURCE_FILES_PROPERTIES(${_last_file} PROPERTIES HEADER_FILE_ONLY TRUE)
+    ELSE()
+      SET(_last_file ${_file})
+      LIST(APPEND _${_target_name}_source_files ${_file})
+    ENDIF()
+  ENDFOREACH(_file)
+
+  # Assemble all header files of the library
   IF(_arg_FIND_HEADER_FILES)
-    GET_ALL_HEADER_FILES(_${target_name}_header_files)
+    GET_ALL_HEADER_FILES(_${_target_name}_header_files)
   ENDIF()
 
   # Remove potential duplicates
-  SET(_${_target_name}_files ${_${target_name}_header_files} ${_arg_SOURCE_FILES})
+  SET(_${_target_name}_files ${_${_target_name}_header_files} ${_${_target_name}_source_files})
   LIST(REMOVE_DUPLICATES _${_target_name}_files)
 
@@ -141,4 +152,10 @@
   ENDIF()
 
+  # No warnings needed from third party libraries
+  IF(_arg_ORXONOX_EXTERNAL)
+    REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
+    ADD_COMPILER_FLAGS("-w")
+  ENDIF()
+
   # Set default linking if required
   IF(NOT _arg_SHARED AND NOT _arg_STATIC)
@@ -156,4 +173,13 @@
     SET(_arg_STATIC)
   ENDIF()
+
+  # Don't compile header files
+  FOREACH(_file ${_${_target_name}_files})
+    IF(NOT _file MATCHES "\\.(c|cc|cpp)")
+      SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
+    ENDIF()
+  ENDFOREACH(_file)
+
+
 
   # Add the library/executable
@@ -164,4 +190,20 @@
     ADD_EXECUTABLE(${_target_name} ${_arg_WIN32} ${_arg_EXCLUDE_FROM_ALL}
                    ${_${_target_name}_files})
+  ENDIF()
+
+
+
+  # Change library prefix to "lib"
+  IF(MSVC AND ${_target_type} STREQUAL "LIBRARY")
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
+      PREFIX "lib"
+    )
+  ENDIF()
+
+  # MSVC hack to exclude external library sources from the intellisense database
+  # (IntelliSense stops working when adding "-Zm1000" as compile flag. "/Zm1000"
+  # would not work because of the slash)
+  IF(_arg_ORXONOX_EXTERNAL AND MSVC)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES COMPILE_FLAGS "-Zm1000")
   ENDIF()
 
@@ -214,5 +256,5 @@
   ENDIF()
 
-ENDFUNCTION(TU_ADD_TARGET)
+ENDMACRO(TU_ADD_TARGET)
 
 
Index: sandbox_light/data/CMakeLists.txt
===================================================================
--- sandbox_light/data/CMakeLists.txt	(revision 5790)
+++ sandbox_light/data/CMakeLists.txt	(revision 6040)
@@ -24,5 +24,5 @@
  #
 
-# For dev runs we've got two data directory. The one from the other repository root folder
+# For dev runs we've got two data directories. The one from the other repository root folder
 # is called EXTERNAL_DATA
 SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
Index: sandbox_light/doc/api/doxy.config.in
===================================================================
--- sandbox_light/doc/api/doxy.config.in	(revision 5790)
+++ sandbox_light/doc/api/doxy.config.in	(revision 6040)
@@ -140,5 +140,5 @@
 # explicit @brief command for a brief description.
 
-JAVADOC_AUTOBRIEF      = NO
+JAVADOC_AUTOBRIEF      = YES
 
 # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
Index: sandbox_light/src/Orxonox.cc
===================================================================
--- sandbox_light/src/Orxonox.cc	(revision 5790)
+++ sandbox_light/src/Orxonox.cc	(revision 6040)
@@ -63,7 +63,7 @@
         for (int i = 1; i < argc; ++i)
             strCmdLine += argv[i] + std::string(" ");
+#endif
 
         return orxonox::main(strCmdLine);
-#endif
     }
     catch (...)
Index: sandbox_light/src/OrxonoxConfig.cmake
===================================================================
--- sandbox_light/src/OrxonoxConfig.cmake	(revision 5790)
+++ sandbox_light/src/OrxonoxConfig.cmake	(revision 6040)
@@ -38,4 +38,7 @@
   OPTION(PCH_ENABLE "Global PCH switch" TRUE)
 ENDIF()
+
+# Global switch to disable multiple file compilations
+OPTION(DISABLE_COMPILATIONS "Global multi-file compilation switch" FALSE)
 
 # Use WinMain() or main()?
Index: sandbox_light/src/external/ogremath/CMakeLists.txt
===================================================================
--- sandbox_light/src/external/ogremath/CMakeLists.txt	(revision 5790)
+++ sandbox_light/src/external/ogremath/CMakeLists.txt	(revision 6040)
@@ -18,5 +18,6 @@
  #
 
-SET(OGREMATH_SRC_FILES
+SET_SOURCE_FILES(OGREMATH_SRC_FILES
+COMPILATION_BEGIN OgreCompilation.cc
   OgreColourValue.cpp
   OgreMath.cpp
@@ -27,12 +28,13 @@
   OgreVector3.cpp
   OgreVector4.cpp
+COMPILATION_END
 )
 
 IF(WIN32)
-  LIST(APPEND OGREMATH_SRC_FILES WIN32/OgreTimer.cpp)
+  ADD_SOURCE_FILES(OGREMATH_SRC_FILES WIN32/OgreTimer.cpp)
 ELSEIF(APPLE)
-  LIST(APPEND OGREMATH_SRC_FILES OSX/OgreTimer.cpp)
+  ADD_SOURCE_FILES(OGREMATH_SRC_FILES OSX/OgreTimer.cpp)
 ELSEIF(UNIX)
-  LIST(APPEND OGREMATH_SRC_FILES GLX/OgreTimer.cpp)
+  ADD_SOURCE_FILES(OGREMATH_SRC_FILES GLX/OgreTimer.cpp)
 ENDIF()
 
Index: sandbox_light/src/external/tolua/CMakeLists.txt
===================================================================
--- sandbox_light/src/external/tolua/CMakeLists.txt	(revision 5790)
+++ sandbox_light/src/external/tolua/CMakeLists.txt	(revision 6040)
@@ -20,8 +20,8 @@
 ################### Tolua++ library ###################
 
-SET(TOLUA++_FILES
+SET_SOURCE_FILES(TOLUA++_FILES
   tolua_event.h
   tolua++.h
-
+COMPILATION_BEGIN ToluaCompilation.c
   tolua_event.c
   tolua_is.c
@@ -29,10 +29,6 @@
   tolua_push.c
   tolua_to.c
+COMPILATION_END
 )
-GENERATE_SOURCE_GROUPS(${TOLUA++_FILES})
-
-# No warnings needed from third party libraries
-REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
-ADD_COMPILER_FLAGS("-w")
 
 ORXONOX_ADD_LIBRARY(tolua++_orxonox
Index: sandbox_light/src/libraries/CMakeLists.txt
===================================================================
--- sandbox_light/src/libraries/CMakeLists.txt	(revision 5790)
+++ sandbox_light/src/libraries/CMakeLists.txt	(revision 6040)
@@ -25,4 +25,4 @@
 ################ Sub Directories ################
 
+ADD_SUBDIRECTORY(util)
 ADD_SUBDIRECTORY(core)
-ADD_SUBDIRECTORY(util)
Index: sandbox_light/src/libraries/core/CMakeLists.txt
===================================================================
--- sandbox_light/src/libraries/core/CMakeLists.txt	(revision 5790)
+++ sandbox_light/src/libraries/core/CMakeLists.txt	(revision 6040)
@@ -19,8 +19,8 @@
 
 SET_SOURCE_FILES(CORE_SRC_FILES
-  Clock.cc
-  CommandLine.cc
+  CommandLineParser.cc
   Core.cc
   LuaState.cc
+  PathConfig.cc
 )
 
Index: sandbox_light/src/libraries/core/Clock.cc
===================================================================
--- sandbox_light/src/libraries/core/Clock.cc	(revision 5790)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- *   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
-*/
-
-#include "Clock.h"
-#include <ogremath/OgreTimer.h>
-
-namespace orxonox
-{
-    Clock::Clock()
-        : timer_(new Ogre::Timer())
-        , storedTime_(0)
-        , tickTime_(0)
-        , tickDt_(0)
-        , tickDtFloat_(0.0f)
-        , lastTimersTime_(0)
-    {
-    }
-
-    Clock::~Clock()
-    {
-        delete timer_;
-    }
-    
-    void Clock::capture()
-    {
-        unsigned long timersTime = timer_->getMicroseconds();
-        tickTime_ = storedTime_ + timersTime;
-        tickDt_ = timersTime - lastTimersTime_;
-        tickDtFloat_ = static_cast<float>(tickDt_) / 1000000.0f;
-
-        if (timersTime > 0xFFFFFFFF/4)
-        {
-            // Ogre timer will overflow at 2^32 microseconds if unsigned long is 32 bit
-            storedTime_ += timersTime;
-            lastTimersTime_ = 0;
-            timer_->reset();
-        }
-        else
-        {
-            lastTimersTime_ = timersTime;
-        }
-    }
-
-    unsigned long long Clock::getRealMicroseconds() const
-    {
-        return this->timer_->getMicroseconds() + this->storedTime_;
-    }
-}
Index: sandbox_light/src/libraries/core/Clock.h
===================================================================
--- sandbox_light/src/libraries/core/Clock.h	(revision 5790)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- *   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 _Clock_H__
-#define _Clock_H__
-
-#include "CorePrereqs.h"
-
-namespace Ogre { class Timer; }
-
-namespace orxonox
-{
-    class _CoreExport Clock
-    {
-    public:
-        Clock();
-        ~Clock();
-
-        void capture();
-
-        unsigned long long getMicroseconds()   const { return tickTime_; }
-        unsigned long long getMilliseconds()   const { return tickTime_ / 1000; }
-        unsigned long      getSeconds()        const { return static_cast<long> (tickTime_ / 1000000); }
-        float              getSecondsPrecise() const { return static_cast<float>(tickTime_ / 1000000.0f); }
-
-        float              getDeltaTime()      const { return tickDtFloat_; }
-        long               getDeltaTimeMicroseconds() const { return tickDt_; }
-
-        unsigned long long getRealMicroseconds() const;
-
-    private:
-        Clock(const Clock& instance);
-
-        Ogre::Timer*       timer_;
-        unsigned long long storedTime_;
-        unsigned long long tickTime_;
-        long               tickDt_;
-        float              tickDtFloat_;
-        unsigned long      lastTimersTime_;
-    };
-}
-
-#endif /* _Clock_H__ */
Index: sandbox_light/src/libraries/core/CommandLine.cc
===================================================================
--- sandbox_light/src/libraries/core/CommandLine.cc	(revision 5790)
+++ 	(revision )
@@ -1,376 +1,0 @@
-/*
- *   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:
- *      ...
- *
- */
-
-#include "CommandLine.h"
-
-#include <algorithm>
-#include <sstream>
-
-#include "util/Convert.h"
-#include "util/Debug.h"
-#include "util/Exception.h"
-#include "util/StringUtils.h"
-#include "util/SubString.h"
-#include "Core.h"
-
-namespace orxonox
-{
-    SetCommandLineOnlyArgument(optionsFile, "start.ini").shortcut("o");
-
-    /**
-    @brief
-        Parses a value string for a command line argument.
-        It simply uses convertValue(Output, Input) to do that.
-        Bools are treated specially. That is necessary
-        so that you can have simple command line switches.
-    */
-    void CommandLineArgument::parse(const std::string& value, bool bParsingFile)
-    {
-        if (bParsingFile && this->bCommandLineOnly_)
-            ThrowException(Argument, "Command line argument '" + getName() + "' is not allowed in files.");
-        if (value_.getType() == MT_Type::Bool)
-        {
-            // simulate command line switch
-            bool temp;
-            if (convertValue(&temp, value))
-            {
-                this->bHasDefaultValue_ = false;
-                this->value_ = temp;
-            }
-            else if (value == "")
-            {
-                this->bHasDefaultValue_ = false;
-                this->value_ = true;
-            }
-            else
-                ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
-        }
-        else
-        {
-            if (!value_.setValue(value))
-            {
-                value_.setValue(defaultValue_);
-                ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
-            }
-            else
-                this->bHasDefaultValue_ = false;
-        }
-    }
-
-
-    /**
-    @brief
-        Destructor destroys all CommandLineArguments with it.
-    */
-    CommandLine::~CommandLine()
-    {
-        CommandLine::destroyAllArguments();
-    }
-
-    /**
-    @brief
-        Returns a unique instance (Meyers Singleton).
-    */
-    CommandLine& CommandLine::_getInstance()
-    {
-        static CommandLine instance;
-        return instance;
-    }
-
-    /**
-    @brief
-        Destroys all command line arguments. This should be called at the end
-        of main. Do not use before that.
-    */
-    void CommandLine::destroyAllArguments()
-    {
-        for (std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.begin();
-            it != _getInstance().cmdLineArgs_.end(); ++it)
-            delete it->second;
-        _getInstance().cmdLineArgs_.clear();
-    }
-
-    /**
-    @brief
-        Reads the command line parses the values of each argument.
-        It is then stored in the corresponding CommandLineArgument.
-    @note
-        The reason that you have to provide the string to be parsed as
-        space separted list is because of argc and argv. If you only have
-        a whole string, simply use getAllStrings() of SubString.
-    @param arguments
-        Vector of space separated strings.
-    */
-    void CommandLine::_parse(const std::vector<std::string>& arguments, bool bParsingFile)
-    {
-        try
-        {
-            // why this? See bFirstTimeParse_ declaration.
-            if (bFirstTimeParse_)
-            {
-                // first shove all the shortcuts in a map
-                for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
-                    it != cmdLineArgs_.end(); ++it)
-                {
-                    OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
-                        "Cannot have two command line shortcut with the same name.");
-                    if (it->second->getShortcut() != "")
-                        cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
-                }
-                bFirstTimeParse_ = false;
-            }
-
-            std::string name;
-            std::string shortcut;
-            std::string value;
-            for (unsigned int i = 0; i < arguments.size(); ++i)
-            {
-                if (arguments[i].size() != 0)
-                {
-                    // sure not ""
-                    if (arguments[i][0] == '-')
-                    {
-                        // start with "-"
-                        if (arguments[i].size() == 1)
-                        {
-                            // argument[i] is "-", probably a minus sign
-                            value += "- ";
-                        }
-                        else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
-                        {
-                            // negative number as a value
-                            value += arguments[i] + " ";
-                        }
-                        else
-                        {
-                            // can be shortcut or full name argument
-
-                            // save old data first
-                            value = removeTrailingWhitespaces(value);
-                            if (name != "")
-                            {
-                                checkFullArgument(name, value, bParsingFile);
-                                name = "";
-                                assert(shortcut == "");
-                            }
-                            else if (shortcut != "")
-                            {
-                                checkShortcut(shortcut, value, bParsingFile);
-                                shortcut = "";
-                                assert(name == "");
-                            }
-
-                            if (arguments[i][1] == '-')
-                            {
-                                // full name argument with "--name"
-                                name = arguments[i].substr(2);
-                            }
-                            else
-                            {
-                                // shortcut with "-s"
-                                shortcut = arguments[i].substr(1);
-                            }
-
-                            // reset value string
-                            value = "";
-                        }
-                    }
-                    else
-                    {
-                        // value string
-
-                        if (name == "" && shortcut == "")
-                        {
-                            ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n");
-                        }
-
-                        // Concatenate strings as long as there's no new argument by "-" or "--"
-                        value += arguments[i] + ' ';
-                    }
-                }
-            }
-
-            // parse last argument
-            value = removeTrailingWhitespaces(value);
-            if (name != "")
-            {
-                checkFullArgument(name, value, bParsingFile);
-                assert(shortcut == "");
-            }
-            else if (shortcut != "")
-            {
-                checkShortcut(shortcut, value, bParsingFile);
-                assert(name == "");
-            }
-        }
-        catch (const ArgumentException& ex)
-        {
-            COUT(0) << "Could not parse command line (including additional files): " << ex.what() << std::endl;
-            COUT(0) << CommandLine::getUsageInformation() << std::endl;
-            throw GeneralException("");
-        }
-    }
-
-    /**
-    @brief
-        Parses an argument based on its full name.
-    @param name
-        Full name of the argument
-    @param value
-        String containing the value
-    */
-    void CommandLine::checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile)
-    {
-        std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.find(name);
-        if (it == cmdLineArgs_.end())
-            ThrowException(Argument, "Command line argument '" + name + "' does not exist.");
-
-        it->second->parse(value, bParsingFile);
-    }
-
-    /**
-    @brief
-        Parses an argument based on its shortcut.
-    @param shortcut
-        Shotcut to the argument
-    @param value
-        String containing the value
-    */
-    void CommandLine::checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile)
-    {
-        std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgsShortcut_.find(shortcut);
-        if (it == cmdLineArgsShortcut_.end())
-            ThrowException(Argument, "Command line shortcut '" + shortcut + "' does not exist.");
-
-        it->second->parse(value, bParsingFile);
-    }
-
-    std::string CommandLine::getUsageInformation()
-    {
-        CommandLine& inst = _getInstance();
-        std::ostringstream infoStr;
-
-        // determine maximum name size
-        size_t maxNameSize = 0;
-        for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
-            it != inst.cmdLineArgs_.end(); ++it)
-        {
-            maxNameSize = std::max(it->second->getName().size(), maxNameSize);
-        }
-
-        infoStr << "Usage: orxonox [options]" << std::endl;
-        infoStr << "Available options:" << std::endl;
-
-        for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
-            it != inst.cmdLineArgs_.end(); ++it)
-        {
-            if (it->second->getShortcut() != "")
-                infoStr << " [-" << it->second->getShortcut() << "] ";
-            else
-                infoStr << "      ";
-            infoStr << "--" << it->second->getName() << " ";
-            if (it->second->getValue().getType() != MT_Type::Bool)
-                infoStr << "ARG ";
-            else
-                infoStr << "    ";
-            // fill with the necessary amount of blanks
-            infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');
-            infoStr << ": " << it->second->getInformation();
-            infoStr << std::endl;
-        }
-        return infoStr.str();
-    }
-
-    /**
-    @brief
-        Retrieves a CommandLineArgument.
-        The method throws an exception if 'name' was not found or the value could not be converted.
-    @note
-        You shold of course not call this method before the command line has been parsed.
-    */
-    const CommandLineArgument* CommandLine::getArgument(const std::string& name)
-    {
-        std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
-        if (it == _getInstance().cmdLineArgs_.end())
-        {
-            ThrowException(Argument, "Could find command line argument '" + name + "'.");
-        }
-        else
-        {
-            return it->second;
-        }
-    }
-
-    /**
-    @brief
-        Parses only the command line for CommandLineArguments.
-    */
-    void CommandLine::_parseCommandLine(const std::string& cmdLine)
-    {
-        std::vector<std::string> args;
-        SubString tokens(cmdLine, " ", " ", false, '\\', true, '"', true, '(', ')', false);
-        for (unsigned i = 0; i < tokens.size(); ++i)
-            args.push_back(tokens[i]);
-        this->_parse(args, false);
-    }
-
-    /**
-    @brief
-        Parses start.ini (or the file specified with --optionsFile) for CommandLineArguments.
-    */
-    void CommandLine::_parseFile()
-    {
-        std::string filename = CommandLine::getValue("optionsFile").getString();
-
-        // look for additional arguments in given file or start.ini as default
-        // They will not overwrite the arguments given directly
-        std::ifstream file;
-        file.open((Core::getConfigPathString() + filename).c_str());
-        std::vector<std::string> args;
-        if (file)
-        {
-            while (!file.eof())
-            {
-                std::string line;
-                std::getline(file, line);
-                line = removeTrailingWhitespaces(line);
-                //if (!(line[0] == '#' || line[0] == '%'))
-                //{
-                SubString tokens(line, " ", " ", false, '\\', true, '"', true, '(', ')', false, '#');
-                for (unsigned i = 0; i < tokens.size(); ++i)
-                    if (tokens[i][0] != '#')
-                        args.push_back(tokens[i]);
-                //args.insert(args.end(), tokens.getAllStrings().begin(), tokens.getAllStrings().end());
-                //}
-            }
-            file.close();
-        }
-
-        _parse(args, true);
-    }
-}
Index: sandbox_light/src/libraries/core/CommandLine.h
===================================================================
--- sandbox_light/src/libraries/core/CommandLine.h	(revision 5790)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- *   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 _CommandLine_H__
-#define _CommandLine_H__
-
-#include "CorePrereqs.h"
-
-#include <map>
-#include "util/OrxAssert.h"
-#include "util/MultiType.h"
-
-#define SetCommandLineArgument(name, defaultValue) \
-    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
-    = orxonox::CommandLine::addArgument(#name, defaultValue, false)
-#define SetCommandLineOnlyArgument(name, defaultValue) \
-    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
-    = orxonox::CommandLine::addArgument(#name, defaultValue, true)
-#define SetCommandLineSwitch(name) \
-    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
-    = orxonox::CommandLine::addArgument(#name, false, false)
-#define SetCommandLineOnlySwitch(name) \
-    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
-    = orxonox::CommandLine::addArgument(#name, false, true)
-
-
-namespace orxonox
-{
-    /**
-    @brief
-        Container class for a command line argument of any type supported by MultiType.
-
-        Whenever you want to have an option specified by a command line switch,
-        you need to first define it with SetCommandLineArgument(name, defaultValue).
-        It is then added to a map and possibly changed when the command line is being parsed.
-        If the option was not given, you can detect this by asking hasDefaultValue().
-
-        There is a possibility to define a short cut so you can write "-p 20" instead of "--port 20".
-        Note the difference between "-" and "--"!
-        Also, there is no restriction to the number of strings you add after --name.
-        So "--startVector (2, 4, 5)" is perfectly legal.
-
-        Retrieving an argument is possible with the getCommandLineArgument function of the
-        CommandLine class. It is a Singleton, but the public interface is static.
-    */
-    class _CoreExport CommandLineArgument
-    {
-        friend class CommandLine;
-
-    public:
-        //! Tells whether the value has been changed by the command line.
-        bool hasDefaultValue() const { return bHasDefaultValue_; }
-        //! Returns the name of the argument.
-        const std::string& getName() const { return name_; }
-
-        //! Returns the shortcut (example: "-p 22" for "--port 22") of the argument.
-        //! Evaluates to "" if there is none.
-        const std::string& getShortcut() const { return shortcut_; }
-        //! Sets the shortcut for the argument
-        CommandLineArgument& shortcut(const std::string& shortcut)
-        { this->shortcut_ = shortcut; return *this; }
-
-        //! Returns the usage information
-        const std::string& getInformation() const { return this->usageInformation_; }
-        //! Sets the option information when displaying orxonox usage.
-        CommandLineArgument& information(const std::string& usage)
-        { this->usageInformation_ = usage; return *this; }
-
-        //! Returns the actual value of the argument. Can be equal to default value.
-        MultiType getValue() const { return value_; }
-        //! Returns the given default value as type T.
-        MultiType getDefaultValue() const { return defaultValue_; }
-
-    private:
-        //! Constructor initialises both value_ and defaultValue_ with defaultValue.
-        CommandLineArgument(const std::string& name, const MultiType& defaultValue, bool bCommandLineOnly)
-            : bHasDefaultValue_(true)
-            , name_(name)
-            , value_(defaultValue)
-            , defaultValue_(defaultValue)
-            , bCommandLineOnly_(bCommandLineOnly)
-        { }
-
-        //! Undefined copy constructor
-        CommandLineArgument(const CommandLineArgument& instance);
-        ~CommandLineArgument() { }
-
-        //! Parses the value string of a command line argument.
-        void parse(const std::string& value, bool bParsingFile);
-
-        //! Tells whether the value has been changed by the command line.
-        bool bHasDefaultValue_;
-
-    private:
-        std::string name_;             //!< Name of the argument
-        std::string shortcut_;         //!< Shortcut of the argument. @see getShortcut().
-        std::string usageInformation_; //!< Tells about the usage of this parameter
-
-        MultiType   value_;            //!< The actual value
-        MultiType   defaultValue_;     //!< Default value. Should not be changed.
-        bool        bCommandLineOnly_; //!< Whether you cannot specify the value in a text file
-    };
-
-
-    /**
-    @brief
-        Global interface to command line options.
-        Allows to add and retrieve command line arguments. Also does the parsing.
-    @note
-        Internally it is a Singleton, but the public interface is static.
-    @see
-        CommandLineArgument
-    */
-    class _CoreExport CommandLine
-    {
-    public:
-
-        //! Parse redirection to internal member method.
-        static void parseCommandLine(const std::string& cmdLine) { _getInstance()._parseCommandLine(cmdLine); }
-        static void parseFile() { _getInstance()._parseFile(); }
-
-        static std::string getUsageInformation();
-
-        static const CommandLineArgument* getArgument(const std::string& name);
-        //! Writes the argument value in the given parameter.
-        template <class T>
-        static void getValue(const std::string& name, T* value)
-        { *value = (T)(getArgument(name)->getValue()); }
-        static MultiType getValue(const std::string& name)
-        { return getArgument(name)->getValue(); }
-        template <class T>
-        static CommandLineArgument& addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly);
-
-        static bool existsArgument(const std::string& name)
-        {
-            std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
-            return !(it == _getInstance().cmdLineArgs_.end());
-        }
-
-        static void destroyAllArguments();
-
-    private:
-        //! Constructor initialises bFirstTimeParse_ with true.
-        CommandLine() : bFirstTimeParse_(true) { }
-        //! Undefined copy constructor
-        CommandLine(const CommandLine& instance);
-        ~CommandLine();
-
-        static CommandLine& _getInstance();
-
-        void _parseCommandLine(const std::string& cmdLine);
-        void _parseFile();
-        void _parse(const std::vector<std::string>& arguments, bool bParsingFile);
-        void checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile);
-        void checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile);
-
-        /**
-            Tells whether we parsed for the first time. The CommmandLineArguments are added before main().
-            So when we call parse() the first time, we need to create a map with all shortcuts since these
-            get added after addCommandLineArgument().
-        */
-        bool bFirstTimeParse_;
-
-        //! Holds all pointers to the arguments and serves as a search map by name.
-        std::map<std::string, CommandLineArgument*> cmdLineArgs_;
-        //! Search map by shortcut for the arguments.
-        std::map<std::string, CommandLineArgument*> cmdLineArgsShortcut_;
-    };
-
-    template <>
-    inline void CommandLine::getValue<std::string>(const std::string& name, std::string* value)
-    {
-        *value = getArgument(name)->getValue().getString();
-    }
-
-    /**
-    @brief
-        Adds a new CommandLineArgument to the internal map.
-        Note that only such arguments are actually valid.
-    @param name
-        Name of the argument. Shortcut can be added later.
-    @param defaultValue
-        Default value that is used when argument was not given.
-    */
-    template <class T>
-    CommandLineArgument& CommandLine::addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly)
-    {
-        OrxAssert(!_getInstance().existsArgument(name),
-            "Cannot add a command line argument with name '" + name + "' twice.");
-        OrxAssert(MultiType(defaultValue).getType() != MT_Type::Bool || MultiType(defaultValue).getBool() != true,
-               "Boolean command line arguments with positive default values are not supported." << std::endl
-            << "Please use SetCommandLineSwitch and adjust your argument: " << name);
-
-        return *(_getInstance().cmdLineArgs_[name] = new CommandLineArgument(name, defaultValue, bCommandLineOnly));
-    }
-}
-
-#endif /* _CommandLine_H__ */
Index: sandbox_light/src/libraries/core/CommandLineParser.cc
===================================================================
--- sandbox_light/src/libraries/core/CommandLineParser.cc	(revision 6040)
+++ sandbox_light/src/libraries/core/CommandLineParser.cc	(revision 6040)
@@ -0,0 +1,377 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#include "CommandLineParser.h"
+
+#include <algorithm>
+#include <sstream>
+
+#include "util/Convert.h"
+#include "util/Debug.h"
+#include "util/Exception.h"
+#include "util/StringUtils.h"
+#include "util/SubString.h"
+#include "PathConfig.h"
+
+namespace orxonox
+{
+    SetCommandLineOnlyArgument(optionsFile, "start.ini").shortcut("o");
+
+    /**
+    @brief
+        Parses a value string for a command line argument.
+        It simply uses convertValue(Output, Input) to do that.
+        Bools are treated specially. That is necessary
+        so that you can have simple command line switches.
+    */
+    void CommandLineArgument::parse(const std::string& value, bool bParsingFile)
+    {
+        if (bParsingFile && this->bCommandLineOnly_)
+            ThrowException(Argument, "Command line argument '" + getName() + "' is not allowed in files.");
+        if (value_.getType() == MT_Type::Bool)
+        {
+            // simulate command line switch
+            bool temp;
+            if (convertValue(&temp, value))
+            {
+                this->bHasDefaultValue_ = false;
+                this->value_ = temp;
+            }
+            else if (value == "")
+            {
+                this->bHasDefaultValue_ = false;
+                this->value_ = true;
+            }
+            else
+                ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
+        }
+        else
+        {
+            if (!value_.setValue(value))
+            {
+                value_.setValue(defaultValue_);
+                ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
+            }
+            else
+                this->bHasDefaultValue_ = false;
+        }
+    }
+
+
+    /**
+    @brief
+        Destructor destroys all CommandLineArguments with it.
+    */
+    CommandLineParser::~CommandLineParser()
+    {
+        CommandLineParser::destroyAllArguments();
+    }
+
+    /**
+    @brief
+        Returns a unique instance (Meyers Singleton).
+    */
+    CommandLineParser& CommandLineParser::_getInstance()
+    {
+        static CommandLineParser instance;
+        return instance;
+    }
+
+    /**
+    @brief
+        Destroys all command line arguments. This should be called at the end
+        of main. Do not use before that.
+    */
+    void CommandLineParser::destroyAllArguments()
+    {
+        for (std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.begin();
+            it != _getInstance().cmdLineArgs_.end(); ++it)
+            delete it->second;
+        _getInstance().cmdLineArgs_.clear();
+    }
+
+    /**
+    @brief
+        Reads the command line parses the values of each argument.
+        It is then stored in the corresponding CommandLineArgument.
+    @note
+        The reason that you have to provide the string to be parsed as
+        space separted list is because of argc and argv. If you only have
+        a whole string, simply use getAllStrings() of SubString.
+    @param arguments
+        Vector of space separated strings.
+    */
+    void CommandLineParser::_parse(const std::vector<std::string>& arguments, bool bParsingFile)
+    {
+        try
+        {
+            // why this? See bFirstTimeParse_ declaration.
+            if (bFirstTimeParse_)
+            {
+                // first shove all the shortcuts in a map
+                for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
+                    it != cmdLineArgs_.end(); ++it)
+                {
+                    OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
+                        "Cannot have two command line shortcut with the same name.");
+                    if (it->second->getShortcut() != "")
+                        cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
+                }
+                bFirstTimeParse_ = false;
+            }
+
+            std::string name;
+            std::string shortcut;
+            std::string value;
+            for (unsigned int i = 0; i < arguments.size(); ++i)
+            {
+                if (arguments[i].size() != 0)
+                {
+                    // sure not ""
+                    if (arguments[i][0] == '-')
+                    {
+                        // start with "-"
+                        if (arguments[i].size() == 1)
+                        {
+                            // argument[i] is "-", probably a minus sign
+                            value += "- ";
+                        }
+                        else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
+                        {
+                            // negative number as a value
+                            value += arguments[i] + " ";
+                        }
+                        else
+                        {
+                            // can be shortcut or full name argument
+
+                            // save old data first
+                            value = removeTrailingWhitespaces(value);
+                            if (name != "")
+                            {
+                                checkFullArgument(name, value, bParsingFile);
+                                name = "";
+                                assert(shortcut == "");
+                            }
+                            else if (shortcut != "")
+                            {
+                                checkShortcut(shortcut, value, bParsingFile);
+                                shortcut = "";
+                                assert(name == "");
+                            }
+
+                            if (arguments[i][1] == '-')
+                            {
+                                // full name argument with "--name"
+                                name = arguments[i].substr(2);
+                            }
+                            else
+                            {
+                                // shortcut with "-s"
+                                shortcut = arguments[i].substr(1);
+                            }
+
+                            // reset value string
+                            value = "";
+                        }
+                    }
+                    else
+                    {
+                        // value string
+
+                        if (name == "" && shortcut == "")
+                        {
+                            ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n");
+                        }
+
+                        // Concatenate strings as long as there's no new argument by "-" or "--"
+                        value += arguments[i] + ' ';
+                    }
+                }
+            }
+
+            // parse last argument
+            value = removeTrailingWhitespaces(value);
+            if (name != "")
+            {
+                checkFullArgument(name, value, bParsingFile);
+                assert(shortcut == "");
+            }
+            else if (shortcut != "")
+            {
+                checkShortcut(shortcut, value, bParsingFile);
+                assert(name == "");
+            }
+        }
+        catch (const ArgumentException& ex)
+        {
+            COUT(0) << "Could not parse command line (including additional files): " << ex.what() << std::endl;
+            COUT(0) << CommandLineParser::getUsageInformation() << std::endl;
+            throw GeneralException("");
+        }
+    }
+
+    /**
+    @brief
+        Parses an argument based on its full name.
+    @param name
+        Full name of the argument
+    @param value
+        String containing the value
+    */
+    void CommandLineParser::checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile)
+    {
+        std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.find(name);
+        if (it == cmdLineArgs_.end())
+            ThrowException(Argument, "Command line argument '" + name + "' does not exist.");
+
+        it->second->parse(value, bParsingFile);
+    }
+
+    /**
+    @brief
+        Parses an argument based on its shortcut.
+    @param shortcut
+        Shotcut to the argument
+    @param value
+        String containing the value
+    */
+    void CommandLineParser::checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile)
+    {
+        std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgsShortcut_.find(shortcut);
+        if (it == cmdLineArgsShortcut_.end())
+            ThrowException(Argument, "Command line shortcut '" + shortcut + "' does not exist.");
+
+        it->second->parse(value, bParsingFile);
+    }
+
+    std::string CommandLineParser::getUsageInformation()
+    {
+        CommandLineParser& inst = _getInstance();
+        std::ostringstream infoStr;
+
+        // determine maximum name size
+        size_t maxNameSize = 0;
+        for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
+            it != inst.cmdLineArgs_.end(); ++it)
+        {
+            maxNameSize = std::max(it->second->getName().size(), maxNameSize);
+        }
+
+        infoStr << std::endl;
+        infoStr << "Usage: orxonox [options]" << std::endl;
+        infoStr << "Available options:" << std::endl;
+
+        for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
+            it != inst.cmdLineArgs_.end(); ++it)
+        {
+            if (it->second->getShortcut() != "")
+                infoStr << " [-" << it->second->getShortcut() << "] ";
+            else
+                infoStr << "      ";
+            infoStr << "--" << it->second->getName() << " ";
+            if (it->second->getValue().getType() != MT_Type::Bool)
+                infoStr << "ARG ";
+            else
+                infoStr << "    ";
+            // fill with the necessary amount of blanks
+            infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');
+            infoStr << ": " << it->second->getInformation();
+            infoStr << std::endl;
+        }
+        return infoStr.str();
+    }
+
+    /**
+    @brief
+        Retrieves a CommandLineArgument.
+        The method throws an exception if 'name' was not found or the value could not be converted.
+    @note
+        You shold of course not call this method before the command line has been parsed.
+    */
+    const CommandLineArgument* CommandLineParser::getArgument(const std::string& name)
+    {
+        std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
+        if (it == _getInstance().cmdLineArgs_.end())
+        {
+            ThrowException(Argument, "Could find command line argument '" + name + "'.");
+        }
+        else
+        {
+            return it->second;
+        }
+    }
+
+    /**
+    @brief
+        Parses only the command line for CommandLineArguments.
+    */
+    void CommandLineParser::_parseCommandLine(const std::string& cmdLine)
+    {
+        std::vector<std::string> args;
+        SubString tokens(cmdLine, " ", " ", false, '\\', true, '"', true, '(', ')', false);
+        for (unsigned i = 0; i < tokens.size(); ++i)
+            args.push_back(tokens[i]);
+        this->_parse(args, false);
+    }
+
+    /**
+    @brief
+        Parses start.ini (or the file specified with --optionsFile) for CommandLineArguments.
+    */
+    void CommandLineParser::_parseFile()
+    {
+        std::string filename = CommandLineParser::getValue("optionsFile").getString();
+
+        // look for additional arguments in given file or start.ini as default
+        // They will not overwrite the arguments given directly
+        std::ifstream file;
+        file.open((PathConfig::getConfigPathString() + filename).c_str());
+        std::vector<std::string> args;
+        if (file)
+        {
+            while (!file.eof())
+            {
+                std::string line;
+                std::getline(file, line);
+                line = removeTrailingWhitespaces(line);
+                //if (!(line[0] == '#' || line[0] == '%'))
+                //{
+                SubString tokens(line, " ", " ", false, '\\', true, '"', true, '(', ')', false, '#');
+                for (unsigned i = 0; i < tokens.size(); ++i)
+                    if (tokens[i][0] != '#')
+                        args.push_back(tokens[i]);
+                //args.insert(args.end(), tokens.getAllStrings().begin(), tokens.getAllStrings().end());
+                //}
+            }
+            file.close();
+        }
+
+        _parse(args, true);
+    }
+}
Index: sandbox_light/src/libraries/core/CommandLineParser.h
===================================================================
--- sandbox_light/src/libraries/core/CommandLineParser.h	(revision 6040)
+++ sandbox_light/src/libraries/core/CommandLineParser.h	(revision 6040)
@@ -0,0 +1,223 @@
+/*
+ *   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 _CommandLine_H__
+#define _CommandLine_H__
+
+#include "CorePrereqs.h"
+
+#include <map>
+#include "util/OrxAssert.h"
+#include "util/MultiType.h"
+
+#define SetCommandLineArgument(name, defaultValue) \
+    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
+    = orxonox::CommandLineParser::addArgument(#name, defaultValue, false)
+#define SetCommandLineOnlyArgument(name, defaultValue) \
+    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
+    = orxonox::CommandLineParser::addArgument(#name, defaultValue, true)
+#define SetCommandLineSwitch(name) \
+    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
+    = orxonox::CommandLineParser::addArgument(#name, false, false)
+#define SetCommandLineOnlySwitch(name) \
+    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
+    = orxonox::CommandLineParser::addArgument(#name, false, true)
+
+
+namespace orxonox
+{
+    /**
+    @brief
+        Container class for a command line argument of any type supported by MultiType.
+
+        Whenever you want to have an option specified by a command line switch,
+        you need to first define it with SetCommandLineArgument(name, defaultValue).
+        It is then added to a map and possibly changed when the command line is being parsed.
+        If the option was not given, you can detect this by asking hasDefaultValue().
+
+        There is a possibility to define a short cut so you can write "-p 20" instead of "--port 20".
+        Note the difference between "-" and "--"!
+        Also, there is no restriction to the number of strings you add after --name.
+        So "--startVector (2, 4, 5)" is perfectly legal.
+
+        Retrieving an argument is possible with the getCommandLineArgument function of the
+        CommandLineParser class. It is a Singleton, but the public interface is static.
+    */
+    class _CoreExport CommandLineArgument
+    {
+        friend class CommandLineParser;
+
+    public:
+        //! Tells whether the value has been changed by the command line.
+        bool hasDefaultValue() const { return bHasDefaultValue_; }
+        //! Returns the name of the argument.
+        const std::string& getName() const { return name_; }
+
+        //! Returns the shortcut (example: "-p 22" for "--port 22") of the argument.
+        //! Evaluates to "" if there is none.
+        const std::string& getShortcut() const { return shortcut_; }
+        //! Sets the shortcut for the argument
+        CommandLineArgument& shortcut(const std::string& shortcut)
+        { this->shortcut_ = shortcut; return *this; }
+
+        //! Returns the usage information
+        const std::string& getInformation() const { return this->usageInformation_; }
+        //! Sets the option information when displaying orxonox usage.
+        CommandLineArgument& information(const std::string& usage)
+        { this->usageInformation_ = usage; return *this; }
+
+        //! Returns the actual value of the argument. Can be equal to default value.
+        MultiType getValue() const { return value_; }
+        //! Returns the given default value as type T.
+        MultiType getDefaultValue() const { return defaultValue_; }
+
+    private:
+        //! Constructor initialises both value_ and defaultValue_ with defaultValue.
+        CommandLineArgument(const std::string& name, const MultiType& defaultValue, bool bCommandLineOnly)
+            : bHasDefaultValue_(true)
+            , name_(name)
+            , value_(defaultValue)
+            , defaultValue_(defaultValue)
+            , bCommandLineOnly_(bCommandLineOnly)
+        { }
+
+        //! Undefined copy constructor
+        CommandLineArgument(const CommandLineArgument& instance);
+        ~CommandLineArgument() { }
+
+        //! Parses the value string of a command line argument.
+        void parse(const std::string& value, bool bParsingFile);
+
+        //! Tells whether the value has been changed by the command line.
+        bool bHasDefaultValue_;
+
+    private:
+        std::string name_;             //!< Name of the argument
+        std::string shortcut_;         //!< Shortcut of the argument. @see getShortcut().
+        std::string usageInformation_; //!< Tells about the usage of this parameter
+
+        MultiType   value_;            //!< The actual value
+        MultiType   defaultValue_;     //!< Default value. Should not be changed.
+        bool        bCommandLineOnly_; //!< Whether you cannot specify the value in a text file
+    };
+
+
+    /**
+    @brief
+        Global interface to command line options.
+        Allows to add and retrieve command line arguments. Also does the parsing.
+    @note
+        Internally it is a Singleton, but the public interface is static.
+    @see
+        CommandLineArgument
+    */
+    class _CoreExport CommandLineParser
+    {
+    public:
+
+        //! Parse redirection to internal member method.
+        static void parseCommandLine(const std::string& cmdLine) { _getInstance()._parseCommandLine(cmdLine); }
+        static void parseFile() { _getInstance()._parseFile(); }
+
+        static std::string getUsageInformation();
+
+        static const CommandLineArgument* getArgument(const std::string& name);
+        //! Writes the argument value in the given parameter.
+        template <class T>
+        static void getValue(const std::string& name, T* value)
+        { *value = (T)(getArgument(name)->getValue()); }
+        static MultiType getValue(const std::string& name)
+        { return getArgument(name)->getValue(); }
+        template <class T>
+        static CommandLineArgument& addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly);
+
+        static bool existsArgument(const std::string& name)
+        {
+            std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
+            return !(it == _getInstance().cmdLineArgs_.end());
+        }
+
+        static void destroyAllArguments();
+
+    private:
+        //! Constructor initialises bFirstTimeParse_ with true.
+        CommandLineParser() : bFirstTimeParse_(true) { }
+        //! Undefined copy constructor
+        CommandLineParser(const CommandLineParser& instance);
+        ~CommandLineParser();
+
+        static CommandLineParser& _getInstance();
+
+        void _parseCommandLine(const std::string& cmdLine);
+        void _parseFile();
+        void _parse(const std::vector<std::string>& arguments, bool bParsingFile);
+        void checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile);
+        void checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile);
+
+        /**
+            Tells whether we parsed for the first time. The CommmandLineArguments are added before main().
+            So when we call parse() the first time, we need to create a map with all shortcuts since these
+            get added after addCommandLineArgument().
+        */
+        bool bFirstTimeParse_;
+
+        //! Holds all pointers to the arguments and serves as a search map by name.
+        std::map<std::string, CommandLineArgument*> cmdLineArgs_;
+        //! Search map by shortcut for the arguments.
+        std::map<std::string, CommandLineArgument*> cmdLineArgsShortcut_;
+    };
+
+    template <>
+    inline void CommandLineParser::getValue<std::string>(const std::string& name, std::string* value)
+    {
+        *value = getArgument(name)->getValue().getString();
+    }
+
+    /**
+    @brief
+        Adds a new CommandLineArgument to the internal map.
+        Note that only such arguments are actually valid.
+    @param name
+        Name of the argument. Shortcut can be added later.
+    @param defaultValue
+        Default value that is used when argument was not given.
+    */
+    template <class T>
+    CommandLineArgument& CommandLineParser::addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly)
+    {
+        OrxAssert(!_getInstance().existsArgument(name),
+            "Cannot add a command line argument with name '" + name + "' twice.");
+        OrxAssert(MultiType(defaultValue).getType() != MT_Type::Bool || MultiType(defaultValue).getBool() != true,
+               "Boolean command line arguments with positive default values are not supported." << std::endl
+            << "Please use SetCommandLineSwitch and adjust your argument: " << name);
+
+        return *(_getInstance().cmdLineArgs_[name] = new CommandLineArgument(name, defaultValue, bCommandLineOnly));
+    }
+}
+
+#endif /* _CommandLine_H__ */
Index: sandbox_light/src/libraries/core/Core.cc
===================================================================
--- sandbox_light/src/libraries/core/Core.cc	(revision 5790)
+++ sandbox_light/src/libraries/core/Core.cc	(revision 6040)
@@ -37,9 +37,6 @@
 
 #include <cassert>
-#include <fstream>
-#include <cstdlib>
-#include <cstdio>
-#include <boost/version.hpp>
-#include <boost/filesystem.hpp>
+#include <ctime>
+#include <vector>
 
 #ifdef ORXONOX_PLATFORM_WINDOWS
@@ -50,26 +47,13 @@
 #  undef min
 #  undef max
-#elif defined(ORXONOX_PLATFORM_APPLE)
-#  include <sys/param.h>
-#  include <mach-o/dyld.h>
-#else /* Linux */
-#  include <sys/types.h>
-#  include <unistd.h>
-#endif
-
-#include "SpecialConfig.h"
+#endif
+
+#include "util/Clock.h"
 #include "util/Debug.h"
 #include "util/Exception.h"
 #include "util/SignalHandler.h"
-#include "Clock.h"
-#include "CommandLine.h"
+#include "PathConfig.h"
+#include "CommandLineParser.h"
 #include "LuaState.h"
-
-// Boost 1.36 has some issues with deprecated functions that have been omitted
-#if (BOOST_VERSION == 103600)
-#  define BOOST_LEAF_FUNCTION filename
-#else
-#  define BOOST_LEAF_FUNCTION leaf
-#endif
 
 namespace orxonox
@@ -78,5 +62,4 @@
     Core* Core::singletonPtr_s  = 0;
 
-    SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
     SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
 #ifdef ORXONOX_PLATFORM_WINDOWS
@@ -151,11 +134,4 @@
         int softDebugLevelShell_;                       //!< The debug level for the ingame shell
         bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
-
-        //! Path to the parent directory of the ones above if program was installed with relativ pahts
-        boost::filesystem::path rootPath_;
-        boost::filesystem::path executablePath_;        //!< Path to the executable
-        boost::filesystem::path dataPath_;              //!< Path to the data file folder
-        boost::filesystem::path configPath_;            //!< Path to the config file folder
-        boost::filesystem::path logPath_;               //!< Path to the log file folder
     };
 
@@ -164,25 +140,24 @@
         // Cleanup guard for identifier destruction (incl. XMLPort, configValues, consoleCommands)
         : configuration_(new CoreConfiguration()) // Don't yet create config values!
-        , bDevRun_(false)
     {
         // Set the hard coded fixed paths
-        this->setFixedPaths();
+        this->pathConfig_.reset(new PathConfig());
 
         // Parse command line arguments AFTER the modules have been loaded (static code!)
-        CommandLine::parseCommandLine(cmdLine);
+        CommandLineParser::parseCommandLine(cmdLine);
 
         // Set configurable paths like log, config and media
-        this->setConfigurablePaths();
+        this->pathConfig_->setConfigurablePaths();
 
         // create a signal handler (only active for linux)
         // This call is placed as soon as possible, but after the directories are set
         this->signalHandler_.reset(new SignalHandler());
-        this->signalHandler_->doCatch(configuration_->executablePath_.string(), Core::getLogPathString() + "orxonox_crash.log");
+        this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log");
 
         // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used
-        OutputHandler::getOutStream().setLogPath(Core::getLogPathString());
+        OutputHandler::getOutStream().setLogPath(PathConfig::getLogPathString());
 
         // Parse additional options file now that we know its path
-        CommandLine::parseFile();
+        CommandLineParser::parseFile();
 
 #ifdef ORXONOX_PLATFORM_WINDOWS
@@ -190,5 +165,5 @@
         // do this after ogre has initialised. Somehow Ogre changes the settings again (not through
         // the timer though).
-        int limitToCPU = CommandLine::getValue("limitToCPU");
+        int limitToCPU = CommandLineParser::getValue("limitToCPU");
         if (limitToCPU > 0)
             setThreadAffinity(static_cast<unsigned int>(limitToCPU));
@@ -250,40 +225,4 @@
     }
 
-    /*static*/ const boost::filesystem::path& Core::getDataPath()
-    {
-        return getInstance().configuration_->dataPath_;
-    }
-    /*static*/ std::string Core::getDataPathString()
-    {
-        return getInstance().configuration_->dataPath_.string() + '/';
-    }
-
-    /*static*/ const boost::filesystem::path& Core::getConfigPath()
-    {
-        return getInstance().configuration_->configPath_;
-    }
-    /*static*/ std::string Core::getConfigPathString()
-    {
-        return getInstance().configuration_->configPath_.string() + '/';
-    }
-
-    /*static*/ const boost::filesystem::path& Core::getLogPath()
-    {
-        return getInstance().configuration_->logPath_;
-    }
-    /*static*/ std::string Core::getLogPathString()
-    {
-        return getInstance().configuration_->logPath_.string() + '/';
-    }
-
-    /*static*/ const boost::filesystem::path& Core::getRootPath()
-    {
-        return getInstance().configuration_->rootPath_;
-    }
-    /*static*/ std::string Core::getRootPathString()
-    {
-        return getInstance().configuration_->rootPath_.string() + '/';
-    }
-
     /**
     @note
@@ -331,162 +270,3 @@
 #endif
     }
-
-    /**
-    @brief
-        Retrievs the executable path and sets all hard coded fixed path (currently only the module path)
-        Also checks for "orxonox_dev_build.keep_me" in the executable diretory.
-        If found it means that this is not an installed run, hence we
-        don't write the logs and config files to ~/.orxonox
-    @throw
-        GeneralException
-    */
-    void Core::setFixedPaths()
-    {
-        //////////////////////////
-        // FIND EXECUTABLE PATH //
-        //////////////////////////
-
-#ifdef ORXONOX_PLATFORM_WINDOWS
-        // get executable module
-        TCHAR buffer[1024];
-        if (GetModuleFileName(NULL, buffer, 1024) == 0)
-            ThrowException(General, "Could not retrieve executable path.");
-
-#elif defined(ORXONOX_PLATFORM_APPLE)
-        char buffer[1024];
-        unsigned long path_len = 1023;
-        if (_NSGetExecutablePath(buffer, &path_len))
-            ThrowException(General, "Could not retrieve executable path.");
-
-#else /* Linux */
-        /* written by Nicolai Haehnle <prefect_@gmx.net> */
-
-        /* Get our PID and build the name of the link in /proc */
-        char linkname[64]; /* /proc/<pid>/exe */
-        if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", getpid()) < 0)
-        {
-            /* This should only happen on large word systems. I'm not sure
-               what the proper response is here.
-               Since it really is an assert-like condition, aborting the
-               program seems to be in order. */
-            assert(false);
-        }
-
-        /* Now read the symbolic link */
-        char buffer[1024];
-        int ret;
-        ret = readlink(linkname, buffer, 1024);
-        /* In case of an error, leave the handling up to the caller */
-        if (ret == -1)
-            ThrowException(General, "Could not retrieve executable path.");
-
-        /* Ensure proper NUL termination */
-        buffer[ret] = 0;
-#endif
-
-        configuration_->executablePath_ = boost::filesystem::path(buffer);
-#ifndef ORXONOX_PLATFORM_APPLE
-        configuration_->executablePath_ = configuration_->executablePath_.branch_path(); // remove executable name
-#endif
-
-        /////////////////////
-        // SET MODULE PATH //
-        /////////////////////
-
-        if (boost::filesystem::exists(configuration_->executablePath_ / "orxonox_dev_build.keep_me"))
-        {
-            COUT(1) << "Running from the build tree." << std::endl;
-            Core::bDevRun_ = true;
-        }
-        else
-        {
-
-#ifdef INSTALL_COPYABLE // --> relative paths
-
-            // Also set the root path
-            boost::filesystem::path relativeExecutablePath(specialConfig::defaultRuntimePath);
-            configuration_->rootPath_ = configuration_->executablePath_;
-            while (!boost::filesystem::equivalent(configuration_->rootPath_ / relativeExecutablePath, configuration_->executablePath_)
-                   && !configuration_->rootPath_.empty())
-                configuration_->rootPath_ = configuration_->rootPath_.branch_path();
-            if (configuration_->rootPath_.empty())
-                ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
-
-#endif
-        }
-    }
-
-    /**
-    @brief
-        Sets config, log and media path and creates folders if necessary.
-    @throws
-        GeneralException
-    */
-    void Core::setConfigurablePaths()
-    {
-        if (Core::isDevelopmentRun())
-        {
-            configuration_->dataPath_  = specialConfig::dataDevDirectory;
-            configuration_->configPath_ = specialConfig::configDevDirectory;
-            configuration_->logPath_    = specialConfig::logDevDirectory;
-        }
-        else
-        {
-
-#ifdef INSTALL_COPYABLE // --> relative paths
-
-            // Using paths relative to the install prefix, complete them
-            configuration_->dataPath_   = configuration_->rootPath_ / specialConfig::defaultDataPath;
-            configuration_->configPath_ = configuration_->rootPath_ / specialConfig::defaultConfigPath;
-            configuration_->logPath_    = configuration_->rootPath_ / specialConfig::defaultLogPath;
-
-#else
-
-            configuration_->dataPath_  = specialConfig::dataInstallDirectory;
-
-            // Get user directory
-#  ifdef ORXONOX_PLATFORM_UNIX /* Apple? */
-            char* userDataPathPtr(getenv("HOME"));
-#  else
-            char* userDataPathPtr(getenv("APPDATA"));
-#  endif
-            if (userDataPathPtr == NULL)
-                ThrowException(General, "Could not retrieve user data path.");
-            boost::filesystem::path userDataPath(userDataPathPtr);
-            userDataPath /= ".orxonox";
-
-            configuration_->configPath_ = userDataPath / specialConfig::defaultConfigPath;
-            configuration_->logPath_    = userDataPath / specialConfig::defaultLogPath;
-
-#endif
-
-        }
-
-        // Option to put all the config and log files in a separate folder
-        if (!CommandLine::getArgument("writingPathSuffix")->hasDefaultValue())
-        {
-            std::string directory(CommandLine::getValue("writingPathSuffix").getString());
-            configuration_->configPath_ = configuration_->configPath_ / directory;
-            configuration_->logPath_    = configuration_->logPath_    / directory;
-        }
-
-        // Create directories to avoid problems when opening files in non existent folders.
-        std::vector<std::pair<boost::filesystem::path, std::string> > directories;
-        directories.push_back(std::make_pair(boost::filesystem::path(configuration_->configPath_), "config"));
-        directories.push_back(std::make_pair(boost::filesystem::path(configuration_->logPath_), "log"));
-
-        for (std::vector<std::pair<boost::filesystem::path, std::string> >::iterator it = directories.begin();
-            it != directories.end(); ++it)
-        {
-            if (boost::filesystem::exists(it->first) && !boost::filesystem::is_directory(it->first))
-            {
-                ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \
-                                         Please remove " + it->first.string());
-            }
-            if (boost::filesystem::create_directories(it->first)) // function may not return true at all (bug?)
-            {
-                COUT(4) << "Created " << it->second << " directory" << std::endl;
-            }
-        }
-    }
 }
Index: sandbox_light/src/libraries/core/Core.h
===================================================================
--- sandbox_light/src/libraries/core/Core.h	(revision 5790)
+++ sandbox_light/src/libraries/core/Core.h	(revision 6040)
@@ -28,13 +28,4 @@
  */
 
-/**
-@file
-@brief
-    Declaration of the Core class.
-@details
-    The Core class is a singleton, only used to configure some variables
-    in the core through the config-file.
-*/
-
 #ifndef _Core_H__
 #define _Core_H__
@@ -55,7 +46,4 @@
     @brief
         The Core class is a singleton used to configure the program basics.
-    @details
-        The class provides information about the data, config and log path.
-        It determines those by the use of platform specific functions.
     @remark
         You should only create this singleton once because it destroys the identifiers!
@@ -82,35 +70,13 @@
             static void  setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
 
-            //! Returns the path to the data files as boost::filesystem::path
-            static const boost::filesystem::path& getDataPath();
-            //! Returns the path to the config files as boost::filesystem::path
-            static const boost::filesystem::path& getConfigPath();
-            //! Returns the path to the log files as boost::filesystem::path
-            static const boost::filesystem::path& getLogPath();
-            //! Returns the path to the root folder as boost::filesystem::path
-            static const boost::filesystem::path& getRootPath();
-            //! Returns the path to the data files as std::string
-            static std::string getDataPathString();
-            //! Returns the path to the config files as std::string
-            static std::string getConfigPathString();
-            //! Returns the path to the log files as std::string
-            static std::string getLogPathString();
-            //! Returns the path to the root folder as std::string
-            static std::string getRootPathString();
-
-            static bool isDevelopmentRun() { return getInstance().bDevRun_; }
-
         private:
             Core(const Core&); //!< Don't use (undefined symbol)
 
-            void setFixedPaths();
-            void setConfigurablePaths();
             void setThreadAffinity(int limitToCPU);
 
             // Mind the order for the destruction!
+            scoped_ptr<PathConfig>        pathConfig_;
             scoped_ptr<SignalHandler>     signalHandler_;
             scoped_ptr<CoreConfiguration> configuration_;
-
-            bool                          bDevRun_;             //!< True for runs in the build directory (not installed)
 
             static Core* singletonPtr_s;
Index: sandbox_light/src/libraries/core/CorePrereqs.h
===================================================================
--- sandbox_light/src/libraries/core/CorePrereqs.h	(revision 5790)
+++ sandbox_light/src/libraries/core/CorePrereqs.h	(revision 6040)
@@ -28,6 +28,7 @@
 
 /**
-  @file
-  @brief Contains all the necessary forward declarations for all classes and structs.
+@file
+@brief
+    Shared library macros, enums, constants and forward declarations for the core library
 */
 
@@ -40,4 +41,5 @@
 // Shared library settings
 //-----------------------------------------------------------------------
+
 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( CORE_STATIC_BUILD )
 #  ifdef CORE_SHARED_BUILD
@@ -56,8 +58,17 @@
 #endif
 
-
-//-----------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
+// Constants
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    static const uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1);
+}
+
+//-----------------------------------------------------------------------
+// Enums
+//-----------------------------------------------------------------------
+
 namespace orxonox
 {
@@ -66,9 +77,10 @@
         enum Mode
         {
+            NOP,
             LoadObject,
             SaveObject,
             ExpandObject
         };
-    }
+}
 
     namespace KeybindMode
@@ -82,11 +94,16 @@
         };
     };
-
+}
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
     typedef std::string LanguageEntryLabel;
 
     class ArgumentCompleter;
     class ArgumentCompletionListElement;
-    class BaseFactory;
-    class BaseMetaObjectListElement;
     class BaseObject;
     template <class T>
@@ -98,8 +115,6 @@
     class ClassTreeMaskNode;
     class ClassTreeMaskObjectIterator;
-    class Clock;
     class CommandEvaluation;
-    class CommandExecutor;
-    class CommandLine;
+    class CommandLineParser;
     class CommandLineArgument;
     class ConfigFile;
@@ -109,4 +124,5 @@
     class ConfigFileManager;
     class ConfigFileSection;
+    struct ConfigFileType;
     class ConfigValueContainer;
     class ConsoleCommand;
@@ -115,5 +131,5 @@
     class DynLibManager;
     struct Event;
-    class EventContainer;
+    class EventState;
     class Executor;
     template <class T>
@@ -125,4 +141,8 @@
     class FunctorMember;
     class FunctorStatic;
+    class Game;
+    class GameState;
+    struct GameStateInfo;
+    struct GameStateTreeNode;
     class GraphicsManager;
     class GUIManager;
@@ -131,8 +151,5 @@
     template <class T>
     class Iterator;
-    class IteratorBase;
     class Language;
-    class LanguageEntry;
-    class Loader;
     class LuaState;
     class MemoryArchive;
@@ -152,8 +169,11 @@
     class OgreWindowEventListener;
     class OrxonoxClass;
+    class PathConfig;
     struct ResourceInfo;
     class Shell;
     class ShellListener;
     template <class T>
+    class SmartPtr;
+    template <class T>
     class SubclassIdentifier;
     class TclBind;
@@ -163,4 +183,8 @@
     class TclThreadManager;
     class Template;
+    class Thread;
+    class ThreadPool;
+    template <class T>
+    class WeakPtr;
     class WindowEventListener;
     class XMLFile;
@@ -173,15 +197,8 @@
     class XMLPortParamContainer;
 
-    // game states
-    class Game;
-    class GameState;
-    struct GameStateInfo;
-    struct GameStateTreeNode;
-
-    // input
+    // Input
     class BaseCommand;
     class BufferedParamCommand;
     class Button;
-    class CalibratorCallback;
     class HalfAxis;
     class InputBuffer;
@@ -192,16 +209,15 @@
     class InputManager;
     class InputState;
+    struct InputStatePriority;
+    class JoyStickQuantityListener;
     class JoyStick;
+    class KeyBinder;
+    class KeyBinderManager;
+    class Keyboard;
+    class KeyDetector;
+    class KeyEvent;
     class Mouse;
-    class Keyboard;
-    class KeyBinder;
-    class KeyDetector;
     class ParamCommand;
     class SimpleCommand;
-
-
-    // multithreading
-    class Thread;
-    class ThreadPool;
 }
 
@@ -282,13 +298,6 @@
 namespace orxonox
 {
-    using ticpp::Document;
     using ticpp::Element;
-    using ticpp::Declaration;
-    using ticpp::StylesheetReference;
-    using ticpp::Text;
-    using ticpp::Comment;
-    using ticpp::Attribute;
-}
-
+}
 
 #endif /* _CorePrereqs_H__ */
Index: sandbox_light/src/libraries/core/LuaState.cc
===================================================================
--- sandbox_light/src/libraries/core/LuaState.cc	(revision 5790)
+++ sandbox_light/src/libraries/core/LuaState.cc	(revision 6040)
@@ -38,5 +38,5 @@
 
 #include "util/Debug.h"
-#include "Core.h"
+#include "PathConfig.h"
 #include "ToluaBindCore.h"
 
@@ -106,5 +106,5 @@
     shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename)
     {
-        boost::filesystem::path filepath = Core::getDataPath() / "lua" / filename;
+        boost::filesystem::path filepath = PathConfig::getDataPath() / "lua" / filename;
         if (boost::filesystem::exists(filepath))
         {
Index: sandbox_light/src/libraries/core/PathConfig.cc
===================================================================
--- sandbox_light/src/libraries/core/PathConfig.cc	(revision 6040)
+++ sandbox_light/src/libraries/core/PathConfig.cc	(revision 6040)
@@ -0,0 +1,260 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#include "PathConfig.h"
+
+#include <cassert>
+#include <cstdlib>
+#include <cstdio>
+#include <vector>
+#include <boost/version.hpp>
+#include <boost/filesystem.hpp>
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+#  ifndef WIN32_LEAN_AND_MEAN
+#    define WIN32_LEAN_AND_MEAN
+#  endif
+#  include <windows.h>
+#  undef min
+#  undef max
+#elif defined(ORXONOX_PLATFORM_APPLE)
+#  include <sys/param.h>
+#  include <mach-o/dyld.h>
+#else /* Linux */
+#  include <sys/types.h>
+#  include <unistd.h>
+#endif
+
+#include "SpecialConfig.h"
+#include "util/Debug.h"
+#include "util/Exception.h"
+#include "CommandLineParser.h"
+
+// Boost 1.36 has some issues with deprecated functions that have been omitted
+#if (BOOST_VERSION == 103600)
+#  define BOOST_LEAF_FUNCTION filename
+#else
+#  define BOOST_LEAF_FUNCTION leaf
+#endif
+
+namespace orxonox
+{
+    namespace bf = boost::filesystem;
+
+    //! Static pointer to the singleton
+    PathConfig* PathConfig::singletonPtr_s  = 0;
+
+    SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
+
+    PathConfig::PathConfig()
+        : rootPath_(*(new bf::path()))
+        , executablePath_(*(new bf::path()))
+        , dataPath_(*(new bf::path()))
+        , configPath_(*(new bf::path()))
+        , logPath_(*(new bf::path()))
+        , bDevRun_(false)
+    {
+        //////////////////////////
+        // FIND EXECUTABLE PATH //
+        //////////////////////////
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+        // get executable module
+        TCHAR buffer[1024];
+        if (GetModuleFileName(NULL, buffer, 1024) == 0)
+            ThrowException(General, "Could not retrieve executable path.");
+
+#elif defined(ORXONOX_PLATFORM_APPLE)
+        char buffer[1024];
+        unsigned long path_len = 1023;
+        if (_NSGetExecutablePath(buffer, &path_len))
+            ThrowException(General, "Could not retrieve executable path.");
+
+#else /* Linux */
+        /* written by Nicolai Haehnle <prefect_@gmx.net> */
+
+        /* Get our PID and build the name of the link in /proc */
+        char linkname[64]; /* /proc/<pid>/exe */
+        if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", getpid()) < 0)
+        {
+            /* This should only happen on large word systems. I'm not sure
+               what the proper response is here.
+               Since it really is an assert-like condition, aborting the
+               program seems to be in order. */
+            assert(false);
+        }
+
+        /* Now read the symbolic link */
+        char buffer[1024];
+        int ret;
+        ret = readlink(linkname, buffer, 1024);
+        /* In case of an error, leave the handling up to the caller */
+        if (ret == -1)
+            ThrowException(General, "Could not retrieve executable path.");
+
+        /* Ensure proper NUL termination */
+        buffer[ret] = 0;
+#endif
+
+        executablePath_ = bf::path(buffer);
+#ifndef ORXONOX_PLATFORM_APPLE
+        executablePath_ = executablePath_.branch_path(); // remove executable name
+#endif
+
+        /////////////////////
+        // SET MODULE PATH //
+        /////////////////////
+
+        if (bf::exists(executablePath_ / "orxonox_dev_build.keep_me"))
+        {
+            COUT(1) << "Running from the build tree." << std::endl;
+            PathConfig::bDevRun_ = true;
+        }
+        else
+        {
+
+#ifdef INSTALL_COPYABLE // --> relative paths
+
+            // Also set the root path
+            bf::path relativeExecutablePath(specialConfig::defaultRuntimePath);
+            rootPath_ = executablePath_;
+            while (!bf::equivalent(rootPath_ / relativeExecutablePath, executablePath_) && !rootPath_.empty())
+                rootPath_ = rootPath_.branch_path();
+            if (rootPath_.empty())
+                ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
+
+#else
+
+            // There is no root path, so don't set it at all
+
+#endif
+        }
+    }
+
+    PathConfig::~PathConfig()
+    {
+        delete &rootPath_;
+        delete &executablePath_;
+        delete &dataPath_;
+        delete &configPath_;
+        delete &logPath_;
+    }
+
+    void PathConfig::setConfigurablePaths()
+    {
+        if (bDevRun_)
+        {
+            dataPath_         = specialConfig::dataDevDirectory;
+            configPath_       = specialConfig::configDevDirectory;
+            logPath_          = specialConfig::logDevDirectory;
+        }
+        else
+        {
+
+#ifdef INSTALL_COPYABLE // --> relative paths
+
+            // Using paths relative to the install prefix, complete them
+            dataPath_   = rootPath_ / specialConfig::defaultDataPath;
+            configPath_ = rootPath_ / specialConfig::defaultConfigPath;
+            logPath_    = rootPath_ / specialConfig::defaultLogPath;
+
+#else
+
+            dataPath_  = specialConfig::dataInstallDirectory;
+
+            // Get user directory
+#  ifdef ORXONOX_PLATFORM_UNIX /* Apple? */
+            char* userDataPathPtr(getenv("HOME"));
+#  else
+            char* userDataPathPtr(getenv("APPDATA"));
+#  endif
+            if (userDataPathPtr == NULL)
+                ThrowException(General, "Could not retrieve user data path.");
+            bf::path userDataPath(userDataPathPtr);
+            userDataPath /= ".orxonox";
+
+            configPath_ = userDataPath / specialConfig::defaultConfigPath;
+            logPath_    = userDataPath / specialConfig::defaultLogPath;
+
+#endif
+
+        }
+
+        // Option to put all the config and log files in a separate folder
+        if (!CommandLineParser::getArgument("writingPathSuffix")->hasDefaultValue())
+        {
+            std::string directory(CommandLineParser::getValue("writingPathSuffix").getString());
+            configPath_ = configPath_ / directory;
+            logPath_    = logPath_    / directory;
+        }
+
+        // Create directories to avoid problems when opening files in non existent folders.
+        std::vector<std::pair<bf::path, std::string> > directories;
+        directories.push_back(std::make_pair(bf::path(configPath_), "config"));
+        directories.push_back(std::make_pair(bf::path(logPath_), "log"));
+
+        for (std::vector<std::pair<bf::path, std::string> >::iterator it = directories.begin();
+            it != directories.end(); ++it)
+        {
+            if (bf::exists(it->first) && !bf::is_directory(it->first))
+            {
+                ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \
+                                         Please remove " + it->first.string());
+            }
+            if (bf::create_directories(it->first)) // function may not return true at all (bug?)
+            {
+                COUT(4) << "Created " << it->second << " directory" << std::endl;
+            }
+        }
+    }
+
+    /*static*/ std::string PathConfig::getRootPathString()
+    {
+        return getInstance().rootPath_.string() + '/';
+    }
+
+    /*static*/ std::string PathConfig::getExecutablePathString()
+    {
+        return getInstance().executablePath_.string() + '/';
+    }
+
+    /*static*/ std::string PathConfig::getDataPathString()
+    {
+        return getInstance().dataPath_.string() + '/';
+    }
+
+    /*static*/ std::string PathConfig::getConfigPathString()
+    {
+        return getInstance().configPath_.string() + '/';
+    }
+
+    /*static*/ std::string PathConfig::getLogPathString()
+    {
+        return getInstance().logPath_.string() + '/';
+    }
+}
Index: sandbox_light/src/libraries/core/PathConfig.h
===================================================================
--- sandbox_light/src/libraries/core/PathConfig.h	(revision 6040)
+++ sandbox_light/src/libraries/core/PathConfig.h	(revision 6040)
@@ -0,0 +1,123 @@
+/*
+ *   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 _PathConfig_H__
+#define _PathConfig_H__
+
+#include "CorePrereqs.h"
+
+#include <string>
+#include <vector>
+#include "util/Singleton.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        The PathConfig class is a singleton used to configure different paths.
+    @details
+        The class provides information about the data, config, log, executable
+        and root path.
+        It determines those by the use of platform specific functions.
+    @remarks
+        Not all paths are always available:
+        - root only when installed copyable
+        - externalData only for development builds in the build tree
+    */
+    class _CoreExport PathConfig : public Singleton<PathConfig>
+    {
+        friend class Singleton<PathConfig>;
+        friend class Core;
+
+        public:
+            /**
+            @brief
+                Retrievs the executable path and sets all hard coded fixed paths (currently only the module path)
+                Also checks for "orxonox_dev_build.keep_me" in the executable diretory.
+                If found it means that this is not an installed run, hence we
+                don't write the logs and config files to ~/.orxonox
+            @throw
+                GeneralException
+            */
+            PathConfig();
+            ~PathConfig();
+
+            //! Returns the path to the root folder as boost::filesystem::path
+            static const boost::filesystem::path& getRootPath()
+                { return getInstance().rootPath_; }
+            //! Returns the path to the executable folder as boost::filesystem::path
+            static const boost::filesystem::path& getExecutablePath()
+                { return getInstance().executablePath_; }
+            //! Returns the path to the data files as boost::filesystem::path
+            static const boost::filesystem::path& getDataPath()
+                { return getInstance().dataPath_; }
+            //! Returns the path to the config files as boost::filesystem::path
+            static const boost::filesystem::path& getConfigPath()
+                { return getInstance().configPath_; }
+            //! Returns the path to the log files as boost::filesystem::path
+            static const boost::filesystem::path& getLogPath()
+                { return getInstance().logPath_; }
+
+            //! Returns the path to the root folder as std::string
+            static std::string getRootPathString();
+            //! Returns the path to the executable folder as std::string
+            static std::string getExecutablePathString();
+            //! Returns the path to the data files as std::string
+            static std::string getDataPathString();
+            //! Returns the path to the config files as std::string
+            static std::string getConfigPathString();
+            //! Returns the path to the log files as std::string
+            static std::string getLogPathString();
+
+            //! Return trrue for runs in the build directory (not installed)
+            static bool isDevelopmentRun() { return getInstance().bDevRun_; }
+
+        private:
+            PathConfig(const PathConfig&); //!< Don't use (undefined symbol)
+
+            /**
+            @brief
+                Sets config, log and media path and creates the folders if necessary.
+            @throws
+                GeneralException
+            */
+            void setConfigurablePaths();
+
+            //! Path to the parent directory of the ones above if program was installed with relativ paths
+            boost::filesystem::path& rootPath_;
+            boost::filesystem::path& executablePath_;        //!< Path to the executable
+            boost::filesystem::path& dataPath_;              //!< Path to the data files folder
+            boost::filesystem::path& configPath_;            //!< Path to the config files folder
+            boost::filesystem::path& logPath_;               //!< Path to the log files folder
+
+            bool                     bDevRun_;               //!< True for runs in the build directory (not installed)
+            static PathConfig* singletonPtr_s;
+    };
+}
+
+#endif /* _PathConfig_H__ */
Index: sandbox_light/src/libraries/util/CMakeLists.txt
===================================================================
--- sandbox_light/src/libraries/util/CMakeLists.txt	(revision 5790)
+++ sandbox_light/src/libraries/util/CMakeLists.txt	(revision 6040)
@@ -19,4 +19,5 @@
 
 SET_SOURCE_FILES(UTIL_SRC_FILES
+  Clock.cc
   Exception.cc
   Math.cc
Index: sandbox_light/src/libraries/util/Clock.cc
===================================================================
--- sandbox_light/src/libraries/util/Clock.cc	(revision 6040)
+++ sandbox_light/src/libraries/util/Clock.cc	(revision 6040)
@@ -0,0 +1,73 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+#include "Clock.h"
+#include <ogremath/OgreTimer.h>
+
+namespace orxonox
+{
+    Clock::Clock()
+        : timer_(new Ogre::Timer())
+        , storedTime_(0)
+        , tickTime_(0)
+        , tickDt_(0)
+        , tickDtFloat_(0.0f)
+        , lastTimersTime_(0)
+    {
+    }
+
+    Clock::~Clock()
+    {
+        delete timer_;
+    }
+    
+    void Clock::capture()
+    {
+        unsigned long timersTime = timer_->getMicroseconds();
+        tickTime_ = storedTime_ + timersTime;
+        tickDt_ = timersTime - lastTimersTime_;
+        tickDtFloat_ = static_cast<float>(tickDt_) / 1000000.0f;
+
+        if (timersTime > 0xFFFFFFFF/4)
+        {
+            // Ogre timer will overflow at 2^32 microseconds if unsigned long is 32 bit
+            storedTime_ += timersTime;
+            lastTimersTime_ = 0;
+            timer_->reset();
+        }
+        else
+        {
+            lastTimersTime_ = timersTime;
+        }
+    }
+
+    unsigned long long Clock::getRealMicroseconds() const
+    {
+        return this->timer_->getMicroseconds() + this->storedTime_;
+    }
+}
Index: sandbox_light/src/libraries/util/Clock.h
===================================================================
--- sandbox_light/src/libraries/util/Clock.h	(revision 6040)
+++ sandbox_light/src/libraries/util/Clock.h	(revision 6040)
@@ -0,0 +1,68 @@
+/*
+ *   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 _Clock_H__
+#define _Clock_H__
+
+#include "UtilPrereqs.h"
+
+namespace Ogre { class Timer; }
+
+namespace orxonox
+{
+    class _UtilExport Clock
+    {
+    public:
+        Clock();
+        ~Clock();
+
+        void capture();
+
+        unsigned long long getMicroseconds()   const { return tickTime_; }
+        unsigned long long getMilliseconds()   const { return tickTime_ / 1000; }
+        unsigned long      getSeconds()        const { return static_cast<long> (tickTime_ / 1000000); }
+        float              getSecondsPrecise() const { return static_cast<float>(tickTime_ / 1000000.0f); }
+
+        float              getDeltaTime()      const { return tickDtFloat_; }
+        long               getDeltaTimeMicroseconds() const { return tickDt_; }
+
+        unsigned long long getRealMicroseconds() const;
+
+    private:
+        Clock(const Clock& instance);
+
+        Ogre::Timer*       timer_;
+        unsigned long long storedTime_;
+        unsigned long long tickTime_;
+        long               tickDt_;
+        float              tickDtFloat_;
+        unsigned long      lastTimersTime_;
+    };
+}
+
+#endif /* _Clock_H__ */
Index: sandbox_light/src/libraries/util/UtilPrereqs.h
===================================================================
--- sandbox_light/src/libraries/util/UtilPrereqs.h	(revision 5790)
+++ sandbox_light/src/libraries/util/UtilPrereqs.h	(revision 6040)
@@ -28,6 +28,7 @@
 
 /**
-  @file
-  @brief Contains all the necessary forward declarations for all classes and structs.
+@file
+@brief
+    Shared library macros, enums, constants and forward declarations for the util library
 */
 
@@ -40,4 +41,5 @@
 // Shared library settings
 //-----------------------------------------------------------------------
+
 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( UTIL_STATIC_BUILD )
 #  ifdef UTIL_SHARED_BUILD
@@ -56,4 +58,20 @@
 #endif
 
+//-----------------------------------------------------------------------
+// Enums
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    namespace ScopeID
+    {
+        //!A list of available scopes for the Scope template.
+        enum Value
+        {
+            Root,
+            Graphics
+        };
+    }
+}
 
 //-----------------------------------------------------------------------
@@ -63,4 +81,5 @@
 namespace orxonox
 {
+    class Clock;
     class Exception;
     class ExprParser;
@@ -71,5 +90,12 @@
     class OutputBufferListener;
     class OutputHandler;
+    template <ScopeID::Value>
+    class Scope;
+    template <class, ScopeID::Value>
+    class ScopedSingleton;
+    class ScopeListener;
     class SignalHandler;
+    template <class T>
+    class Singleton;
     class SubString;
 }
Index: sandbox_light/src/orxonox/Main.cc
===================================================================
--- sandbox_light/src/orxonox/Main.cc	(revision 5790)
+++ sandbox_light/src/orxonox/Main.cc	(revision 6040)
@@ -31,12 +31,12 @@
 @file
 @brief
-    The main function of Orxonox.
+    The main function of Orxonox (but not the entry point of the program!)
 */
 
 #include "OrxonoxPrereqs.h"
 
-#include "core/CommandLine.h"
+#include "util/Clock.h"
+#include "core/CommandLineParser.h"
 #include "core/Core.h"
-#include "core/Clock.h"
 #include "core/LuaState.h"
 #include "ToluaBindOrxonox.h"
@@ -53,5 +53,5 @@
     /**
     @brief
-        Main method. Game starts here (except for static initialisations).
+        Starting point of orxonox (however not the entry point of the program!)
     */
     int main(const std::string& strCmdLine)
Index: sandbox_light/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- sandbox_light/src/orxonox/OrxonoxPrereqs.h	(revision 5790)
+++ sandbox_light/src/orxonox/OrxonoxPrereqs.h	(revision 6040)
@@ -28,6 +28,7 @@
 
 /**
-  @file
-  @brief Contains all the necessary forward declarations for all classes and structs.
+@file
+@brief
+    Shared library macros, enums, constants and forward declarations for the orxonox library
 */
 
@@ -36,8 +37,8 @@
 
 #include "OrxonoxConfig.h"
-
 //-----------------------------------------------------------------------
 // Shared library settings
 //-----------------------------------------------------------------------
+
 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
 #  ifdef ORXONOX_SHARED_BUILD
@@ -63,69 +64,73 @@
 {
     class CameraManager;
+    class Level;
     class LevelManager;
     class PawnManager;
     class PlayerManager;
-
-    class Level;
+    class Radar;
     class Scene;
-    class Tickable;
+
+    // collisionshapes
+    class CollisionShape;
+    class CompoundCollisionShape;
+    class WorldEntityCollisionShape;
+
+    // controllers
+    class AIController;
+    class ArtificialController;
+    class Controller;
+    class HumanController;
+    class ScriptController;
+    class WaypointController;
+    class WaypointPatrolController;
+
+    // gametypes
+    class Asteroids;
+    class Deathmatch;
+    class Gametype;
+    class TeamBaseMatch;
+    class TeamDeathmatch;
+    class UnderAttack;
+
+    // graphics
+    class Backlight;
+    class Billboard;
+    class BlinkingBillboard;
+    class Camera;
+    class FadingBillboard;
+    class GlobalShader;
+    class Light;
+    class Model;
+    class ParticleEmitter;
+    class ParticleSpawner;
+
+    // infos
+    class Bot;
+    class GametypeInfo;
+    class HumanPlayer;
+    class Info;
+    class PlayerInfo;
 
     // interfaces
     class GametypeMessageListener;
     class NotificationListener;
-    class PawnListener;
     class PlayerTrigger;
     class RadarListener;
     class RadarViewable;
     class Rewardable;
-    class Teamcolourable;
-
-    // worldentities
-    class WorldEntity;
-    class StaticEntity;
-    class MobileEntity;
-    class ControllableEntity;
-    class MovableEntity;
-
-    // graphics
-    class Model;
-    class Billboard;
-    class BlinkingBillboard;
-    class BigExplosion;
-    class ExplosionChunk;
-    class FadingBillboard;
-    class GlobalShader;
-    class Light;
-    class Backlight;
-    class ParticleEmitter;
-    class ParticleSpawner;
-    class Camera;
-
-    // mixed
-    class SpawnPoint;
-    class TeamSpawnPoint;
-
-    class CameraPosition;
-    class Sublevel;
-    class Radar;
-
-    class Test;
-
-    // pawns
-    class Spectator;
-    class Pawn;
-    class SpaceShip;
-    class TeamBaseMatchBase;
-    class Destroyer;
-
-    // gametypes
-    class Gametype;
-    class Deathmatch;
-    class TeamDeathmatch;
-    class Asteroids;
-    class TeamBaseMatch;
-    class UnderAttack;
-
-    // pickups
+    class TeamColourable;
+
+    // items
+    class Engine;
+    class Item;
+    class MultiStateEngine;
+
+    // overlays
+    class InGameConsole;
+    class Map;
+    class OrxonoxOverlay;
+    class OverlayGroup;
+
+    // pickup
     class BaseItem;
     class DroppedItem;
@@ -137,58 +142,42 @@
     class PickupSpawner;
     class UsableItem;
-
+    // pickup, items
+    class HealthImmediate;
+    class HealthUsable;
     class Jump;
-    class HealthUsable;
-    class PassiveItem;
-
-    // items
-    class Item;
-    class Engine;
-    class MultiStateEngine;
-    class RotatingEngine;
+
+    //sound
+    class AmbientSound;
+    class BaseSound;
+    class SoundManager;
+    class WorldSound;
 
     // weaponsystem
-    class WeaponSystem;
+    class DefaultWeaponmodeLink;
+    class Munition;
+    class Weapon;
+    class WeaponMode;
+    class WeaponPack;
     class WeaponSet;
     class WeaponSlot;
-    class WeaponPack;
-    class Weapon;
-    class WeaponMode;
-    class DefaultWeaponmodeLink;
-    class Munition;
-
-    // controller
-    class Controller;
-    class HumanController;
-    class ArtificialController;
-    class AIController;
-    class ScriptController;
-    class WaypointController;
-    class WaypointPatrolController;
-
-    // infos
-    class Info;
-    class PlayerInfo;
-    class HumanPlayer;
-    class Bot;
-    class GametypeInfo;
-
-    // collision
-    class CollisionShape;
-    class CompoundCollisionShape;
-    class WorldEntityCollisionShape;
-
-    // overlays
-    class OverlayGroup;
-    class OrxonoxOverlay;
-    class Notification;
-    class NotificationManager;
-    class InGameConsole;
-    class Map;
-
-    //sound
-    class SoundBase;
-    class SoundManager;
-    class SoundMainMenu;
+    class WeaponSystem;
+
+    // worldentities
+    class BigExplosion;
+    class CameraPosition;
+    class ControllableEntity;
+    class ExplosionChunk;
+    class MobileEntity;
+    class MovableEntity;
+    class SpawnPoint;
+    class StaticEntity;
+    class TeamSpawnPoint;
+    class WorldEntity;
+    // worldentities, pawns
+    class Destroyer;
+    class Pawn;
+    class SpaceShip;
+    class Spectator;
+    class TeamBaseMatchBase;
 }
 
