Index: /sandbox_light/CMakeLists.txt
===================================================================
--- /sandbox_light/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,120 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Configures some basics and controls the configuration scripts
+ #
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
+
+# Keep devs from using the root directory as binary directory (messes up the source tree)
+IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
+  MESSAGE(FATAL_ERROR "Please do not use the root directory as CMake output directory!
+  mkdir build; cd build; cmake ..
+  And you will have to clean the source directory by deleting CMakeCache.txt and the folder CMakeFiles")
+ENDIF()
+
+PROJECT(Orxonox C CXX)
+
+################ General Config #################
+
+# Version info
+SET(ORXONOX_VERSION_MAJOR 0)
+SET(ORXONOX_VERSION_MINOR 0)
+SET(ORXONOX_VERSION_PATCH 3)
+SET(ORXONOX_VERSION 0.0.3)
+SET(ORXONOX_VERSION_NAME "Arcturus")
+
+# Standard path suffixes
+SET(DEFAULT_RUNTIME_PATH bin)
+SET(DEFAULT_LIBRARY_PATH lib)
+SET(DEFAULT_ARCHIVE_PATH lib/static)
+SET(DEFAULT_MODULE_PATH  lib/modules)
+SET(DEFAULT_DOC_PATH     doc)
+SET(DEFAULT_DATA_PATH    data)
+SET(DEFAULT_CONFIG_PATH  config)
+SET(DEFAULT_LOG_PATH     log)
+
+# Set output directories
+SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_RUNTIME_PATH})
+SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH})
+SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH})
+SET(CMAKE_MODULE_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_MODULE_PATH})
+SET(CMAKE_DOC_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH})
+# Data directories are only inputs, no delclaration here
+SET(CMAKE_CONFIG_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH})
+SET(CMAKE_LOG_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH})
+
+# Set the extension of the dynamic modules
+SET(ORXONOX_MODULE_EXTENSION ".module")
+
+# Sets where to find the external libraries like OgreMain.dll at runtime
+# On Unix you should not have to change this at all.
+# This only applies to development runs in the build tree
+SET(RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+
+# Take care of some CMake 2.6.0 leftovers
+MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
+
+# This sets where to look for CMake modules (e.g. "Find*.cmake" files)
+SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+
+# Set Debug build to default when not having multi-config generator like msvc
+IF(NOT CMAKE_CONFIGURATION_TYPES)
+  IF(NOT CMAKE_BUILD_TYPE)
+    SET(CMAKE_BUILD_TYPE Debug CACHE STRING
+        "Build types are: Debug, Release, MinSizeRel, RelWithDebInfo" FORCE)
+  ENDIF()
+  MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE)
+
+  MESSAGE(STATUS "*** Build type is ${CMAKE_BUILD_TYPE} ***")
+ELSE()
+  IF(CMAKE_BUILD_TYPE)
+    SET(CMAKE_BUILD_TYPE CACHE STRING FORCE)
+  ENDIF()
+  MARK_AS_ADVANCED(CMAKE_BUILD_TYPE)
+ENDIF()
+
+# Enable expensive optimisations: use this for a binary release build
+OPTION(ORXONOX_RELEASE "Enable when building restributable releases" FALSE)
+
+########### Subfolders and Subscripts ###########
+
+# Library finding
+INCLUDE(LibraryConfig)
+
+# General build and compiler options and configurations
+INCLUDE(CompilerConfig)
+
+# Configure installation paths and options
+INCLUDE(InstallConfig)
+
+# Configure data directory location and installation
+ADD_SUBDIRECTORY(data)
+
+# Create the actual project
+ADD_SUBDIRECTORY(src)
+
+# Configure the binary output directory. Do this after src!
+ADD_SUBDIRECTORY(bin)
+
+# Last but not least: Try to make a doc target with Doxygen
+ADD_SUBDIRECTORY(doc)
Index: /sandbox_light/INSTALL
===================================================================
--- /sandbox_light/INSTALL	(revision 5788)
+++ /sandbox_light/INSTALL	(revision 5788)
@@ -0,0 +1,26 @@
+************* Build System **************
+To make platform support as easy as possible we have decided to use CMake as our build system.
+Therefore the first thing you need to do is to get
+CMake v.2.6 or later.
+
+************** Libraries ****************
+
+In order to compile Orxonox you will need the following libraries:
+(for windows there are already precompiled packages on the website)
+
+OGRE 3D Graphics Engine          1.4 (1.6 not yet supported)
+CEGUI (Crazy Eddie's GUI System) 0.5
+Boost libraries                  1.34
+ENet (Network library)           1.1
+Lua (scripting language)         5.0 or 5.1
+Tcl (shell script language)      8.4 or 8.5
+OpenAL (audio)                   (no version requirements specified yet)
+ALUT (audio)                     (no version requirements specified yet)
+LibOgg                           (no version requirements specified yet)
+LibVorbis                        (no version requirements specified yet)
+ZLib (compression)               (no version requirements specified yet)
+
+OGRE supports both OpenGL and DirectX9 rendering. You will also need OGRE for the dedicated server!
+
+Further information about installing and running this application can be found on
+http://www.orxonox.net/wiki/Running
Index: /sandbox_light/LICENSE
===================================================================
--- /sandbox_light/LICENSE	(revision 5788)
+++ /sandbox_light/LICENSE	(revision 5788)
@@ -0,0 +1,344 @@
+
+        GNU GENERAL PUBLIC LICENSE
+           Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+          Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+        GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software
+    interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Program does not specify a
+version number of this License, you may choose any version ever
+published by the Free Software Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+          NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+         END OF TERMS AND CONDITIONS
+
+      How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these
+terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Index: /sandbox_light/README
===================================================================
--- /sandbox_light/README	(revision 5788)
+++ /sandbox_light/README	(revision 5788)
@@ -0,0 +1,20 @@
+Hi there,
+
+We are proud to present you Orxonox - the most ferious 3D space shooter ever to exist.
+
+This game is free, if you have paid for this, get your money back! The source code of this game is licensed under the GPL (GNU General Public License). 
+The game content is licensed under the Creative Commons Attribution-Sharealike 2.5 license. For more information read LICENSE in the same folder you found this file.
+
+For directions to install this game, please check out the file INSTALL or http://www.orxonox.net/wiki/Running
+
+This application uses the Ogre Graphics Engine (http://www.ogre3d.org), if you haven't already downloaded a precompiled version of Ogre with this package. Visit our webpage to get your Orxonox compatible version of the Ogre libraries.
+
+This is an open source game. If you want to contribute check out http://www.orxonox.net/wiki/development to find more information how you could help us making the game better. We are always looking for programmers and content designers, who like to contribute.
+
+We hope you have fun playing the game. Check out http://www.orxonox.net for news and newer versions of the game.
+
+Please contact us in our forum ( http://forum.orxonox.net ) or check out our contact page ( http://www.orxonox.net/wiki/about#Contact ). We hope to hear from you and are looking forward to your feedback.
+
+
+Cheers,
+The Orxonox Development Team
Index: /sandbox_light/bin/CMakeLists.txt
===================================================================
--- /sandbox_light/bin/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/bin/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,72 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Creates run scripts in the root directory of the build tree and
+ #    the runtime output directory.
+ #
+
+# Create run scripts for Windows to manually add the DLL path when executing
+SET(RUN_SCRIPTS run)
+IF(WIN32)
+  FOREACH(_script ${RUN_SCRIPTS})
+    LIST(REMOVE_ITEM RUN_SCRIPTS ${_script})
+    LIST(APPEND RUN_SCRIPTS ${_script}.bat)
+  ENDFOREACH(_script)
+ENDIF()
+# Also copy vld.ini (visual leak detector config) for MSVC
+IF(MSVC)
+  LIST(APPEND RUN_SCRIPTS vld.ini)
+ENDIF()
+
+IF(NOT CMAKE_CONFIGURATION_TYPES)
+  SET(_subdirs .)
+  SEt(_default_subdir .)
+ELSE()
+  SET(_subdirs ${CMAKE_CONFIGURATION_TYPES})
+  SEt(_default_subdir) # No default subdir
+ENDIF()
+STRING(REPLACE "/" "\\" RUNTIME_LIBRARY_DIRECTORY_WINDOWS ${RUNTIME_LIBRARY_DIRECTORY})
+FOREACH(_subdir ${_subdirs})
+  GET_FILENAME_COMPONENT(CURRENT_RUNTIME_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_subdir} ABSOLUTE)
+
+  # Note: Do not use FILE(TO_NATIVE_PATH) because it doesn't work for MinGW
+  STRING(REGEX REPLACE "^([A-Z]\\:)\\/.*$" "\\1" WINDOWS_DRIVE_CHANGE ${CURRENT_RUNTIME_DIR})
+  STRING(REPLACE "/" "\\" CURRENT_RUNTIME_DIR_WINDOWS ${CURRENT_RUNTIME_DIR})
+
+  FOREACH(_script ${RUN_SCRIPTS})
+    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${_script}.in ${CURRENT_RUNTIME_DIR}/${_script} @ONLY)
+    IF(_subdir STREQUAL _default_subdir)
+      # Convenience script to be used when sitting in the binary directory. Does nothing for MSVC
+      CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${_script}.in ${CMAKE_BINARY_DIR}/${_script} @ONLY)
+    ENDIF()
+  ENDFOREACH(_script)
+
+  # In order to evaluate at run time whether it is a dev build in the build tree,
+  # we plant a special file
+  CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/orxonox_dev_build.keep_me ${CURRENT_RUNTIME_DIR}/orxonox_dev_build.keep_me)
+ENDFOREACH(_subdir)
+
+
+# Make a symlink to be able to run from the root directory when installing copyable on Unix
+IF(UNIX AND INSTALL_COPYABLE)
+  INSTAll(CODE "EXECUTE_PROCESS(COMMAND ln -sf ${RUNTIME_INSTALL_DIRECTORY}/${ORXONOX_EXECUTABLE_NAME} ${CMAKE_INSTALL_PREFIX}/orxonox)")
+ENDIF()
Index: /sandbox_light/bin/run.bat.in
===================================================================
--- /sandbox_light/bin/run.bat.in	(revision 5788)
+++ /sandbox_light/bin/run.bat.in	(revision 5788)
@@ -0,0 +1,4 @@
+title @PROJECT_NAME@
+path @RUNTIME_LIBRARY_DIRECTORY_WINDOWS@;%path%
+@CURRENT_RUNTIME_DIR_WINDOWS@\@ORXONOX_EXECUTABLE_NAME@
+pause
Index: /sandbox_light/bin/run.in
===================================================================
--- /sandbox_light/bin/run.in	(revision 5788)
+++ /sandbox_light/bin/run.in	(revision 5788)
@@ -0,0 +1,4 @@
+#!/bin/sh
+# convenience script for starting orxonox on Linux
+
+exec @CURRENT_RUNTIME_DIR@/@ORXONOX_EXECUTABLE_NAME@ $@
Index: /sandbox_light/bin/vld.ini.in
===================================================================
--- /sandbox_light/bin/vld.ini.in	(revision 5788)
+++ /sandbox_light/bin/vld.ini.in	(revision 5788)
@@ -0,0 +1,155 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;  Visual Leak Detector - Initialization/Configuration File
+;;  Copyright (c) 2006 Dan Moulding
+;;
+;;  This library is free software; you can redistribute it and/or
+;;  modify it under the terms of the GNU Lesser General Public
+;;  License as published by the Free Software Foundation; either
+;;  version 2.1 of the License, or (at your option) any later version.
+;;
+;;  This library 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
+;;  Lesser General Public License for more details.
+;;
+;;  You should have received a copy of the GNU Lesser General Public
+;;  License along with this library; if not, write to the Free Software
+;;  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+;;
+;;  See COPYING.txt for the full terms of the GNU Lesser General Public License.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+; Any options left blank or not present will revert to their default values.
+[Options]
+
+; The main on/off switch. If off, Visual Leak Detector will be completely
+; disabled. It will do nothing but print a message to the debugger indicating
+; that it has been turned off.
+;
+;  Valid Values: on, off
+;  Default: on
+;
+VLD = @VISUAL_LEAK_DETECTOR_ENABLE@ 
+
+; If yes, duplicate leaks (those that are identical) are not shown individually.
+; Only the first such leak is shown, along with a number indicating the total
+; number of duplicate leaks.
+;
+;   Valid Values: yes, no
+;   Default: no
+;
+AggregateDuplicates = yes
+
+; Lists any additional modules to be included in memory leak detection. This can
+; be useful for checking for memory leaks in debug builds of 3rd party modules
+; which can not be easily rebuilt with '#include "vld.h"'. This option should be
+; used only if absolutely necessary and only if you really know what you are
+; doing.
+;
+;   CAUTION: Avoid listing any modules that link with the release CRT libraries.
+;     Only modules that link with the debug CRT libraries should be listed here.
+;     Doing otherwise might result in false memory leak reports or even crashes.
+;
+;   Valid Values: Any list containing module names (i.e. names of EXEs or DLLs).
+;   Default: None.
+;
+ForceIncludeModules =
+
+; Maximum number of data bytes to display for each leaked block. If zero, then
+; the data dump is completely suppressed and only call stacks are shown.
+; Limiting this to a low number can be useful if any of the leaked blocks are
+; very large and cause unnecessary clutter in the memory leak report.
+;
+;   Value Values: 0 - 4294967295
+;   Default: 4294967295
+;
+MaxDataDump = 
+
+; Maximum number of call stack frames to trace back during leak detection.
+; Limiting this to a low number can reduce the CPU utilization overhead imposed
+; by memory leak detection, especially when using the slower "safe" stack
+; walking method (see StackWalkMethod below).
+;
+;   Valid Values: 1 - 4294967295
+;   Default: 4294967295
+;
+MaxTraceFrames = 
+
+; Sets the type of encoding to use for the generated memory leak report. This
+; option is really only useful in conjuction with sending the report to a file.
+; Sending a Unicode encoded report to the debugger is not useful because the
+; debugger cannot display Unicode characters. Using Unicode encoding might be
+; useful if the data contained in leaked blocks is likely to consist of Unicode
+; text.
+;
+;   Valid Values: ascii, unicode
+;   Default: ascii
+;
+ReportEncoding = ascii
+
+; Sets the report file destination, if reporting to file is enabled. A relative
+; path may be specified and is considered relative to the process' working
+; directory.
+;
+;   Valid Values: Any valid path and filename.
+;   Default: .\memory_leak_report.txt
+;
+ReportFile = 
+
+; Sets the report destination to either a file, the debugger, or both. If
+; reporting to file is enabled, the report is sent to the file specified by the
+; ReportFile option.
+;
+;   Valid Values: debugger, file, both
+;   Default: debugger
+;
+ReportTo = debugger
+
+; Turns on or off a self-test mode which is used to verify that VLD is able to
+; detect memory leaks in itself. Intended to be used for debugging VLD itself,
+; not for debugging other programs.
+;
+;   Valid Values: on, off
+;   Default: off
+;
+SelfTest = off
+
+; Selects the method to be used for walking the stack to obtain stack traces for
+; allocated memory blocks. The "fast" method may not always be able to
+; successfully trace completely through all call stacks. In such cases, the
+; "safe" method may prove to more reliably obtain the full stack trace. The
+; disadvantage is that the "safe" method is significantly slower than the "fast"
+; method and will probably result in very noticeable performance degradation of
+; the program being debugged.
+;
+;   Valid Values: fast, safe
+;   Default: fast
+; 
+StackWalkMethod = fast
+
+; Determines whether memory leak detection should be initially enabled for all
+; threads, or whether it should be initially disabled for all threads. If set
+; to "yes", then any threads requiring memory leak detection to be enabled will
+; need to call VLDEnable at some point to enable leak detection for those
+; threads.
+;
+;   Valid Values: yes, no
+;   Default: no
+;
+StartDisabled = no
+
+; Determines whether or not all frames, including frames internal to the heap,
+; are traced. There will always be a number of frames internal to Visual Leak
+; Detector and C/C++ or Win32 heap APIs that aren't generally useful for
+; determining the cause of a leak. Normally these frames are skipped during the
+; stack trace, which somewhat reduces the time spent tracing and amount of data
+; collected and stored in memory. Including all frames in the stack trace, all
+; the way down into VLD's own code can, however, be useful for debugging VLD
+; itself.
+;
+;   Valid Values: yes, no
+;   Default: no
+;
+TraceInternalFrames = no
Index: /sandbox_light/cmake/CapitaliseName.cmake
===================================================================
--- /sandbox_light/cmake/CapitaliseName.cmake	(revision 5788)
+++ /sandbox_light/cmake/CapitaliseName.cmake	(revision 5788)
@@ -0,0 +1,33 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Examples:
+ #    "orxonox"  --> "Orxonox"
+ #    "ORXONOX"  --> "ORXONOX"
+ #    "1orxonox" --> "1orxonox"
+ #
+
+FUNCTION(CAPITALISE_NAME _name _output_var)
+  STRING(SUBSTRING "${_name}" 0 1 _first_letter)
+  STRING(TOUPPER "${_first_letter}" _first_letter)
+  STRING(REGEX REPLACE "^.(.*)$" "\\1" _rest "${_name}")
+  SET(${_output_var} "${_first_letter}${_rest}" PARENT_SCOPE)
+ENDFUNCTION(CAPITALISE_NAME)
Index: /sandbox_light/cmake/CompareVersionStrings.cmake
===================================================================
--- /sandbox_light/cmake/CompareVersionStrings.cmake	(revision 5788)
+++ /sandbox_light/cmake/CompareVersionStrings.cmake	(revision 5788)
@@ -0,0 +1,78 @@
+# Computes the relationship between two version strings.  A version
+# string is a number delineated by '.'s such as 1.3.2 and 0.99.9.1.
+# You can feed version strings with different number of dot versions,
+# and the shorter version number will be padded with zeros: 9.2 <
+# 9.2.1 will actually compare 9.2.0 < 9.2.1.
+#
+# Input: a_in - value, not variable
+#        b_in - value, not variable
+#        result_out - variable with value:
+#                         -1 : a_in <  b_in
+#                          0 : a_in == b_in
+#                          1 : a_in >  b_in
+#        optional argument - TRUE or default FALSE:
+#              When passing 1.2.3 and 1.2 and this switch is on
+#              the function will actually compare 1.2 < 1.2
+#              Caution: Only the first string is adjusted!
+#
+# Written by James Bigler.
+# Extended with an optional argument by Reto Grieder
+
+FUNCTION(COMPARE_VERSION_STRINGS a_in b_in result_out)
+  # Additional argument can be a switch to change compare behaviour
+  SET(cut_first ${ARGN})
+
+  # Replace '.' with ';' to allow easy tokenization of the string.
+  STRING(REPLACE "." ";" a ${a_in})
+  STRING(REPLACE "." ";" b ${b_in})
+
+  # Check the size of each list to see if they are equal.
+  LIST(LENGTH a a_length)
+  LIST(LENGTH b b_length)
+
+  # Pad the shorter list with zeros.
+
+  IF(a_length LESS b_length)
+    # a is shorter
+    SET(shorter a)
+    MATH(EXPR pad_range "${b_length} - ${a_length} - 1")
+  ELSE(a_length LESS b_length)
+    # b is shorter
+    SET(shorter b)
+    SET(first_longer a)
+    MATH(EXPR pad_range "${a_length} - ${b_length} - 1")
+  ENDIF(a_length LESS b_length)
+
+  # PAD out if we need to
+  IF(NOT pad_range LESS 0)
+    FOREACH(pad RANGE ${pad_range})
+      # Since shorter is an alias for b, we need to get to it by dereferencing shorter.
+      IF(cut_first AND first_longer)
+        LIST(REMOVE_AT a -1) # remove last element
+      ELSE(cut_first AND first_longer)
+        LIST(APPEND ${shorter} 0)
+      ENDIF(cut_first AND first_longer)
+    ENDFOREACH(pad)
+  ENDIF(NOT pad_range LESS 0)
+
+  SET(result 0)
+  SET(index 0)
+  FOREACH(a_version ${a})
+    IF(result EQUAL 0)
+      # Only continue to compare things as long as they are equal
+      LIST(GET b ${index} b_version)
+      # LESS
+      IF(a_version LESS b_version)
+        SET(result -1)
+      ENDIF(a_version LESS b_version)
+      # GREATER
+      IF(a_version GREATER b_version)
+        SET(result 1)
+      ENDIF(a_version GREATER b_version)
+    ENDIF(result EQUAL 0)
+    MATH(EXPR index "${index} + 1")
+  ENDFOREACH(a_version)
+
+  # Copy out the return result
+  SET(${result_out} ${result} PARENT_SCOPE)
+ENDFUNCTION(COMPARE_VERSION_STRINGS)
Index: /sandbox_light/cmake/CompilerConfig.cmake
===================================================================
--- /sandbox_light/cmake/CompilerConfig.cmake	(revision 5788)
+++ /sandbox_light/cmake/CompilerConfig.cmake	(revision 5788)
@@ -0,0 +1,35 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Calls a compiler specific script and sets some options.
+ #
+
+OPTION(EXTRA_COMPILER_WARNINGS "Enable some extra warnings (heavily pollutes the output)" FALSE)
+
+# Configure the compiler specific build options
+IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
+  INCLUDE(CompilerConfigGCC)
+ELSEIF(MSVC)
+  INCLUDE(CompilerConfigMSVC)
+ELSE()
+  MESSAGE(STATUS "Warning: Your compiler is not officially supported.")
+ENDIF()
Index: /sandbox_light/cmake/CompilerConfigGCC.cmake
===================================================================
--- /sandbox_light/cmake/CompilerConfigGCC.cmake	(revision 5788)
+++ /sandbox_light/cmake/CompilerConfigGCC.cmake	(revision 5788)
@@ -0,0 +1,101 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder, Adrian Friedli
+ #  Description:
+ #    Sets the right compiler and linker flags for GCC.
+ #
+
+INCLUDE(FlagUtilities)
+INCLUDE(CompareVersionStrings)
+
+# Shortcut for CMAKE_COMPILER_IS_GNUCXX and ..._GNUC
+SET(CMAKE_COMPILER_IS_GNU TRUE)
+
+# Determine compiler version
+EXEC_PROGRAM(
+  ${CMAKE_CXX_COMPILER}
+  ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
+  OUTPUT_VARIABLE GCC_VERSION
+)
+
+# Complain about incompatibilities
+COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.4.0" _compare_result)
+IF(NOT _compare_result LESS 0)
+  IF(${Boost_VERSION} LESS 103700)
+    MESSAGE(STATUS "Warning: Boost versions earlier than 1.37 may not compile with GCC 4.4 or later!")
+  ENDIF()
+ENDIF()
+
+# GCC may not support #pragma GCC system_header correctly when using
+# templates. According to Bugzilla, it was fixed March 07 but tests
+# have confirmed that GCC 4.0.0 does not pose a problem for our cases.
+COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.0.0" _compare_result)
+IF(_compare_result LESS 0)
+  SET(GCC_NO_SYSTEM_HEADER_SUPPORT TRUE)
+ENDIF()
+
+# GCC only supports PCH in versions 3.4 and above
+INCLUDE(CompareVersionStrings)
+COMPARE_VERSION_STRINGS("${GCC_VERSION}" "3.4.0" _compare_result)
+IF(_compare_result GREATER -1)
+  SET(PCH_COMPILER_SUPPORT TRUE)
+ENDIF()
+
+# Also include environment flags. Could cause conflicts though
+SET_COMPILER_FLAGS("$ENV{CXXFLAGS}" CXX CACHE)
+SET_COMPILER_FLAGS("$ENV{CFLAGS}"   C   CACHE)
+
+# These flags get added to the flags above
+SET_COMPILER_FLAGS("    -g -ggdb -D_DEBUG" Debug          CACHE)
+SET_COMPILER_FLAGS("             -DNDEBUG" ReleaseAll     CACHE)
+ADD_COMPILER_FLAGS("-O3"                   Release        CACHE)
+ADD_COMPILER_FLAGS("-O2 -g -ggdb"          RelWithDebInfo CACHE)
+ADD_COMPILER_FLAGS("-Os"                   MinSizeRel     CACHE)
+
+# CMake doesn't seem to set the PIC flags right on certain 64 bit systems
+IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+  ADD_COMPILER_FLAGS("-fPIC" CACHE)
+ENDIF()
+
+# We have some uncoformant code, disable an optimisation feature
+ADD_COMPILER_FLAGS("-fno-strict-aliasing" CACHE)
+
+# For GCC older than version 4, do not display sign compare warings
+# because of boost::filesystem (which creates about a hundred per include)
+ADD_COMPILER_FLAGS("-Wno-sign-compare" GCC_NO_SYSTEM_HEADER_SUPPORT CACHE)
+
+# For newer GCC (4.3 and above), don't display hundreds of annoying deprecated
+# messages. Other versions don't seem to show any such warnings at all.
+ADD_COMPILER_FLAGS("-Wno-deprecated" CXX CACHE)
+
+# Always show why a precompiled header file could not be used
+ADD_COMPILER_FLAGS("-Winvalid-pch" CXX CACHE)
+
+# Increase warning level if requested
+IF(EXTRA_COMPILER_WARNINGS)
+  ADD_COMPILER_FLAGS("-Wall -Wextra -Wno-unused-parameter" CACHE)
+ELSE()
+  REMOVE_COMPILER_FLAGS("-Wextra -Wno-unused-parameter" CACHE)
+  ADD_COMPILER_FLAGS("-Wall" CACHE)
+ENDIF()
+
+# General linker flags
+SET_LINKER_FLAGS("--no-undefined" CACHE)
Index: /sandbox_light/cmake/CompilerConfigMSVC.cmake
===================================================================
--- /sandbox_light/cmake/CompilerConfigMSVC.cmake	(revision 5788)
+++ /sandbox_light/cmake/CompilerConfigMSVC.cmake	(revision 5788)
@@ -0,0 +1,152 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Sets the right compiler and linker flags for the Microsoft Compiler.
+ #
+
+INCLUDE(FlagUtilities)
+
+################### Compiler Version ####################
+
+# We make use of variadic macros, which is only supported by MSVC 8 and above
+IF(MSVC_VERSION LESS 1400)
+  MESSAGE(FATAL_ERROR "Microsoft Visual Studio versions below 8 (2005) are not supported because of missing compiler extensions.")
+ENDIF()
+
+
+######################## Options ########################
+
+# Currently VLD has a problem with MSVC9 although it actually is supported
+IF(MSVC80)
+  OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" off)
+ENDIF()
+# Make sure the value is "on" or "off" for vld.ini
+IF(VISUAL_LEAK_DETECTOR_ENABLE)
+  SET(VISUAL_LEAK_DETECTOR_ENABLE on)
+ELSE()
+  SET(VISUAL_LEAK_DETECTOR_ENABLE off)
+ENDIF()
+
+# Orxonox only supports MSVC 8 and above, which gets asserted above
+SET(PCH_COMPILER_SUPPORT TRUE)
+
+
+#################### Compiler Flags #####################
+
+# -MD    Minimal Rebuild
+# -RTC1  Both basic runtime checks
+# -MD[d] Multithreaded [debug] DLL
+# -Zi    Program Database
+# -ZI    Program Database for Edit & Continue
+# -WX    General warning Level X
+# -wdX   Disable specific warning X
+# -wnX   Set warning level of specific warning X to level n
+
+# Overwrite CMake default flags first. Be careful with this
+# Only add (not set) the general compiler flags.
+# CMake default flags : -DWIN32 -D_WINDOWS -W3 -Zm1000
+# additionally for CXX: -EHsc -GR
+ADD_COMPILER_FLAGS("-D__WIN32__ -D_WIN32"      CACHE)
+ADD_COMPILER_FLAGS("-D_CRT_SECURE_NO_WARNINGS" CACHE)
+
+# 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)
+
+# Use Link time code generation for Release config if ORXONOX_RELEASE is defined
+IF(ORXONOX_RELEASE)
+  ADD_COMPILER_FLAGS("-GL" ReleaseAll CACHE)
+ENDIF()
+
+
+####################### Warnings ########################
+
+# Increase warning level if requested
+IF(EXTRA_COMPILER_WARNINGS)
+  REMOVE_COMPILER_FLAGS("-W1 -W2 -W3" CACHE)
+  ADD_COMPILER_FLAGS   ("-W4" CACHE)
+ELSE()
+  REMOVE_COMPILER_FLAGS("-W1 -W2 -W4" CACHE)
+  ADD_COMPILER_FLAGS   ("-W3" CACHE)
+ENDIF()
+
+# "<type> needs to have dll-interface to be used by clients'
+# Happens on STL member variables which are not public
+ADD_COMPILER_FLAGS("-w44251" CACHE)
+ADD_COMPILER_FLAGS("-w44275" CACHE) # For inheritance
+
+# Multiple assignment operators specified
+ADD_COMPILER_FLAGS("-w44522" CACHE)
+
+# Forcing values to bool
+ADD_COMPILER_FLAGS("-w44800" CACHE)
+
+# This warns about truncation to 255 characters in debug/browse info
+# ADD_COMPILER_FLAGS("-w44786 -w44503" CACHE)
+
+# conversion from 'double' to 'float', possible loss of data
+# conversion from 'ogg_int64_t' to 'long', possible loss of data
+# ADD_COMPILER_FLAGS("-w44244" CACHE)
+
+# "conversion from 'size_t' to 'unsigned int', possible loss of data
+# ADD_COMPILER_FLAGS("-w44267" CACHE)
+
+# "truncation from 'double' to 'float'
+# ADD_COMPILER_FLAGS("-w44305" CACHE)
+
+# "non dll-interface class used as base for dll-interface class"
+# ADD_COMPILER_FLAGS("-w44275" CACHE)
+
+# "C++ Exception Specification ignored"
+# This is because MSVC 6 did not implement all the C++ exception
+# specifications in the ANSI C++ draft.
+# ADD_COMPILER_FLAGS("-w44290" CACHE)
+
+# "no suitable definition provided for explicit template
+# instantiation request" Occurs in VC7 for no justifiable reason.
+# ADD_COMPILER_FLAGS("-w44661" CACHE)
+
+# Deprecation warnings when using CRT calls in VC8
+# These show up on all C runtime lib code in VC8, disable since they clutter
+# the warnings with things we may not be able to do anything about (e.g.
+# generated code from nvparse etc). I doubt very much that these calls
+# will ever be actually removed from VC anyway, it would break too much code.
+# Note: Probably handled by "-DCRT_SECURE_NO_WARNINGS"
+# ADD_COMPILER_FLAGS("-w44996" CACHE)
+
+# "conditional expression constant"
+# ADD_COMPILER_FLAGS("-w4201" CACHE)
+
+
+##################### Linker Flags ######################
+
+# CMake default flags: -MANIFEST -STACK:10000000 -machine:I386
+# and INCREMENTAL and DEBUG for debug versions
+ADD_LINKER_FLAGS("-OPT:REF -OPT:ICF" Release MinSizeRel CACHE)
+ADD_LINKER_FLAGS("-OPT:NOWIN98" MSVC80 CACHE)
+
+# Use Link time code generation for Release config if ORXONOX_RELEASE is defined
+IF(ORXONOX_RELEASE)
+  ADD_LINKER_FLAGS("-LTCG" ReleaseAll CACHE)
+ENDIF()
Index: /sandbox_light/cmake/DetermineVersion.cmake
===================================================================
--- /sandbox_light/cmake/DetermineVersion.cmake	(revision 5788)
+++ /sandbox_light/cmake/DetermineVersion.cmake	(revision 5788)
@@ -0,0 +1,58 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Inspects a given file for the following expressions
+ #    "NAME_MAJOR_VERSION #"
+ #    "NAME_MINOR_VERSION #"
+ #    "NAME_PATCH_VERSION #"
+ #    and sets NAME_VERSION accordingly. NAME_PART_VERSION variables are also
+ #    set. If you wish to look for different parts (e.g. "first" "second", etc.)
+ #    simply deliver them as additional arguments (have to be three though).
+ #
+
+FUNCTION(DETERMINE_VERSION _name _file)
+  IF(EXISTS ${_file})
+    FILE(READ ${_file} _file_content)
+    SET(_parts ${ARGN})
+    LIST(LENGTH _parts _parts_length)
+    IF(NOT ${_parts_length} EQUAL 3)
+      SET(_parts MAJOR MINOR PATCH)
+    ENDIF()
+
+    FOREACH(_part ${_parts})
+      STRING(REGEX MATCH "${_name}_VERSION_${_part} +([0-9]+)" _match ${_file_content})
+      IF(_match)
+        SET(${_name}_VERSION_${_part} ${CMAKE_MATCH_1})
+        SET(${_name}_VERSION_${_part} ${CMAKE_MATCH_1} PARENT_SCOPE)
+      ELSE()
+        SET(${_name}_VERSION_${_part} "0")
+        SET(${_name}_VERSION_${_part} "0" PARENT_SCOPE)
+      ENDIF()
+      IF("${_parts}" MATCHES "^${_part}") # First?
+        SET(${_name}_VERSION "${${_name}_VERSION_${_part}}")
+      ELSE()
+        SET(${_name}_VERSION "${${_name}_VERSION}.${${_name}_VERSION_${_part}}")
+      ENDIF()
+    ENDFOREACH(_part)
+    SET(${_name}_VERSION "${${_name}_VERSION}" PARENT_SCOPE)
+  ENDIF(EXISTS ${_file})
+ENDFUNCTION(DETERMINE_VERSION)
Index: /sandbox_light/cmake/FindLua.cmake
===================================================================
--- /sandbox_light/cmake/FindLua.cmake	(revision 5788)
+++ /sandbox_light/cmake/FindLua.cmake	(revision 5788)
@@ -0,0 +1,184 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Finds either Lua 5.0 or Lua 5.1 on the system. The script regards the
+ #    VERSION, EXACT, REQUIRED and QUIET arguments. A note about the EXACT
+ #    argument: EXACT 5 will match all Lua 5 versions.
+ #    When the search was successful, the following variables are set:
+ #    LUA_INCLUDE_DIR, LUA_LIBRARIES, LUA_VERSION, LUA_FOUND
+ #
+
+INCLUDE(CompareVersionStrings)
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
+
+# Macro that determines Lua version. Should work for versions 2.2 and above (current release: 5.1.4)
+FUNCTION(DETERMINE_LUA_VERSION _file _varname)
+  IF(EXISTS ${_file})
+    FILE(STRINGS ${_file} _file_content REGEX "LUA_VERSION|LUA_RELEASE")
+  ELSE()
+    SET(${_varname} "0" PARENT_SCOPE)
+    RETURN()
+  ENDIF()
+  STRING(REGEX REPLACE "^.*LUA_RELEASE[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
+  IF(${_varname} STREQUAL "${_file_content}")
+    # At most version 5.1.0
+    STRING(REGEX REPLACE "^.*LUA_VERSION[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
+    IF(${_varname} STREQUAL "${_file_content}")
+      MESSAGE(FATAL_ERROR "Could not determine Lua version which means this script has a bug")
+    ENDIF()
+    IF(${_varname} MATCHES "^[0-9]+\\.[0-9]+$")
+      SET(${_varname} "${${_varname}}.0") # E.g. "3.2" is "3.2.0" actually
+    ENDIF()
+  ENDIF()
+  SET(${_varname} "${${_varname}}" PARENT_SCOPE)
+ENDFUNCTION(DETERMINE_LUA_VERSION)
+
+
+# Find Lua 5.1
+FIND_PATH(LUA_5.1_INCLUDE_DIR lua.h
+  PATHS $ENV{LUA_DIR}
+  PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
+)
+IF(LUA_5.1_INCLUDE_DIR)
+  DETERMINE_LUA_VERSION(${LUA_5.1_INCLUDE_DIR}/lua.h LUA_5.1_VERSION)
+  COMPARE_VERSION_STRINGS("${LUA_5.1_VERSION}" "5.1" _version_compare TRUE)
+  IF(NOT _version_compare EQUAL 0)
+    # Incorrect version found, abort search
+    SET(LUA_5.1_INCLUDE_DIR "LUA_5.1_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
+  ELSE()
+    FIND_LIBRARY(LUA_5.1_LIBRARY_OPTIMIZED
+      NAMES lua51 lua5.1 lua
+      PATHS $ENV{LUA_DIR}
+      PATH_SUFFIXES lib64 lib
+    )
+    FIND_LIBRARY(LUA_5.1_LIBRARY_DEBUG
+      NAMES lua51d lua51_d lua5.1d lua5.1_d luad lua_d
+            lua51D lua51_D lua5.1D lua5.1_D luad lua_D
+      PATHS $ENV{LUA_DIR}
+      PATH_SUFFIXES lib64 lib
+    )
+    HANDLE_LIBRARY_TYPES(LUA_5.1)
+    SET(LUA_5.1_LIBRARIES ${LUA_5.1_LIBRARY})
+    IF(LUA_5.1_LIBRARIES)
+      SET(LUA_5.1_FOUND TRUE)
+    ENDIF()
+  ENDIF(NOT _version_compare EQUAL 0)
+ENDIF(LUA_5.1_INCLUDE_DIR)
+
+
+# Find Lua 5.0
+FIND_PATH(LUA_5.0_INCLUDE_DIR lua.h
+  PATHS $ENV{LUA_DIR}
+  PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include
+)
+IF(LUA_5.0_INCLUDE_DIR)
+  DETERMINE_LUA_VERSION(${LUA_5.0_INCLUDE_DIR}/lua.h LUA_5.0_VERSION)
+  COMPARE_VERSION_STRINGS("${LUA_5.0_VERSION}" "5.0" _version_compare TRUE)
+  IF(NOT _version_compare EQUAL 0)
+    # Incorrect version found, abourt search
+    SET(LUA_5.0_INCLUDE_DIR "LUA_5.0_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
+  ELSE()
+    FIND_LIBRARY(LUA_5.0_LUA_LIBRARY_OPTIMIZED
+      NAMES lua50 lua5.0 lua5 lua
+      PATHS $ENV{LUA_DIR}
+      PATH_SUFFIXES lib64 lib
+    )
+    FIND_LIBRARY(LUA_5.0_LUA_LIBRARY_DEBUG
+      NAMES lua50d lua50_d lua5.0d lua5.0_d lua5d lua5_d luad lua_d
+            lua50D lua50_D lua5.0D lua5.0_D lua5d lua5_D luaD lua_D
+      PATHS $ENV{LUA_DIR}
+      PATH_SUFFIXES lib64 lib
+    )
+    HANDLE_LIBRARY_TYPES(LUA_5.0_LUA)
+
+    # In an OS X framework, lualib is usually included as part of the framework
+    # (like GLU in OpenGL.framework)
+    IF(${LUA_5.0_LUA_LIBRARY} MATCHES "framework")
+      SET(LUA_5.0_LIBRARIES ${LUA_5.0_LUA_LIBRARY})
+    ELSE()
+      FIND_LIBRARY(LUA_5.0_LUALIB_LIBRARY_OPTIMIZED
+        NAMES lualib50 lualib5.0 lualib5 lualib
+        PATHS $ENV{LUALIB_DIR} $ENV{LUA_DIR}
+        PATH_SUFFIXES lib64 lib
+      )
+      FIND_LIBRARY(LUA_5.0_LUALIB_LIBRARY_DEBUG
+        NAMES lualib50d lualib50_d lualib5.0d lualib5.0_d
+              lualib5d lualib5_d lualibd lualib_d
+              lualib50D lualib50_D lualib5.0D lualib5.0_D
+              lualib5D lualib5_D lualibD lualib_D
+        PATHS $ENV{LUALIB_DIR} $ENV{LUA_DIR}
+        PATH_SUFFIXES lib64 lib
+      )
+      HANDLE_LIBRARY_TYPES(LUA_5.0_LUALIB)
+      # Both libraries are required for Lua 5.0 to be found
+      IF(LUA_5.0_LUA_LIBRARY AND LUA_5.0_LUALIB_LIBRARY)
+        SET(LUA_5.0_LIBRARIES ${LUA_5.0_LUA_LIBRARY} ${LUA_5.0_LUALIB_LIBRARY})
+      ENDIF()
+    ENDIF(${LUA_5.0_LUA_LIBRARY} MATCHES "framework")
+    
+    IF(LUA_5.0_LIBRARIES)
+      SET(LUA_5.0_FOUND TRUE)
+    ENDIF()
+  ENDIF(NOT _version_compare EQUAL 0)
+ENDIF(LUA_5.0_INCLUDE_DIR)
+
+# Pick the right version
+IF(Lua_FIND_VERSION_EXACT AND NOT Lua_FIND_VERSION MATCHES "^[0-9]*$")
+  STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+)(\\..*)?$" "\\1" LUA_VERSION_SELECTION ${Lua_FIND_VERSION})
+ELSE()
+  IF(LUA_5.1_FOUND) # Prefer version 5.1 if found
+    SET(LUA_VERSION_SELECTION "5.1")
+  ELSEIF(LUA_5.0_FOUND)
+    SET(LUA_VERSION_SELECTION "5.0")
+  ENDIF()
+ENDIF()
+
+SET(LUA_INCLUDE_DIR "${LUA_${LUA_VERSION_SELECTION}_INCLUDE_DIR}")
+SET(LUA_LIBRARIES "${LUA_${LUA_VERSION_SELECTION}_LIBRARIES}")
+SET(LUA_VERSION_LONG "${LUA_${LUA_VERSION_SELECTION}_VERSION}")
+SET(LUA_VERSION "${LUA_VERSION_SELECTION}")
+
+FIND_PACKAGE_HANDLE_ADVANCED_ARGS(Lua DEFAULT_MSG "${LUA_VERSION_LONG}"
+  LUA_LIBRARIES
+  LUA_INCLUDE_DIR
+)
+
+# Include the math library for Unix only
+IF(LUA_FOUND)
+  IF(UNIX AND NOT APPLE)
+    FIND_LIBRARY(UNIX_MATH_LIBRARY m)
+    SET(LUA_LIBRARIES ${LUA_LIBRARIES} ${UNIX_MATH_LIBRARY})
+  ENDIF()
+ENDIF(LUA_FOUND)
+
+MARK_AS_ADVANCED(
+  LUA_5.0_INCLUDE_DIR
+  LUA_5.0_LUA_LIBRARY_OPTIMIZED
+  LUA_5.0_LUA_LIBRARY_DEBUG
+  LUA_5.0_LUALIB_LIBRARY_OPTIMIZED
+  LUA_5.0_LUALIB_LIBRARY_DEBUG
+  LUA_5.1_INCLUDE_DIR
+  LUA_5.1_LIBRARY_OPTIMIZED
+  LUA_5.1_LIBRARY_DEBUG
+  UNIX_MATH_LIBRARY
+)
Index: /sandbox_light/cmake/FindOGRE.cmake
===================================================================
--- /sandbox_light/cmake/FindOGRE.cmake	(revision 5788)
+++ /sandbox_light/cmake/FindOGRE.cmake	(revision 5788)
@@ -0,0 +1,55 @@
+# Find OGRE includes and library
+#
+# This module defines
+#  OGRE_INCLUDE_DIR
+#  OGRE_LIBRARY, the library to link against to use OGRE.
+#  OGRE_FOUND, If false, do not try to use OGRE
+#
+# Copyright © 2007, Matt Williams
+# Modified by Nicolas Schlumberger to make it work on the Tardis-Infrastucture
+# of the ETH Zurich (removed later on)
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Lots of simplifications by Adrian Friedli
+# Version checking by Reto Grieder
+#                 > www.orxonox.net <
+
+INCLUDE(DetermineVersion)
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
+
+FIND_PATH(OGRE_INCLUDE_DIR Ogre.h
+  PATHS $ENV{OGRE_HOME}
+  PATH_SUFFIXES include include/OGRE Ogre.framework/Headers
+)
+FIND_LIBRARY(OGRE_LIBRARY_OPTIMIZED
+  NAMES OgreMain Ogre
+  PATHS $ENV{OGRE_HOME}
+  PATH_SUFFIXES lib bin/Release bin/release Release release
+)
+FIND_LIBRARY(OGRE_LIBRARY_DEBUG
+  NAMES OgreMaind OgreMain_d OgreMainD OgreMain_D Ogred Ogre_d OgreD Ogre_d
+  PATHS $ENV{OGRE_HOME}
+  PATH_SUFFIXES lib bin/Debug bin/debug Debug debug Versions/A
+)
+
+# Inspect OgrePrerquisites.h for the version number
+DETERMINE_VERSION(OGRE ${OGRE_INCLUDE_DIR}/OgrePrerequisites.h)
+
+# Handle the REQUIRED argument and set OGRE_FOUND
+# Also check the version requirements
+FIND_PACKAGE_HANDLE_ADVANCED_ARGS(OGRE DEFAULT_MSG ${OGRE_VERSION}
+  OGRE_LIBRARY_OPTIMIZED
+  OGRE_INCLUDE_DIR
+)
+
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(OGRE)
+
+MARK_AS_ADVANCED(
+  OGRE_INCLUDE_DIR
+  OGRE_LIBRARY_OPTIMIZED
+  OGRE_LIBRARY_DEBUG
+)
Index: /sandbox_light/cmake/FindPackageHandleAdvancedArgs.cmake
===================================================================
--- /sandbox_light/cmake/FindPackageHandleAdvancedArgs.cmake	(revision 5788)
+++ /sandbox_light/cmake/FindPackageHandleAdvancedArgs.cmake	(revision 5788)
@@ -0,0 +1,66 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Extension of the standard module "FindPackageHandleStandardArgs".
+ #    This function also checks the version requirements. Also regards the
+ #    EXACT keyword if specified in FIND_PACKAGE(...).
+ #
+ 
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(CompareVersionStrings)
+
+FUNCTION(FIND_PACKAGE_HANDLE_ADVANCED_ARGS _name _fail_msg _version)
+
+  # Modify the message to include version requirements
+  IF("${_fail_msg}" STREQUAL "DEFAULT_MSG")
+    SET(_fail_msg_adv "Could NOT find ${_name}")
+  ELSE()
+    SET(_fail_msg_adv "${_fail_msg}")
+  ENDIF()
+  IF(${_name}_FIND_VERSION_EXACT)
+    SET(_fail_msg_adv "${_fail_msg_adv} (version requirements: exactly ${${_name}_FIND_VERSION})")
+  ELSE()
+    SET(_fail_msg_adv "${_fail_msg_adv} (version requirements: at least ${${_name}_FIND_VERSION})")
+  ENDIF()
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS("${_name}" "${_fail_msg_adv}" ${ARGN})
+  STRING(TOUPPER ${_name} _NAME_UPPER)
+
+  # Also check version requirements if given to FindPackage(...)
+  IF(${_name}_FIND_VERSION)
+    # Note: the last argument of the function tells it to cut the first
+    #       version string instead of padding it with zeros if necessary
+    COMPARE_VERSION_STRINGS("${_version}" "${${_name}_FIND_VERSION}" _compatible TRUE)
+    IF(${_name}_FIND_VERSION_EXACT AND NOT _compatible EQUAL 0)
+      MESSAGE(FATAL_ERROR "Exact ${_name} version required is ${${_name}_FIND_VERSION}\n"
+                          "Your version is ${_version}")
+      SET(${_NAME_UPPER}_FOUND FALSE)
+    ELSEIF(_compatible LESS 0)
+      MESSAGE(FATAL_ERROR "Minimum ${_name} version required is ${${_name}_FIND_VERSION}\n"
+                          "Your version is ${_version}")
+      SET(${_NAME_UPPER}_FOUND FALSE)
+    ENDIF()
+  ENDIF(${_name}_FIND_VERSION)
+
+  # Raise scope (FindPackageHandleStandardArgs uses PARENT_SCOPE)
+  SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
+
+ENDFUNCTION(FIND_PACKAGE_HANDLE_ADVANCED_ARGS)
Index: /sandbox_light/cmake/FlagUtilities.cmake
===================================================================
--- /sandbox_light/cmake/FlagUtilities.cmake	(revision 5788)
+++ /sandbox_light/cmake/FlagUtilities.cmake	(revision 5788)
@@ -0,0 +1,177 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Sets the compiler/linker flags. After the flags you can specify more args:
+ #    Release, Debug, RelWithDebInfo, MinSizeRel: Build configs (inclusive)
+ #    ReleaseAll: Sets the flags of all three release builds
+ #    CACHE: Values are witten with SET_CACHE_ADVANCED
+ #    FORCE: When writing to the cache, the values are set anyway
+ #    Any variable names (like WIN32, MSVC, etc.): Condition (combined with AND)
+ #    You can suffix the condition with a NOT if you wish
+ #  Function names:
+ #    [ADD/SET/REMOVE]_[COMPILER/LINKER]_FLAGS
+ #  Caution: -If you use CACHE after calling the macro without CACHE, the value
+ #            Will not be written unless FORCE is specified.
+ #          - Also be aware to always specify the flags in quotes.
+ #  Example:
+ #    REMOVE_COMPILER_FLAGS("/Gm "asdf" -q"test -foo" CXX ReleaseAll NOT UNIX)
+ #    This will only remove the CXX (C++) flags on a non Unix system for the
+ #    Release, RelWithDebInfo and MinSizeRel configurations. The macros should
+ #    be able to cope with "test -foo" as string argument for a flag.
+ #
+
+INCLUDE(SeparateFlags)
+INCLUDE(SetCacheAdvanced)
+
+# Compiler flags, additional arguments:
+# C, CXX: Specify a language, default is both
+MACRO(SET_COMPILER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(SET "C;CXX" "" "${_flags}" "${ARGN}")
+ENDMACRO(SET_COMPILER_FLAGS)
+# Add flags (flags don't get added twice)
+MACRO(ADD_COMPILER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(APPEND "C;CXX" "" "${_flags}" "${ARGN}")
+ENDMACRO(ADD_COMPILER_FLAGS)
+# Remove flags
+MACRO(REMOVE_COMPILER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(REMOVE_ITEM "C;CXX" "" "${_flags}" "${ARGN}")
+ENDMACRO(REMOVE_COMPILER_FLAGS)
+
+
+# Linker flags, additional arguments:
+# EXE, SHARED, MODULE: Specify a linker mode, default is all three
+MACRO(SET_LINKER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(SET "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
+ENDMACRO(SET_LINKER_FLAGS)
+# Add flags (flags don't get added twice)
+MACRO(ADD_LINKER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(APPEND "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
+ENDMACRO(ADD_LINKER_FLAGS)
+# Remove flags
+MACRO(REMOVE_LINKER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(REMOVE_ITEM "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
+ENDMACRO(REMOVE_LINKER_FLAGS)
+
+
+# Internal macro, do not use
+# Parses the given additional arguments and sets the flags to the
+# corresponding variables.
+MACRO(_INTERNAL_PARSE_FLAGS_ARGS _mode _keys _key_postfix _flags)
+  SET(_langs)
+  SET(_build_types)
+  SET(_cond TRUE)
+  SET(_invert_condition FALSE)
+  SET(_write_to_cache FALSE)
+  SET(_force FALSE)
+  STRING(REPLACE ";" "|" _key_regex "${_keys}")
+  SET(_key_regex "^(${_key_regex})$")
+
+  FOREACH(_arg ${ARGN})
+    IF(_arg MATCHES "${_key_regex}")
+      LIST(APPEND _langs "${_arg}")
+    ELSEIF(   _arg MATCHES "^(Debug|Release|MinSizeRel|RelWithDebInfo)$"
+           OR _arg MATCHES "^(DEBUG|RELEASE|MINSIZEREL|RELWITHDEBINFO)$")
+      STRING(TOUPPER "${_arg}" _upper_arg)
+      LIST(APPEND _build_types ${_upper_arg})
+    ELSEIF(_arg STREQUAL "ReleaseAll")
+      LIST(APPEND _build_types RELEASE MINSIZEREL RELWITHDEBINFO)
+    ELSEIF(_arg STREQUAL "CACHE")
+      SET(_write_to_cache TRUE)
+    ELSEIF(_arg STREQUAL "FORCE")
+      SET(_force TRUE)
+    ELSEIF(_arg MATCHES "^[Nn][Oo][Tt]$")
+      SET(_invert_condition TRUE)
+    ELSE()
+      IF(_invert_condition)
+        SET(_invert_condition FALSE)
+        IF(${_arg})
+          SET(_arg_cond FALSE)
+        ELSE()
+          SET(_arg_cond TRUE)
+       ENDIF()
+      ELSE()
+        SET(_arg_cond ${${_arg}})
+      ENDIF()
+      IF(_cond AND _arg_cond)
+        SET(_cond TRUE)
+      ELSE()
+        SET(_cond FALSE)
+      ENDIF()
+    ENDIF()
+  ENDFOREACH(_arg)
+
+  # No language specified, use all: C and CXX or EXE, SHARED and MODULE
+  IF(NOT DEFINED _langs)
+    SET(_langs ${_keys})
+  ENDIF()
+
+  IF(_cond)
+    FOREACH(_lang ${_langs})
+      SET(_varname "CMAKE_${_lang}${_key_postfix}_FLAGS")
+      IF(DEFINED _build_types)
+        FOREACH(_build_type ${_build_types})
+          _INTERNAL_PARSE_FLAGS(${_mode} "${_flags}" ${_varname}_${_build_type} ${_write_to_cache} ${_force})
+        ENDFOREACH(_build_type)
+      ELSE()
+        _INTERNAL_PARSE_FLAGS(${_mode} "${_flags}" ${_varname} ${_write_to_cache} ${_force})
+      ENDIF()
+    ENDFOREACH(_lang ${_langs})
+  ENDIF(_cond)
+ENDMACRO(_INTERNAL_PARSE_FLAGS_ARGS)
+
+
+# Internal macro, do not use
+# Modifies the flags according to the mode: set, add or remove
+# Also sets flags according to the CACHE and FORCE parameter.
+# If only CACHE is specified, SET_CACHE_ADVANCED() is used.
+MACRO(_INTERNAL_PARSE_FLAGS _mode _flags _varname _write_to_cache _force)
+  SEPARATE_FLAGS("${_flags}" _arg_flag_list)
+
+  IF("${_mode}" STREQUAL "SET")
+    # SET
+    SET(_flag_list "${_arg_flag_list}")
+  ELSE()
+    # ADD or REMOVE
+    SEPARATE_FLAGS("${${_varname}}" _flag_list)
+    IF(NOT _flag_list)
+      SET(_flag_list "") # LIST command requires a list in any case
+    ENDIF()
+    FOREACH(_flag ${_arg_flag_list})
+      LIST(${_mode} _flag_list "${_flag}")
+    ENDFOREACH(_flag)
+  ENDIF()
+
+  LIST(REMOVE_DUPLICATES _flag_list)
+  LIST(SORT _flag_list)
+  STRING(REPLACE ";" " " _flag_list "${_flag_list}")
+
+  IF(_write_to_cache)
+    IF(_force)
+      SET(${_varname} "${_flag_list}" CACHE STRING "${${_varname}}" FORCE)
+      SET(${_varname} "${_flag_list}" CACHE STRING "${${_varname}}" FORCE)
+    ELSE()
+      SET_CACHE_ADVANCED(${_varname} STRING "${${_varname}}" "${_flag_list}")
+    ENDIF()
+  ELSE()
+    SET(${_varname} "${_flag_list}")
+  ENDIF()
+ENDMACRO(_INTERNAL_PARSE_FLAGS)
Index: /sandbox_light/cmake/GenerateToluaBindings.cmake
===================================================================
--- /sandbox_light/cmake/GenerateToluaBindings.cmake	(revision 5788)
+++ /sandbox_light/cmake/GenerateToluaBindings.cmake	(revision 5788)
@@ -0,0 +1,79 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Adrian Friedli
+ #  Description:
+ #    Sets the CMake options that will generate Tolua++ bindings.
+ #  Parameters:
+ #    _tolua_package - Name of the package, e.g. "Core"
+ #    _target_source_files - Variable name of the target source files, the
+ #                           script will add the generated files to this list.
+ #    ARGN - The header files in the style "INTPUTFILES Foo.h Bar.h"
+ #  Global Variables: (need to be set before)
+ #    TOLUA_PARSER_SOURCE - Lua file with the parser source code
+ #    TOLUA_PARSER_DEPENDENCIES - All the dependent lua files
+ #    RUNTIME_LIBRARY_DIRECTORY - Working directory
+ #
+
+FUNCTION(GENERATE_TOLUA_BINDINGS _tolua_package _target_source_files)
+  SET(_tolua_inputfiles ${ARGN})
+  LIST(REMOVE_ITEM _tolua_inputfiles "INPUTFILES")
+
+  SET(_tolua_pkgfile "${CMAKE_CURRENT_BINARY_DIR}/tolua.pkg")
+  SET(_tolua_cxxfile "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.cc")
+  SET(_tolua_hfile   "${CMAKE_BINARY_DIR}/src/toluabind/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.h")
+
+  SET(${_target_source_files}
+    ${${_target_source_files}}
+    ${_tolua_cxxfile}
+    ${_tolua_hfile}
+    PARENT_SCOPE
+  )
+  SOURCE_GROUP("Tolua" FILES ${_tolua_cxxfile} ${_tolua_hfile})
+  # Disable annoying GCC warnings
+  IF(CMAKE_COMPILER_IS_GNU)
+    SET_SOURCE_FILES_PROPERTIES(${_tolua_cxxfile} PROPERTIES COMPILE_FLAGS "-w")
+  ENDIF()
+  # Tolua binding speedup if required
+  IF(ORXONOX_RELEASE)
+    SET_SOURCE_FILES_PROPERTIES(${_tolua_cxxfile} PROPERTIES COMPILE_FLAGS "-DTOLUA_RELEASE")
+  ENDIF()
+
+  # Create temporary package file and implicit dependencies
+  FILE(REMOVE ${_tolua_pkgfile})
+  FOREACH(_tolua_inputfile ${_tolua_inputfiles})
+    FILE(APPEND ${_tolua_pkgfile} "\$cfile \"${_tolua_inputfile}\"\n")
+    LIST(APPEND _implicit_dependencies CXX ${_tolua_inputfile})
+  ENDFOREACH(_tolua_inputfile)
+
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${_tolua_cxxfile} ${_tolua_hfile}
+    COMMAND tolua++app_orxonox -n ${_tolua_package}
+                               -w ${CMAKE_CURRENT_SOURCE_DIR}
+                               -o ${_tolua_cxxfile}
+                               -H ${_tolua_hfile}
+                               -s ${TOLUA_PARSER_SOURCE}
+                                  ${_tolua_pkgfile}
+    DEPENDS           ${TOLUA_PARSER_DEPENDENCIES}
+    IMPLICIT_DEPENDS  ${_implicit_dependencies}
+    WORKING_DIRECTORY ${RUNTIME_LIBRARY_DIRECTORY}
+    COMMENT "Generating tolua bind files for package ${_tolua_package}"
+  )
+ENDFUNCTION(GENERATE_TOLUA_BINDINGS)
Index: /sandbox_light/cmake/GetGCCCompilerFlags.cmake
===================================================================
--- /sandbox_light/cmake/GetGCCCompilerFlags.cmake	(revision 5788)
+++ /sandbox_light/cmake/GetGCCCompilerFlags.cmake	(revision 5788)
@@ -0,0 +1,73 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Tries to return all GCC compiler flags set for a target. This also
+ #    all definitions of the current directory.
+ #
+
+INCLUDE(SeparateFlags)
+
+FUNCTION(GET_GCC_COMPILER_FLAGS _target _flagsvar)
+
+  # General flags
+  STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type_upper)
+  SET(_flag_str "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_build_type_upper}}")
+
+  # Include directories
+  GET_DIRECTORY_PROPERTY(_include_dirs INCLUDE_DIRECTORIES)
+  IF(_include_dirs)
+    FOREACH(_directory ${_include_dirs})
+      SET(_flag_str "${_flag_str} -I${_directory}")
+    ENDFOREACH(_directory)
+  ENDIF()
+
+  # For shared libraries linked with gcc, we have to add -fPIC
+  GET_TARGET_PROPERTY(_target_type ${_target} TYPE)
+  IF(NOT MINGW AND ${_target_type} STREQUAL SHARED_LIBRARY)
+    SET(_flag_str "${_flag_str} -fPIC")
+  ENDIF()
+
+  # Target compile flags
+  GET_TARGET_PROPERTY(_target_flags ${_target} COMPILE_FLAGS)
+  IF(_target_flags)
+    SET(_flag_str "${_flag_str} ${_target_flags}")
+  ENDIF()
+
+  # Definitions from target and directory
+  GET_DIRECTORY_PROPERTY(_directory_defs                 COMPILE_DEFINITIONS)
+  GET_DIRECTORY_PROPERTY(_directory_defs_build_type      COMPILE_DEFINITIONS_${_build_type_upper})
+  GET_TARGET_PROPERTY(_target_defs            ${_target} COMPILE_DEFINITIONS)
+  GET_TARGET_PROPERTY(_target_defs_build_type ${_target} COMPILE_DEFINITIONS_${_build_type_upper})
+  GET_TARGET_PROPERTY(_target_def_symbol      ${_target} DEFINE_SYMBOL)
+  # Prefix them all with a "-D" if the property was found
+  FOREACH(_def ${_directory_defs} ${_directory_defs_build_type} ${_target_defs}
+               ${_target_defs_build_type} ${_target_def_symbol})
+    IF(_def)
+      SET(_flag_str "${_flag_str} -D${_def}")
+    ENDIF(_def)
+  ENDFOREACH(_def)
+
+  SEPARATE_FLAGS("${_flag_str}" _flags)
+  LIST(REMOVE_DUPLICATES _flags)
+  SET(${_flagsvar} ${_flags} PARENT_SCOPE)
+
+ENDFUNCTION(GET_GCC_COMPILER_FLAGS)
Index: /sandbox_light/cmake/HandleLibraryTypes.cmake
===================================================================
--- /sandbox_light/cmake/HandleLibraryTypes.cmake	(revision 5788)
+++ /sandbox_light/cmake/HandleLibraryTypes.cmake	(revision 5788)
@@ -0,0 +1,42 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Checks debug and optimized libaries and sets the variable ${_name}_LIBRARY
+ #    accordingly. If only an optimized library was found, the "optimized"
+ #    keyword is omitted to support the debug version too.
+ #
+
+FUNCTION(HANDLE_LIBRARY_TYPES _name)
+  # Additional libraries can be added as additional arguments
+  IF(${_name}_LIBRARY_DEBUG AND ${_name}_LIBRARY_OPTIMIZED)
+    SET(${_name}_LIBRARY
+      optimized ${${_name}_LIBRARY_OPTIMIZED} ${ARGN}
+      debug     ${${_name}_LIBRARY_DEBUG}     ${ARGN}
+      PARENT_SCOPE
+    )
+  ELSE()
+    SET(${_name}_LIBRARY
+      ${${_name}_LIBRARY_OPTIMIZED} ${ARGN}
+      PARENT_SCOPE
+     )
+  ENDIF()
+ENDFUNCTION(HANDLE_LIBRARY_TYPES)
Index: /sandbox_light/cmake/InstallConfig.cmake
===================================================================
--- /sandbox_light/cmake/InstallConfig.cmake	(revision 5788)
+++ /sandbox_light/cmake/InstallConfig.cmake	(revision 5788)
@@ -0,0 +1,82 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Configures the installation (paths, rpaths, options)
+ #
+
+IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # Variable provided by CMake
+  IF("$ENV{ORXONOX_DEV}" OR TARDIS)
+    SET(_install_prefix_changed 1)
+    SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH
+        "Install path prefix, prepended onto install directories." FORCE)
+  ENDIF()
+ENDIF()
+
+SET(_info_text "Puts all installed files in subfolders of the install prefix path. That root folder can then be moved, copied and renamed as you wish. The executable will not write to folders like ~/.orxonox or \"Applictation Data\"")
+IF(UNIX AND NOT _install_prefix_changed)
+  OPTION(INSTALL_COPYABLE "${_info_text}" FALSE)
+ELSE()
+  OPTION(INSTALL_COPYABLE "${_info_text}" TRUE)
+ENDIF()
+
+# Default installation paths
+SET(RUNTIME_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_RUNTIME_PATH})
+SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LIBRARY_PATH})
+SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_ARCHIVE_PATH})
+SET(MODULE_INSTALL_DIRECTORY  ${CMAKE_INSTALL_PREFIX}/${DEFAULT_MODULE_PATH})
+SET(DOC_INSTALL_DIRECTORY     ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DOC_PATH})
+SET(DATA_INSTALL_DIRECTORY    ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DATA_PATH})
+SET(CONFIG_INSTALL_DIRECTORY  ${CMAKE_INSTALL_PREFIX}/${DEFAULT_CONFIG_PATH})
+SET(LOG_INSTALL_DIRECTORY     ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LOG_PATH})
+
+IF(NOT INSTALL_COPYABLE)
+  IF(UNIX) # Apple too?
+    # Using absolute paths
+    SET(RUNTIME_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)
+    SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/orxonox)
+    SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/orxonox/static)
+    SET(MODULE_INSTALL_DIRECTORY  ${CMAKE_INSTALL_PREFIX}/lib/orxonox/modules)
+    SET(DOC_INSTALL_DIRECTORY     ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox)
+    SET(DATA_INSTALL_DIRECTORY    ${CMAKE_INSTALL_PREFIX}/share/orxonox)
+  ENDIF()
+
+  # Leave empty because it is user and therefore runtime dependent
+  SET(CONFIG_INSTALL_DIRECTORY)
+  SET(LOG_INSTALL_DIRECTORY)
+ENDIF()
+
+################## Unix rpath ###################
+
+# When building, don't use the install RPATH already
+# (but later on when installing)
+SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+# The RPATH to be used when installing
+IF(INSTALL_COPYABLE)
+  SET(CMAKE_INSTALL_RPATH ${DEFAULT_LIBRARY_PATH})
+ELSE()
+  SET(CMAKE_INSTALL_RPATH ${LIBRARY_INSTALL_DIRECTORY})
+ENDIF()
+
+# Add the automatically determined parts of the RPATH
+# which point to directories outside the build tree to the install RPATH
+SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
Index: /sandbox_light/cmake/LibraryConfig.cmake
===================================================================
--- /sandbox_light/cmake/LibraryConfig.cmake	(revision 5788)
+++ /sandbox_light/cmake/LibraryConfig.cmake	(revision 5788)
@@ -0,0 +1,119 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Configures the external libraries. Whenever possible, the find scripts
+ #    from the CMake module path are used, but that required some adjustments
+ #    for certain libraries (Boost, OpenAL, TCL)
+ #
+ 
+INCLUDE(CompareVersionStrings)
+INCLUDE(FindPackageHandleStandardArgs)
+
+# Prevent CMake from finding libraries in the installation folder on Windows.
+# There might already be an installation from another compiler
+IF(WIN32)
+  LIST(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH  "${CMAKE_INSTALL_PREFIX}")
+  LIST(REMOVE_ITEM CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin")
+ENDIF()
+
+############## Platform Scripts #################
+
+# On Windows using a package causes way less problems
+SET(_option_msg "Set this to true to use precompiled dependecy archives")
+IF(WIN32)
+  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" ON)
+ELSE(WIN32)
+  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
+ENDIF(WIN32)
+
+# Scripts for specific library and CMake config
+INCLUDE(LibraryConfigTardis)
+
+IF(DEPENDENCY_PACKAGE_ENABLE)
+  GET_FILENAME_COMPONENT(_dep_dir_1 ${CMAKE_SOURCE_DIR}/../dependencies ABSOLUTE)
+  GET_FILENAME_COMPONENT(_dep_dir_2 ${CMAKE_SOURCE_DIR}/../lib_dist/dependencies ABSOLUTE)
+  FIND_PATH(DEPENDENCY_PACKAGE_DIR
+    NAMES include
+    PATHS
+      ${CMAKE_SOURCE_DIR}/dependencies
+      ${_dep_dir_1}
+      ${_dep_dir_2}
+    NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH
+  )
+  IF(NOT DEPENDENCY_PACKAGE_DIR)
+    MESSAGE(STATUS "Warning: Could not find dependency directory."
+                   "Disable LIBRARY_USE_PACKAGE if you have none intalled.")
+  ELSE()
+    INCLUDE(PackageConfigMinGW)
+    INCLUDE(PackageConfigMSVC)
+    INCLUDE(PackageConfig) # For both msvc and mingw
+  ENDIF()
+ENDIF(DEPENDENCY_PACKAGE_ENABLE)
+
+############### Library finding #################
+# Performs the search and sets the variables    #
+
+FIND_PACKAGE(OGRE  1.4       REQUIRED)
+##### Lua #####
+IF(CEGUILUA_USE_EXTERNAL_LIBRARY)
+  COMPARE_VERSION_STRINGS(${CEGUI_VERSION} "0.6" _version_comparison)
+  IF(version_comparison LESS 0)
+    SET(LUA_VERSION_REQUEST 5.0)
+  ELSE()
+    SET(LUA_VERSION_REQUEST 5.1)
+  ENDIF()
+ELSE()
+  SET(LUA_VERSION_REQUEST 5)
+ENDIF()
+FIND_PACKAGE(Lua ${LUA_VERSION_REQUEST} EXACT REQUIRED)
+
+##### 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)
+FIND_PACKAGE(Boost 1.35 REQUIRED thread filesystem system date_time)
+# No auto linking, so this option is useless anyway
+MARK_AS_ADVANCED(Boost_LIB_DIAGNOSTIC_DEFINITIONS)
+
+
+####### Static/Dynamic linking options ##########
+
+# On Windows dynamically linked libraries need some special treatment
+# You may want to edit these settings if you provide your own libraries
+# Note: Default option in the libraries vary, but our default option is dynamic
+IF(WIN32)
+  OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
+  OPTION(LINK_OGRE_DYNAMIC  "Link OGRE dynamically on Windows" TRUE)
+  COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)
+  IF(_version_comparison LESS 0)
+    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE)
+  ELSE(_version_comparison LESS 0)
+    OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE)
+  ENDIF(_version_comparison LESS 0)
+
+  IF(DEPENDENCY_PACKAGE_ENABLE)
+    MARK_AS_ADVANCED(
+      LINK_BOOST_DYNAMIC
+      LINK_OGRE_DYNAMIC
+      LINK_LUA_DYNAMIC
+    )
+  ENDIF()
+ENDIF(WIN32)
Index: /sandbox_light/cmake/LibraryConfigTardis.cmake
===================================================================
--- /sandbox_light/cmake/LibraryConfigTardis.cmake	(revision 5788)
+++ /sandbox_light/cmake/LibraryConfigTardis.cmake	(revision 5788)
@@ -0,0 +1,48 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Adrian Friedli
+ #  Description:
+ #    Sets the correct find script paths on the ETH Tardis workstations.
+ #    Also sets the TARDIS variable.
+ #
+
+IF(UNIX AND NOT APPLE)
+  IF(EXISTS /etc/hostname)
+    FILE(STRINGS /etc/hostname HOSTNAME LIMIT_COUNT 1)
+    IF(${HOSTNAME} MATCHES "^tardis-[a-z][0-9][0-9]$")
+      SET (TARDIS ON)
+    ENDIF()
+  ENDIF()
+ENDIF()
+
+IF(TARDIS)
+  MESSAGE(STATUS "Running on D-ITET isg.ee Tardis Computer. Using customized paths.")
+
+  SET(CMAKE_C_COMPILER "gcc-4.1.1")
+  SET(CMAKE_CXX_COMPILER "g++-4.1.1")
+
+  # Note: When setting ENV${} variables, make sure to use quotes when
+  #       having multiple directories.
+  SET(BOOST_INCLUDEDIR "/usr/pack/boost-1.36.0-sd/include/boost-1_36")
+  SET(BOOST_LIBRARYDIR "/usr/pack/boost-1.36.0-sd/i686-debian-linux4.0/lib")
+  SET(ENV{LUA_DIR}     "/usr/pack/lua-5.1.4-sd;/usr/pack/lua-5.1.4-sd/i686-debian-linux4.0")
+  SET(ENV{OGRE_HOME}   "/usr/pack/ogre-1.4.9-sd;/usr/pack/ogre-1.4.9-sd/i686-debian-linux4.0")
+ENDIF(TARDIS)
Index: /sandbox_light/cmake/PackageConfig.cmake
===================================================================
--- /sandbox_light/cmake/PackageConfig.cmake	(revision 5788)
+++ /sandbox_light/cmake/PackageConfig.cmake	(revision 5788)
@@ -0,0 +1,87 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    General package configuration. Merely sets the include paths.
+ #    Library files are treated separately.
+ #
+
+# 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)
+IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
+  SET(DEPENDENCY_VERSION 1.0)
+ELSE()
+  # Get version from file
+  FILE(READ ${DEPENDENCY_PACKAGE_DIR}/version.txt _file_content)
+  SET(_match)
+  STRING(REGEX MATCH "([0-9]+.[0-9]+)" _match ${_file_content})
+  IF(_match)
+    SET(DEPENDENCY_VERSION ${_match})
+  ELSE()
+    MESSAGE(FATAL_ERROR "The version.txt file in the dependency file has corrupt version information.")
+  ENDIF()
+ENDIF()
+
+INCLUDE(CompareVersionStrings)
+COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${DEPENDENCY_VERSION_REQUIRED} _result TRUE)
+IF(NOT _result EQUAL 0)
+  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")
+ENDIF()
+
+IF(NOT _INTERNAL_PACKAGE_MESSAGE)
+  MESSAGE(STATUS "Using library package for the dependencies.")
+  SET(_INTERNAL_PACKAGE_MESSAGE 1 CACHE INTERNAL "Do not edit!" FORCE)
+ENDIF()
+
+# Include paths and other special treatments
+SET(ENV{BOOST_ROOT}            ${DEP_INCLUDE_DIR}/boost)
+SET(ENV{LUA_DIR}               ${DEP_INCLUDE_DIR}/lua)
+SET(ENV{OGRE_HOME}             ${DEP_INCLUDE_DIR}/ogre)
+
+### INSTALL ###
+
+# On Windows, DLLs have to be in the executable folder, install them
+IF(WIN32 AND DEP_BINARY_DIR)
+  ## DEBUG
+  # When installing a debug version, we really can't know which libraries
+  # are used in released mode because there might be deps of deps.
+  # --> Copy all of them, except the debug databases
+  INSTALL(
+    DIRECTORY ${DEP_BINARY_DIR}/
+    DESTINATION bin
+    CONFIGURATIONS Debug
+    REGEX "^.*\\.pdb$" EXCLUDE
+  )
+
+  ## RELEASE
+  # Try to filter out all the debug libraries. If the regex doesn't do the
+  # job anymore, simply adjust it.
+  INSTALL(
+    DIRECTORY ${DEP_BINARY_DIR}/
+    DESTINATION bin
+    CONFIGURATIONS Release RelWithDebInfo MinSizeRel
+    REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE
+  )
+ENDIF()
Index: /sandbox_light/cmake/PackageConfigMSVC.cmake
===================================================================
--- /sandbox_light/cmake/PackageConfigMSVC.cmake	(revision 5788)
+++ /sandbox_light/cmake/PackageConfigMSVC.cmake	(revision 5788)
@@ -0,0 +1,60 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Sets the library directories when using precompiled dependency archives
+ #  Note:
+ #    When setting ENV${} variables, make sure to use quotes for lists
+ #
+
+IF(MSVC)
+
+  # 64 bit system?
+  IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    SET(BINARY_POSTFIX x64)
+  ELSE()
+    SET(BINARY_POSTFIX x86)
+  ENDIF()
+
+  # Choose right MSVC version
+  STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?) .*$" "\\1"
+         _msvc_version "${CMAKE_GENERATOR}")
+
+  SET(DEP_INCLUDE_DIR ${DEPENDENCY_PACKAGE_DIR}/include)
+  SET(DEP_LIBRARY_DIR ${DEPENDENCY_PACKAGE_DIR}/lib/msvc${_msvc_version}-${BINARY_POSTFIX})
+  SET(DEP_BINARY_DIR  ${DEPENDENCY_PACKAGE_DIR}/bin/msvc${_msvc_version}-${BINARY_POSTFIX})
+  IF(NOT EXISTS ${DEP_LIBRARY_DIR})
+    message(FATAL_ERROR "No binaries found for your MSVC Version (${CMAKE_GENERATOR})")
+  ENDIF()
+
+  # Also the directory with the runtime libraries
+  SET(RUNTIME_LIBRARY_DIRECTORY ${DEP_BINARY_DIR})
+
+  # Sets the library path for the FIND_LIBRARY
+  SET(CMAKE_LIBRARY_PATH ${DEP_LIBRARY_DIR})
+
+  # Visual Leak Detector
+  SET(VLD_INCLUDE_DIR  ${DEP_INCLUDE_DIR}/vld   CACHE PATH "")
+  SET(VLD_LIBRARY_DIR  ${DEP_LIBRARY_DIR}       CACHE PATH "")
+  LINK_DIRECTORIES(${VLD_LIBRARY_DIR}) # Used for auto-linking
+  MARK_AS_ADVANCED(VLD_INCLUDE_DIR VLD_LIBRARY_DIR)
+
+ENDIF(MSVC)
Index: /sandbox_light/cmake/PackageConfigMinGW.cmake
===================================================================
--- /sandbox_light/cmake/PackageConfigMinGW.cmake	(revision 5788)
+++ /sandbox_light/cmake/PackageConfigMinGW.cmake	(revision 5788)
@@ -0,0 +1,47 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Sets the library directories when using precompiled dependency archives
+ #  Note:
+ #    When setting ENV${} variables, make sure to use quotes for lists
+ #
+
+IF(MINGW)
+
+  # 64 bit system?
+  IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    SET(BINARY_POSTFIX x64)
+  ELSE()
+    SET(BINARY_POSTFIX x86)
+  ENDIF()
+
+  SET(DEP_INCLUDE_DIR ${DEPENDENCY_PACKAGE_DIR}/include)
+  SET(DEP_LIBRARY_DIR ${DEPENDENCY_PACKAGE_DIR}/lib/mingw-${BINARY_POSTFIX})
+  SET(DEP_BINARY_DIR  ${DEPENDENCY_PACKAGE_DIR}/bin/mingw-${BINARY_POSTFIX})
+
+  # Also the directory with the runtime libraries
+  SET(RUNTIME_LIBRARY_DIRECTORY ${DEP_BINARY_DIR})
+
+  # Sets the library path for the FIND_LIBRARY
+  SET(CMAKE_LIBRARY_PATH ${DEP_LIBRARY_DIR} ${DEP_BINARY_DIR})
+
+ENDIF(MINGW)
Index: /sandbox_light/cmake/ParseMacroArguments.cmake
===================================================================
--- /sandbox_light/cmake/ParseMacroArguments.cmake	(revision 5788)
+++ /sandbox_light/cmake/ParseMacroArguments.cmake	(revision 5788)
@@ -0,0 +1,86 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Parses a list of macro arguments which are separated by keywords and
+ #    writes the result to the _arg_KEYWORD variable. Switches are set to their
+ #    literal name if found and the lists contain their elements.
+ #    The order of the arguments is arbitrary.
+ #  Note:
+ #    You have to specify the switches and list_names as a
+ #    semicolon separated list or all hell breaks loose!
+ #  Example:
+ #    The arguments  BLUBB_FILES foo.cc bar.c NO_ASDF  will do the following:
+ #    SET(_arg_NO_ASDF _arg_NO_ASDF)
+ #    SET(_arg_BLUBB_FILES foo.cc bar.c)
+ #    But NO_FOO will not be set at all if it was specified as a switch
+ #
+
+MACRO(PARSE_MACRO_ARGUMENTS _switches _list_names)
+
+  # Using LIST(FIND ...) speeds up the process
+  SET(_keywords ${_switches} ${_list_names})
+
+  # Parse all the arguments and set the corresponding variable
+  # If the option is just a switch, set the variable to its name for later use
+  FOREACH(_arg ${ARGN})
+
+    # Is the argument a keyword?
+    LIST(FIND _keywords ${_arg} _keyword_index)
+    IF(NOT _keyword_index EQUAL -1)
+
+      # Another optimisation
+      SET(_arg_found FALSE)
+      # Switches
+      FOREACH(_switch ${_switches})
+        IF(${_switch} STREQUAL ${_arg})
+          SET(_arg_${_switch} ${_switch})
+          SET(_arg_found TRUE)
+          # Avoid interpreting arguments after this one as options args for the previous one
+          SET(_storage_var)
+          BREAK()
+        ENDIF()
+      ENDFOREACH(_switch)
+
+      # Input options
+      IF(NOT _arg_found)
+        FOREACH(_list_name ${_list_names})
+          IF(${_list_name} STREQUAL ${_arg})
+            SET(_storage_var _arg_${_list_name})
+            BREAK()
+          ENDIF()
+        ENDFOREACH(_list_name)
+      ENDIF(NOT _arg_found)
+
+    ELSE()
+
+      # Arguments of an input option (like source files for SOURCE_FILES)
+      IF(_storage_var)
+        # Store in variable define above in the foreach loop
+        SET(${_storage_var} ${${_storage_var}} ${_arg})
+      ELSE()
+        MESSAGE(FATAL_ERROR "ORXONOX_ADD_${_target_type} was given a non compliant argument: ${_arg}")
+      ENDIF(_storage_var)
+
+    ENDIF()
+
+  ENDFOREACH(_arg)
+ENDMACRO(PARSE_MACRO_ARGUMENTS)
Index: /sandbox_light/cmake/PrecompiledHeaderFiles.cmake
===================================================================
--- /sandbox_light/cmake/PrecompiledHeaderFiles.cmake	(revision 5788)
+++ /sandbox_light/cmake/PrecompiledHeaderFiles.cmake	(revision 5788)
@@ -0,0 +1,161 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #
+
+INCLUDE(GetGCCCompilerFlags)
+ 
+MACRO(PRECOMPILED_HEADER_FILES_PRE_TARGET _target_name _header_file_arg _sourcefile_var)
+
+  GET_FILENAME_COMPONENT(_pch_header_file ${_header_file_arg} ABSOLUTE)
+  GET_FILENAME_COMPONENT(_pch_header_filename ${_pch_header_file} NAME)
+  GET_FILENAME_COMPONENT(_pch_header_filename_we ${_pch_header_file} NAME_WE)
+
+  IF(NOT EXISTS ${_pch_header_file})
+    MESSAGE(FATAL_ERROR "Specified precompiled headerfile '${_header_file_arg}' does not exist.")
+  ENDIF()
+
+  # Extract arguments from ARGN
+  FOREACH(_arg ${ARGN})
+    IF(NOT "${_arg}" STREQUAL "EXCLUDE")
+      IF(NOT _arg_second)
+        # Source files with PCH support
+        SET(_included_files ${_included_files} ${_arg})
+      ELSE()
+        # Source files to be excluded from PCH support (easier syntax this way)
+        SET(_excluded files ${_excluded_files} ${_arg})
+      ENDIF()
+    ELSE()
+      SET(_arg_second TRUE)
+    ENDIF()
+  ENDFOREACH(_arg)
+
+  # Use ${_sourcefile_var} if no files were specified explicitely
+  IF(NOT _included_files)
+    SET(_source_files ${${_sourcefile_var}})
+  ELSE()
+    SET(_source_files ${_included_files})
+  ENDIF()
+
+  # Exclude files (if specified)
+  FOREACH(_file ${_excluded_files})
+    LIST(FIND _source_files ${_file} _list_index)
+    IF(_list_index GREATER -1)
+      LIST(REMOVE_AT _source_files _list_index)
+    ELSE()
+      MESSAGE(FATAL_ERROR "Could not exclude file ${_file} in target ${_target_name}")
+    ENDIF()
+  ENDFOREACH(_file)
+
+  LIST(FIND ${_sourcefile_var} ${_pch_header_file} _list_index)
+  IF(_list_index EQUAL -1) # Header file could already be included with GET_ALL_HEADER_FILES
+    LIST(APPEND ${_sourcefile_var} ${_pch_header_file})
+  ENDIF()
+  SOURCE_GROUP("PCH" FILES ${_pch_header_file})
+
+  IF(MSVC)
+
+    # Write and add one source file, which generates the precompiled header file
+    SET(_pch_source_file "${CMAKE_CURRENT_BINARY_DIR}/${_pch_header_filename_we}.cc")
+    IF(NOT EXISTS ${_pch_source_file})
+      FILE(WRITE ${_pch_source_file} "#include \"${_pch_header_file}\"\n")
+    ENDIF()
+    SET_SOURCE_FILES_PROPERTIES(_pch_source_file PROPERTIES GENERATED TRUE)
+    LIST(APPEND ${_sourcefile_var} ${_pch_source_file})
+    SOURCE_GROUP("PCH" FILES ${_pch_source_file})
+
+    SET(_pch_file "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${_pch_header_filename}.pch")
+    # Set compile flags for generated source file
+    SET_SOURCE_FILES_PROPERTIES(${_pch_source_file} PROPERTIES COMPILE_FLAGS "/c /Yc\"${_pch_header_file}\" /Fp\"${_pch_file}\"")
+    # Set Compile flags for the other source files
+    FOREACH(_file ${_source_files})
+      GET_SOURCE_FILE_PROPERTY(_is_header ${_file} HEADER_FILE_ONLY)
+      IF(NOT _is_header)
+        GET_SOURCE_FILE_PROPERTY(_old_flags ${_file} COMPILE_FLAGS)
+        IF(NOT _old_flags)
+          SET(_old_flags "")
+        ENDIF()
+	SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES COMPILE_FLAGS "${_old_flags} /FI\"${_pch_header_file}\" /Yu\"${_pch_header_file}\" /Fp\"${_pch_file}\"")
+      ENDIF(NOT _is_header)
+    ENDFOREACH(_file)
+
+  ELSEIF(CMAKE_COMPILER_IS_GNU)
+
+    SET(_pch_file "${CMAKE_CURRENT_BINARY_DIR}/${_pch_header_filename}.gch")
+    SET(_pch_dep_helper_file "${CMAKE_CURRENT_BINARY_DIR}/${_target_name}PCHDependencyHelper.h")
+
+    # Append the gch-dir to make sure gcc finds the pch file
+    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
+
+    # Get compiler flags of the source files (target does not yet exist!)
+    # This is just the best possible opportunity to address this dependency issue
+    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}")
+      SET(_INTERNAL_${_target_name}_PCH_GCC_FLAGS "${_pch_gcc_flags}" CACHE INTERNAL "")
+      FILE(WRITE ${_pch_dep_helper_file} "/* ${_pch_gcc_flags} */")
+    ENDIF()
+
+    # Set Compile flags for the other source files
+    FOREACH(_file ${_source_files})
+      GET_SOURCE_FILE_PROPERTY(_is_header ${_file} HEADER_FILE_ONLY)
+      IF(NOT _is_header)
+        GET_SOURCE_FILE_PROPERTY(_old_flags ${_file} COMPILE_FLAGS)
+        IF(NOT _old_flags)
+          SET(_old_flags "")
+        ENDIF()
+        SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES
+          COMPILE_FLAGS "${_old_flags} -include ${_pch_header_filename}"
+          OBJECT_DEPENDS "${_pch_header_file};${_pch_file}"
+        )
+      ENDIF(NOT _is_header)
+    ENDFOREACH(_file)
+
+  ENDIF()
+
+ENDMACRO(PRECOMPILED_HEADER_FILES_PRE_TARGET)
+
+FUNCTION(PRECOMPILED_HEADER_FILES_POST_TARGET _target_name)
+    # This macro is only necessary for GCC
+    IF(CMAKE_COMPILER_IS_GNU)
+
+      # Workaround for distcc
+      IF(CMAKE_CXX_COMPILER_ARG1)
+        # remove leading space in compiler argument
+        STRING(REGEX REPLACE "^ +" "" _pch_cmake_cxx_compiler_arg1 "${CMAKE_CXX_COMPILER_ARG1}")
+      ENDIF()
+
+      # Get compiler flags of the source files again (target exists this time)
+      GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags)
+
+      # Compile the header file
+      ADD_CUSTOM_COMMAND(
+        OUTPUT ${_pch_file}
+        COMMAND ${CMAKE_CXX_COMPILER}
+        ARGS ${pchsupport_compiler_cxx_arg1} ${_pch_gcc_flags} -c -x c++-header -o ${_pch_file} ${_pch_header_file}
+	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+        DEPENDS ${_pch_dep_helper_file}
+        IMPLICIT_DEPENDS CXX ${_pch_header_file}
+        VERBATIM
+      )
+
+    ENDIF(CMAKE_COMPILER_IS_GNU)
+ENDFUNCTION(PRECOMPILED_HEADER_FILES_POST_TARGET)
Index: /sandbox_light/cmake/SeparateFlags.cmake
===================================================================
--- /sandbox_light/cmake/SeparateFlags.cmake	(revision 5788)
+++ /sandbox_light/cmake/SeparateFlags.cmake	(revision 5788)
@@ -0,0 +1,63 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Separates a string of program flags like "--blubb -test -D AA".
+ #    " -" or " /" denotes the start of a flag.
+ #    The same sequence inside double quotation marks is being ignored.
+ #    Spaces not within quotes are cleaned meaningfully.
+ #  Note:
+ #    This macro cannot cope with semicolons in the flag string!
+
+FUNCTION(SEPARATE_FLAGS _flags _output_variable)
+  # Visual studio (esp. IntelliSense) doesn't like dashes to specify arguments
+  # Always use foward slashes instead
+  IF(MSVC)
+    SET(_argument_starter "/")
+  ELSE()
+    SET(_argument_starter "-")
+  ENDIF(MSVC)
+
+  SET(_flags_prep " ${_flags} -")
+  # Separate the chunks
+  STRING(REPLACE " " " ;" _flag_chunks "${_flags_prep}") # Max loop iterations
+  SET(_flag_string)
+  SET(_parsed_flags)
+  # Loop is necessary because the regex engine is greedy
+  FOREACH(_chunk ${_flag_chunks})
+    SET(_flag_string "${_flag_string}${_chunk}")
+    # Replace all " -" and " /" inside quotation marks
+    STRING(REGEX REPLACE "^(([^\"]*\"[^\"]*\")*[^\"]*\"[^\"]*) [/-]([^\"]*\")"
+           "\\1@39535493@\\3" _flag_string "${_flag_string}")
+    # Extract one flag if possible
+    SET(_flag)
+    STRING(REGEX REPLACE "^.* [/-](.+)( [/-].*$)" "${_argument_starter}\\1" _flag "${_flag_string}")
+    STRING(REGEX REPLACE "^.* [/-](.+)( [/-].*$)" "\\2"  _flag_string "${_flag_string}")
+    IF(NOT _flag STREQUAL _flag_string)
+      STRING(STRIP "${_flag}" _flag_stripped)
+      LIST(APPEND _parsed_flags "${_flag_stripped}")
+    ENDIF(NOT _flag STREQUAL _flag_string)
+  ENDFOREACH(_chunk)
+
+  # Re-replace all " -" and " /" inside quotation marks
+  STRING(REGEX REPLACE "@39535493@" " -" _parsed_flags "${_parsed_flags}")
+  SET(${_output_variable} "${_parsed_flags}" PARENT_SCOPE)
+ENDFUNCTION(SEPARATE_FLAGS)
Index: /sandbox_light/cmake/SetCacheAdvanced.cmake
===================================================================
--- /sandbox_light/cmake/SetCacheAdvanced.cmake	(revision 5788)
+++ /sandbox_light/cmake/SetCacheAdvanced.cmake	(revision 5788)
@@ -0,0 +1,36 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Write to the cache by force, but only if the user hasn't changed the value
+ #    Additional argument is the value (may also be a list)
+
+FUNCTION(SET_CACHE_ADVANCED _varname _type _docstring)
+  SET(_value ${ARGN})
+  IF(NOT "${_type}" MATCHES "^(STRING|BOOL|PATH|FILEPATH)$")
+    MESSAGE(FATAL_ERROR "${_type} is not a valid CACHE entry type")
+  ENDIF()
+
+  IF(NOT DEFINED _INTERNAL_${_varname} OR "${_INTERNAL_${_varname}}" STREQUAL "${${_varname}}")
+    SET(${_varname} "${_value}" CACHE ${_type} "${_docstring}" FORCE)
+    SET(_INTERNAL_${_varname} "${_value}" CACHE INTERNAL "Do not edit in any case!")
+  ENDIF()
+ENDFUNCTION(SET_CACHE_ADVANCED)
Index: /sandbox_light/cmake/SourceFileUtilities.cmake
===================================================================
--- /sandbox_light/cmake/SourceFileUtilities.cmake	(revision 5788)
+++ /sandbox_light/cmake/SourceFileUtilities.cmake	(revision 5788)
@@ -0,0 +1,73 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Several functions that help organising the source tree.
+ #    [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.
+ #    GENERATE_SOURCE_GROUPS - Set Visual Studio source groups.
+ #
+
+# 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)
+  # Write into the cache to avoid variable scoping in subdirs
+  SET(${_varname} ${${_varname}} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
+ENDFUNCTION(ADD_SOURCE_FILES)
+
+
+# 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)
+  # Write into the cache to avoid variable scoping in subdirs
+  SET(${_varname} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
+ENDFUNCTION(SET_SOURCE_FILES)
+
+
+# Search the entire directory tree for header files and add them to a variable
+MACRO(GET_ALL_HEADER_FILES _target_varname)
+  FILE(GLOB_RECURSE ${_target_varname} ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
+ENDMACRO(GET_ALL_HEADER_FILES)
+
+
+# Generate source groups according to the directory structure
+FUNCTION(GENERATE_SOURCE_GROUPS)
+
+  FOREACH(_file ${ARGN})
+    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})
+  ENDFOREACH(_file)
+
+ENDFUNCTION(GENERATE_SOURCE_GROUPS)
Index: /sandbox_light/cmake/TargetUtilities.cmake
===================================================================
--- /sandbox_light/cmake/TargetUtilities.cmake	(revision 5788)
+++ /sandbox_light/cmake/TargetUtilities.cmake	(revision 5788)
@@ -0,0 +1,253 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Adds a library or an executable like ADD_LIBRARY/ADD_EXECUTABLE, but
+ #    accepts a lot more input information. Simply supply the keywords
+ #    described below in any order you wish.
+ #    The output is then stored in "_arg_ARGNAME" where ARGNAME is the the
+ #    name of the switch or list.
+ #
+ #    Switches: (when given --> TRUE, FALSE otherwise)
+ #      FIND_HEADER_FILES: Searches the current directory for all header files
+ #                         and adds them to the target.
+ #      EXCLUDE_FROM_ALL:  Inherited from ADD_LIBRARY/ADD_EXECUTABLE
+ #      ORXONOX_EXTERNAL:  Specify this for third party libraries
+ #      NO_DLL_INTERFACE:  Link statically with MSVC
+ #      NO_SOURCE_GROUPS:  Don't create msvc source groups
+ #      STATIC/SHARED:     Inherited from ADD_LIBRARY
+ #      MODULE:            For dynamic module libraries
+ #      WIN32:             Inherited from ADD_EXECUTABLE
+ #      PCH_NO_DEFAULT:    Do not make precompiled header files default if
+ #                         specified with PCH_FILE
+ #      NO_INSTALL:        Do not install the target at all
+ #
+ #    Lists:
+ #      LINK_LIBRARIES:    Redirects to TARGET_LINK_LIBRARIES
+ #      VERSION:           Set version to the binary
+ #      SOURCE_FILES:      Source files for the target
+ #      DEFINE_SYMBOL:     Sets the DEFINE_SYMBOL target property
+ #      TOLUA_FILES:       Files with tolua interface
+ #      PCH_FILE:          Precompiled header file
+ #      PCH_EXCLUDE:       Source files to be excluded from PCH support
+ #      OUTPUT_NAME:       If you want a different name than the target name
+ #  Note:
+ #    This function also installs the target!
+ #  Prerequisistes:
+ #    ORXONOX_DEFAULT_LINK, ORXONOX_CONFIG_FILES
+ #  Parameters:
+ #    _target_name, ARGN for the macro arguments
+ #
+
+INCLUDE(CMakeDependentOption)
+INCLUDE(CapitaliseName)
+INCLUDE(GenerateToluaBindings)
+INCLUDE(ParseMacroArguments)
+INCLUDE(SourceFileUtilities)
+IF(PCH_COMPILER_SUPPORT)
+  INCLUDE(PrecompiledHeaderFiles)
+ENDIF()
+
+FUNCTION(ORXONOX_ADD_LIBRARY _target_name)
+  TU_ADD_TARGET(${_target_name} LIBRARY "STATIC;SHARED" ${ARGN})
+ENDFUNCTION(ORXONOX_ADD_LIBRARY)
+
+FUNCTION(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)
+  CAPITALISE_NAME(${_target_name} _target_name_capitalised)
+
+  # Specify all possible options (either switch or with add. arguments)
+  SET(_switches   FIND_HEADER_FILES  EXCLUDE_FROM_ALL  ORXONOX_EXTERNAL
+                  NO_DLL_INTERFACE   NO_SOURCE_GROUPS  ${_additional_switches}
+                  PCH_NO_DEFAULT     NO_INSTALL        MODULE)
+  SET(_list_names LINK_LIBRARIES  VERSION   SOURCE_FILES  DEFINE_SYMBOL
+                  TOLUA_FILES     PCH_FILE  PCH_EXCLUDE OUTPUT_NAME)
+  PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
+
+
+  # GET_HEADER_FILES
+  IF(_arg_FIND_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})
+  LIST(REMOVE_DUPLICATES _${_target_name}_files)
+
+  # Generate the source groups
+  IF(NOT _arg_NO_SOURCE_GROUPS)
+    GENERATE_SOURCE_GROUPS(${_${_target_name}_files})
+
+    IF(NOT _arg_ORXONOX_EXTERNAL)
+      # Move the prereqs.h file to the config section
+      IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_target_name_capitalised}Prereqs.h)
+        SOURCE_GROUP("Config" FILES ${_target_name_capitalised}Prereqs.h)
+      ENDIF()
+      # Add the config files in a special source group
+      LIST(APPEND _${_target_name}_files ${ORXONOX_CONFIG_FILES})
+      SOURCE_GROUP("Config" FILES ${ORXONOX_CONFIG_FILES})
+    ENDIF()
+  ENDIF(NOT _arg_NO_SOURCE_GROUPS)
+
+  # TOLUA_FILES
+  IF(_arg_TOLUA_FILES)
+    GENERATE_TOLUA_BINDINGS(${_target_name_capitalised} _${_target_name}_files
+                            INPUTFILES ${_arg_TOLUA_FILES})
+  ENDIF()
+
+  # First part (pre target) of precompiled header files
+  IF(PCH_COMPILER_SUPPORT AND _arg_PCH_FILE)
+    # Provide convenient option to control PCH
+    STRING(TOUPPER "${_target_name}" _target_name_upper)
+    IF(_arg_PCH_NO_DEFAULT)
+      SET(PCH_DEFAULT FALSE)
+    ELSE()
+      SET(PCH_DEFAULT TRUE)
+    ENDIF()
+    CMAKE_DEPENDENT_OPTION(PCH_ENABLE_${_target_name_upper}
+      "Enable using precompiled header files for library ${_target_name}." ${PCH_DEFAULT} PCH_ENABLE OFF)
+
+    IF(PCH_ENABLE_${_target_name_upper})
+      PRECOMPILED_HEADER_FILES_PRE_TARGET(${_target_name} ${_arg_PCH_FILE} _${_target_name}_files EXCLUDE ${_arg_PCH_EXCLUDE})
+    ENDIF()
+  ENDIF()
+
+  # Certain libraries don't have dllexport/dllimport and can't be linked shared with msvc
+  IF(MSVC AND _arg_NO_DLL_INTERFACE)
+    SET(_arg_SHARED)
+    SET(_arg_STATIC STATIC)
+  ENDIF()
+
+  # Set default linking if required
+  IF(NOT _arg_SHARED AND NOT _arg_STATIC)
+    IF("${ORXONOX_DEFAULT_LINK}" STREQUAL "STATIC")
+      SET(_arg_STATIC STATIC)
+    ELSEIF("${ORXONOX_DEFAULT_LINK}" STREQUAL "SHARED")
+      SET(_arg_SHARED SHARED)
+    ENDIF()
+  ENDIF()
+
+  # MODULE A
+  # Always create shared libraries
+  IF(_arg_MODULE)
+    SET(_arg_SHARED SHARED)
+    SET(_arg_STATIC)
+  ENDIF()
+
+  # Add the library/executable
+  IF("${_target_type}" STREQUAL "LIBRARY")
+    ADD_LIBRARY(${_target_name} ${_arg_STATIC} ${_arg_SHARED}
+                ${_arg_EXCLUDE_FROM_ALL} ${_${_target_name}_files})
+  ELSE()
+    ADD_EXECUTABLE(${_target_name} ${_arg_WIN32} ${_arg_EXCLUDE_FROM_ALL}
+                   ${_${_target_name}_files})
+  ENDIF()
+
+  # MODULE B
+  IF (_arg_MODULE)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
+      RUNTIME_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Windows
+      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix
+    )
+    ADD_MODULE(${_target_name})
+  ENDIF()
+
+  # LINK_LIBRARIES
+  IF(_arg_LINK_LIBRARIES)
+    TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBRARIES})
+  ENDIF()
+
+  # DEFINE_SYMBOL
+  IF(_arg_DEFINE_SYMBOL)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES DEFINE_SYMBOL ${_arg_DEFINE_SYMBOL})
+  ENDIF()
+
+  # VERSION
+  IF(_arg_VERSION)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${_arg_VERSION})
+  ELSEIF(NOT _arg_ORXONOX_EXTERNAL)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${ORXONOX_VERSION})
+  ENDIF()
+
+  # OUTPUT_NAME
+  IF(_arg_OUTPUT_NAME)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES OUTPUT_NAME  ${_arg_OUTPUT_NAME})
+  ENDIF()
+
+  # Second part of precompiled header files
+  IF(PCH_COMPILER_SUPPORT AND PCH_ENABLE_${_target_name_upper} AND _arg_PCH_FILE)
+    PRECOMPILED_HEADER_FILES_POST_TARGET(${_target_name} ${_arg_PCH_FILE})
+  ENDIF()
+
+  IF(NOT _arg_STATIC AND NOT _arg_NO_INSTALL)
+    IF(_arg_MODULE)
+      INSTALL(TARGETS ${_target_name}
+        RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY}
+        LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY}
+      )
+    ELSE()
+      INSTALL(TARGETS ${_target_name}
+        RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
+        LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY}
+      )
+    ENDIF()
+  ENDIF()
+
+ENDFUNCTION(TU_ADD_TARGET)
+
+
+# Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}
+# This helps finding dynamically loadable modules at runtime
+
+FUNCTION(ADD_MODULE _target)
+  # We use the properties to get the name because the librarys name may differ from
+  # the target name (for example orxonox <-> liborxonox)
+
+  GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)
+  GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)
+
+  IF(CMAKE_CONFIGURATION_TYPES)
+    FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
+      SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})
+
+      FILE(WRITE ${_module_filename})
+
+      INSTALL(
+        FILES ${_module_filename}
+        DESTINATION ${MODULE_INSTALL_DIRECTORY}
+        CONFIGURATIONS ${_config}
+      )
+    ENDFOREACH()
+  ELSE()
+    SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})
+
+    FILE(WRITE ${_module_filename})
+
+    INSTALL(
+      FILES ${_module_filename}
+      DESTINATION ${MODULE_INSTALL_DIRECTORY}
+    )
+  ENDIF()
+ENDFUNCTION(ADD_MODULE)
Index: /sandbox_light/data/CMakeLists.txt
===================================================================
--- /sandbox_light/data/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/data/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,38 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Finds the external data directory and configures the data installation.
+ #    Default search paths are: ../../data and ../data_extern
+ #
+
+# For dev runs we've got two data directory. The one from the other repository root folder
+# is called EXTERNAL_DATA
+SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
+
+################ Installation #################
+
+INSTALL(
+  DIRECTORY ${DATA_DIRECTORY}/
+  DESTINATION ${DATA_INSTALL_DIRECTORY}
+  REGEX "\\.svn$|_svn$|CMakeLists.txt" EXCLUDE
+)
Index: /sandbox_light/data/lua/LuaStateInit.lua
===================================================================
--- /sandbox_light/data/lua/LuaStateInit.lua	(revision 5788)
+++ /sandbox_light/data/lua/LuaStateInit.lua	(revision 5788)
@@ -0,0 +1,68 @@
+-- Note: luaState is a pointer to the LuaState instance that created this lua state
+
+-- Save original print function in debug
+debug = print
+
+-- Redirect print to the C++ print function
+print = function(s)
+  luaState:luaPrint(s)
+end
+
+-- Create function to log text like COUT, but always prints a line!
+logMessage = function(level, message)
+  luaState:luaLog(level, message)
+end
+
+-- Redirect dofile in order to load with the resource manager
+-- Note: The function does not behave exactly like LuaState::doFile because the
+--       default argument here for the group is not "General" but
+--       "NoResourceGroupProvided". This resolves to the resource group used to
+--       do the current file.
+doFile = function(filename, resourceGroup)
+  local bSearchOtherPaths = (resourceGroup == nil) or false
+  resourceGroup = resourceGroup or "NoResourceGroupProvided"
+  luaState:doFile(filename, resourceGroup, bSearchOtherPaths)
+  -- Required because the C++ function cannot return whatever might be on the stack
+  return LuaStateReturnValue
+end
+original_dofile = dofile
+dofile = doFile
+
+-- Create includeFile function that preparses the file according
+-- to a function provided to the LuaState constructor (in C++)
+-- Note: See the same notes as for doFile
+include = function(filename, resourceGroup)
+  local bSearchOtherPaths = (resourceGroup == nil) or false
+  resourceGroup = resourceGroup or "NoResourceGroupProvided"
+  luaState:includeFile(filename, resourceGroup, bSearchOtherPaths)
+  -- Required because the C++ function cannot return whatever might be on the stack
+  return LuaStateReturnValue
+end
+
+-- Replace require function with almost similar behaviour
+-- The difference is that you need to provide a resource group
+-- Default value there is the current one (if present) or else "General"
+-- But the loaded modules are then stored with only with the name (where name has no .lua extension)
+-- CAUTION: That also means that you need to take care of conflicting filenames among groups
+-- Furthermore the moduleName parameters is appended with the .lua extension when looking for the file
+old_require = require
+require = function(moduleName, resourceGroup)
+  local bSearchOtherPaths = (resourceGroup == nil) or false
+  resourceGroup = resourceGroup or "NoResourceGroupProvided"
+  if not luaState:fileExists(moduleName .. ".lua", resourceGroup, bSearchOtherPaths) then
+    return nil
+  end
+  if not _LOADED then
+    _LOADED = {}
+  end
+  if not _LOADED[moduleName] then
+    -- save old value
+    _REQUIREDNAME_OLD = _REQUIREDNAME
+    _REQUIREDNAME = moduleName
+    luaState:doFile(moduleName .. ".lua", resourceGroup, bSearchOtherPaths)
+    _LOADED[moduleName] = LuaStateReturnValue or true
+    -- restore old value
+    _REQUIREDNAME = _REQUIREDNAME_OLD
+  end
+  return _LOADED[moduleName]
+end
Index: /sandbox_light/doc/CMakeLists.txt
===================================================================
--- /sandbox_light/doc/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/doc/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,5 @@
+# Add a "doc" target with CMake build system. 
+# And configure doxy.config.in to doxy.config
+#
+# target "doc" allows building the documentation with doxygen/dot on WIN32 and Linux
+ADD_SUBDIRECTORY(api)
Index: /sandbox_light/doc/api/CMakeLists.txt
===================================================================
--- /sandbox_light/doc/api/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/doc/api/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,88 @@
+# Add a "doc" target with CMake build system. 
+# And configure doxy.config.in to doxy.config
+#
+# target "doc" allows building the documentation with doxygen/dot on WIN32 and Linux
+# Creates .chm windows help file if MS HTML help workshop 
+# (available from http://msdn.microsoft.com/workshop/author/htmlhelp)
+# is installed with its DLLs in PATH.
+#
+#
+# Please note, that the tools, e.g.:
+# doxygen, dot, latex, dvips, makeindex, gswin32, etc.
+# must be in path.
+#
+# Note about Visual Studio Projects: 
+# MSVS hast its own path environment which may differ from the shell.
+# See "Menu Tools/Options/Projects/VC++ Directories" in VS 7.1
+#
+# author Jan Woetzel 2004-2006
+# www.mip.informatik.uni-kiel.de/~jw
+# Adjustments for Orxonox by Reto Grieder
+
+FIND_PACKAGE(Doxygen QUIET)
+
+IF (DOXYGEN_FOUND)
+  # click+jump in Emacs and Visual Studio (for doxy.config) (jw)
+  IF(CMAKE_BUILD_TOOL MATCHES "msdev|devenv")
+    SET(DOXY_WARN_FORMAT "\"$file($line) : $text \"")
+  ELSE()
+    SET(DOXY_WARN_FORMAT "\"$file:$line: $text \"")
+  ENDIF()
+
+  SET(DOXY_INPUT_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
+  SET(DOXY_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+  
+  # we need latex for doxygen because of the formulas
+  # Orxonox doesn't
+  #FIND_PACKAGE(LATEX)
+  #IF    (NOT LATEX_COMPILER)
+  #  MESSAGE(STATUS "latex command LATEX_COMPILER not found but usually required. You will probably get warnings and user inetraction on doxy run.")
+  #ENDIF (NOT LATEX_COMPILER)
+  #IF    (NOT MAKEINDEX_COMPILER)
+  #  MESSAGE(STATUS "makeindex command MAKEINDEX_COMPILER not found but usually required.")
+  #ENDIF (NOT MAKEINDEX_COMPILER)
+  #IF    (NOT DVIPS_CONVERTER)
+  #  MESSAGE(STATUS "dvips command DVIPS_CONVERTER not found but usually required.")
+  #ENDIF (NOT DVIPS_CONVERTER)
+  
+  IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in)
+    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in ${CMAKE_CURRENT_BINARY_DIR}/doxy.config @ONLY)
+    # use (configured) doxy.config from (out of place) BUILD tree:
+    SET(DOXY_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/doxy.config)
+    SET(DOXY_LOGFILE ${CMAKE_CURRENT_BINARY_DIR}/doxy.log)
+  ELSE()
+    MESSAGE(FATAL_ERROR "Warning: Could not find dox.config.in in the root directory.")
+  ENDIF()
+  
+  ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG})
+  
+  # create a windows help .chm file using hhc.exe
+  # HTMLHelp DLL must be in path!
+  # fallback: use hhw.exe interactively
+  IF(WIN32)
+    FIND_PACKAGE(HTMLHelp)
+    IF(HTML_HELP_COMPILER)      
+      SET(TMP ${DOXY_OUTPUT_DIR}/html/index.hhp)
+      STRING(REGEX REPLACE "/" "\\\\" HHP_FILE ${TMP})
+      ADD_CUSTOM_TARGET(doc_chm ${HTML_HELP_COMPILER} ${HHP_FILE})
+      ADD_DEPENDENCIES(doc_chm doc)
+      # Adding a dependency somehow adds doc target as default build target
+      SET_TARGET_PROPERTIES(doc doc_chm PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
+    ENDIF(HTML_HELP_COMPILER)
+  ENDIF (WIN32) 
+
+
+  # Installation
+  INSTALL(
+    FILES ${DOXY_CONFIG} ${CMAKE_CURRENT_BINARY_DIR}/doxy.log
+    DESTINATION ${DOC_INSTALL_DIRECTORY}/api OPTIONAL
+  )
+  # Install command always needs the directory
+  IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/html)
+    FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html)
+  ENDIF()
+  INSTALL(
+    DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
+    DESTINATION ${DOC_INSTALL_DIRECTORY}/api
+  )
+ENDIF(DOXYGEN_FOUND)
Index: /sandbox_light/doc/api/doxy.config.in
===================================================================
--- /sandbox_light/doc/api/doxy.config.in	(revision 5788)
+++ /sandbox_light/doc/api/doxy.config.in	(revision 5788)
@@ -0,0 +1,1248 @@
+# Doxyfile 1.4.5
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = "@PROJECT_NAME@"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = "@ORXONOX_VERSION@ Codename: @ORXONOX_VERSION_NAME@"
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = @DOXY_OUTPUT_DIR@
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, 
+# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, 
+# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, 
+# Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = @CMAKE_SOURCE_DIR@
+
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = @CMAKE_SOURCE_DIR@
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like the Qt-style comments (thus requiring an 
+# explicit @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for Java. 
+# For instance, namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to 
+# include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = YES
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = YES
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is YES.
+
+SHOW_DIRECTORIES       = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the Folder
+# Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page. This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from the 
+# version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = @DOXY_WARN_FORMAT@
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = @DOXY_LOGFILE@
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = @CMAKE_SOURCE_DIR@/src \
+                         @CMAKE_CURRENT_SOURCE_DIR@ \
+                         @CMAKE_BINARY_DIR@/src
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
+
+FILE_PATTERNS          = *.cpp \
+                         *.cc \
+                         *.h \
+                         *.hh \
+                         *.hpp \
+                         *.dox
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = @CMAKE_SOURCE_DIR@/src/bullet/
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = */.svn/*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = @CMAKE_CURRENT_SOURCE_DIR@/examples/
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = *.cpp \
+                         *.cc \
+                         *.h \
+                         *.hh \
+                         INSTALL DEPENDENCIES CHANGELOG LICENSE LGPL
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = YES
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = @CMAKE_CURRENT_SOURCE_DIR@/images/
+
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 2
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+HTML_HEADER            = 
+
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+#LATEX_CMD_NAME         = latex
+LATEX_CMD_NAME          = @LATEX_COMPILER@
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+#MAKEINDEX_CMD_NAME     = makeindex
+MAKEINDEX_CMD_NAME     = @MAKEINDEX_COMPILER@
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = YES
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = DOXYGEN_SHOULD_SKIP_THIS
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = @DOXY_OUTPUT_DIR@/html/@PROJECT_NAME@.TAGFILE
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = @DOXYGEN_DOT_FOUND@
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
+# generate a call dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable call graphs for selected 
+# functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = @DOXYGEN_DOT_EXECUTABLE_PATH@
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = @CMAKE_CURRENT_SOURCE_DIR@/dot
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that a graph may be further truncated if the graph's 
+# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH 
+# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), 
+# the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH    = 1000
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, which results in a white background. 
+# Warning: Depending on the platform used, enabling this option may lead to 
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to 
+# read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = YES
Index: /sandbox_light/doc/api/main.dox
===================================================================
--- /sandbox_light/doc/api/main.dox	(revision 5788)
+++ /sandbox_light/doc/api/main.dox	(revision 5788)
@@ -0,0 +1,4 @@
+/**
+@mainpage
+    Orxonox Doxygen Reference
+*/
Index: /sandbox_light/src/CMakeLists.txt
===================================================================
--- /sandbox_light/src/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/src/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,122 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Configures the compilers and sets build options.
+ #
+
+# Required macros and functions
+INCLUDE(FlagUtilities)
+INCLUDE(TargetUtilities)
+
+# Configure the two headers and set some options
+INCLUDE(OrxonoxConfig.cmake)
+
+################ Library Defines ################
+
+# Disable Boost auto linking completely
+ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB")
+
+# If no defines are specified, these libs get linked statically
+ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC)
+ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL"   WIN32 LINK_LUA_DYNAMIC)
+# If no defines are specified, these libs get linked dynamically
+ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB"    WIN32 NOT LINK_OGRE_DYNAMIC)
+
+############## Include Directories ##############
+
+# Set the search paths for include files
+INCLUDE_DIRECTORIES(
+  # External
+  ${OGRE_INCLUDE_DIR}
+  ${Boost_INCLUDE_DIRS}
+  ${LUA_INCLUDE_DIR}
+  ${VLD_INCLUDE_DIR}
+
+  # All includes in "externals" should be prefixed with the path
+  # relative to "external" to avoid conflicts
+  ${CMAKE_CURRENT_SOURCE_DIR}/external
+
+  # OrxonoxConfig.h
+  ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+################### Tolua Bind ##################
+
+# Create directory because the tolua application doesn't work otherwise
+IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
+  FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
+ENDIF()
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
+
+################ Sub Directories ################
+
+ADD_SUBDIRECTORY(external)
+ADD_SUBDIRECTORY(libraries)
+ADD_SUBDIRECTORY(orxonox)
+ADD_SUBDIRECTORY(modules)
+
+################ Executable ################
+
+INCLUDE_DIRECTORIES(
+  ${CMAKE_CURRENT_SOURCE_DIR}/libraries
+  ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
+)
+
+# Translate argument
+IF(ORXONOX_USE_WINMAIN)
+  SET(ORXONOX_WIN32 WIN32)
+ENDIF()
+
+ORXONOX_ADD_EXECUTABLE(orxonox-main
+  # When defined as WIN32 this removes the console window on Windows
+  ${ORXONOX_WIN32}
+  LINK_LIBRARIES
+    orxonox
+  SOURCE_FILES
+    Orxonox.cc
+  OUTPUT_NAME orxonox
+)
+
+# Get name to configure the run scripts
+GET_TARGET_PROPERTY(_exec_loc orxonox-main LOCATION)
+GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME)
+SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "")
+
+
+# When using Visual Studio we want to use the output directory as working
+# directory and we also want to specify where the external dlls
+# (lua, ogre, etc.) are. The problem hereby is that these information cannot
+# be specified in CMake because they are not stored in the actual project file.
+# This workaround will create a configured *.vcproj.user file that holds the
+# right values. When starting the solution for the first time,
+# these get written to the *vcproj.yourPCname.yourname.user
+IF(MSVC)
+  IF(CMAKE_CL_64)
+    SET(MSVC_PLATFORM "x64")
+  ELSE()
+    SET(MSVC_PLATFORM "Win32")
+  ENDIF()
+  STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?) .*$" "\\1"
+         VISUAL_STUDIO_VERSION_SIMPLE "${CMAKE_GENERATOR}")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/orxonox-main.vcproj.user.in" "${CMAKE_CURRENT_BINARY_DIR}/orxonox-main.vcproj.user")
+ENDIF(MSVC)
Index: /sandbox_light/src/Orxonox.cc
===================================================================
--- /sandbox_light/src/Orxonox.cc	(revision 5788)
+++ /sandbox_light/src/Orxonox.cc	(revision 5788)
@@ -0,0 +1,75 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Entry point of the program.
+*/
+
+#include "SpecialConfig.h"
+
+#ifdef ORXONOX_USE_WINMAIN
+# ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+# endif
+#include <windows.h>
+#endif
+
+#include "util/Debug.h"
+#include "util/Exception.h"
+#include "orxonox/Main.h"
+
+/*
+@brief
+    Main method. Game starts here (except for static initialisations).
+*/
+#ifdef ORXONOX_USE_WINMAIN
+INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
+#else
+int main(int argc, char** argv)
+#endif
+{
+    try
+    {
+#ifndef ORXONOX_USE_WINMAIN
+        std::string strCmdLine;
+        for (int i = 1; i < argc; ++i)
+            strCmdLine += argv[i] + std::string(" ");
+
+        return orxonox::main(strCmdLine);
+#endif
+    }
+    catch (...)
+    {
+        COUT(0) << "Orxonox failed to initialise: " << orxonox::Exception::handleMessage() << std::endl;
+        COUT(0) << "Terminating program." << std::endl;
+        return 1;
+    }
+}
Index: /sandbox_light/src/OrxonoxConfig.cmake
===================================================================
--- /sandbox_light/src/OrxonoxConfig.cmake	(revision 5788)
+++ /sandbox_light/src/OrxonoxConfig.cmake	(revision 5788)
@@ -0,0 +1,103 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+ #
+ #  Author:
+ #    Reto Grieder
+ #  Description:
+ #    Configures the header files OrxonoxConfig.h and SpecialConfig.h
+ #    and sets some other options. All the build related options should be
+ #    found and set here if possible.
+ #
+
+#################### Options ####################
+
+# Default linking is SHARED
+SET(ORXONOX_DEFAULT_LINK SHARED)
+
+# Use, i.e. don't skip the full RPATH for the build tree
+SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
+
+# Global switch to disable Precompiled Header Files
+IF(PCH_COMPILER_SUPPORT)
+  OPTION(PCH_ENABLE "Global PCH switch" TRUE)
+ENDIF()
+
+# Use WinMain() or main()?
+IF(WIN32)
+  OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE)
+ENDIF()
+
+################ Platform Config ################
+
+# Check endianness
+INCLUDE(TestBigEndian)
+TEST_BIG_ENDIAN(ORXONOX_BIG_ENDIAN)
+IF(NOT ORXONOX_BIG_ENDIAN)
+  SET(ORXONOX_LITTLE_ENDIAN TRUE)
+ENDIF()
+
+# 32/64 bit system check
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+  SET(ORXONOX_ARCH_64 TRUE)
+ELSE()
+  SET(ORXONOX_ARCH_32 TRUE)
+ENDIF()
+
+# Platforms
+SET(ORXONOX_PLATFORM_WINDOWS ${WIN32})
+SET(ORXONOX_PLATFORM_APPLE ${APPLE})
+SET(ORXONOX_PLATFORM_UNIX ${UNIX})
+IF(UNIX AND NOT APPLE)
+  SET(ORXONOX_PLATFORM_LINUX TRUE)
+ENDIF()
+
+# Check __forceinline
+IF(MSVC)
+  INCLUDE(CheckCXXSourceCompiles)
+  SET(_source "int main() { return 0; } __forceinline void test() { return; }")
+  CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE)
+ENDIF(MSVC)
+
+# Check iso646.h include (literal operators)
+INCLUDE(CheckIncludeFileCXX)
+CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H)
+
+# XCode and Visual Studio support multiple configurations. In order to tell
+# about the active one we have to define the macro for each configuration
+ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Debug"          Debug)
+ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=Release"        Release)
+ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=RelWithDebInfo" RelWithDebInfo)
+ADD_COMPILER_FLAGS("-DCMAKE_BUILD_TYPE=MinSizeRel"     MinSizeRel)
+
+############## Configured Headers ###############
+
+SET(GENERATED_FILE_COMMENT
+   "DO NOT EDIT THIS FILE! <br>
+    It has been automatically generated by CMake from OrxonoxConfig.h.in")
+# Copy and configure OrxonoxConfig which gets included in every file
+CONFIGURE_FILE(OrxonoxConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h)
+# This file only gets included by very few classes to avoid a large recompilation
+CONFIGURE_FILE(SpecialConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h)
+
+SET(ORXONOX_CONFIG_FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/OrxonoxConfig.h.in
+  ${CMAKE_CURRENT_BINARY_DIR}/SpecialConfig.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/SpecialConfig.h.in
+)
Index: /sandbox_light/src/OrxonoxConfig.h.in
===================================================================
--- /sandbox_light/src/OrxonoxConfig.h.in	(revision 5788)
+++ /sandbox_light/src/OrxonoxConfig.h.in	(revision 5788)
@@ -0,0 +1,220 @@
+/*
+ *   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:
+ *      ...
+ *
+ *   Original code: OgrePlatform.h, licensed under the LGPL. The code
+ *   has changed almost completely though.
+ *
+ *   Caution: Do not configure this file CMake configuration (Debug, Release, etc.)
+ *            dependent! XCode and Visual Studio have the same file for all.
+ *
+ */
+
+/**
+@file
+@brief
+    Various constants for compiler, architecture and platform.
+@remarks
+    @GENERATED_FILE_COMMENT@
+*/
+
+#ifndef _OrxonoxConfig_H__
+#define _OrxonoxConfig_H__
+
+/*---------------------------------
+ * Platform and compiler related options
+ *-------------------------------*/
+#cmakedefine ORXONOX_PLATFORM_WINDOWS
+#cmakedefine ORXONOX_PLATFORM_LINUX
+#cmakedefine ORXONOX_PLATFORM_APPLE
+#cmakedefine ORXONOX_PLATFORM_UNIX /* Apple and Linux */
+
+// Determine compiler and set ORXONOX_COMP_VER
+#if defined( _MSC_VER )
+#  define ORXONOX_COMPILER_MSVC
+#  define ORXONOX_COMP_VER _MSC_VER
+
+#elif defined( __GNUC__ )
+#  define ORXONOX_COMPILER_GCC
+#  define ORXONOX_COMP_VER (((__GNUC__)*100) + \
+        (__GNUC_MINOR__*10) + \
+        __GNUC_PATCHLEVEL__)
+#  if defined(__MINGW32__)
+#    define ORXONOX_COMPILER_MINGW
+#  endif
+
+#elif defined( __BORLANDC__ )
+#  define ORXONOX_COMPILER_BORLAND
+#  define ORXONOX_COMP_VER __BCPLUSPLUS__
+
+#else
+#  pragma error "No known compiler. Abort!"
+
+#endif
+
+// Endianness
+#cmakedefine ORXONOX_BIG_ENDIAN
+#cmakedefine ORXONOX_LITTLE_ENDIAN
+
+// Architecture
+#cmakedefine ORXONOX_ARCH_32
+#cmakedefine ORXONOX_ARCH_64
+
+// See if we can use __forceinline or if we need to use __inline instead
+#cmakedefine HAVE_FORCEINLINE
+#ifndef FORCEINLINE
+#  ifdef HAVE_FORCEINLINE
+#    define FORCEINLINE __forceinline
+#  else
+#    define FORCEINLINE __inline
+#  endif
+#endif
+
+// Try to define function information
+#ifndef __FUNCTIONNAME__
+#  ifdef ORXONOX_COMPILER_BORLAND
+#    define __FUNCTIONNAME__ __FUNC__
+#  elif defined(ORXONOX_COMPILER_GCC)
+#    define __FUNCTIONNAME__ __PRETTY_FUNCTION__
+#  elif defined(ORXONOX_COMPILER_MSVC)
+#    define __FUNCTIONNAME__ __FUNCTION__
+#  else
+#    define __FUNCTIONNAME__
+#  endif
+#endif
+
+
+/*---------------------------------
+ * Version information
+ *-------------------------------*/
+#define ORXONOX_VERSION_MAJOR @ORXONOX_VERSION_MAJOR@
+#define ORXONOX_VERSION_MINOR @ORXONOX_VERSION_MINOR@
+#define ORXONOX_VERSION_PATCH @ORXONOX_VERSION_PATCH@
+#define ORXONOX_VERSION_NAME "@ORXONOX_VERSION_NAME@"
+
+//! Defines version info encoded as 0xMMIIPP (M: Major version, I: Minor version, P: Patch version, all as hex)
+#define ORXONOX_VERSION \
+    ((ORXONOX_VERSION_MAJOR << 16) | (ORXONOX_VERSION_MINOR << 8) | ORXONOX_VERSION_PATCH)
+
+
+/*---------------------------------
+ * Unix settings
+ *-------------------------------*/
+#ifdef ORXONOX_PLATFORM_UNIX
+
+// TODO: Check what this actually is and whether we need it or not
+#if 0
+#  ifdef ORXONOX_PLATFORM_APPLE
+#    define ORXONOX_PLATFORM_LIB "OrxonoxPlatform.bundle"
+#  else // ORXONOX_PLATFORM_LINUX
+#    define ORXONOX_PLATFORM_LIB "libOrxonoxPlatform.so"
+#  endif
+#endif
+
+#endif /* Patform Unix */
+
+
+/*---------------------------------
+ * Apple Settings
+ *-------------------------------*/
+
+
+/*---------------------------------
+ * Options
+ *-------------------------------*/
+/**
+@def ORXONOX_RELEASE
+    Enables expensive (build time) optimisations and disables certain features
+*/
+#cmakedefine ORXONOX_RELEASE
+
+
+/*---------------------------------
+ * Includes and Declarations
+ *-------------------------------*/
+// Define the english written operators like and, or, xor
+// This is C++ standard, but the Microsoft compiler doesn't define them.
+#cmakedefine HAVE_ISO646_H
+#ifdef HAVE_ISO646_H
+#  include <iso646.h>
+#endif
+
+#cmakedefine HAVE_STDINT_H
+#ifdef HAVE_STDINT_H
+#  include <stdint.h>
+#elif defined(ORXONOX_COMPILER_MSVC)
+typedef __int8            int8_t;
+typedef __int16           int16_t;
+typedef __int32           int32_t;
+typedef __int64           int64_t;
+typedef unsigned __int8   uint8_t;
+typedef unsigned __int16  uint16_t;
+typedef unsigned __int32  uint32_t;
+typedef unsigned __int64  uint64_t;
+#endif
+
+#cmakedefine HAVE_STDDEF_H
+/* Quite large, do not include unless necessary
+#ifdef HAVE_STDDEF_H
+#  include <stddef.h>
+#endif
+*/
+
+// Always include the memory leak detector for MSVC except for actual releases
+// Note: Although officially supported, VLD does not work with MSVC 9
+#if defined(ORXONOX_COMPILER_MSVC) && _MSC_VER < 1500 && !defined(ORXONOX_RELEASE)
+#  include <vld.h>
+#endif
+
+// Forward declare the everywhere used std::string
+namespace std
+{
+    template<class _Elem> struct char_traits;
+    template<class _Ty>   class  allocator;
+    template<class _Elem, class _Traits, class _Ax> class basic_string;
+    typedef basic_string<char, char_traits<char>, allocator<char> > string;
+}
+
+// Import general purpose smart pointers
+namespace boost
+{
+    template<class T> class scoped_ptr;
+    template<class T> class shared_ptr;
+    template<class T> class weak_ptr;
+    template<class T> class intrusive_ptr;
+    template<class T> class shared_array;
+    template<class T> class scoped_array;
+}
+namespace orxonox
+{
+    using boost::scoped_ptr;
+    using boost::shared_ptr;
+    using boost::weak_ptr;
+    using boost::intrusive_ptr;
+    using boost::shared_array;
+    using boost::scoped_array;
+}
+
+#endif /* _OrxonoxConfig_H__ */
Index: /sandbox_light/src/SpecialConfig.h.in
===================================================================
--- /sandbox_light/src/SpecialConfig.h.in	(revision 5788)
+++ /sandbox_light/src/SpecialConfig.h.in	(revision 5788)
@@ -0,0 +1,110 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Various constants and options that only affect very little code.
+@note
+    This is merely to avoid recompiling everything when only a path changes.
+@remarks
+    @GENERATED_FILE_COMMENT@
+*/
+
+#ifndef _SpecialConfig_H__
+#define _SpecialConfig_H__
+
+#include "OrxonoxConfig.h"
+#include <boost/preprocessor/stringize.hpp>
+
+/**
+@def DEPENDENCY_PACKAGE_ENABLE
+    Defined if a precompiled depdency package was used. We then copy all libraries
+    too when installing.
+*/
+#cmakedefine DEPENDENCY_PACKAGE_ENABLE
+
+/**
+@def INSTALL_COPYABLE
+    Orxonox either gets installed to the system or just into a folder.
+    The latter uses relative paths.
+*/
+#cmakedefine INSTALL_COPYABLE
+
+/**
+@def CMAKE_CONFIGURATION_TYPES
+    Using MSVC or XCode IDE
+*/
+#cmakedefine CMAKE_CONFIGURATION_TYPES
+
+// Handle default ConfigValues
+namespace orxonox { namespace specialConfig
+{
+    // DEFAULT RELATIVE PATHS (might not be used at all)
+    const char defaultRuntimePath[] = "@DEFAULT_RUNTIME_PATH@";
+    const char defaultLibraryPath[] = "@DEFAULT_LIBRARY_PATH@";
+    const char defaultArchivePath[] = "@DEFAULT_ARCHIVE_PATH@";
+    const char defaultModulePath[]  = "@DEFAULT_MODULE_PATH@";
+    const char defaultDocPath[]     = "@DEFAULT_DOC_PATH@";
+    const char defaultDataPath[]    = "@DEFAULT_DATA_PATH@";
+    const char defaultConfigPath[]  = "@DEFAULT_CONFIG_PATH@";
+    const char defaultLogPath[]     = "@DEFAULT_LOG_PATH@";
+
+#ifndef INSTALL_COPYABLE
+    // INSTALLATION PATHS
+    const char dataInstallDirectory[]       = "@DATA_INSTALL_DIRECTORY@";
+    const char moduleInstallDirectory[]     = "@MODULE_INSTALL_DIRECTORY@";
+#endif
+
+    // DEVELOPMENT RUN PATHS
+    const char dataDevDirectory[]           = "@DATA_DIRECTORY@";
+#ifdef CMAKE_CONFIGURATION_TYPES
+    const char moduleDevDirectory[]         = "@CMAKE_MODULE_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);
+    const char configDevDirectory[]         = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);
+    const char logDevDirectory[]            = "@CMAKE_LOG_OUTPUT_DIRECTORY@/"    BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);
+#else
+    const char moduleDevDirectory[]         = "@CMAKE_MODULE_OUTPUT_DIRECTORY@";
+    const char configDevDirectory[]         = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@";
+    const char logDevDirectory[]            = "@CMAKE_LOG_OUTPUT_DIRECTORY@";
+#endif
+
+#ifdef DEPENDENCY_PACKAGE_ENABLE
+    const char dependencyLibraryDirectory[] = "@DEP_LIBRARY_DIR@";
+#endif
+
+    // Module extension
+    const char moduleExtension[] = "@ORXONOX_MODULE_EXTENSION@";
+} }
+
+/**
+@def ORXONOX_USE_WINMAIN
+    Use main() or WinMain()?
+*/
+#cmakedefine ORXONOX_USE_WINMAIN
+
+#endif /* _SpecialConfig_H__ */
Index: /sandbox_light/src/external/CMakeLists.txt
===================================================================
--- /sandbox_light/src/external/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/src/external/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,22 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+
+################ Sub Directories ################
+
+ADD_SUBDIRECTORY(tolua)
Index: /sandbox_light/src/external/tolua/CMakeLists.txt
===================================================================
--- /sandbox_light/src/external/tolua/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/src/external/tolua/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,92 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+
+################### Tolua++ library ###################
+
+SET(TOLUA++_FILES
+  tolua_event.h
+  tolua++.h
+
+  tolua_event.c
+  tolua_is.c
+  tolua_map.c
+  tolua_push.c
+  tolua_to.c
+)
+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
+  ORXONOX_EXTERNAL
+  DEFINE_SYMBOL
+    "TOLUA_SHARED_BUILD"
+  VERSION
+    1.0.92
+  LINK_LIBRARIES
+    ${LUA_LIBRARIES}
+  SOURCE_FILES
+    ${TOLUA++_FILES}
+)
+
+
+################## Tolua++ generator ##################
+
+ORXONOX_ADD_EXECUTABLE(tolua++app_orxonox
+  ORXONOX_EXTERNAL
+  VERSION
+    1.0.92
+  NO_INSTALL
+  LINK_LIBRARIES
+    ${LUA_LIBRARIES}
+  SOURCE_FILES
+    tolua.c
+)
+
+# Set some variables to the cache in order to use them in the TOLUA macro
+SET(TOLUA_PARSER_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/all-${LUA_VERSION}.lua" CACHE INTERNAL "")
+SET(TOLUA_PARSER_DEPENDENCIES
+  tolua++app_orxonox
+  ${CMAKE_CURRENT_SOURCE_DIR}/all-${LUA_VERSION}.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/compat-5.1.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/compat.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/basic.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/feature.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/verbatim.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/code.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/typedef.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/container.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/package.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/module.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/namespace.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/define.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/enumerate.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/declaration.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/variable.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/array.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/function.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/operator.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/class.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/clean.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/doit.lua
+
+  CACHE INTERNAL ""
+)
Index: /sandbox_light/src/external/tolua/MANUAL
===================================================================
--- /sandbox_light/src/external/tolua/MANUAL	(revision 5788)
+++ /sandbox_light/src/external/tolua/MANUAL	(revision 5788)
@@ -0,0 +1,58 @@
+This tolua++ is modified with support for exception handling, and more will
+likely come over time.
+
+So to avoid forgetting how it works and what's new, all added features will
+be documented in full in this file:
+
+***********************
+* Exception handling: *
+***********************
+A new function modifier 'tolua_throws' has been added. It goes the same place
+as 'tolua_outside' etc. - so before the function name and return type.
+
+Two "types" of exceptions are supported internally, but they can be customized
+by making the tolua++ binary execute a Lua script before parsing with the '-L'
+command line option.
+Look in '../LuaScriptModule/package/exceptions.lua' to see the format. It's
+fairly simple and gives you alot of control.
+
+You always have 'std::exception' and 'any' (which means ...) available.
+
+This first example would be valid in a .pkg file for tolua++, and would ensure
+that any exceptions based on 'std::exception' thrown by the real C++ function
+would result in return value of 'nil' in Lua:
+
+	tolua_throws|std::exception,nil| void I_Throw:StdException();
+
+Inside the pipes the exception name follow by return values (or actions) are
+listed. The syntax is like so:
+
+	tolua_throws|<exceptionName>[,<ret1>[,<ret2> ... [, <retN>]]]|[<exceptionName>...|]
+
+The return values can by any of the following:
+* nil
+* message (the exception message, or 'Unknown' if not possible.
+* true
+* false
+* error (can only be used alone, will contain the exception is possible)
+
+In case no return values are specified, it will default to: 'nil, message'.
+
+Example 1: 
+----------
+Returns 'nil, false' for all exceptions:
+
+	tolua_throws|any,nil,false|
+
+Example 2:
+----------
+Returns 'nil, message' if a 'std::exception' is thrown:
+
+	tolua_throws|std::exception,nil,message|
+
+Example 3:
+----------
+If a CEGUI::Exception is thrown, return 'nil, message'.
+If any other kind of exception is thrown abort (error).
+
+	tolua_throws|CEGUI::Exception|any,error|
Index: /sandbox_light/src/external/tolua/README
===================================================================
--- /sandbox_light/src/external/tolua/README	(revision 5788)
+++ /sandbox_light/src/external/tolua/README	(revision 5788)
@@ -0,0 +1,32 @@
+This is tolua++-1.0
+
+* What is tolua++?
+  tolua++ is an extension of toLua, a tool to integrate C/C++ code with
+  Lua. tolua++ includes new features oriented to c++, such as class
+  templates.
+
+  tolua is a tool that greatly simplifies the integration of C/C++ code 
+  with Lua. Based on a "cleaned" header file, tolua automatically generates 
+  the binding code to access C/C++ features from Lua. Using Lua-5.0 API and
+  metamethod facilities, the current version automatically maps C/C++ 
+  constants, external variables, functions, namespace, classes, and methods 
+  to Lua. It also provides facilities to create Lua modules.
+
+* Availability
+  tolua is freely available; you can redistribute it and/or modify it.
+  The software provided hereunder is on an "as is" basis, and
+  the author has no obligation to provide maintenance, support, 
+  updates, enhancements, or modifications.
+
+  tolua can be downloaded from the sites below:
+            http://www.codenix.com/~tolua/
+            http://www.codenix.com/~tolua/tolua++-1.0.tar.bz2
+
+* Installation
+  See INSTALL.
+
+* Contacting the author
+  tolua has been designed and implemented by Waldemar Celes.
+  tolua++ is maintained by Ariel Manzur.
+  Send your comments, bug reports and anything else to 
+  tolua@codenix.com
Index: /sandbox_light/src/external/tolua/VERSION
===================================================================
--- /sandbox_light/src/external/tolua/VERSION	(revision 5788)
+++ /sandbox_light/src/external/tolua/VERSION	(revision 5788)
@@ -0,0 +1,9 @@
+Tolua++ v1.0.92 with changes:
+
+- Exception handling by CEGUI team
+- Corrected all indentation by Orxonox
+- Added more command line arguments by Orxonox
+- Several small changes considering the output files by Orxonox
+
+The changes to the C source files are stored in changes_orxonox.diff
+
Index: /sandbox_light/src/external/tolua/all-5.0.lua
===================================================================
--- /sandbox_light/src/external/tolua/all-5.0.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/all-5.0.lua	(revision 5788)
@@ -0,0 +1,28 @@
+dofile(path.."lua/compat.lua")
+dofile(path.."lua/basic.lua")
+dofile(path.."lua/feature.lua")
+dofile(path.."lua/verbatim.lua")
+dofile(path.."lua/code.lua")
+dofile(path.."lua/typedef.lua")
+dofile(path.."lua/container.lua")
+dofile(path.."lua/package.lua")
+dofile(path.."lua/module.lua")
+dofile(path.."lua/namespace.lua")
+dofile(path.."lua/define.lua")
+dofile(path.."lua/enumerate.lua")
+dofile(path.."lua/declaration.lua")
+dofile(path.."lua/variable.lua")
+dofile(path.."lua/array.lua")
+dofile(path.."lua/function.lua")
+dofile(path.."lua/operator.lua")
+dofile(path.."lua/class.lua")
+dofile(path.."lua/clean.lua")
+--dofile(path.."lua/custom.lua")
+dofile(path.."lua/doit.lua")
+
+local err,msg = xpcall(doit, debug.traceback)
+if not err then
+--print("**** msg is "..tostring(msg))
+ local _,_,label,msg = strfind(msg,"(.-:.-:%s*)(.*)")
+ tolua_error(msg,label)
+end
Index: /sandbox_light/src/external/tolua/all-5.1.lua
===================================================================
--- /sandbox_light/src/external/tolua/all-5.1.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/all-5.1.lua	(revision 5788)
@@ -0,0 +1,29 @@
+dofile(path.."lua/compat-5.1.lua")
+dofile(path.."lua/compat.lua")
+dofile(path.."lua/basic.lua")
+dofile(path.."lua/feature.lua")
+dofile(path.."lua/verbatim.lua")
+dofile(path.."lua/code.lua")
+dofile(path.."lua/typedef.lua")
+dofile(path.."lua/container.lua")
+dofile(path.."lua/package.lua")
+dofile(path.."lua/module.lua")
+dofile(path.."lua/namespace.lua")
+dofile(path.."lua/define.lua")
+dofile(path.."lua/enumerate.lua")
+dofile(path.."lua/declaration.lua")
+dofile(path.."lua/variable.lua")
+dofile(path.."lua/array.lua")
+dofile(path.."lua/function.lua")
+dofile(path.."lua/operator.lua")
+dofile(path.."lua/class.lua")
+dofile(path.."lua/clean.lua")
+--dofile(path.."lua/custom.lua")
+dofile(path.."lua/doit.lua")
+
+local err,msg = xpcall(doit, debug.traceback)
+if not err then
+--print("**** msg is "..tostring(msg))
+ local _,_,label,msg = strfind(msg,"(.-:.-:%s*)(.*)")
+ tolua_error(msg,label)
+end
Index: /sandbox_light/src/external/tolua/changes_orxonox.diff
===================================================================
--- /sandbox_light/src/external/tolua/changes_orxonox.diff	(revision 5788)
+++ /sandbox_light/src/external/tolua/changes_orxonox.diff	(revision 5788)
@@ -0,0 +1,182 @@
+diff -ruN tolua/tolua++.h tolua2/tolua++.h
+--- tolua/tolua++.h	Wed Jan 28 21:51:38 2009
++++ tolua2/tolua++.h	Sat Jan 10 14:48:44 2009
+@@ -16,9 +16,34 @@
+ #ifndef TOLUA_H
+ #define TOLUA_H
+ 
++/* original code */
++/*
+ #ifndef TOLUA_API
+ #define TOLUA_API extern
+ #endif
++*/
++
++/********************************
++******* ORXONOX CHANGES *********
++********************************/
++
++#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined( TOLUA_STATIC_BUILD )
++#  ifdef TOLUA_SHARED_BUILD
++#    define TOLUA_API __declspec(dllexport)
++#  else
++#    if defined( __MINGW32__ )
++#      define TOLUA_API
++#    else
++#      define TOLUA_API __declspec(dllimport)
++#    endif
++#  endif
++#else
++#  define TOLUA_API extern
++#endif
++
++/********************************
++****** END ORXONOX CHANGES ******
++********************************/
+ 
+ #define TOLUA_VERSION "tolua++-1.0.92"
+ 
+diff -ruN tolua/tolua.c tolua2/tolua.c
+--- tolua/tolua.c	Wed Jan 28 21:51:00 2009
++++ tolua2/tolua.c	Sat Jan 10 14:48:45 2009
+@@ -4,6 +4,8 @@
+ ** TeCGraf/PUC-Rio
+ ** Aug 2003
+ ** $Id:$
++** Extension by Orxonox (Reto Grieder) to support working directory
++** and direct usage of lua files. (2008)
+ */
+ 
+ /* This code is free software; you can redistribute it and/or modify it.
+@@ -33,6 +35,8 @@
+          "  -o  file : set output file; default is stdout.\n"
+          "  -H  file : create include file.\n"
+          "  -n  name : set package name; default is input file root name.\n"
++         "  -w  directory : set working directory; default is location of package file.\n"
++         "  -s  file : specify source lua code for the parser; all.lua is default.\n"
+          "  -p       : parse only.\n"
+          "  -P       : parse and print structure information (for debug).\n"
+          "  -S       : disable support for c++ strings.\n"
+@@ -64,12 +68,12 @@
+ }
+ 
+ static void add_extra (lua_State* L, char* value) {
+-	int len;
+-	lua_getglobal(L, "_extra_parameters");
+-	len = luaL_getn(L, -1);
+-	lua_pushstring(L, value);
+-	lua_rawseti(L, -2, len+1);
+-	lua_pop(L, 1);
++ int len;
++ lua_getglobal(L, "_extra_parameters");
++ len = luaL_getn(L, -1);
++ lua_pushstring(L, value);
++ lua_rawseti(L, -2, len+1);
++ lua_pop(L, 1);
+ };
+ 
+ static void error (char* o)
+@@ -81,6 +85,9 @@
+ 
+ int main (int argc, char* argv[])
+ {
++ char* working_directory = "";
++ char* lua_source = "";
++
+  #ifdef LUA_VERSION_NUM /* lua 5.1 */
+  lua_State* L = luaL_newstate();
+  luaL_openlibs(L);
+@@ -97,6 +104,7 @@
+  lua_pushstring(L,TOLUA_VERSION); lua_setglobal(L,"TOLUA_VERSION");
+  lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION");
+ 
++
+  if (argc==1)
+  {
+   help();
+@@ -124,6 +132,14 @@
+      case 'o': setfield(L,t,"o",argv[++i]); break;
+      case 'n': setfield(L,t,"n",argv[++i]); break;
+      case 'H': setfield(L,t,"H",argv[++i]); break;
++     case 'w':
++      working_directory = argv[++i];
++      setfield(L,t,"w",argv[i]);
++      break;
++     case 's':
++      lua_source = argv[++i];
++      setfield(L,t,"s",argv[i]);
++      break;
+      case 'S': setfield(L,t,"S",""); break;
+      case '1': setfield(L,t,"1",""); break;
+      case 'L': setfield(L,t,"L",argv[++i]); break;
+@@ -143,25 +159,53 @@
+   }
+   lua_pop(L,1);
+  }
+-/* #define TOLUA_SCRIPT_RUN */
+-#ifndef TOLUA_SCRIPT_RUN
++
+  {
+-  int tolua_tolua_open (lua_State* L);
+-  tolua_tolua_open(L);
+- }
++  char path[BUFSIZ];
++  char file[BUFSIZ];
++  path[0] = '\0';
++  file[0] = '\0';
++
++  if (strlen(lua_source) > 0 &&
++      lua_source[0] != '/' &&
++      lua_source[0] != '\\' &&
++      strlen(lua_source) > 1 &&
++      lua_source[1] != ':')
++  {
++   /* Relative path, prefix working directory */
++   strcpy(path, working_directory);
++   /* Make sure there is '\\' or '/' at the end of the path */
++   if (strlen(path) > 0)
++   {
++    char last = path[strlen(path) - 1];
++    if (last != '\\' && last != '/')
++     strcat(path, "/");
++   }
++  }
++
++  strcat(path, lua_source);
++
++  /* Extract the full path */
++  {
++   char* p;
++   p = strrchr(path, '/');
++   if (p == NULL)
++    p = strrchr(path, '\\');
++   p = (p == NULL) ? path : p + 1;
++   strcpy(file, p);
++   *p = '\0';
++  }
++  if (strlen(file) == 0)
++   strcpy(file, "all.lua");
++
++  lua_pushstring(L, path);
++  lua_setglobal(L, "path");
++  strcat(path, file);
++#ifdef LUA_VERSION_NUM /* lua 5.1 */
++  luaL_dofile(L, path);
+ #else
+- {
+-  char* p;
+-  char  path[BUFSIZ];
+-  strcpy(path,argv[0]);
+-  p = strrchr(path,'/');
+-  if (p==NULL) p = strrchr(path,'\\');
+-  p = (p==NULL) ? path : p+1;
+-  sprintf(p,"%s","../src/bin/lua/");
+-  lua_pushstring(L,path); lua_setglobal(L,"path");
+-		strcat(path,"all.lua");
+-  lua_dofile(L,path);
+- }
++  lua_dofile(L, path);
+ #endif
++ }
+  return 0;
+ }
Index: /sandbox_light/src/external/tolua/lua/array.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/array.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/array.lua	(revision 5788)
@@ -0,0 +1,226 @@
+-- tolua: array class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1999
+-- $Id: array.lua,v 1.1 2000/11/06 22:03:57 celes Exp $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- Array class
+-- Represents a extern array variable or a public member of a class.
+-- Stores all fields present in a declaration.
+classArray = {
+}
+classArray.__index = classArray
+setmetatable(classArray,classDeclaration)
+
+-- Print method
+function classArray:print (ident,close)
+    print(ident.."Array{")
+    print(ident.." mod  = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." ptr  = '"..self.ptr.."',")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." def  = '"..self.def.."',")
+    print(ident.." dim  = '"..self.dim.."',")
+    print(ident.." ret  = '"..self.ret.."',")
+    print(ident.."}"..close)
+end
+
+-- check if it is a variable
+function classArray:isvariable ()
+    return true
+end
+
+
+-- get variable value
+function classArray:getvalue (class,static)
+    if class and static then
+        return class..'::'..self.name..'[tolua_index]'
+    elseif class then
+        return 'self->'..self.name..'[tolua_index]'
+    else
+        return self.name..'[tolua_index]'
+    end
+end
+
+-- Write binding functions
+function classArray:supcode ()
+    local class = self:inclass()
+
+    -- get function ------------------------------------------------
+    if class then
+        output("/* get function:",self.name," of class ",class," */")
+    else
+        output("/* get function:",self.name," */")
+    end
+    self.cgetname = self:cfuncname("tolua_get")
+    output("#ifndef TOLUA_DISABLE_"..self.cgetname)
+    output("\nstatic int",self.cgetname,"(lua_State* tolua_S)")
+    output("{")
+    output(" int tolua_index;")
+
+    -- declare self, if the case
+    local _,_,static = strfind(self.mod,'^%s*(static)')
+    if class and static==nil then
+        output(' ',self.parent.type,'*','self;')
+        output(' lua_pushstring(tolua_S,".self");')
+        output(' lua_rawget(tolua_S,1);')
+        output(' self = ')
+        output('(',self.parent.type,'*) ')
+        output('lua_touserdata(tolua_S,-1);')
+    elseif static then
+        _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
+    end
+
+    -- check index
+    output('#ifndef TOLUA_RELEASE\n')
+    output(' {')
+    output('  tolua_Error tolua_err;')
+    output('  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))')
+    output('   tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);')
+    output(' }')
+    output('#endif\n')
+    if flags['1'] then -- for compatibility with tolua5 ?
+        output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;')
+    else
+        output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0);')
+    end
+    output('#ifndef TOLUA_RELEASE\n')
+    if self.dim and self.dim ~= '' then
+        output(' if (tolua_index<0 || tolua_index>='..self.dim..')')
+    else
+        output(' if (tolua_index<0)')
+    end
+    output('  tolua_error(tolua_S,"array indexing out of range.",NULL);')
+    output('#endif\n')
+
+    -- return value
+    local t,ct = isbasic(self.type)
+    if t then
+        output(' tolua_push'..t..'(tolua_S,(',ct,')'..self:getvalue(class,static)..');')
+    else
+        t = self.type
+        if self.ptr == '&' or self.ptr == '' then
+            output(' tolua_pushusertype(tolua_S,(void*)&'..self:getvalue(class,static)..',"',t,'");')
+        else
+            output(' tolua_pushusertype(tolua_S,(void*)'..self:getvalue(class,static)..',"',t,'");')
+        end
+    end
+    output(' return 1;')
+    output('}')
+    output('#endif //#ifndef TOLUA_DISABLE\n')
+    output('\n')
+
+    -- set function ------------------------------------------------
+    if not strfind(self.type,'const') then
+        if class then
+            output("/* set function:",self.name," of class ",class," */")
+        else
+            output("/* set function:",self.name," */")
+        end
+        self.csetname = self:cfuncname("tolua_set")
+        output("#ifndef TOLUA_DISABLE_"..self.csetname)
+        output("\nstatic int",self.csetname,"(lua_State* tolua_S)")
+        output("{")
+
+        -- declare index
+        output(' int tolua_index;')
+
+        -- declare self, if the case
+        local _,_,static = strfind(self.mod,'^%s*(static)')
+        if class and static==nil then
+            output(' ',self.parent.type,'*','self;')
+            output(' lua_pushstring(tolua_S,".self");')
+            output(' lua_rawget(tolua_S,1);')
+            output(' self = ')
+            output('(',self.parent.type,'*) ')
+            output('lua_touserdata(tolua_S,-1);')
+        elseif static then
+            _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
+        end
+
+        -- check index
+        output('#ifndef TOLUA_RELEASE\n')
+        output(' {')
+        output('  tolua_Error tolua_err;')
+        output('  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))')
+        output('   tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);')
+        output(' }')
+        output('#endif\n')
+
+        if flags['1'] then -- for compatibility with tolua5 ?
+            output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;')
+        else
+            output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0);')
+        end
+
+        output('#ifndef TOLUA_RELEASE\n')
+        if self.dim and self.dim ~= '' then
+            output(' if (tolua_index<0 || tolua_index>='..self.dim..')')
+        else
+            output(' if (tolua_index<0)')
+        end
+        output('  tolua_error(tolua_S,"array indexing out of range.",NULL);')
+        output('#endif\n')
+
+        -- assign value
+        local ptr = ''
+        if self.ptr~='' then ptr = '*' end
+            output(' ')
+        if class and static then
+            output(class..'::'..self.name..'[tolua_index]')
+        elseif class then
+            output('self->'..self.name..'[tolua_index]')
+        else
+            output(self.name..'[tolua_index]')
+        end
+        local t = isbasic(self.type)
+        output(' = ')
+        if not t and ptr=='' then output('*') end
+        output('((',self.mod,self.type)
+        if not t then
+            output('*')
+        end
+        output(') ')
+        local def = 0
+        if self.def ~= '' then def = self.def end
+        if t then
+            output('tolua_to'..t,'(tolua_S,3,',def,'));')
+        else
+            output('tolua_tousertype(tolua_S,3,',def,'));')
+        end
+        output(' return 0;')
+        output('}')
+        output('#endif //#ifndef TOLUA_DISABLE\n')
+        output('\n')
+    end
+end
+
+function classArray:register (pre)
+    pre = pre or ''
+    if self.csetname then
+        output(pre..'tolua_array(tolua_S,"'..self.lname..'",'..self.cgetname..','..self.csetname..');')
+    else
+        output(pre..'tolua_array(tolua_S,"'..self.lname..'",'..self.cgetname..',NULL);')
+    end
+end
+
+-- Internal constructor
+function _Array (t)
+    setmetatable(t,classArray)
+    append(t)
+    return t
+end
+
+-- Constructor
+-- Expects a string representing the variable declaration.
+function Array (s)
+    return _Array (Declaration(s,'var'))
+end
+
+
Index: /sandbox_light/src/external/tolua/lua/basic.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/basic.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/basic.lua	(revision 5788)
@@ -0,0 +1,356 @@
+-- tolua: basic utility functions
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- Last update: Apr 2003
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- Basic C types and their corresponding Lua types
+-- All occurrences of "char*" will be replaced by "_cstring",
+-- and all occurrences of "void*" will be replaced by "_userdata"
+_basic = {
+    ['void'] = '',
+    ['char'] = 'number',
+    ['int'] = 'number',
+    ['short'] = 'number',
+    ['long'] = 'number',
+    ['unsigned'] = 'number',
+    ['float'] = 'number',
+    ['double'] = 'number',
+    ['_cstring'] = 'string',
+    ['_userdata'] = 'userdata',
+    ['char*'] = 'string',
+    ['void*'] = 'userdata',
+    ['bool'] = 'boolean',
+    ['lua_Object'] = 'value',
+    ['LUA_VALUE'] = 'value',    -- for compatibility with tolua 4.0
+    ['lua_State*'] = 'state',
+    ['_lstate'] = 'state',
+    ['lua_Function'] = 'value',
+}
+
+_basic_ctype = {
+    number = "lua_Number",
+    string = "const char*",
+    userdata = "void*",
+    boolean = "bool",
+    value = "int",
+    state = "lua_State*",
+}
+
+-- functions the are used to do a 'raw push' of basic types
+_basic_raw_push = {}
+
+-- List of user defined types
+-- Each type corresponds to a variable name that stores its tag value.
+_usertype = {}
+
+-- List of types that have to be collected
+_collect = {}
+
+-- List of types
+_global_types = {n=0}
+_global_types_hash = {}
+
+-- list of classes
+_global_classes = {}
+
+-- List of enum constants
+_global_enums = {}
+
+-- List of auto renaming
+_renaming = {}
+function appendrenaming (s)
+    local b,e,old,new = strfind(s,"%s*(.-)%s*@%s*(.-)%s*$")
+    if not b then
+        error("#Invalid renaming syntax; it should be of the form: pattern@pattern")
+    end
+    tinsert(_renaming,{old=old, new=new})
+end
+
+function applyrenaming (s)
+    for i=1,getn(_renaming) do
+        local m,n = gsub(s,_renaming[i].old,_renaming[i].new)
+        if n ~= 0 then
+            return m
+        end
+    end
+    return nil
+end
+
+-- Error handler
+function tolua_error (s,f)
+    if _curr_code then
+        print("***curr code for error is "..tostring(_curr_code))
+        print(debug.traceback())
+    end
+    local out = _OUTPUT
+    _OUTPUT = _STDERR
+    if strsub(s,1,1) == '#' then
+        write("\n** tolua: "..strsub(s,2)..".\n\n")
+        if _curr_code then
+            local _,_,s = strfind(_curr_code,"^%s*(.-\n)") -- extract first line
+            if s==nil then s = _curr_code end
+            s = gsub(s,"_userdata","void*") -- return with 'void*'
+            s = gsub(s,"_cstring","char*")  -- return with 'char*'
+            s = gsub(s,"_lstate","lua_State*")  -- return with 'lua_State*'
+            write("Code being processed:\n"..s.."\n")
+        end
+    else
+        if not f then f = "(f is nil)" end
+        print("\n** tolua internal error: "..f..s..".\n\n")
+        return
+    end
+    _OUTPUT = out
+end
+
+function warning (msg)
+    local out = _OUTPUT
+    _OUTPUT = _STDERR
+    write("\n** tolua warning: "..msg..".\n\n")
+    _OUTPUT = out
+end
+
+-- register an user defined type: returns full type
+function regtype (t)
+    --if isbasic(t) then
+    --    return t
+    --end
+    local ft = findtype(t)
+
+    if not _usertype[ft] then
+        return appendusertype(t)
+    end
+    return ft
+end
+
+-- return type name: returns full type
+function typevar(type)
+    if type == '' or type == 'void' then
+        return type
+    else
+        local ft = findtype(type)
+        if ft then
+            return ft
+        end
+        _usertype[type] = type
+        return type
+    end
+end
+
+-- check if basic type
+function isbasic (type)
+    local t = gsub(type,'const ','')
+    local m,t = applytypedef('', t)
+    local b = _basic[t]
+    if b then
+        return b,_basic_ctype[b]
+    end
+    return nil
+end
+
+-- split string using a token
+function split (s,t)
+    local l = {n=0}
+    local f = function (s)
+        l.n = l.n + 1
+        l[l.n] = s
+        return ""
+    end
+    local p = "%s*(.-)%s*"..t.."%s*"
+    s = gsub(s,"^%s+","")
+    s = gsub(s,"%s+$","")
+    s = gsub(s,p,f)
+    l.n = l.n + 1
+    l[l.n] = gsub(s,"(%s%s*)$","")
+    return l
+end
+
+-- splits a string using a pattern, considering the spacial cases of C code (templates, function parameters, etc)
+-- pattern can't contain the '^' (as used to identify the begining of the line)
+-- also strips whitespace
+function split_c_tokens(s, pat)
+
+    s = string.gsub(s, "^%s*", "")
+    s = string.gsub(s, "%s*$", "")
+
+    local token_begin = 1
+    local token_end = 1
+    local ofs = 1
+    local ret = {n=0}
+
+    function add_token(ofs)
+
+        local t = string.sub(s, token_begin, ofs)
+        t = string.gsub(t, "^%s*", "")
+        t = string.gsub(t, "%s*$", "")
+        ret.n = ret.n + 1
+        ret[ret.n] = t
+    end
+
+    while ofs <= string.len(s) do
+
+        local sub = string.sub(s, ofs, -1)
+        local b,e = string.find(sub, "^"..pat)
+        if b then
+            add_token(ofs-1)
+            ofs = ofs+e
+            token_begin = ofs
+        else
+            local char = string.sub(s, ofs, ofs)
+            if char == "(" or char == "<" then
+
+                local block
+                if char == "(" then block = "^%b()" end
+                if char == "<" then block = "^%b<>" end
+
+                b,e = string.find(sub, block)
+                if not b then
+                    -- unterminated block?
+                    ofs = ofs+1
+                else
+                    ofs = ofs + e
+                end
+
+            else
+                ofs = ofs+1
+            end
+        end
+
+    end
+    add_token(ofs)
+    --if ret.n == 0 then
+
+    --    ret.n=1
+    --    ret[1] = ""
+    --end
+
+    return ret
+
+end
+
+-- concatenate strings of a table
+function concat (t,f,l,jstr)
+    jstr = jstr or " "
+    local s = ''
+    local i=f
+    while i<=l do
+        s = s..t[i]
+        i = i+1
+        if i <= l then s = s..jstr end
+    end
+    return s
+end
+
+-- concatenate all parameters, following output rules
+function concatparam (line, ...)
+    local i=1
+    while i<=arg.n do
+        if _cont and not strfind(_cont,'[%(,"]') and
+            strfind(arg[i],"^[%a_~]") then
+            line = line .. ' '
+        end
+        line = line .. arg[i]
+        if arg[i] ~= '' then
+            _cont = strsub(arg[i],-1,-1)
+        end
+        i = i+1
+    end
+    if strfind(arg[arg.n],"[%/%)%;%{%}]$") then
+        _cont=nil line = line .. '\n'
+    end
+    return line
+end
+
+-- output line
+function output (...)
+    local i=1
+    while i<=arg.n do
+        if _cont and not strfind(_cont,'[%(,"]') and
+            strfind(arg[i],"^[%a_~]") then
+            write(' ')
+        end
+        write(arg[i])
+        if arg[i] ~= '' then
+            _cont = strsub(arg[i],-1,-1)
+        end
+        i = i+1
+    end
+    if strfind(arg[arg.n],"[%/%)%;%{%}]$") then
+        _cont=nil write('\n')
+    end
+end
+
+function get_property_methods(ptype, name)
+
+    if get_property_methods_hook and get_property_methods_hook(ptype,name) then
+        return get_property_methods_hook(ptype, name)
+    end
+
+    if ptype == "default" then -- get_name, set_name
+        return "get_"..name, "set_"..name
+    end
+
+    if ptype == "qt" then -- name, setName
+        return name, "set"..string.upper(string.sub(name, 1, 1))..string.sub(name, 2, -1)
+    end
+
+    if ptype == "overload" then -- name, name
+        return name,name
+    end
+
+    return nil
+end
+
+-------------- the hooks
+
+-- called right after processing the $[ichl]file directives,
+-- right before processing anything else
+-- takes the package object as the parameter
+function preprocess_hook(p)
+    -- p.code has all the input code from the pkg
+end
+
+
+-- called for every $ifile directive
+-- takes a table with a string called 'code' inside, the filename, and any extra arguments
+-- passed to $ifile. no return value
+function include_file_hook(t, filename, ...)
+
+end
+
+-- called after processing anything that's not code (like '$renaming', comments, etc)
+-- and right before parsing the actual code.
+-- takes the Package object with all the code on the 'code' key. no return value
+function preparse_hook(package)
+
+end
+
+
+-- called after writing all the output.
+-- takes the Package object
+function post_output_hook(package)
+
+end
+
+
+-- called from 'get_property_methods' to get the methods to retrieve a property
+-- according to its type
+function get_property_methods_hook(property_type, name)
+
+end
+
+-- called from ClassContainer:doparse with the string being parsed
+-- return nil, or a substring
+function parser_hook(s)
+
+    return nil
+end
+
+
Index: /sandbox_light/src/external/tolua/lua/class.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/class.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/class.lua	(revision 5788)
@@ -0,0 +1,220 @@
+-- tolua: class class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- Class class
+-- Represents a class definition.
+-- Stores the following fields:
+--    name = class name
+--    base = class base, if any (only single inheritance is supported)
+--    {i}  = list of members
+classClass = {
+    classtype = 'class',
+    name = '',
+    base = '',
+    type = '',
+    btype = '',
+    ctype = '',
+}
+classClass.__index = classClass
+setmetatable(classClass,classContainer)
+
+
+-- register class
+function classClass:register (pre)
+    if not self:check_public_access() then
+        return
+    end
+
+    pre = pre or ''
+    push(self)
+    if _collect[self.type] then
+        output(pre,'#ifdef __cplusplus\n')
+        output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",'.._collect[self.type]..');')
+        output(pre,'#else\n')
+        output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",NULL);')
+        output(pre,'#endif\n')
+    else
+        output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",NULL);')
+    end
+    if self.extra_bases then
+        for k,base in ipairs(self.extra_bases) do
+            -- not now
+            --output(pre..' tolua_addbase(tolua_S, "'..self.type..'", "'..base..'");')
+        end
+    end
+    output(pre..'tolua_beginmodule(tolua_S,"'..self.lname..'");')
+    local i=1
+    while self[i] do
+        self[i]:register(pre..' ')
+        i = i+1
+    end
+    output(pre..'tolua_endmodule(tolua_S);')
+    pop()
+end
+
+-- return collection requirement
+function classClass:requirecollection (t)
+    if self.flags.protected_destructor then
+        return false
+    end
+    push(self)
+    local r = false
+    local i=1
+    while self[i] do
+        r = self[i]:requirecollection(t) or r
+        i = i+1
+    end
+    pop()
+    -- only class that exports destructor can be appropriately collected
+    -- classes that export constructors need to have a collector (overrided by -D flag on command line)
+    if self._delete or ((not flags['D']) and self._new) then
+        --t[self.type] = "tolua_collect_" .. gsub(self.type,"::","_")
+        t[self.type] = "tolua_collect_" .. clean_template(self.type)
+        r = true
+    end
+    return r
+end
+
+-- output tags
+function classClass:decltype ()
+    push(self)
+    self.type = regtype(self.original_name or self.name)
+    self.btype = typevar(self.base)
+    self.ctype = 'const '..self.type
+    if self.extra_bases then
+        for i=1,table.getn(self.extra_bases) do
+            self.extra_bases[i] = typevar(self.extra_bases[i])
+        end
+    end
+    local i=1
+    while self[i] do
+        self[i]:decltype()
+        i = i+1
+    end
+    pop()
+end
+
+
+-- Print method
+function classClass:print (ident,close)
+    print(ident.."Class{")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." base = '"..self.base.."';")
+    print(ident.." lname = '"..self.lname.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." btype = '"..self.btype.."',")
+    print(ident.." ctype = '"..self.ctype.."',")
+    local i=1
+    while self[i] do
+        self[i]:print(ident.." ",",")
+        i = i+1
+    end
+    print(ident.."}"..close)
+end
+
+function classClass:set_protected_destructor(p)
+self.flags.protected_destructor = self.flags.protected_destructor or p
+end
+
+-- Internal constructor
+function _Class (t)
+    setmetatable(t,classClass)
+    t:buildnames()
+    append(t)
+    return t
+end
+
+-- Constructor
+-- Expects the name, the base (array) and the body of the class.
+function Class (n,p,b)
+
+    if table.getn(p) > 1 then
+        b = string.sub(b, 1, -2)
+        for i=2,table.getn(p),1 do
+            b = b.."\n tolua_inherits "..p[i].." __"..p[i].."__;\n"
+        end
+        b = b.."\n}"
+    end
+
+    -- check for template
+    b = string.gsub(b, "^{%s*TEMPLATE_BIND", "{\nTOLUA_TEMPLATE_BIND")
+    local t,_,T,I = string.find(b, "^{%s*TOLUA_TEMPLATE_BIND%s*%(+%s*\"?([^\",]*)\"?%s*,%s*([^%)]*)%s*%)+")
+    if t then
+
+        -- remove quotes
+        I = string.gsub(I, "\"", "")
+        T = string.gsub(T, "\"", "")
+        -- get type list
+        local types = split_c_tokens(I, ",")
+        -- remove TEMPLATE_BIND line
+        local bs = string.gsub(b, "^{%s*TOLUA_TEMPLATE_BIND[^\n]*\n", "{\n")
+
+        -- replace
+        for i =1 , types.n do
+
+            local Tl = split(T, " ")
+            local Il = split_c_tokens(types[i], " ")
+            local bI = bs
+            local pI = {}
+            for j = 1,Tl.n do
+                Tl[j] = findtype(Tl[j]) or Tl[j]
+                bI = string.gsub(bI, "([^_%w])"..Tl[j].."([^_%w])", "%1"..Il[j].."%2")
+                if p then
+                    for i=1,table.getn(p) do
+                        pI[i] = string.gsub(p[i], "([^_%w]?)"..Tl[j].."([^_%w]?)", "%1"..Il[j].."%2")
+                    end
+                end
+            end
+            --local append = "<"..string.gsub(types[i], "%s+", ",")..">"
+            local append = "<"..concat(Il, 1, table.getn(Il), ",")..">"
+            append = string.gsub(append, "%s*,%s*", ",")
+            append = string.gsub(append, ">>", "> >")
+            for i=1,table.getn(pI) do
+                --pI[i] = string.gsub(pI[i], ">>", "> >")
+                pI[i] = resolve_template_types(pI[i])
+            end
+            bI = string.gsub(bI, ">>", "> >")
+            Class(n..append, pI, bI)
+        end
+        return
+    end
+
+    local mbase
+
+    if p then
+        mbase = table.remove(p, 1)
+        if not p[1] then p = nil end
+    end
+
+    mbase = mbase and resolve_template_types(mbase)
+
+    local c
+    local oname = string.gsub(n, "@.*$", "")
+    oname = getnamespace(classContainer.curr)..oname
+
+    if _global_classes[oname] then
+        c = _global_classes[oname]
+        if mbase and ((not c.base) or c.base == "") then
+            c.base = mbase
+        end
+    else
+        c = _Class(_Container{name=n, base=mbase, extra_bases=p})
+
+        local ft = getnamespace(c.parent)..c.original_name
+        append_global_type(ft, c)
+    end
+
+    push(c)
+    c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
+    pop()
+end
+
Index: /sandbox_light/src/external/tolua/lua/clean.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/clean.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/clean.lua	(revision 5788)
@@ -0,0 +1,79 @@
+-- mark up comments and strings
+STR1 = "\001"
+STR2 = "\002"
+STR3 = "\003"
+STR4 = "\004"
+REM  = "\005"
+ANY  = "([\001-\005])"
+ESC1 = "\006"
+ESC2 = "\007"
+
+MASK = { -- the substitution order is important
+    {ESC1, "\\'"},
+    {ESC2, '\\"'},
+    {STR1, "'"},
+    {STR2, '"'},
+    {STR3, "%[%["},
+    {STR4, "%]%]"},
+    {REM , "%-%-"},
+}
+
+function mask (s)
+    for i = 1,getn(MASK)  do
+        s = gsub(s,MASK[i][2],MASK[i][1])
+    end
+    return s
+end
+
+function unmask (s)
+    for i = 1,getn(MASK)  do
+        s = gsub(s,MASK[i][1],MASK[i][2])
+    end
+    return s
+end
+
+function clean (s)
+    -- check for compilation error
+    local code = "return function ()\n" .. s .. "\n end"
+    if not dostring(code) then
+        return nil
+    end
+
+    if flags['C'] then
+        return s
+    end
+
+    local S = "" -- saved string
+
+    s = mask(s)
+
+    -- remove blanks and comments
+    while 1 do
+        local b,e,d = strfind(s,ANY)
+        if b then
+            S = S..strsub(s,1,b-1)
+            s = strsub(s,b+1)
+            if d==STR1 or d==STR2 then
+                e = strfind(s,d)
+                S = S ..d..strsub(s,1,e)
+                s = strsub(s,e+1)
+            elseif d==STR3 then
+                e = strfind(s,STR4)
+                S = S..d..strsub(s,1,e)
+                s = strsub(s,e+1)
+            elseif d==REM then
+                s = gsub(s,"[^\n]*(\n?)","%1",1)
+            end
+        else
+            S = S..s
+            break
+        end
+    end
+    -- eliminate unecessary spaces
+    S = gsub(S,"[ \t]+"," ")
+    S = gsub(S,"[ \t]*\n[ \t]*","\n")
+    S = gsub(S,"\n+","\n")
+    S = unmask(S)
+    return S
+end
+
Index: /sandbox_light/src/external/tolua/lua/code.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/code.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/code.lua	(revision 5788)
@@ -0,0 +1,100 @@
+-- tolua: code class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1999
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+-- global
+code_n = 1
+
+-- Code class
+-- Represents Lua code to be compiled and included
+-- in the initialization function.
+-- The following fields are stored:
+--   text = text code
+classCode = {
+    text = '',
+}
+classCode.__index = classCode
+setmetatable(classCode,classFeature)
+
+-- register code
+function classCode:register (pre)
+    pre = pre or ''
+    -- clean Lua code
+    local s = clean(self.text)
+    if not s then
+        --print(self.text)
+        error("parser error in embedded code")
+    end
+
+    -- get first line
+    local _, _, first_line=string.find(self.text, "^([^\n\r]*)")
+    if string.find(first_line, "^%s*%-%-") then
+        if string.find(first_line, "^%-%-##") then
+            first_line = string.gsub(first_line, "^%-%-##", "")
+            if flags['C'] then
+                s = string.gsub(s, "^%-%-##[^\n\r]*\n", "")
+            end
+        end
+    else
+        first_line = ""
+    end
+
+    -- convert to C
+    output('\n'..pre..'{ /* begin embedded lua code */\n')
+    output(pre..' int top = lua_gettop(tolua_S);')
+    output(pre..' static unsigned char B[] = {\n   ')
+    local t={n=0}
+    local b = gsub(s, '(.)',
+        function (c)
+            local e = ''
+            t.n=t.n+1
+            if t.n==15 then
+             t.n=0 e='\n'..pre..'  '
+            end
+            return format('%3u,%s',strbyte(c),e)
+        end
+    )
+    output(b..strbyte(" "))
+    output('\n'..pre..' };\n')
+    if first_line and first_line ~= "" then
+        output(pre..' tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: '..first_line..'");')
+    else
+        output(pre..' tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code '..code_n..'");')
+    end
+    output(pre..' lua_settop(tolua_S, top);')
+    output(pre..'} /* end of embedded lua code */\n\n')
+    code_n = code_n +1
+end
+
+
+-- Print method
+function classCode:print (ident,close)
+    print(ident.."Code{")
+    print(ident.." text = [["..self.text.."]],")
+    print(ident.."}"..close)
+end
+
+
+-- Internal constructor
+function _Code (t)
+    setmetatable(t,classCode)
+    append(t)
+    return t
+end
+
+-- Constructor
+-- Expects a string representing the code text
+function Code (l)
+    return _Code {
+        text = l
+    }
+end
+
+
Index: /sandbox_light/src/external/tolua/lua/compat-5.1.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/compat-5.1.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/compat-5.1.lua	(revision 5788)
@@ -0,0 +1,52 @@
+if string.find(_VERSION, "5%.0") then
+    return
+end
+
+-- "loadfile"
+local function pp_dofile(path)
+    local loaded = false
+    local getfile = function()
+
+        if loaded then
+            return
+        else
+            local file,err = io.open(path)
+            if not file then
+                error("error loading file "..path..": "..err)
+            end
+            local ret = file:read("*a")
+            file:close()
+
+            ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};")
+
+            loaded = true
+            return ret
+        end
+    end
+
+    local f = load(getfile, path)
+    return f()
+end
+
+old_dofile = dofile
+dofile = pp_dofile
+
+
+-- string.gsub
+--[[
+local ogsub = string.gsub
+local function compgsub(a,b,c,d)
+    if type(c) == "function" then
+        local oc = c
+        c = function (...) return oc(...) or '' end
+    end
+    return ogsub(a,b,c,d)
+end
+string.repl = ogsub
+--]]
+
+--string.gsub = compgsub
+
+
+
+
Index: /sandbox_light/src/external/tolua/lua/compat.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/compat.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/compat.lua	(revision 5788)
@@ -0,0 +1,193 @@
+-------------------------------------------------------------------
+-- Real globals
+-- _ALERT
+-- _ERRORMESSAGE
+-- _VERSION
+-- _G
+-- assert
+-- error
+-- metatable
+-- next
+-- print
+-- require
+-- tonumber
+-- tostring
+-- type
+-- unpack
+
+-------------------------------------------------------------------
+-- collectgarbage
+-- gcinfo
+
+-- globals
+
+-- call   -> protect(f, err)
+-- loadfile
+-- loadstring
+
+-- rawget
+-- rawset
+
+-- getargs = Main.getargs ??
+
+rawtype = type
+
+function do_ (f, err)
+    if not f then print(err); return end
+    local a,b = pcall(f)
+    if not a then print(b); return nil
+    else return b or true
+    end
+end
+
+function dostring(s) return do_(loadstring(s)) end
+-- function dofile(s) return do_(loadfile(s)) end
+
+-------------------------------------------------------------------
+-- Table library
+local tab = table
+foreach = tab.foreach
+foreachi = tab.foreachi
+getn = tab.getn
+tinsert = tab.insert
+tremove = tab.remove
+sort = tab.sort
+
+-------------------------------------------------------------------
+-- Debug library
+local dbg = debug
+getinfo = dbg.getinfo
+getlocal = dbg.getlocal
+setcallhook = function () error"`setcallhook' is deprecated" end
+setlinehook = function () error"`setlinehook' is deprecated" end
+setlocal = dbg.setlocal
+
+-------------------------------------------------------------------
+-- math library
+local math = math
+abs = math.abs
+acos = function (x) return math.deg(math.acos(x)) end
+asin = function (x) return math.deg(math.asin(x)) end
+atan = function (x) return math.deg(math.atan(x)) end
+atan2 = function (x,y) return math.deg(math.atan2(x,y)) end
+ceil = math.ceil
+cos = function (x) return math.cos(math.rad(x)) end
+deg = math.deg
+exp = math.exp
+floor = math.floor
+frexp = math.frexp
+ldexp = math.ldexp
+log = math.log
+log10 = math.log10
+max = math.max
+min = math.min
+mod = math.mod
+PI = math.pi
+--??? pow = math.pow  
+rad = math.rad
+random = math.random
+randomseed = math.randomseed
+sin = function (x) return math.sin(math.rad(x)) end
+sqrt = math.sqrt
+tan = function (x) return math.tan(math.rad(x)) end
+
+-------------------------------------------------------------------
+-- string library
+local str = string
+strbyte = str.byte
+strchar = str.char
+strfind = str.find
+format = str.format
+gsub = str.gsub
+strlen = str.len
+strlower = str.lower
+strrep = str.rep
+strsub = str.sub
+strupper = str.upper
+
+-------------------------------------------------------------------
+-- os library
+clock = os.clock
+date = os.date
+difftime = os.difftime
+execute = os.execute --?
+exit = os.exit
+getenv = os.getenv
+remove = os.remove
+rename = os.rename
+setlocale = os.setlocale
+time = os.time
+tmpname = os.tmpname
+
+-------------------------------------------------------------------
+-- compatibility only
+getglobal = function (n) return _G[n] end
+setglobal = function (n,v) _G[n] = v end
+
+-------------------------------------------------------------------
+
+local io, tab = io, table
+
+-- IO library (files)
+_STDIN = io.stdin
+_STDERR = io.stderr
+_STDOUT = io.stdout
+_INPUT = io.stdin
+_OUTPUT = io.stdout
+seek = io.stdin.seek   -- sick ;-)
+tmpfile = io.tmpfile
+closefile = io.close
+openfile = io.open
+
+function flush (f)
+    if f then f:flush()
+    else _OUTPUT:flush()
+    end
+end
+
+function readfrom (name)
+    if name == nil then
+        local f, err, cod = io.close(_INPUT)
+        _INPUT = io.stdin
+        return f, err, cod
+    else
+        local f, err, cod = io.open(name, "r")
+        _INPUT = f or _INPUT
+        return f, err, cod
+    end
+end
+
+function writeto (name)
+    if name == nil then
+        local f, err, cod = io.close(_OUTPUT)
+        _OUTPUT = io.stdout
+        return f, err, cod
+    else
+        local f, err, cod = io.open(name, "w")
+        _OUTPUT = f or _OUTPUT
+        return f, err, cod
+    end
+end
+
+function appendto (name)
+    local f, err, cod = io.open(name, "a")
+    _OUTPUT = f or _OUTPUT
+    return f, err, cod
+end
+
+function read (...)
+    local f = _INPUT
+    if rawtype(arg[1]) == 'userdata' then
+        f = tab.remove(arg, 1)
+    end
+    return f:read(unpack(arg))
+end
+
+function write (...)
+    local f = _OUTPUT
+    if rawtype(arg[1]) == 'userdata' then
+        f = tab.remove(arg, 1)
+    end
+    return f:write(unpack(arg))
+end
+
Index: /sandbox_light/src/external/tolua/lua/container.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/container.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/container.lua	(revision 5788)
@@ -0,0 +1,770 @@
+-- tolua: container abstract class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+-- table to store namespaced typedefs/enums in global scope
+global_typedefs = {}
+global_enums = {}
+
+-- Container class
+-- Represents a container of features to be bound
+-- to lua.
+classContainer =
+{
+    curr = nil,
+}
+classContainer.__index = classContainer
+setmetatable(classContainer,classFeature)
+
+-- output tags
+function classContainer:decltype ()
+    push(self)
+    local i=1
+    while self[i] do
+        self[i]:decltype()
+        i = i+1
+    end
+    pop()
+end
+
+
+-- write support code
+function classContainer:supcode ()
+
+    if not self:check_public_access() then
+        return
+    end
+
+    push(self)
+    local i=1
+    while self[i] do
+        if self[i]:check_public_access() then
+            self[i]:supcode()
+        end
+        i = i+1
+    end
+    pop()
+end
+
+function classContainer:hasvar ()
+    local i=1
+    while self[i] do
+        if self[i]:isvariable() then
+            return 1
+        end
+        i = i+1
+    end
+    return 0
+end
+
+-- Internal container constructor
+function _Container (self)
+    setmetatable(self,classContainer)
+    self.n = 0
+    self.typedefs = {tolua_n=0}
+    self.usertypes = {}
+    self.enums = {tolua_n=0}
+    self.lnames = {}
+    return self
+end
+
+-- push container
+function push (t)
+    t.prox = classContainer.curr
+    classContainer.curr = t
+end
+
+-- pop container
+function pop ()
+    --print("name",classContainer.curr.name)
+    --foreach(classContainer.curr.usertypes,print)
+    --print("______________")
+    classContainer.curr = classContainer.curr.prox
+end
+
+-- get current namespace
+function getcurrnamespace ()
+    return getnamespace(classContainer.curr)
+end
+
+-- append to current container
+function append (t)
+    return classContainer.curr:append(t)
+end
+
+-- append typedef to current container
+function appendtypedef (t)
+    return classContainer.curr:appendtypedef(t)
+end
+
+-- append usertype to current container
+function appendusertype (t)
+    return classContainer.curr:appendusertype(t)
+end
+
+-- append enum to current container
+function appendenum (t)
+    return classContainer.curr:appendenum(t)
+end
+
+-- substitute typedef
+function applytypedef (mod,type)
+    return classContainer.curr:applytypedef(mod,type)
+end
+
+-- check if is type
+function findtype (type)
+    local t = classContainer.curr:findtype(type)
+    return t
+end
+
+-- check if is typedef
+function istypedef (type)
+    return classContainer.curr:istypedef(type)
+end
+
+-- get fulltype (with namespace)
+function fulltype (t)
+    local curr =  classContainer.curr
+    while curr do
+        if curr then
+            if curr.typedefs and curr.typedefs[t] then
+                return curr.typedefs[t]
+            elseif curr.usertypes and curr.usertypes[t] then
+                return curr.usertypes[t]
+            end
+        end
+        curr = curr.prox
+    end
+    return t
+end
+
+-- checks if it requires collection
+function classContainer:requirecollection (t)
+    push(self)
+    local i=1
+    local r = false
+    while self[i] do
+        r = self[i]:requirecollection(t) or r
+        i = i+1
+    end
+    pop()
+    return r
+end
+
+
+-- get namesapce
+function getnamespace (curr)
+    local namespace = ''
+    while curr do
+        if curr and
+            ( curr.classtype == 'class' or curr.classtype == 'namespace')
+        then
+            namespace = (curr.original_name or curr.name) .. '::' .. namespace
+            --namespace = curr.name .. '::' .. namespace
+        end
+        curr = curr.prox
+    end
+    return namespace
+end
+
+-- get namespace (only namespace)
+function getonlynamespace ()
+    local curr = classContainer.curr
+    local namespace = ''
+    while curr do
+        if curr.classtype == 'class' then
+            return namespace
+        elseif curr.classtype == 'namespace' then
+            namespace = curr.name .. '::' .. namespace
+        end
+        curr = curr.prox
+    end
+    return namespace
+end
+
+-- check if is enum
+function isenum (type)
+    return classContainer.curr:isenum(type)
+end
+
+-- append feature to container
+function classContainer:append (t)
+    self.n = self.n + 1
+    self[self.n] = t
+    t.parent = self
+end
+
+-- append typedef
+function classContainer:appendtypedef (t)
+    local namespace = getnamespace(classContainer.curr)
+    self.typedefs.tolua_n = self.typedefs.tolua_n + 1
+    self.typedefs[self.typedefs.tolua_n] = t
+    self.typedefs[t.utype] = namespace .. t.utype
+    global_typedefs[namespace..t.utype] = t
+    t.ftype = findtype(t.type) or t.type
+    --print("appending typedef "..t.utype.." as "..namespace..t.utype.." with ftype "..t.ftype)
+    append_global_type(namespace..t.utype)
+    if t.ftype and isenum(t.ftype) then
+        global_enums[namespace..t.utype] = true
+    end
+end
+
+-- append usertype: return full type
+function classContainer:appendusertype (t)
+    local container
+    if t == (self.original_name or self.name) then
+        container = self.prox
+    else
+        container = self
+    end
+    local ft = getnamespace(container) .. t
+    container.usertypes[t] = ft
+    _usertype[ft] = ft
+    return ft
+end
+
+-- append enum
+function classContainer:appendenum (t)
+    local namespace = getnamespace(classContainer.curr)
+    self.enums.tolua_n = self.enums.tolua_n + 1
+    self.enums[self.enums.tolua_n] = t
+    global_enums[namespace..t.name] = t
+end
+
+-- determine lua function name overload
+function classContainer:overload (lname)
+    if not self.lnames[lname] then
+        self.lnames[lname] = 0
+    else
+        self.lnames[lname] = self.lnames[lname] + 1
+    end
+    return format("%02d",self.lnames[lname])
+end
+
+-- applies typedef: returns the 'the facto' modifier and type
+function classContainer:applytypedef (mod,type)
+    if global_typedefs[type] then
+        --print("found typedef "..global_typedefs[type].type)
+        local mod1, type1 = global_typedefs[type].mod, global_typedefs[type].ftype
+        local mod2, type2 = applytypedef(mod.." "..mod1, type1)
+        --return mod2 .. ' ' .. mod1, type2
+        return mod2, type2
+    end
+    do return mod,type end
+end
+
+-- check if it is a typedef
+function classContainer:istypedef (type)
+    local env = self
+    while env do
+        if env.typedefs then
+            local i=1
+            while env.typedefs[i] do
+                if env.typedefs[i].utype == type then
+                    return type
+                end
+                i = i+1
+            end
+        end
+        env = env.parent
+    end
+    return nil
+end
+
+function find_enum_var(var)
+
+    if tonumber(var) then return var end
+
+    local c = classContainer.curr
+    while c do
+        local ns = getnamespace(c)
+        for k,v in pairs(_global_enums) do
+            if match_type(var, v, ns) then
+                return v
+            end
+        end
+        if c.base and c.base ~= '' then
+            c = _global_classes[c:findtype(c.base)]
+        else
+            c = nil
+        end
+    end
+
+    return var
+end
+
+-- check if is a registered type: return full type or nil
+function classContainer:findtype (t)
+
+    t = string.gsub(t, "=.*", "")
+    if _basic[t] then
+     return t
+    end
+
+    local _,_,em = string.find(t, "([&%*])%s*$")
+    t = string.gsub(t, "%s*([&%*])%s*$", "")
+    p = self
+    while p and type(p)=='table' do
+        local st = getnamespace(p)
+
+        for i=_global_types.n,1,-1 do -- in reverse order
+
+            if match_type(t, _global_types[i], st) then
+                return _global_types[i]..(em or "")
+            end
+        end
+        if p.base and p.base ~= '' and p.base ~= t then
+            --print("type is "..t..", p is "..p.base.." self.type is "..self.type.." self.name is "..self.name)
+            p = _global_classes[p:findtype(p.base)]
+        else
+            p = nil
+        end
+    end
+
+    return nil
+end
+
+function append_global_type(t, class)
+    _global_types.n = _global_types.n +1
+    _global_types[_global_types.n] = t
+    _global_types_hash[t] = 1
+    if class then append_class_type(t, class) end
+end
+
+function append_class_type(t,class)
+    if _global_classes[t] then
+        class.flags = _global_classes[t].flags
+        class.lnames = _global_classes[t].lnames
+        if _global_classes[t].base and (_global_classes[t].base ~= '') then
+            class.base = _global_classes[t].base or class.base
+        end
+    end
+    _global_classes[t] = class
+    class.flags = class.flags or {}
+end
+
+function match_type(childtype, regtype, st)
+--print("findtype "..childtype..", "..regtype..", "..st)
+    local b,e = string.find(regtype, childtype, -string.len(childtype), true)
+    if b then
+
+        if e == string.len(regtype) and
+                (b == 1 or (string.sub(regtype, b-1, b-1) == ':' and
+                string.sub(regtype, 1, b-1) == string.sub(st, 1, b-1))) then
+            return true
+        end
+    end
+
+    return false
+end
+
+function findtype_on_childs(self, t)
+
+    local tchild
+    if self.classtype == 'class' or self.classtype == 'namespace' then
+        for k,v in ipairs(self) do
+            if v.classtype == 'class' or v.classtype == 'namespace' then
+                if v.typedefs and v.typedefs[t] then
+                 return v.typedefs[t]
+                elseif v.usertypes and v.usertypes[t] then
+                 return v.usertypes[t]
+                end
+                tchild = findtype_on_childs(v, t)
+                if tchild then return tchild end
+            end
+        end
+    end
+    return nil
+
+end
+
+function classContainer:isenum (type)
+    if global_enums[type] then
+        return type
+    else
+        return false
+    end
+
+    local basetype = gsub(type,"^.*::","")
+    local env = self
+    while env do
+        if env.enums then
+            local i=1
+            while env.enums[i] do
+                if env.enums[i].name == basetype then
+                    return true
+                end
+                i = i+1
+            end
+        end
+        env = env.parent
+    end
+    return false
+end
+
+methodisvirtual = false -- a global
+
+-- parse chunk
+function classContainer:doparse (s)
+    --print ("parse "..s)
+
+    -- try the parser hook
+    do
+        local sub = parser_hook(s)
+        if sub then
+            return sub
+        end
+    end
+
+    -- try the null statement
+    do
+        local b,e,code = string.find(s, "^%s*;")
+        if b then
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try empty verbatim line
+    do
+        local b,e,code = string.find(s, "^%s*$\n")
+        if b then
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try Lua code
+    do
+        local b,e,code = strfind(s,"^%s*(%b\1\2)")
+        if b then
+            Code(strsub(code,2,-2))
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try C code
+    do
+        local b,e,code = strfind(s,"^%s*(%b\3\4)")
+        if b then
+            code = '{'..strsub(code,2,-2)..'\n}\n'
+            Verbatim(code,'r')        -- verbatim code for 'r'egister fragment
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try C code for preamble section
+    do
+        local b,e,code = string.find(s, "^%s*(%b\5\6)")
+        if b then
+            code = string.sub(code, 2, -2).."\n"
+            Verbatim(code, '')
+            return string.sub(s, e+1)
+        end
+    end
+
+    -- try default_property directive
+    do
+        local b,e,ptype = strfind(s, "^%s*TOLUA_PROPERTY_TYPE%s*%(+%s*([^%)%s]*)%s*%)+%s*;?")
+        if b then
+            if not ptype or ptype == "" then
+                ptype = "default"
+            end
+            self:set_property_type(ptype)
+            return strsub(s, e+1)
+        end
+    end
+
+    -- try protected_destructor directive
+    do
+        local b,e = string.find(s, "^%s*TOLUA_PROTECTED_DESTRUCTOR%s*;?")
+        if b then
+            if self.set_protected_destructor then
+                self:set_protected_destructor(true)
+            end
+            return strsub(s, e+1)
+        end
+    end
+
+    -- try 'extern' keyword
+    do
+        local b,e = string.find(s, "^%s*extern%s+")
+        if b then
+            -- do nothing
+            return strsub(s, e+1)
+        end
+    end
+
+    -- try 'virtual' keyworkd
+    do
+        local b,e = string.find(s, "^%s*virtual%s+")
+        if b then
+            methodisvirtual = true
+            return strsub(s, e+1)
+        end
+    end
+
+    -- try labels (public, private, etc)
+    do
+        local b,e = string.find(s, "^%s*%w*%s*:[^:]")
+        if b then
+            return strsub(s, e) -- preserve the [^:]
+        end
+    end
+
+    -- try module
+    do
+        local b,e,name,body = strfind(s,"^%s*module%s%s*([_%w][_%w]*)%s*(%b{})%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Module(name,body)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try namesapce
+    do
+        local b,e,name,body = strfind(s,"^%s*namespace%s%s*([_%w][_%w]*)%s*(%b{})%s*;?")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Namespace(name,body)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try define
+    do
+        local b,e,name = strfind(s,"^%s*#define%s%s*([^%s]*)[^\n]*\n%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Define(name)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try enumerates
+
+    do
+        local b,e,name,body,varname = strfind(s,"^%s*enum%s+(%S*)%s*(%b{})%s*([^%s;]*)%s*;?%s*")
+        if b then
+            --error("#Sorry, declaration of enums and variables on the same statement is not supported.\nDeclare your variable separately (example: '"..name.." "..varname..";')")
+            _curr_code = strsub(s,b,e)
+            Enumerate(name,body,varname)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- do
+    --    local b,e,name,body = strfind(s,"^%s*enum%s+(%S*)%s*(%b{})%s*;?%s*")
+    --    if b then
+    --        _curr_code = strsub(s,b,e)
+    --        Enumerate(name,body)
+    --        return strsub(s,e+1)
+    --    end
+    -- end
+
+    do
+        local b,e,body,name = strfind(s,"^%s*typedef%s+enum[^{]*(%b{})%s*([%w_][^%s]*)%s*;%s*")
+        if b then
+        _curr_code = strsub(s,b,e)
+        Enumerate(name,body)
+        return strsub(s,e+1)
+        end
+    end
+
+    -- try operator
+    do
+        local b,e,decl,kind,arg,const = strfind(s,"^%s*([_%w][_%w%s%*&:<>,]-%s+operator)%s*([^%s][^%s]*)%s*(%b())%s*(c?o?n?s?t?)%s*;%s*")
+        if not b then
+            -- try inline
+            b,e,decl,kind,arg,const = strfind(s,"^%s*([_%w][_%w%s%*&:<>,]-%s+operator)%s*([^%s][^%s]*)%s*(%b())%s*(c?o?n?s?t?)[%s\n]*%b{}%s*;?%s*")
+        end
+        if not b then
+            -- try cast operator
+            b,e,decl,kind,arg,const = strfind(s, "^%s*(operator)%s+([%w_:%d<>%*%&%s]+)%s*(%b())%s*(c?o?n?s?t?)");
+            if b then
+                local _,ie = string.find(s, "^%s*%b{}", e+1)
+                if ie then
+                    e = ie
+                end
+            end
+        end
+        if b then
+            _curr_code = strsub(s,b,e)
+            Operator(decl,kind,arg,const)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try function
+    do
+        --local b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w])%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*")
+        local b,e,decl,arg,const,virt = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)%s*(=?%s*0?)%s*;%s*")
+        if not b then
+            -- try function with template
+            b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w]%b<>)%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*")
+        end
+        if not b then
+            -- try a single letter function name
+            b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?)%s*;%s*")
+        end
+        if b then
+            if virt and string.find(virt, "[=0]") then
+                if self.flags then
+                    self.flags.pure_virtual = true
+                end
+            end
+            _curr_code = strsub(s,b,e)
+            Function(decl,arg,const)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try inline function
+    do
+        local b,e,decl,arg,const = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)[^;{]*%b{}%s*;?%s*")
+        --local b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w>])%s*(%b())%s*(c?o?n?s?t?)[^;]*%b{}%s*;?%s*")
+        if not b then
+            -- try a single letter function name
+            b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?).-%b{}%s*;?%s*")
+        end
+        if b then
+            _curr_code = strsub(s,b,e)
+            Function(decl,arg,const)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try class
+    do
+        local b,e,name,base,body
+        base = '' body = ''
+        b,e,name = strfind(s,"^%s*class%s*([_%w][_%w@]*)%s*;")  -- dummy class
+        if not b then
+            b,e,name = strfind(s,"^%s*struct%s*([_%w][_%w@]*)%s*;")    -- dummy struct
+            if not b then
+                b,e,name,base,body = strfind(s,"^%s*class%s*([_%w][_%w@]*)%s*(.-)%s*(%b{})%s*;%s*")
+                if not b then
+                    b,e,name,base,body = strfind(s,"^%s*struct%s*([_%w][_%w@]*)%s*(.-)%s*(%b{})%s*;%s*")
+                    if not b then
+                        b,e,name,base,body = strfind(s,"^%s*union%s*([_%w][_%w@]*)%s*(.-)%s*(%b{})%s*;%s*")
+                        if not b then
+                            base = ''
+                            b,e,body,name = strfind(s,"^%s*typedef%s%s*struct%s%s*[_%w]*%s*(%b{})%s*([_%w][_%w@]*)%s*;%s*")
+                        end
+                    end
+                end
+            end
+        end
+        if b then
+            if base ~= '' then
+                base = string.gsub(base, "^%s*:%s*", "")
+                base = string.gsub(base, "%s*public%s*", "")
+                base = split(base, ",")
+                --local b,e
+                --b,e,base = strfind(base,".-([_%w][_%w<>,:]*)$")
+            else
+                base = {}
+            end
+            _curr_code = strsub(s,b,e)
+            Class(name,base,body)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try typedef
+    do
+        local b,e,types = strfind(s,"^%s*typedef%s%s*(.-)%s*;%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Typedef(types)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try variable
+    do
+        local b,e,decl = strfind(s,"^%s*([_%w][_@%s%w%d%*&:<>,]*[_%w%d])%s*;%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+
+            local list = split_c_tokens(decl, ",")
+            Variable(list[1])
+            if list.n > 1 then
+                local _,_,type = strfind(list[1], "(.-)%s+([^%s]*)$");
+
+                local i =2;
+                while list[i] do
+                    Variable(type.." "..list[i])
+                    i=i+1
+                end
+            end
+            --Variable(decl)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try string
+    do
+        local b,e,decl = strfind(s,"^%s*([_%w]?[_%s%w%d]-char%s+[_@%w%d]*%s*%[%s*%S+%s*%])%s*;%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Variable(decl)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try array
+    do
+        local b,e,decl = strfind(s,"^%s*([_%w][][_@%s%w%d%*&:]*[]_%w%d])%s*;%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Array(decl)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- no matching
+    if gsub(s,"%s%s*","") ~= "" then
+        _curr_code = s
+        error("#parse error")
+    else
+        return ""
+    end
+
+end
+
+function classContainer:parse (s)
+
+    self.curr_member_access = nil
+
+    while s ~= '' do
+        s = self:doparse(s)
+        methodisvirtual = false
+    end
+end
+
+
+-- property types
+
+function get_property_type()
+
+    return classContainer.curr:get_property_type()
+end
+
+function classContainer:set_property_type(ptype)
+    ptype = string.gsub(ptype, "^%s*", "")
+    ptype = string.gsub(ptype, "%s*$", "")
+
+    self.property_type = ptype
+end
+
+function classContainer:get_property_type()
+    return self.property_type or (self.parent and self.parent:get_property_type()) or "default"
+end
Index: /sandbox_light/src/external/tolua/lua/custom.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/custom.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/custom.lua	(revision 5788)
@@ -0,0 +1,45 @@
+
+function extract_code(fn,s)
+    local code = ""
+    if fn then
+        code = '\n$#include "'..fn..'"\n'
+    end
+    s= "\n" .. s .. "\n" -- add blank lines as sentinels
+    local _,e,c,t = strfind(s, "\n([^\n]-)SCRIPT_([%w_]*)[^\n]*\n")
+    while e do
+        t = strlower(t)
+        if t == "bind_begin" then
+            _,e,c = strfind(s,"(.-)\n[^\n]*SCRIPT_BIND_END[^\n]*\n",e)
+            if not e then
+             tolua_error("Unbalanced 'SCRIPT_BIND_BEGIN' directive in header file")
+            end
+        end
+        if t == "bind_class" or t == "bind_block" then
+            local b
+            _,e,c,b = string.find(s, "([^{]-)(%b{})", e)
+            c = c..'{\n'..extract_code(nil, b)..'\n};\n'
+        end
+        code = code .. c .. "\n"
+     _,e,c,t = strfind(s, "\n([^\n]-)SCRIPT_([%w_]*)[^\n]*\n",e)
+    end
+    return code
+end
+
+function preprocess_hook(p)
+end
+
+function preparse_hook(p)
+end
+
+function include_file_hook(p, filename)
+    do return end
+--print("FILENAME is "..filename)
+    p.code = string.gsub(p.code, "\n%s*SigC::Signal", "\n\ttolua_readonly SigC::Signal")
+    p.code = string.gsub(p.code, "#ifdef __cplusplus\nextern \"C\" {\n#endif", "")
+    p.code = string.gsub(p.code, "#ifdef __cplusplus\n};?\n#endif", "")
+    p.code = string.gsub(p.code, "DECLSPEC", "")
+    p.code = string.gsub(p.code, "SDLCALL", "")
+    p.code = string.gsub(p.code, "DLLINTERFACE", "")
+    p.code = string.gsub(p.code, "#define[^\n]*_[hH]_?%s*\n", "\n")
+--print("code is "..p.code)
+end
Index: /sandbox_light/src/external/tolua/lua/custom_hide.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/custom_hide.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/custom_hide.lua	(revision 5788)
@@ -0,0 +1,21 @@
+-- extract code with tolua_hide, and also
+function extract_code(fn,s)
+    local code = '\n$#include "'..fn..'"\n'
+    s= "\n" .. s .. "\n" -- add blank lines as sentinels
+    local _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n")
+    while e do
+        t = strlower(t)
+        if t == "begin" then
+            _,e,c = strfind(s,"(.-)\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[Ee][Nn][Dd][^\n]*\n",e)
+            if not e then
+             tolua_error("Unbalanced 'tolua_begin' directive in header file")
+            end
+        end
+        c = c.."\n"
+        c = string.gsub(c, "\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[hH][iI][Dd][eE][^\n]*\n", "\n");
+        c = string.gsub(c, "#define[^%(\n]*%(.-\n", "\n")
+        code = code .. c
+     _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n",e)
+    end
+    return code
+end
Index: /sandbox_light/src/external/tolua/lua/declaration.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/declaration.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/declaration.lua	(revision 5788)
@@ -0,0 +1,567 @@
+-- tolua: declaration class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- Declaration class
+-- Represents variable, function, or argument declaration.
+-- Stores the following fields:
+--  mod  = type modifiers
+--  type = type
+--  ptr  = "*" or "&", if representing a pointer or a reference
+--  name = name
+--  dim  = dimension, if a vector
+--  def  = default value, if any (only for arguments)
+--  ret  = "*" or "&", if value is to be returned (only for arguments)
+classDeclaration = {
+    mod = '',
+    type = '',
+    ptr = '',
+    name = '',
+    dim = '',
+    ret = '',
+    def = ''
+}
+classDeclaration.__index = classDeclaration
+setmetatable(classDeclaration,classFeature)
+
+-- Create an unique variable name
+function create_varname ()
+    if not _varnumber then _varnumber = 0 end
+    _varnumber = _varnumber + 1
+    return "tolua_var_".._varnumber
+end
+
+-- Check declaration name
+-- It also identifies default values
+function classDeclaration:checkname ()
+
+    if strsub(self.name,1,1) == '[' and not findtype(self.type) then
+        self.name = self.type..self.name
+        local m = split(self.mod,'%s%s*')
+        self.type = m[m.n]
+        self.mod = concat(m,1,m.n-1)
+    end
+
+    local t = split(self.name,'=')
+    if t.n==2 then
+        self.name = t[1]
+        self.def = find_enum_var(t[t.n])
+    end
+
+    local b,e,d = strfind(self.name,"%[(.-)%]")
+    if b then
+        self.name = strsub(self.name,1,b-1)
+        self.dim = find_enum_var(d)
+    end
+
+
+    if self.type ~= '' and self.type ~= 'void' and self.name == '' then
+        self.name = create_varname()
+    elseif self.kind=='var' then
+        if self.type=='' and self.name~='' then
+            self.type = self.type..self.name
+            self.name = create_varname()
+        elseif findtype(self.name) then
+            if self.type=='' then self.type = self.name
+            else self.type = self.type..' '..self.name end
+            self.name = create_varname()
+        end
+    end
+
+    -- adjust type of string
+    if self.type == 'char' and self.dim ~= '' then
+        self.type = 'char*'
+    end
+
+    if self.kind and self.kind == 'var' then
+        self.name = string.gsub(self.name, ":.*$", "") -- ???
+    end
+end
+
+-- Check declaration type
+-- Substitutes typedef's.
+function classDeclaration:checktype ()
+
+    -- check if there is a pointer to basic type
+    local basic = isbasic(self.type)
+    if self.kind == 'func' and basic=='number' and string.find(self.ptr, "%*") then
+        self.type = '_userdata'
+        self.ptr = ""
+    end
+    if basic and self.ptr~='' then
+        self.ret = self.ptr
+        self.ptr = nil
+        if isbasic(self.type) == 'number' then
+            self.return_userdata = true
+        end
+    end
+
+    -- check if there is array to be returned
+    if self.dim~='' and self.ret~='' then
+        error('#invalid parameter: cannot return an array of values')
+    end
+    -- restore 'void*' and 'string*'
+    if self.type == '_userdata' then self.type = 'void*'
+    elseif self.type == '_cstring' then self.type = 'char*'
+    elseif self.type == '_lstate' then self.type = 'lua_State*'
+    end
+
+    -- resolve types inside the templates
+    if self.type then
+        self.type = resolve_template_types(self.type)
+    end
+
+    --
+    -- -- if returning value, automatically set default value
+    -- if self.ret ~= '' and self.def == '' then
+    --  self.def = '0'
+    -- end
+    --
+
+end
+
+function resolve_template_types(type)
+
+    if isbasic(type) then
+        return type
+    end
+    local b,_,m = string.find(type, "(%b<>)")
+    if b then
+
+        m = split_c_tokens(string.sub(m, 2, -2), ",")
+        for i=1, table.getn(m) do
+            m[i] = string.gsub(m[i],"%s*([%*&])", "%1")
+            m[i] = findtype(m[i]) or m[i]
+            m[i] = resolve_template_types(m[i])
+        end
+
+        local b,i
+        type,b,i = break_template(type)
+        local template_part = "<"..string.gsub(concat(m, 1, m.n), " ", ",")..">"
+        type = rebuild_template(type, b, template_part)
+        type = string.gsub(type, ">>", "> >")
+    end
+    return type
+end
+
+function break_template(s)
+    local b,e,timpl = string.find(s, "(%b<>)")
+    if timpl then
+        s = string.gsub(s, "%b<>", "")
+        return s, b, timpl
+    else
+        return s, 0, nil
+    end
+end
+
+function rebuild_template(s, b, timpl)
+
+    if b == 0 then
+        return s
+    end
+
+    return string.sub(s, 1, b-1)..timpl..string.sub(s, b, -1)
+end
+
+-- Print method
+function classDeclaration:print (ident,close)
+    print(ident.."Declaration{")
+    print(ident.." mod  = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." ptr  = '"..self.ptr.."',")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." dim  = '"..self.dim.."',")
+    print(ident.." def  = '"..self.def.."',")
+    print(ident.." ret  = '"..self.ret.."',")
+    print(ident.."}"..close)
+end
+
+-- check if array of values are returned to Lua
+function classDeclaration:requirecollection (t)
+ if self.mod ~= 'const' and
+        self.dim and self.dim ~= '' and
+                 not isbasic(self.type) and
+                 self.ptr == '' then
+        local type = gsub(self.type,"%s*const%s+","")
+        t[type] = "tolua_collect_" .. clean_template(type)
+        return true
+    end
+    return false
+end
+
+-- declare tag
+function classDeclaration:decltype ()
+
+    self.type = typevar(self.type)
+    if strfind(self.mod,'const') then
+        self.type = 'const '..self.type
+        self.mod = gsub(self.mod,'const%s*','')
+    end
+end
+
+
+-- output type checking
+function classDeclaration:outchecktype (narg)
+    local def
+    local t = isbasic(self.type)
+    if self.def~='' then
+        def = 1
+    else
+        def = 0
+    end
+    if self.dim ~= '' then
+        --if t=='string' then
+        --    return 'tolua_isstringarray(tolua_S,'..narg..','..def..',&tolua_err)'
+        --else
+        return 'tolua_istable(tolua_S,'..narg..',0,&tolua_err)'
+        --end
+    elseif t then
+        return 'tolua_is'..t..'(tolua_S,'..narg..','..def..',&tolua_err)'
+    else
+        return 'tolua_isusertype(tolua_S,'..narg..',"'..self.type..'",'..def..',&tolua_err)'
+    end
+end
+
+function classDeclaration:builddeclaration (narg, cplusplus)
+    local array = self.dim ~= '' and tonumber(self.dim)==nil
+    local line = ""
+    local ptr = ''
+    local mod
+    local type = self.type
+    if self.dim ~= '' then
+        type = gsub(self.type,'const%s+','')  -- eliminates const modifier for arrays
+    end
+    if self.ptr~='' and not isbasic(type) then ptr = '*' end
+    line = concatparam(line," ",self.mod,type,ptr)
+    if array then
+        line = concatparam(line,'*')
+    end
+    line = concatparam(line,self.name)
+    if self.dim ~= '' then
+        if tonumber(self.dim)~=nil then
+            line = concatparam(line,'[',self.dim,'];')
+        else
+            if cplusplus then
+                line = concatparam(line,' = new',type,ptr,'['..self.dim..'];')
+            else
+                line = concatparam(line,' = (',type,ptr,'*)',
+                'malloc((',self.dim,')*sizeof(',type,ptr,'));')
+            end
+        end
+    else
+    local t = isbasic(type)
+    line = concatparam(line,' = ')
+    if t == 'state' then
+        line = concatparam(line, 'tolua_S;')
+    else
+        --print("t is "..tostring(t)..", ptr is "..tostring(self.ptr))
+        if t == 'number' and string.find(self.ptr, "%*") then
+            t = 'userdata'
+        end
+        if not t and ptr=='' then line = concatparam(line,'*') end
+            line = concatparam(line,'((',self.mod,type)
+            if not t then
+                line = concatparam(line,'*')
+            end
+            line = concatparam(line,') ')
+            if isenum(type) then
+                line = concatparam(line,'(int) ')
+            end
+            local def = 0
+            if self.def ~= '' then
+                def = self.def
+                if (ptr == '' or self.ptr == '&') and not t then
+                    def = "(void*)&(const "..type..")"..def
+                end
+            end
+            if t then
+                line = concatparam(line,'tolua_to'..t,'(tolua_S,',narg,',',def,'));')
+            else
+                line = concatparam(line,'tolua_tousertype(tolua_S,',narg,',',def,'));')
+            end
+        end
+    end
+    return line
+end
+
+-- Declare variable
+function classDeclaration:declare (narg)
+    if self.dim ~= '' and tonumber(self.dim)==nil then
+        output('#ifdef __cplusplus\n')
+        output(self:builddeclaration(narg,true))
+        output('#else\n')
+        output(self:builddeclaration(narg,false))
+        output('#endif\n')
+    else
+        output(self:builddeclaration(narg,false))
+    end
+end
+
+-- Get parameter value
+function classDeclaration:getarray (narg)
+    if self.dim ~= '' then
+        local type = gsub(self.type,'const ','')
+        output('  {')
+        output('#ifndef TOLUA_RELEASE\n')
+        local def; if self.def~='' then def=1 else def=0 end
+        local t = isbasic(type)
+        if (t) then
+            output('   if (!tolua_is'..t..'array(tolua_S,',narg,',',self.dim,',',def,',&tolua_err))')
+        else
+            output('   if (!tolua_isusertypearray(tolua_S,',narg,',"',type,'",',self.dim,',',def,',&tolua_err))')
+        end
+        output('    goto tolua_lerror;')
+        output('   else\n')
+        output('#endif\n')
+        output('   {')
+        output('    int i;')
+        output('    for(i=0; i<'..self.dim..';i++)')
+        local t = isbasic(type)
+        local ptr = ''
+        if self.ptr~='' then ptr = '*' end
+        output('   ',self.name..'[i] = ')
+        if not t and ptr=='' then output('*') end
+        output('((',type)
+        if not t then
+            output('*')
+        end
+        output(') ')
+        local def = 0
+        if self.def ~= '' then def = self.def end
+        if t then
+            output('tolua_tofield'..t..'(tolua_S,',narg,',i+1,',def,'));')
+        else
+            output('tolua_tofieldusertype(tolua_S,',narg,',i+1,',def,'));')
+        end
+        output('   }')
+        output('  }')
+    end
+end
+
+-- Get parameter value
+function classDeclaration:setarray (narg)
+    if not strfind(self.type,'const%s+') and self.dim ~= '' then
+        local type = gsub(self.type,'const ','')
+        output('  {')
+        output('   int i;')
+        output('   for(i=0; i<'..self.dim..';i++)')
+        local t,ct = isbasic(type)
+        if t then
+            output('    tolua_pushfield'..t..'(tolua_S,',narg,',i+1,(',ct,')',self.name,'[i]);')
+        else
+            if self.ptr == '' then
+                output('   {')
+                output('#ifdef __cplusplus\n')
+                output('    void* tolua_obj = new',type,'(',self.name,'[i]);')
+                output('    tolua_pushfieldusertype_and_takeownership(tolua_S,',narg,',i+1,tolua_obj,"',type,'");')
+                output('#else\n')
+                output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&',self.name,'[i],sizeof(',type,'));')
+                output('    tolua_pushfieldusertype(tolua_S,',narg,',i+1,tolua_obj,"',type,'");')
+                output('#endif\n')
+                output('   }')
+            else
+                output('   tolua_pushfieldusertype(tolua_S,',narg,',i+1,(void*)',self.name,'[i],"',type,'");')
+            end
+        end
+        output('  }')
+    end
+end
+
+-- Free dynamically allocated array
+function classDeclaration:freearray ()
+    if self.dim ~= '' and tonumber(self.dim)==nil then
+        output('#ifdef __cplusplus\n')
+        output('  delete []',self.name,';')
+        output('#else\n')
+        output('  free(',self.name,');')
+        output('#endif\n')
+    end
+end
+
+-- Pass parameter
+function classDeclaration:passpar ()
+    if self.ptr=='&' and not isbasic(self.type) then
+        output('*'..self.name)
+    elseif self.ret=='*' then
+        output('&'..self.name)
+    else
+        output(self.name)
+    end
+end
+
+-- Return parameter value
+function classDeclaration:retvalue ()
+    if self.ret ~= '' then
+        local t,ct = isbasic(self.type)
+        if t and t~='' then
+            output('   tolua_push'..t..'(tolua_S,(',ct,')'..self.name..');')
+        else
+            output('   tolua_pushusertype(tolua_S,(void*)'..self.name..',"',self.type,'");')
+        end
+        return 1
+    end
+    return 0
+end
+
+-- Internal constructor
+function _Declaration (t)
+
+    setmetatable(t,classDeclaration)
+    t:buildnames()
+    t:checkname()
+    t:checktype()
+    local ft = findtype(t.type) or t.type
+    if not isenum(ft) then
+        t.mod, t.type = applytypedef(t.mod, ft)
+    end
+
+    if t.kind=="var" and (string.find(t.mod, "tolua_property%s") or string.find(t.mod, "tolua_property$")) then
+        t.mod = string.gsub(t.mod, "tolua_property", "tolua_property__"..get_property_type())
+    end
+
+    return t
+end
+
+-- Constructor
+-- Expects the string declaration.
+-- The kind of declaration can be "var" or "func".
+function Declaration (s,kind,is_parameter)
+
+    -- eliminate spaces if default value is provided
+    s = gsub(s,"%s*=%s*","=")
+    s = gsub(s, "%s*<", "<")
+
+    local defb,tmpdef
+    defb,_,tmpdef = string.find(s, "(=.*)$")
+    if defb then
+        s = string.gsub(s, "=.*$", "")
+    else
+        tmpdef = ''
+    end
+    if kind == "var" then
+        -- check the form: void
+        if s == '' or s == 'void' then
+            return _Declaration{type = 'void', kind = kind, is_parameter = is_parameter}
+        end
+    end
+
+    -- check the form: mod type*& name
+    local t = split_c_tokens(s,'%*%s*&')
+    if t.n == 2 then
+        if kind == 'func' then
+            error("#invalid function return type: "..s)
+        end
+        --local m = split(t[1],'%s%s*')
+        local m = split_c_tokens(t[1],'%s+')
+        return _Declaration {
+            name = t[2]..tmpdef,
+            ptr = '*',
+            ret = '&',
+            --type = rebuild_template(m[m.n], tb, timpl),
+            type = m[m.n],
+            mod = concat(m,1,m.n-1),
+            is_parameter = is_parameter,
+            kind = kind
+        }
+    end
+
+    -- check the form: mod type** name
+    t = split_c_tokens(s,'%*%s*%*')
+    if t.n == 2 then
+        if kind == 'func' then
+            error("#invalid function return type: "..s)
+        end
+        --local m = split(t[1],'%s%s*')
+        local m = split_c_tokens(t[1],'%s+')
+        return _Declaration {
+            name = t[2]..tmpdef,
+            ptr = '*',
+            ret = '*',
+            --type = rebuild_template(m[m.n], tb, timpl),
+            type = m[m.n],
+            mod = concat(m,1,m.n-1),
+            is_parameter = is_parameter,
+            kind = kind
+        }
+    end
+
+    -- check the form: mod type& name
+    t = split_c_tokens(s,'&')
+    if t.n == 2 then
+        --local m = split(t[1],'%s%s*')
+        local m = split_c_tokens(t[1],'%s+')
+        return _Declaration {
+            name = t[2]..tmpdef,
+            ptr = '&',
+            --type = rebuild_template(m[m.n], tb, timpl),
+            type = m[m.n],
+            mod = concat(m,1,m.n-1),
+            is_parameter = is_parameter,
+            kind = kind
+        }
+    end
+
+    -- check the form: mod type* name
+    local s1 = gsub(s,"(%b\[\])",function (n) return gsub(n,'%*','\1') end)
+    t = split_c_tokens(s1,'%*')
+    if t.n == 2 then
+        t[2] = gsub(t[2],'\1','%*') -- restore * in dimension expression
+        --local m = split(t[1],'%s%s*')
+        local m = split_c_tokens(t[1],'%s+')
+        return _Declaration {
+            name = t[2]..tmpdef,
+            ptr = '*',
+            type = m[m.n],
+            --type = rebuild_template(m[m.n], tb, timpl),
+            mod = concat(m,1,m.n-1)   ,
+            is_parameter = is_parameter,
+            kind = kind
+        }
+    end
+
+    if kind == 'var' then
+        -- check the form: mod type name
+        --t = split(s,'%s%s*')
+        t = split_c_tokens(s,'%s+')
+        local v
+        if findtype(t[t.n]) then v = create_varname() else v = t[t.n]; t.n = t.n-1 end
+        return _Declaration {
+            name = v..tmpdef,
+            --type = rebuild_template(t[t.n], tb, timpl),
+            type = t[t.n],
+            mod = concat(t,1,t.n-1),
+            is_parameter = is_parameter,
+            kind = kind
+        }
+
+    else -- kind == "func"
+
+        -- check the form: mod type name
+        --t = split(s,'%s%s*')
+        t = split_c_tokens(s,'%s+')
+        local v = t[t.n]  -- last word is the function name
+        local tp,md
+        if t.n>1 then
+            tp = t[t.n-1]
+            md = concat(t,1,t.n-2)
+        end
+        --if tp then tp = rebuild_template(tp, tb, timpl) end
+        return _Declaration {
+            name = v,
+            type = tp,
+            mod = md,
+            is_parameter = is_parameter,
+            kind = kind
+        }
+    end
+
+end
+
Index: /sandbox_light/src/external/tolua/lua/define.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/define.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/define.lua	(revision 5788)
@@ -0,0 +1,63 @@
+-- tolua: define class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: define.lua,v 1.2 1999/07/28 22:21:08 celes Exp $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- Define class
+-- Represents a numeric const definition
+-- The following filds are stored:
+--   name = constant name
+classDefine = {
+    name = '',
+}
+classDefine.__index = classDefine
+setmetatable(classDefine,classFeature)
+
+-- register define
+function classDefine:register (pre)
+    if not self:check_public_access() then
+        return
+    end
+
+    pre = pre or ''
+    output(pre..'tolua_constant(tolua_S,"'..self.lname..'",'..self.name..');')
+end
+
+-- Print method
+function classDefine:print (ident,close)
+    print(ident.."Define{")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." lname = '"..self.lname.."',")
+    print(ident.."}"..close)
+end
+
+
+-- Internal constructor
+function _Define (t)
+    setmetatable(t,classDefine)
+    t:buildnames()
+
+    if t.name == '' then
+        error("#invalid define")
+    end
+
+    append(t)
+    return t
+end
+
+-- Constructor
+-- Expects a string representing the constant name
+function Define (n)
+    return _Define {
+        name = n
+    }
+end
+
+
Index: /sandbox_light/src/external/tolua/lua/doit.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/doit.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/doit.lua	(revision 5788)
@@ -0,0 +1,126 @@
+-- Generate binding code
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- Last update: Apr 2003
+-- $Id: $
+
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+function parse_extra()
+
+    for k,v in ipairs(_extra_parameters or {}) do
+        
+        local b,e,name,value = string.find(v, "^([^=])=(.*)$")
+        if b then
+            _extra_parameters[name] = value
+        else
+            _extra_parameters[v] = true
+        end
+    end
+end
+
+function doit ()
+    -- define package name, if not provided
+    if not flags.n then
+        if flags.f then
+            flags.n = gsub(flags.f,"%..*$","")
+            _,_,flags.n = string.find(flags.n, "([^/\\]*)$")
+        else
+            error("#no package name nor input file provided")
+        end
+    end
+
+    -- parse table with extra paramters
+    parse_extra()
+
+    -- get potential working directory
+    if not flags.w then
+        flags.w = ''
+    end
+
+    -- do this after setting the package name
+    if flags.L then
+        if string.sub(flags.L, 1, 1) == '/' or string.sub(flags.L, 1, 1) == '\\' or (string.len(flags.L) > 1 and string.sub(flags.L, 2, 2) == ':') then
+            dofile(flags.L)
+        else
+            dofile(flags.w..'/'..flags.L)
+        end
+    end
+
+    -- add cppstring
+    if not flags.S then
+        _basic['string'] = 'cppstring'
+        _basic['std::string'] = 'cppstring'
+        _basic_ctype.cppstring = 'const char*'
+    end
+
+    -- proccess package
+    local file
+    if flags.f then
+        if string.sub(flags.f, 1, 1) == '/' or string.sub(flags.f, 1, 1) == '\\' or (string.len(flags.f) > 1 and string.sub(flags.f, 2, 2) == ':') then
+            file = flags.f
+        else
+            file = flags.w..'/'..flags.f
+        end
+    else
+        file = flags.f
+    end
+    local p  = Package(flags.n, file)
+
+    if flags.p then
+        return        -- only parse
+    end
+
+    if flags.o then
+        local file
+        if string.sub(flags.o, 1, 1) == '/' or string.sub(flags.o, 1, 1) == '\\' or (string.len(flags.o) > 1 and string.sub(flags.o, 2, 2) == ':') then
+            file = flags.o
+        else
+            file = flags.w..'/'..flags.o
+        end
+        local st,msg = writeto(file)
+        if not st then
+            error('#'..msg)
+        end
+    end
+
+    p:decltype()
+    if flags.P then
+        p:print()
+    else
+        p:preamble()
+        p:supcode()
+        p:register()
+        push(p)
+        post_output_hook(p)
+        pop()
+    end
+
+    if flags.o then
+        writeto()
+    end
+
+    -- write header file
+    if not flags.P then
+        if flags.H then
+            local file
+            if string.sub(flags.H, 1, 1) == '/' or string.sub(flags.H, 1, 1) == '\\' or (string.len(flags.H) > 1 and string.sub(flags.H, 2, 2) == ':') then
+                file = flags.H
+            else
+                file = flags.w..'/'..flags.H
+            end
+            local st,msg = writeto(file)
+            if not st then
+                error('#'..msg)
+            end
+            p:header()
+            writeto()
+        end
+    end
+end
+
Index: /sandbox_light/src/external/tolua/lua/enumerate.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/enumerate.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/enumerate.lua	(revision 5788)
@@ -0,0 +1,95 @@
+-- tolua: enumerate class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: enumerate.lua,v 1.3 2000/01/24 20:41:15 celes Exp $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- Enumerate class
+-- Represents enumeration
+-- The following fields are stored:
+--    {i} = list of constant names
+classEnumerate = {
+}
+classEnumerate.__index = classEnumerate
+setmetatable(classEnumerate,classFeature)
+
+-- register enumeration
+function classEnumerate:register (pre)
+    pre = pre or ''
+    local nspace = getnamespace(classContainer.curr)
+    local i=1
+    while self[i] do
+        output(pre..'tolua_constant(tolua_S,"'..self.lnames[i]..'",'..nspace..self[i]..');')
+        i = i+1
+    end
+end
+
+-- Print method
+function classEnumerate:print (ident,close)
+    print(ident.."Enumerate{")
+    print(ident.." name = "..self.name)
+    local i=1
+    while self[i] do
+        print(ident.." '"..self[i].."'("..self.lnames[i].."),")
+        i = i+1
+    end
+    print(ident.."}"..close)
+end
+
+-- Internal constructor
+function _Enumerate (t,varname)
+    setmetatable(t,classEnumerate)
+    append(t)
+    appendenum(t)
+    if varname and varname ~= "" then
+        if t.name ~= "" then
+            Variable(t.name.." "..varname)
+        else
+            local ns = getcurrnamespace()
+            warning("Variable "..ns..varname.." of type <anonymous enum> is declared as read-only")
+            Variable("tolua_readonly int "..varname)
+        end
+    end
+    return t
+end
+
+-- Constructor
+-- Expects a string representing the enumerate body
+function Enumerate (n,b,varname)
+    b = string.gsub(b, ",[%s\n]*}", "\n}") -- eliminate last ','
+    local t = split(strsub(b,2,-2),',') -- eliminate braces
+    local i = 1
+    local e = {n=0}
+    while t[i] do
+        local tt = split(t[i],'=')  -- discard initial value
+        e.n = e.n + 1
+        e[e.n] = tt[1]
+        i = i+1
+    end
+    -- set lua names
+    i  = 1
+    e.lnames = {}
+    local ns = getcurrnamespace()
+    while e[i] do
+        local t = split(e[i],'@')
+        e[i] = t[1]
+        if not t[2] then
+            t[2] = applyrenaming(t[1])
+        end
+        e.lnames[i] = t[2] or t[1]
+        _global_enums[ ns..e[i] ] = (ns..e[i])
+        i = i+1
+    end
+    e.name = n
+    if n ~= "" then
+        Typedef("int "..n)
+    end
+    return _Enumerate(e, varname)
+end
+
Index: /sandbox_light/src/external/tolua/lua/feature.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/feature.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/feature.lua	(revision 5788)
@@ -0,0 +1,128 @@
+-- tolua: abstract feature class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- Feature class
+-- Represents the base class of all mapped feature.
+classFeature = {
+}
+classFeature.__index = classFeature
+
+-- write support code
+function classFeature:supcode ()
+end
+
+-- output tag
+function classFeature:decltype ()
+end
+
+-- register feature
+function classFeature:register (pre)
+end
+
+-- translate verbatim
+function classFeature:preamble ()
+end
+
+-- check if it is a variable
+function classFeature:isvariable ()
+ return false
+end
+
+-- check if it requires collection
+function classFeature:requirecollection (t)
+    return false
+end
+
+-- build names
+function classFeature:buildnames ()
+    if self.name and self.name~='' then
+        local n = split(self.name,'@')
+        self.name = n[1]
+        if not n[2] then
+            n[2] = applyrenaming(n[1])
+        end
+        self.lname = n[2] or gsub(n[1],"%[.-%]","")
+        self.original_name = self.name
+        self.lname = clean_template(self.lname)
+    end
+    if not self.is_parameter then
+        self.name = getonlynamespace() .. self.name
+    end
+
+    local parent = classContainer.curr
+    if parent then
+        self.access = parent.curr_member_access
+    else
+    end
+end
+
+function classFeature:check_public_access()
+
+    if self.access and self.access ~= 0 then
+        return false
+    end
+
+    local parent = classContainer.curr
+    while parent do
+        if parent.access and parent.access ~= 0 then
+            return false
+        end
+        parent = parent.prox
+    end
+    return true
+end
+
+function clean_template(t)
+
+    return string.gsub(t, "[<>:, %*]", "_")
+end
+
+-- check if feature is inside a container definition
+-- it returns the container class name or nil.
+function classFeature:incontainer (which)
+    if self.parent then
+        local parent = self.parent
+        while parent do
+            if parent.classtype == which then
+                return parent.name
+            end
+            parent = parent.parent
+        end
+    end
+    return nil
+end
+
+function classFeature:inclass ()
+    return self:incontainer('class')
+end
+
+function classFeature:inmodule ()
+    return self:incontainer('module')
+end
+
+function classFeature:innamespace ()
+    return self:incontainer('namespace')
+end
+
+-- return C binding function name based on name
+-- the client specifies a prefix
+function classFeature:cfuncname (n)
+
+    if self.parent then
+        n = self.parent:cfuncname(n)
+    end
+
+    n = string.gsub(n..'_'.. (self.lname or self.name), "[<>:, \.%*&]", "_")
+
+    return n
+end
+
Index: /sandbox_light/src/external/tolua/lua/function.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/function.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/function.lua	(revision 5788)
@@ -0,0 +1,737 @@
+-- tolua: function class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: function.lua 1597 2008-03-11 22:25:01Z ice-drezday $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- CEGUILua mod
+-- exception handling
+-- patch from Tov
+-- modded by Lindquist
+exceptionDefs = exceptionDefs or {}
+exceptionDefs["std::exception"]             = {}
+exceptionDefs["std::exception"]["var"]      = "&e"
+exceptionDefs["std::exception"]["c_str"]    = "e.what()"
+
+exceptionDefs["any"]                        = {}
+exceptionDefs["any"]["var"]                 = ""
+exceptionDefs["any"]["c_str"]               = '"Unknown"'
+
+exceptionMessageBufferSize = 512
+
+function outputExceptionError(f,e,errBuf)
+    -- if the exception is not "..." then use the "c_str" info the get a real exception message
+    local messageC_str = true
+    if e.name == "any" then
+        messageC_str = false
+    end
+
+    -- make a default e.ret if empty
+    if not e.ret or e.ret == "" then
+        e.ret = "nil,message"
+    end
+
+    -- create a default exceptionDef if we dont have one
+    if not exceptionDefs[e.name] then
+        exceptionDefs[e.name] = {}
+        exceptionDefs[e.name].var = "&e"
+        exceptionDefs[e.name].c_str = '"Unknown"'
+    end
+
+    -- print catch header
+    local nameToEcho = e.name
+    if nameToEcho == "any" then
+        nameToEcho = "..."
+    end
+    if e.ret == "nil" then
+        output("catch(",nameToEcho," CEGUIDeadException(",exceptionDefs[e.name].var,"))\n{\n")
+    else
+        output("catch(",nameToEcho,exceptionDefs[e.name].var,")\n{\n")
+    end
+
+    -- if just a nil
+    if e.ret == "nil" then
+        output("return 0;\n")
+    -- if error should be raised
+    elseif string.find(e.ret,"error") then
+        if messageC_str then
+            output("snprintf(errorBuffer,"..exceptionMessageBufferSize..",\"Exception of type '"..e.name.."' was thrown by function '"..f.."'\\nMessage: %s\","..exceptionDefs[e.name].c_str..");\n")
+        else
+            output("snprintf(errorBuffer,"..exceptionMessageBufferSize..",\"Unknown exception thrown by function '"..f.."'\");\n")
+        end
+        output("errorDoIt = true;\n")
+    -- else go through the returns
+    else
+        -- buffer for message
+        if string.find(e.ret,"message") and messageC_str and errBuf == false then
+            output("char errorBuffer["..exceptionMessageBufferSize.."];\n")
+        end
+        local numrets = 0
+        local retpat = "(%w+),?"
+        local i,j,retval = string.find(e.ret,retpat)
+        while i do
+            local code = ""
+
+            -- NIL
+            if retval == "nil" then
+                code = "tolua_pushnil(tolua_S);\n"
+
+            -- MESSAGE
+            elseif retval == "message" then
+                if messageC_str then
+                    code = "snprintf(errorBuffer,"..exceptionMessageBufferSize..",\"Exception of type '"..e.name.."' was thrown by function '"..f.."'\\nMessage: %s\","..exceptionDefs[e.name].c_str..");\ntolua_pushstring(tolua_S,errorBuffer);\n"
+                else
+                    code = "tolua_pushstring(tolua_S,\"Unknown exception thrown by function '"..f.."'\");\n"
+                end
+
+            -- TRUE
+            elseif retval == "true" then
+                code = "tolua_pushboolean(tolua_S, 1);\n"
+
+            -- FALSE
+            elseif retval == "false" then
+                code = "tolua_pushboolean(tolua_S, 0);\n"
+            end
+
+            -- print code for this return value
+            if code ~= "" then
+                output(code)
+                numrets = numrets + 1
+            end
+
+            -- next return value
+            i,j,retval = string.find(e.ret,retpat,j+1)
+        end
+        output("return ",numrets,";\n")
+    end
+
+    -- print catch footer
+    output("}\n")
+end
+
+function outputExceptionCatchBlocks(func,throws,err)
+    for i=1,table.getn(throws) do
+        outputExceptionError(func, throws[i], err)
+    end
+
+    -- if an error should be raised, we do it here
+    if err then
+        output("if (errorDoIt) {\n")
+        output("luaL_error(tolua_S,errorBuffer);\n")
+        output("}\n")
+    end
+end
+
+
+-- Function class
+-- Represents a function or a class method.
+-- The following fields are stored:
+--  mod  = type modifiers
+--  type = type
+--  ptr  = "*" or "&", if representing a pointer or a reference
+--  name = name
+--  lname = lua name
+--  args  = list of argument declarations
+--  const = if it is a method receiving a const "this".
+classFunction = {
+    mod = '',
+    type = '',
+    ptr = '',
+    name = '',
+    args = {n=0},
+    const = '',
+}
+classFunction.__index = classFunction
+setmetatable(classFunction,classFeature)
+
+-- declare tags
+function classFunction:decltype ()
+    self.type = typevar(self.type)
+    if strfind(self.mod,'const') then
+        self.type = 'const '..self.type
+        self.mod = gsub(self.mod,'const','')
+    end
+    local i=1
+    while self.args[i] do
+        self.args[i]:decltype()
+        i = i+1
+    end
+end
+
+
+-- Write binding function
+-- Outputs C/C++ binding function.
+function classFunction:supcode (local_constructor)
+
+    local overload = strsub(self.cname,-2,-1) - 1  -- indicate overloaded func
+    local nret = 0      -- number of returned values
+    local class = self:inclass()
+    local _,_,static = strfind(self.mod,'^%s*(static)')
+    if class then
+
+        if self.name == 'new' and self.parent.flags.pure_virtual then
+            -- no constructor for classes with pure virtual methods
+            return
+        end
+
+        if local_constructor then
+           output("/* method: new_local of class ",class," */")
+       else
+           output("/* method:",self.name," of class ",class," */")
+       end
+    else
+        output("/* function:",self.name," */")
+    end
+
+    if local_constructor then
+        output("#ifndef TOLUA_DISABLE_"..self.cname.."_local")
+        output("\nstatic int",self.cname.."_local","(lua_State* tolua_S)")
+    else
+        output("#ifndef TOLUA_DISABLE_"..self.cname)
+        output("\nstatic int",self.cname,"(lua_State* tolua_S)")
+    end
+    output("{")
+
+    -- check types
+    if overload < 0 then
+        output('#ifndef TOLUA_RELEASE\n')
+    end
+    output(' tolua_Error tolua_err;')
+    output(' if (\n')
+    -- check self
+    local narg
+    if class then narg=2 else narg=1 end
+    if class then
+        local func = 'tolua_isusertype'
+        local type = self.parent.type
+        if self.name=='new' or static~=nil then
+            func = 'tolua_isusertable'
+            type = self.parent.type
+        end
+        if self.const ~= '' then
+            type = "const "..type
+        end
+        output('     !'..func..'(tolua_S,1,"'..type..'",0,&tolua_err) ||\n')
+    end
+    -- check args
+    if self.args[1].type ~= 'void' then
+        local i=1
+        while self.args[i] do
+            local btype = isbasic(self.args[i].type)
+            if btype ~= 'value' and btype ~= 'state' then
+                output('     !'..self.args[i]:outchecktype(narg)..' ||\n')
+            end
+            if btype ~= 'state' then
+                narg = narg+1
+            end
+            i = i+1
+        end
+    end
+    -- check end of list
+    output('     !tolua_isnoobj(tolua_S,'..narg..',&tolua_err)\n )')
+    output('  goto tolua_lerror;')
+
+    output(' else\n')
+    if overload < 0 then
+        output('#endif\n')
+    end
+    output(' {')
+
+    -- declare self, if the case
+    local narg
+    if class then narg=2 else narg=1 end
+    if class and self.name~='new' and static==nil then
+        output(' ',self.const,self.parent.type,'*','self = ')
+        output('(',self.const,self.parent.type,'*) ')
+        output('tolua_tousertype(tolua_S,1,0);')
+    elseif static then
+        _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
+    end
+    -- declare parameters
+    if self.args[1].type ~= 'void' then
+        local i=1
+        while self.args[i] do
+            self.args[i]:declare(narg)
+            if isbasic(self.args[i].type) ~= "state" then
+                narg = narg+1
+            end
+            i = i+1
+        end
+    end
+
+    -- check self
+    if class and self.name~='new' and static==nil then
+        output('#ifndef TOLUA_RELEASE\n')
+        output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in function \''..self.name..'\'",NULL);');
+        output('#endif\n')
+    end
+
+    -- get array element values
+    if class then narg=2 else narg=1 end
+    if self.args[1].type ~= 'void' then
+        local i=1
+        while self.args[i] do
+            self.args[i]:getarray(narg)
+            narg = narg+1
+            i = i+1
+        end
+    end
+
+    --------------------------------------------------
+    -- CEGUILua mod
+    -- init exception handling
+    local throws = false
+    do
+        local pattern = "tolua_throws|.*|"
+        local i,j = string.find(self.mod, pattern)
+        if i then
+            throws = {}
+            -- ensure table is empty.  Used to be: table.setn(throws,0)
+            for x in pairs(throws) do
+                throws[x] = nil
+            end
+            local excepts = string.sub(self.mod, i+12,j)
+            local epattern = "|.-|"
+            local i,j = string.find(excepts, epattern)
+            while i do
+                local e = string.sub(excepts,i+1,j-1)
+                local _,_,name,rest = string.find(e, "([%w:_]+),?(.*)")
+                table.insert(throws,{name=name, ret=rest})
+                i,j = string.find(excepts, epattern, j)
+            end
+            self.mod = string.gsub(self.mod, pattern, "")
+        end
+    end
+    local exRaiseError = false
+    --------------------------------------------------
+
+    local out = string.find(self.mod, "tolua_outside")
+
+    ---------------
+    -- CEGUILua mod
+    -- remove "tolua_outside" from self.mod
+    if out then
+        self.mod = string.gsub(self.mod, "tolua_outside", "")
+    end
+
+    -- call function
+    if class and self.name=='delete' then
+        output('  delete self;')
+    elseif class and self.name == 'operator&[]' then
+        if flags['1'] then -- for compatibility with tolua5 ?
+            output('  self->operator[](',self.args[1].name,'-1) = ',self.args[2].name,';')
+        else
+            output('  self->operator[](',self.args[1].name,') = ',self.args[2].name,';')
+        end
+    else
+    -- CEGUILua mod begin- throws
+    if throws then
+        for i=1,table.getn(throws) do
+            if string.find(throws[i].ret, "error") then
+                output("char errorBuffer["..exceptionMessageBufferSize.."];\n")
+                output("bool errorDoIt = false;\n")
+                exRaiseError = true
+                break
+            end
+        end
+        output("try\n")
+    end
+    -- CEGUILua mod end - throws
+    output('  {')
+    if self.type ~= '' and self.type ~= 'void' then
+        output('  ',self.mod,self.type,self.ptr,'tolua_ret = ')
+        output('(',self.mod,self.type,self.ptr,') ')
+    else
+        output('  ')
+    end
+    if class and self.name=='new' then
+        output('new',self.type,'(')
+    elseif class and static then
+        if out then
+            output(self.name,'(')
+        else
+            output(class..'::'..self.name,'(')
+        end
+    elseif class then
+        if out then
+            output(self.name,'(')
+        else
+            if self.cast_operator then
+                output('static_cast<',self.mod,self.type,self.ptr,'>(*self')
+            else
+                output('self->'..self.name,'(')
+            end
+        end
+    else
+        output(self.name,'(')
+    end
+
+    if out and not static then
+        output('self')
+        if self.args[1] and self.args[1].name ~= '' then
+            output(',')
+        end
+    end
+    -- write parameters
+    local i=1
+    while self.args[i] do
+        self.args[i]:passpar()
+        i = i+1
+        if self.args[i] then
+            output(',')
+        end
+    end
+
+    if class and self.name == 'operator[]' and flags['1'] then
+        output('-1);')
+    else
+        output(');')
+    end
+
+    -- return values
+    if self.type ~= '' and self.type ~= 'void' then
+        nret = nret + 1
+        local t,ct = isbasic(self.type)
+        if t then
+            if self.cast_operator and _basic_raw_push[t] then
+                output('   ',_basic_raw_push[t],'(tolua_S,(',ct,')tolua_ret);')
+            else
+                output('   tolua_push'..t..'(tolua_S,(',ct,')tolua_ret);')
+            end
+            else
+                t = self.type
+                new_t = string.gsub(t, "const%s+", "")
+                if self.ptr == '' then
+                    output('   {')
+                    output('#ifdef __cplusplus\n')
+                    output('    void* tolua_obj = new',new_t,'(tolua_ret);')
+                    output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
+                    output('#else\n')
+                    output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));')
+                    output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
+                    output('#endif\n')
+                    output('   }')
+                elseif self.ptr == '&' then
+                    output('   tolua_pushusertype(tolua_S,(void*)&tolua_ret,"',t,'");')
+                else
+                    if local_constructor then
+                        output('   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"',t,'");')
+                    else
+                        output('   tolua_pushusertype(tolua_S,(void*)tolua_ret,"',t,'");')
+                    end
+                end
+            end
+        end
+        local i=1
+        while self.args[i] do
+            nret = nret + self.args[i]:retvalue()
+            i = i+1
+        end
+        output('  }')
+
+        ------------------------------------------
+        -- CEGUILua mod
+        -- finish exception handling
+        -- catch
+        if throws then
+            outputExceptionCatchBlocks(self.name, throws, exRaiseError)
+        end
+        ------------------------------------------
+
+        -- set array element values
+        if class then narg=2 else narg=1 end
+        if self.args[1].type ~= 'void' then
+            local i=1
+            while self.args[i] do
+                self.args[i]:setarray(narg)
+                narg = narg+1
+                i = i+1
+            end
+        end
+
+        -- free dynamically allocated array
+        if self.args[1].type ~= 'void' then
+            local i=1
+            while self.args[i] do
+                self.args[i]:freearray()
+                i = i+1
+            end
+        end
+    end
+
+    output(' }')
+    output(' return '..nret..';')
+
+    -- call overloaded function or generate error
+    if overload < 0 then
+
+        output('#ifndef TOLUA_RELEASE\n')
+        output('tolua_lerror:\n')
+        output(' tolua_error(tolua_S,"#ferror in function \''..self.lname..'\'.",&tolua_err);')
+        output(' return 0;')
+        output('#endif\n')
+    else
+        local _local = ""
+        if local_constructor then
+            _local = "_local"
+        end
+        output('tolua_lerror:\n')
+        output(' return '..strsub(self.cname,1,-3)..format("%02d",overload).._local..'(tolua_S);')
+    end
+    output('}')
+    output('#endif //#ifndef TOLUA_DISABLE\n')
+    output('\n')
+
+    -- recursive call to write local constructor
+    if class and self.name=='new' and not local_constructor then
+
+        self:supcode(1)
+    end
+
+end
+
+
+-- register function
+function classFunction:register (pre)
+
+    if not self:check_public_access() then
+        return
+    end
+
+    if self.name == 'new' and self.parent.flags.pure_virtual then
+        -- no constructor for classes with pure virtual methods
+        return
+    end
+
+    output(pre..'tolua_function(tolua_S,"'..self.lname..'",'..self.cname..');')
+    if self.name == 'new' then
+        output(pre..'tolua_function(tolua_S,"new_local",'..self.cname..'_local);')
+        output(pre..'tolua_function(tolua_S,".call",'..self.cname..'_local);')
+        --output(' tolua_set_call_event(tolua_S,'..self.cname..'_local, "'..self.parent.type..'");')
+    end
+end
+
+-- Print method
+function classFunction:print (ident,close)
+    print(ident.."Function{")
+    print(ident.." mod  = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." ptr  = '"..self.ptr.."',")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." lname = '"..self.lname.."',")
+    print(ident.." const = '"..self.const.."',")
+    print(ident.." cname = '"..self.cname.."',")
+    print(ident.." lname = '"..self.lname.."',")
+    print(ident.." args = {")
+    local i=1
+    while self.args[i] do
+        self.args[i]:print(ident.."  ",",")
+        i = i+1
+    end
+    print(ident.." }")
+    print(ident.."}"..close)
+end
+
+-- check if it returns an object by value
+function classFunction:requirecollection (t)
+    local r = false
+    if self.type ~= '' and not isbasic(self.type) and self.ptr=='' then
+        local type = gsub(self.type,"%s*const%s+","")
+        t[type] = "tolua_collect_" .. clean_template(type)
+        r = true
+    end
+    local i=1
+    while self.args[i] do
+        r = self.args[i]:requirecollection(t) or r
+        i = i+1
+    end
+    return r
+end
+
+-- determine lua function name overload
+function classFunction:overload ()
+    return self.parent:overload(self.lname)
+end
+
+
+function param_object(par) -- returns true if the parameter has an object as its default value
+
+    if not string.find(par, '=') then return false end -- it has no default value
+
+    local _,_,def = string.find(par, "=(.*)$")
+
+    if string.find(par, "|") then -- a list of flags
+
+        return true
+    end
+
+    if string.find(par, "%*") then -- it's a pointer with a default value
+
+        if string.find(par, '=%s*new') then -- it's a pointer with an instance as default parameter.. is that valid?
+            return true
+        end
+        return false -- default value is 'NULL' or something
+    end
+
+
+    if string.find(par, "[%(&]") then
+        return true
+    end -- default value is a constructor call (most likely for a const reference)
+
+    --if string.find(par, "&") then
+
+    --    if string.find(def, ":") or string.find(def, "^%s*new%s+") then
+
+    --        -- it's a reference with default to something like Class::member, or 'new Class'
+    --        return true
+    --    end
+    --end
+
+    return false -- ?
+end
+
+function strip_last_arg(all_args, last_arg) -- strips the default value from the last argument
+
+    local _,_,s_arg = string.find(last_arg, "^([^=]+)")
+    last_arg = string.gsub(last_arg, "([%%%(%)])", "%%%1");
+    all_args = string.gsub(all_args, "%s*,%s*"..last_arg.."%s*%)%s*$", ")")
+    return all_args, s_arg
+end
+
+
+
+-- Internal constructor
+function _Function (t)
+    setmetatable(t,classFunction)
+
+    if t.const ~= 'const' and t.const ~= '' then
+        error("#invalid 'const' specification")
+    end
+
+    append(t)
+    if t:inclass() then
+        --print ('t.name is '..t.name..', parent.name is '..t.parent.name)
+        if string.gsub(t.name, "%b<>", "") == string.gsub(t.parent.original_name or t.parent.name, "%b<>", "") then
+            t.name = 'new'
+            t.lname = 'new'
+            t.parent._new = true
+            t.type = t.parent.name
+            t.ptr = '*'
+        elseif string.gsub(t.name, "%b<>", "") == '~'..string.gsub(t.parent.original_name or t.parent.name, "%b<>", "") then
+            t.name = 'delete'
+            t.lname = 'delete'
+            t.parent._delete = true
+        end
+    end
+    t.cname = t:cfuncname("tolua")..t:overload(t)
+    return t
+end
+
+-- Constructor
+-- Expects three strings: one representing the function declaration,
+-- another representing the argument list, and the third representing
+-- the "const" or empty string.
+function Function (d,a,c)
+    --local t = split(strsub(a,2,-2),',') -- eliminate braces
+    --local t = split_params(strsub(a,2,-2))
+
+    if not flags['W'] and string.find(a, "%.%.%.%s*%)") then
+
+        warning("Functions with variable arguments (`...') are not supported. Ignoring "..d..a..c)
+        return nil
+    end
+
+
+    local i=1
+    local l = {n=0}
+
+    a = string.gsub(a, "%s*([%(%)])%s*", "%1")
+    local t,strip,last = strip_pars(strsub(a,2,-2));
+    if strip then
+        --local ns = string.sub(strsub(a,1,-2), 1, -(string.len(last)+1))
+        local ns = join(t, ",", 1, last-1)
+
+        ns = "("..string.gsub(ns, "%s*,%s*$", "")..')'
+        --ns = strip_defaults(ns)
+
+        Function(d, ns, c)
+        for i=1,last do
+            t[i] = string.gsub(t[i], "=.*$", "")
+        end
+    end
+
+    while t[i] do
+        l.n = l.n+1
+        l[l.n] = Declaration(t[i],'var',true)
+        i = i+1
+    end
+    local f = Declaration(d,'func')
+    f.args = l
+    f.const = c
+    return _Function(f)
+end
+
+function join(t, sep, first, last)
+
+    first = first or 1
+    last = last or table.getn(t)
+    local lsep = ""
+    local ret = ""
+    local loop = false
+    for i = first,last do
+
+        ret = ret..lsep..t[i]
+        lsep = sep
+        loop = true
+    end
+    if not loop then
+        return ""
+    end
+
+    return ret
+end
+
+function strip_pars(s)
+
+    local t = split_c_tokens(s, ',')
+    local strip = false
+    local last
+
+    for i=t.n,1,-1 do
+
+        if not strip and param_object(t[i]) then
+            last = i
+            strip = true
+        end
+        --if strip then
+        --    t[i] = string.gsub(t[i], "=.*$", "")
+        --end
+    end
+
+    return t,strip,last
+
+end
+
+function strip_defaults(s)
+
+    s = string.gsub(s, "^%(", "")
+    s = string.gsub(s, "%)$", "")
+
+    local t = split_c_tokens(s, ",")
+    local sep, ret = "",""
+    for i=1,t.n do
+        t[i] = string.gsub(t[i], "=.*$", "")
+        ret = ret..sep..t[i]
+        sep = ","
+    end
+
+    return "("..ret..")"
+end
+
+
Index: /sandbox_light/src/external/tolua/lua/module.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/module.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/module.lua	(revision 5788)
@@ -0,0 +1,68 @@
+-- tolua: module class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+
+-- Module class
+-- Represents module.
+-- The following fields are stored:
+--    {i} = list of objects in the module.
+classModule = {
+    classtype = 'module'
+}
+classModule.__index = classModule
+setmetatable(classModule,classContainer)
+
+-- register module
+function classModule:register (pre)
+    pre = pre or ''
+    push(self)
+    output(pre..'tolua_module(tolua_S,"'..self.name..'",',self:hasvar(),');')
+    output(pre..'tolua_beginmodule(tolua_S,"'..self.name..'");')
+    local i=1
+    while self[i] do
+        self[i]:register(pre..' ')
+        i = i+1
+    end
+    output(pre..'tolua_endmodule(tolua_S);')
+    pop()
+end
+
+-- Print method
+function classModule:print (ident,close)
+    print(ident.."Module{")
+    print(ident.." name = '"..self.name.."';")
+    local i=1
+    while self[i] do
+        self[i]:print(ident.." ",",")
+        i = i+1
+    end
+    print(ident.."}"..close)
+end
+
+-- Internal constructor
+function _Module (t)
+    setmetatable(t,classModule)
+    append(t)
+    return t
+end
+
+-- Constructor
+-- Expects two string representing the module name and body.
+function Module (n,b)
+    local t = _Module(_Container{name=n})
+    push(t)
+    t:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
+    pop()
+    return t
+end
+
+
Index: /sandbox_light/src/external/tolua/lua/namespace.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/namespace.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/namespace.lua	(revision 5788)
@@ -0,0 +1,52 @@
+-- tolua: namespace class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 2003
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- Namespace class
+-- Represents a namesapce definition.
+-- Stores the following fields:
+--    name = class name
+--    {i}  = list of members
+classNamespace = {
+    classtype = 'namespace',
+    name = '',
+}
+classNamespace.__index = classNamespace
+setmetatable(classNamespace,classModule)
+
+-- Print method
+function classNamespace:print (ident,close)
+    print(ident.."Namespace{")
+    print(ident.." name = '"..self.name.."',")
+    local i=1
+    while self[i] do
+        self[i]:print(ident.." ",",")
+        i = i+1
+    end
+    print(ident.."}"..close)
+end
+
+-- Internal constructor
+function _Namespace (t)
+    setmetatable(t,classNamespace)
+    append(t)
+    return t
+end
+
+-- Constructor
+-- Expects the name and the body of the namespace.
+function Namespace (n,b)
+    local c = _Namespace(_Container{name=n})
+    push(c)
+    c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
+    pop()
+end
+
Index: /sandbox_light/src/external/tolua/lua/operator.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/operator.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/operator.lua	(revision 5788)
@@ -0,0 +1,215 @@
+-- tolua: operator class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- Operator class
+-- Represents an operator function or a class operator method.
+-- It stores the same fields as functions do plus:
+--  kind = set of character representing the operator (as it appers in C++ code)
+classOperator = {
+    kind = '',
+}
+classOperator.__index = classOperator
+setmetatable(classOperator,classFunction)
+
+-- table to transform operator kind into the appropriate tag method name
+_TM = {
+    ['+'] = 'add',
+    ['-'] = 'sub',
+    ['*'] = 'mul',
+    ['/'] = 'div',
+    ['<'] = 'lt',
+    ['<='] = 'le',
+    ['=='] = 'eq',
+    ['[]'] = 'geti',
+    ['&[]'] = 'seti',
+    --['->'] = 'flechita',
+}
+
+
+-- Print method
+function classOperator:print (ident,close)
+    print(ident.."Operator{")
+    print(ident.." kind  = '"..self.kind.."',")
+    print(ident.." mod  = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." ptr  = '"..self.ptr.."',")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." const = '"..self.const.."',")
+    print(ident.." cname = '"..self.cname.."',")
+    print(ident.." lname = '"..self.lname.."',")
+    print(ident.." args = {")
+    local i=1
+    while self.args[i] do
+        self.args[i]:print(ident.."  ",",")
+        i = i+1
+    end
+    print(ident.." }")
+    print(ident.."}"..close)
+end
+
+function classOperator:supcode_tmp()
+
+    if not _TM[self.kind] then
+        return classFunction.supcode(self)
+    end
+
+    -- no overload, no parameters, always inclass
+    output("/* method:",self.name," of class ",self:inclass()," */")
+
+    output("#ifndef TOLUA_DISABLE_"..self.cname)
+    output("\nstatic int",self.cname,"(lua_State* tolua_S)")
+
+    if overload < 0 then
+        output('#ifndef TOLUA_RELEASE\n')
+    end
+    output(' tolua_Error tolua_err;')
+    output(' if (\n')
+    -- check self
+    output('     !'..'tolua_isusertype(tolua_S,1,"'..self.parent.type..'",0,&tolua_err) ||\n')
+    output('     !tolua_isnoobj(tolua_S,2,&tolua_err)\n )')
+    output('  goto tolua_lerror;')
+
+    output(' else\n')
+    output('#endif\n') -- tolua_release
+    output(' {')
+
+    -- declare self
+    output(' ',self.const,self.parent.type,'*','self = ')
+    output('(',self.const,self.parent.type,'*) ')
+    output('tolua_tousertype(tolua_S,1,0);')
+
+    -- check self
+    output('#ifndef TOLUA_RELEASE\n')
+    output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in function \''..self.name..'\'",NULL);');
+    output('#endif\n')
+
+    -- cast self
+    output('  ',self.mod,self.type,self.ptr,'tolua_ret = ')
+    output('(',self.mod,self.type,self.ptr,')(*self);')
+
+    -- return value
+    local t,ct = isbasic(self.type)
+    if t then
+        output('   tolua_push'..t..'(tolua_S,(',ct,')tolua_ret);')
+    else
+        t = self.type
+        new_t = string.gsub(t, "const%s+", "")
+        if self.ptr == '' then
+            output('   {')
+            output('#ifdef __cplusplus\n')
+            output('    void* tolua_obj = new',new_t,'(tolua_ret);')
+            output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
+            output('#else\n')
+            output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));')
+            output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
+            output('#endif\n')
+            output('   }')
+        elseif self.ptr == '&' then
+            output('   tolua_pushusertype(tolua_S,(void*)&tolua_ret,"',t,'");')
+        else
+            if local_constructor then
+                output('   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"',t,'");')
+            else
+                output('   tolua_pushusertype(tolua_S,(void*)tolua_ret,"',t,'");')
+            end
+        end
+    end
+
+    output('  }')
+    output(' return 1;')
+
+    output('#ifndef TOLUA_RELEASE\n')
+    output('tolua_lerror:\n')
+    output(' tolua_error(tolua_S,"#ferror in function \''..self.lname..'\'.",&tolua_err);')
+    output(' return 0;')
+    output('#endif\n')
+
+
+    output('}')
+    output('#endif //#ifndef TOLUA_DISABLE\n')
+    output('\n')
+end
+
+-- Internal constructor
+function _Operator (t)
+    setmetatable(t,classOperator)
+
+    if t.const ~= 'const' and t.const ~= '' then
+        error("#invalid 'const' specification")
+    end
+
+    append(t)
+    if not t:inclass() then
+        error("#operator can only be defined as class member")
+    end
+
+    --t.name = t.name .. "_" .. (_TM[t.kind] or t.kind)
+    t.cname = t:cfuncname("tolua")..t:overload(t)
+    t.name = "operator" .. t.kind  -- set appropriate calling name
+    return t
+end
+
+-- Constructor
+function Operator (d,k,a,c)
+
+    local op_k = string.gsub(k, "^%s*", "")
+    op_k = string.gsub(k, "%s*$", "")
+    --if string.find(k, "^[%w_:%d<>%*%&]+$") then
+    if d == "operator" and k ~= '' then
+
+        d = k.." operator"
+    elseif not _TM[op_k] then
+
+        if flags['W'] then
+            error("tolua: no support for operator" .. f.kind)
+        else
+            warning("No support for operator "..op_k..", ignoring")
+            return nil
+        end
+    end
+
+    local ref = ''
+    local t = split_c_tokens(strsub(a,2,strlen(a)-1),',') -- eliminate braces
+    local i=1
+    local l = {n=0}
+    while t[i] do
+        l.n = l.n+1
+        l[l.n] = Declaration(t[i],'var')
+        i = i+1
+    end
+    if k == '[]' then
+        local _
+        _, _, ref = strfind(d,'(&)')
+        d = gsub(d,'&','')
+    elseif k=='&[]' then
+        l.n = l.n+1
+        l[l.n] = Declaration(d,'var')
+        l[l.n].name = 'tolua_value'
+    end
+    local f = Declaration(d,'func')
+    if k == '[]' and (l[1]==nil or isbasic(l[1].type)~='number') then
+        error('operator[] can only be defined for numeric index.')
+    end
+    f.args = l
+    f.const = c
+    f.kind = op_k
+    f.lname = "."..(_TM[f.kind] or f.kind)
+    if not _TM[f.kind] then
+        f.cast_operator = true
+    end
+    if f.kind == '[]' and ref=='&' and f.const~='const' then
+        Operator(d,'&'..k,a,c)     -- create correspoding set operator
+    end
+    return _Operator(f)
+end
+
+
Index: /sandbox_light/src/external/tolua/lua/package.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/package.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/package.lua	(revision 5788)
@@ -0,0 +1,335 @@
+-- tolua: package class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+
+-- Package class
+-- Represents the whole package being bound.
+-- The following fields are stored:
+--    {i} = list of objects in the package.
+classPackage = {
+    classtype = 'package'
+}
+classPackage.__index = classPackage
+setmetatable(classPackage,classContainer)
+
+-- Print method
+function classPackage:print ()
+    print("Package: "..self.name)
+    local i=1
+    while self[i] do
+        self[i]:print("","")
+        i = i+1
+    end
+end
+
+function classPackage:preprocess ()
+
+    -- avoid preprocessing embedded Lua code
+    local L = {}
+    self.code = gsub(self.code,"\n%s*%$%[","\1") -- deal with embedded lua code
+    self.code = gsub(self.code,"\n%s*%$%]","\2")
+    self.code = gsub(self.code,"(%b\1\2)", function (c)
+                                               tinsert(L,c)
+                                               return "\n#["..getn(L).."]#"
+                                           end
+    )
+    -- avoid preprocessing embedded C code
+    local C = {}
+    self.code = gsub(self.code,"\n%s*%$%<","\3") -- deal with embedded C code
+    self.code = gsub(self.code,"\n%s*%$%>","\4")
+    self.code = gsub(self.code,"(%b\3\4)", function (c)
+                                               tinsert(C,c)
+                                               return "\n#<"..getn(C)..">#"
+                                           end
+    )
+    -- avoid preprocessing embedded C code
+    self.code = gsub(self.code,"\n%s*%$%{","\5") -- deal with embedded C code
+    self.code = gsub(self.code,"\n%s*%$%}","\6")
+    self.code = gsub(self.code,"(%b\5\6)", function (c)
+                                               tinsert(C,c)
+                                               return "\n#<"..getn(C)..">#"
+                                           end
+    )
+
+    --self.code = gsub(self.code,"\n%s*#[^d][^\n]*\n", "\n\n") -- eliminate preprocessor directives that don't start with 'd'
+    self.code = gsub(self.code,"\n[ \t]*#[ \t]*[^d%<%[]", "\n//") -- eliminate preprocessor directives that don't start with 'd'
+
+    -- avoid preprocessing verbatim lines
+    local V = {}
+    self.code = gsub(self.code,"\n(%s*%$[^%[%]][^\n]*)", function (v)
+                                                             tinsert(V,v)
+                                                             return "\n#"..getn(V).."#"
+                                                         end
+    )
+
+    -- perform global substitution
+
+    self.code = gsub(self.code,"(//[^\n]*)","")     -- eliminate C++ comments
+    self.code = gsub(self.code,"/%*","\1")
+    self.code = gsub(self.code,"%*/","\2")
+    self.code = gsub(self.code,"%b\1\2","")
+    self.code = gsub(self.code,"\1","/%*")
+    self.code = gsub(self.code,"\2","%*/")
+    self.code = gsub(self.code,"%s*@%s*","@") -- eliminate spaces beside @
+    self.code = gsub(self.code,"%s?inline(%s)","%1") -- eliminate 'inline' keyword
+    --self.code = gsub(self.code,"%s?extern(%s)","%1") -- eliminate 'extern' keyword
+    --self.code = gsub(self.code,"%s?virtual(%s)","%1") -- eliminate 'virtual' keyword
+    --self.code = gsub(self.code,"public:","") -- eliminate 'public:' keyword
+    self.code = gsub(self.code,"([^%w_])void%s*%*","%1_userdata ") -- substitute 'void*'
+    self.code = gsub(self.code,"([^%w_])void%s*%*","%1_userdata ") -- substitute 'void*'
+    self.code = gsub(self.code,"([^%w_])char%s*%*","%1_cstring ")  -- substitute 'char*'
+    self.code = gsub(self.code,"([^%w_])lua_State%s*%*","%1_lstate ")  -- substitute 'lua_State*'
+
+    -- restore embedded Lua code
+    self.code = gsub(self.code,"%#%[(%d+)%]%#", function (n)
+                                                    return L[tonumber(n)]
+                                                end
+    )
+    -- restore embedded C code
+    self.code = gsub(self.code,"%#%<(%d+)%>%#", function (n)
+                                                    return C[tonumber(n)]
+                                                end
+    )
+    -- restore verbatim lines
+    self.code = gsub(self.code,"%#(%d+)%#", function (n)
+                                                return V[tonumber(n)]
+                                            end
+    )
+
+    self.code = string.gsub(self.code, "\n%s*%$([^\n]+)", function (l)
+                                                              Verbatim(l.."\n")
+                                                              return "\n"
+                                                          end
+    )
+end
+
+-- translate verbatim
+function classPackage:preamble ()
+    output('/*\n')
+    output('** Lua binding: '..self.name..'\n')
+    output('** Generated automatically by '..TOLUA_VERSION..' on '..date()..'.\n')
+    output('*/\n\n')
+
+    output('#ifndef __cplusplus\n')
+    output('#include <stdlib.h>\n')
+    output('#endif\n')
+    output('#include <string.h>\n\n')
+    output('#include <tolua/tolua++.h>\n\n')
+
+    if flags.H then
+        output('#include "'..flags.H..'"\n')
+    end
+
+    local i=1
+    while self[i] do
+        self[i]:preamble()
+        i = i+1
+    end
+
+    if self:requirecollection(_collect) then
+        output('\n')
+        output('/* function to release collected object via destructor */')
+        output('#ifdef __cplusplus\n')
+        for i,v in pairs(_collect) do
+            output('\nstatic int '..v..' (lua_State* tolua_S)')
+            output('{')
+            output(' '..i..'* self = ('..i..'*) tolua_tousertype(tolua_S,1,0);')
+            output('    delete self;')
+            output('    return 0;')
+            output('}')
+        end
+        output('#endif\n\n')
+    end
+
+    output('\n')
+    output('/* function to register type */')
+    output('static void tolua_reg_types (lua_State* tolua_S)')
+    output('{')
+    foreach(_usertype,function(n,v) output(' tolua_usertype(tolua_S,"',v,'");') end)
+    if flags.t then
+        output("#ifndef Mtolua_typeid\n#define Mtolua_typeid(L,TI,T)\n#endif\n")
+        foreach(_usertype,function(n,v) output(' Mtolua_typeid(tolua_S,typeid(',v,'), "',v,'");') end)
+    end
+    output('}')
+    output('\n')
+end
+
+-- register package
+-- write package open function
+function classPackage:register (pre)
+    pre = pre or ''
+    push(self)
+    output(pre.."/* Open function */")
+    output(pre.."int tolua_"..self.name.."_open (lua_State* tolua_S)")
+    output(pre.."{")
+    output(pre.." tolua_open(tolua_S);")
+    output(pre.." tolua_reg_types(tolua_S);")
+    output(pre.." tolua_module(tolua_S,NULL,",self:hasvar(),");")
+    output(pre.." tolua_beginmodule(tolua_S,NULL);")
+    local i=1
+    while self[i] do
+        self[i]:register(pre.."  ")
+        i = i+1
+    end
+    output(pre.." tolua_endmodule(tolua_S);")
+    output(pre.." return 1;")
+    output(pre.."}")
+
+    output("\n\n")
+    output("#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501\n");
+    output(pre.."int luaopen_"..self.name.." (lua_State* tolua_S) {")
+    output(pre.." return tolua_"..self.name.."_open(tolua_S);")
+    output(pre.."};")
+    output("#endif\n\n")
+
+    pop()
+end
+
+-- write header file
+function classPackage:header ()
+    output('/*\n') output('** Lua binding: '..self.name..'\n')
+    output('** Generated automatically by '..TOLUA_VERSION..' on '..date()..'.\n')
+    output('*/\n\n')
+
+    if flags.H then
+        output('#include "'..flags.w..'/'..self.name..'Prereqs.h"\n')
+        output('/* Exported function */')
+        output('_'..self.name..'Export')
+        output('int  tolua_'..self.name..'_open (lua_State* tolua_S);')
+        output('\n')
+    end
+end
+
+-- Internal constructor
+function _Package (self)
+    setmetatable(self,classPackage)
+    return self
+end
+
+-- Parse C header file with tolua directives
+-- *** Thanks to Ariel Manzur for fixing bugs in nested directives ***
+function extract_code(fn,s)
+    local code = '\n$#include "'..flags.w..'/'..fn..'"\n'
+    s= "\n" .. s .. "\n" -- add blank lines as sentinels
+
+    -- eliminate export macro problems in class declarations
+    s = gsub(s, ' _%w*Export ', ' ')
+
+    local _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n")
+    while e do
+        t = strlower(t)
+        if t == "begin" then
+            _,e,c = strfind(s,"(.-)\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[Ee][Nn][Dd][^\n]*\n",e)
+            if not e then
+             tolua_error("Unbalanced 'tolua_begin' directive in header file")
+            end
+        end
+        code = code .. c .. "\n"
+        _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n",e)
+    end
+    return code
+end
+
+-- Constructor
+-- Expects the package name, the file extension, and the file text.
+function Package (name,fn)
+    local ext = "pkg"
+
+    -- open input file, if any
+    if fn then
+        local file
+        if flags.f then
+            if string.sub(flags.f, 1, 1) == '/' or string.sub(flags.f, 1, 1) == '\\' or (string.len(flags.f) > 1 and string.sub(flags.f, 2, 2) == ':') then
+                file = flags.f
+            else
+                file = flags.w..'/'..flags.f
+            end
+        else
+            file = flags.f
+        end
+        local st, msg = readfrom(file)
+        if not st then
+            error('#'..msg..' path: '..flags.f)
+        end
+        local _; _, _, ext = strfind(fn,".*%.(.*)$")
+    end
+    local code = "\n" .. read('*a')
+    if ext == 'h' or ext == 'hpp' then
+        code = extract_code(fn,code)
+    end
+
+    -- close file
+    if fn then
+        readfrom()
+    end
+
+    -- prepare working directory
+    local current_path
+    if not flags.w and flags.f then
+        current_path = gsub(flags.f, '(/)[^/]*%.?[^/]*$', '%1')
+    elseif flags.w then
+        if not (string.sub(flags.w, string.len(flags.w)) == '/') then
+            current_path = flags.w..'/'
+        else
+            current_path = flags.w
+        end
+    else
+        current_path = ''
+    end
+
+    -- deal with include directive
+    local nsubst
+    repeat
+        code,nsubst = gsub(code,'\n%s*%$(.)file%s*"(.-)"([^\n]*)\n',
+            function (kind,fn,extra)
+                local _, _, ext = strfind(fn,".*%.(.*)$")
+                local fp,msg = openfile(current_path..fn,'r')
+                if not fp then
+                    error('#'..msg..': '..fn)
+                end
+                local s = read(fp,'*a')
+                closefile(fp)
+                if kind == 'c' or kind == 'h' then
+                    return extract_code(fn,s)
+                elseif kind == 'p' then
+                    return "\n\n" .. s
+                elseif kind == 'l' then
+                    return "\n$[--##"..fn.."\n" .. s .. "\n$]\n"
+                elseif kind == 'i' then
+                    local t = {code=s}
+                    extra = string.gsub(extra, "^%s*,%s*", "")
+                    local pars = split_c_tokens(extra, ",")
+                    include_file_hook(t, fn, unpack(pars))
+                    return "\n\n" .. t.code
+                else
+                    error('#Invalid include directive (use $cfile, $pfile, $lfile or $ifile)')
+                end
+            end
+        )
+    until nsubst==0
+
+    -- deal with renaming directive
+    repeat -- I don't know why this is necesary
+        code,nsubst = gsub(code,'\n%s*%$renaming%s*(.-)%s*\n', function (r) appendrenaming(r) return "\n" end)
+    until nsubst == 0
+
+    local t = _Package(_Container{name=name, code=code})
+    push(t)
+    preprocess_hook(t)
+    t:preprocess()
+    preparse_hook(t)
+    t:parse(t.code)
+    pop()
+    return t
+end
+
+
Index: /sandbox_light/src/external/tolua/lua/typedef.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/typedef.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/typedef.lua	(revision 5788)
@@ -0,0 +1,71 @@
+-- tolua: typedef class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+
+-- Typedef class
+-- Represents a type synonym.
+-- The 'de facto' type replaces the typedef before the
+-- remaining code is parsed.
+-- The following fields are stored:
+--   utype = typedef name
+--   type = 'the facto' type
+--   mod = modifiers to the 'de facto' type
+classTypedef = {
+    utype = '',
+    mod = '',
+    type = ''
+}
+classTypedef.__index = classTypedef
+
+-- Print method
+function classTypedef:print (ident,close)
+    print(ident.."Typedef{")
+    print(ident.." utype = '"..self.utype.."',")
+    print(ident.." mod = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.."}"..close)
+end
+
+-- Return it's not a variable
+function classTypedef:isvariable ()
+    return false
+end
+
+-- Internal constructor
+function _Typedef (t)
+    setmetatable(t,classTypedef)
+    t.type = resolve_template_types(t.type)
+    appendtypedef(t)
+    return t
+end
+
+-- Constructor
+-- Expects one string representing the type definition.
+function Typedef (s)
+    if strfind(string.gsub(s, '%b<>', ''),'[%*&]') then
+        tolua_error("#invalid typedef: pointers (and references) are not supported")
+    end
+    local o = {mod = ''}
+    if string.find(s, "[<>]") then
+        _,_,o.type,o.utype = string.find(s, "^%s*([^<>]+%b<>[^%s]*)%s+(.-)$")
+    else
+        local t = split(gsub(s,"%s%s*"," ")," ")
+        o = {
+            utype = t[t.n],
+            type = t[t.n-1],
+            mod = concat(t,1,t.n-2),
+        }
+    end
+    return _Typedef(o)
+end
+
+
Index: /sandbox_light/src/external/tolua/lua/variable.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/variable.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/variable.lua	(revision 5788)
@@ -0,0 +1,295 @@
+-- tolua: variable class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+-- Variable class
+-- Represents a extern variable or a public member of a class.
+-- Stores all fields present in a declaration.
+classVariable = {
+    _get = {},   -- mapped get functions
+    _set = {},   -- mapped set functions
+}
+classVariable.__index = classVariable
+setmetatable(classVariable,classDeclaration)
+
+-- Print method
+function classVariable:print (ident,close)
+    print(ident.."Variable{")
+    print(ident.." mod  = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." ptr  = '"..self.ptr.."',")
+    print(ident.." name = '"..self.name.."',")
+    if self.dim then print(ident.." dim = '"..self.dim.."',") end
+    print(ident.." def  = '"..self.def.."',")
+    print(ident.." ret  = '"..self.ret.."',")
+    print(ident.."}"..close)
+end
+
+-- Generates C function name
+function classVariable:cfuncname (prefix)
+    local parent = ""
+    local unsigned = ""
+    local ptr = ""
+
+    local p = self:inmodule() or self:innamespace() or self:inclass()
+
+    if p then
+        if self.parent.classtype == 'class' then
+            parent = "_" .. self.parent.type
+        else
+            parent = "_" .. p
+        end
+    end
+
+    if strfind(self.mod,"(unsigned)") then
+        unsigned = "_unsigned"
+    end
+
+    if self.ptr == "*" then ptr = "_ptr"
+    elseif self.ptr == "&" then ptr = "_ref"
+    end
+
+    local name =  prefix .. parent .. unsigned .. "_" .. gsub(self.lname or self.name,".*::","") .. ptr
+
+    name = clean_template(name)
+    return name
+
+end
+
+-- check if it is a variable
+function classVariable:isvariable ()
+    return true
+end
+
+-- get variable value
+function classVariable:getvalue (class,static, prop_get)
+
+    local name
+    if prop_get then
+
+        name = prop_get.."()"
+    else
+        name = self.name
+    end
+
+    if class and static then
+        return self.parent.type..'::'..name
+    elseif class then
+        return 'self->'..name
+    else
+        return name
+    end
+end
+
+-- get variable pointer value
+function classVariable:getpointervalue (class,static)
+    if class and static then
+        return class..'::p'
+    elseif class then
+        return 'self->p'
+    else
+        return 'p'
+    end
+end
+
+-- Write binding functions
+function classVariable:supcode ()
+
+ local class = self:inclass()
+
+    local prop_get,prop_set
+    if string.find(self.mod, 'tolua_property') then
+
+        _,_,type = string.find(self.mod, "tolua_property__([^%s]*)")
+        type = type or "default"
+        prop_get,prop_set = get_property_methods(type, self.name)
+        self.mod = string.gsub(self.mod, "tolua_property[^%s]*", "")
+    end
+
+    -- get function ------------------------------------------------
+    if class then
+        output("/* get function:",self.name," of class ",class," */")
+    else
+        output("/* get function:",self.name," */")
+    end
+    self.cgetname = self:cfuncname("tolua_get")
+    output("#ifndef TOLUA_DISABLE_"..self.cgetname)
+    output("\nstatic int",self.cgetname,"(lua_State* tolua_S)")
+    output("{")
+
+    -- declare self, if the case
+    local _,_,static = strfind(self.mod,'^%s*(static)')
+    if class and static==nil then
+        output(' ',self.parent.type,'*','self = ')
+        output('(',self.parent.type,'*) ')
+        output('tolua_tousertype(tolua_S,1,0);')
+    elseif static then
+        _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
+    end
+
+
+    -- check self value
+    if class and static==nil then
+        output('#ifndef TOLUA_RELEASE\n')
+        output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in accessing variable \''..self.name..'\'",NULL);');
+        output('#endif\n')
+    end
+
+    -- return value
+    if string.find(self.mod, 'tolua_inherits') then
+        output('#ifdef __cplusplus\n')
+        output('  tolua_pushusertype(tolua_S,(void*)static_cast<'..self.type..'*>(self), "',self.type,'");')
+        output('#else\n')
+        output('  tolua_pushusertype(tolua_S,(void*)(('..self.type..'*)self), "',self.type,'");')
+        output('#endif\n')
+    else
+        local t,ct = isbasic(self.type)
+        if t then
+            output('  tolua_push'..t..'(tolua_S,(',ct,')'..self:getvalue(class,static,prop_get)..');')
+        else
+            t = self.type
+            if self.ptr == '&' or self.ptr == '' then
+                output('  tolua_pushusertype(tolua_S,(void*)&'..self:getvalue(class,static,prop_get)..',"',t,'");')
+            else
+                output('  tolua_pushusertype(tolua_S,(void*)'..self:getvalue(class,static,prop_get)..',"',t,'");')
+            end
+        end
+    end
+    output(' return 1;')
+    output('}')
+    output('#endif //#ifndef TOLUA_DISABLE\n')
+    output('\n')
+
+    -- set function ------------------------------------------------
+    if not (strfind(self.type,'const%s+') or string.find(self.mod, 'tolua_readonly') or string.find(self.mod, 'tolua_inherits'))  then
+    if class then
+        output("/* set function:",self.name," of class ",class," */")
+    else
+        output("/* set function:",self.name," */")
+    end
+    self.csetname = self:cfuncname("tolua_set")
+    output("#ifndef TOLUA_DISABLE_"..self.csetname)
+    output("\nstatic int",self.csetname,"(lua_State* tolua_S)")
+    output("{")
+
+    -- declare self, if the case
+    if class and static==nil then
+        output(' ',self.parent.type,'*','self = ')
+        output('(',self.parent.type,'*) ')
+        output('tolua_tousertype(tolua_S,1,0);')
+        -- check self value
+    end
+    -- check types
+    output('#ifndef TOLUA_RELEASE\n')
+    output('  tolua_Error tolua_err;')
+    if class and static==nil then
+        output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in accessing variable \''..self.name..'\'",NULL);');
+    elseif static then
+        _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
+    end
+
+    -- check variable type
+    output('  if (!'..self:outchecktype(2)..')')
+    output('   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);')
+    output('#endif\n')
+
+    -- assign value
+    local def = 0
+    if self.def ~= '' then def = self.def end
+    if self.type == 'char*' and self.dim ~= '' then -- is string
+        output(' strncpy(')
+        if class and static then
+            output(self.parent.type..'::'..self.name)
+            elseif class then
+                output('self->'..self.name)
+            else
+                output(self.name)
+            end
+            output(',tolua_tostring(tolua_S,2,',def,'),',self.dim,'-1);')
+        else
+            local ptr = ''
+            if self.ptr~='' then ptr = '*' end
+            output(' ')
+            local name = prop_set or self.name
+            if class and static then
+                output(self.parent.type..'::'..name)
+            elseif class then
+                output('self->'..name)
+            else
+                output(name)
+            end
+            local t = isbasic(self.type)
+            if prop_set then
+                output('(')
+            else
+                output(' = ')
+            end
+            if not t and ptr=='' then output('*') end
+            output('((',self.mod,self.type)
+            if not t then
+                output('*')
+            end
+            output(') ')
+            if t then
+                if isenum(self.type) then
+                    output('(int) ')
+                end
+                output('tolua_to'..t,'(tolua_S,2,',def,'))')
+            else
+                output('tolua_tousertype(tolua_S,2,',def,'))')
+            end
+            if prop_set then
+                output(")")
+            end
+            output(";")
+        end
+        output(' return 0;')
+        output('}')
+        output('#endif //#ifndef TOLUA_DISABLE\n')
+        output('\n')
+    end
+
+end
+
+function classVariable:register (pre)
+
+    if not self:check_public_access() then
+        return
+    end
+    pre = pre or ''
+    local parent = self:inmodule() or self:innamespace() or self:inclass()
+    if not parent then
+        if classVariable._warning==nil then
+            warning("Mapping variable to global may degrade performance")
+            classVariable._warning = 1
+        end
+    end
+    if self.csetname then
+        output(pre..'tolua_variable(tolua_S,"'..self.lname..'",'..self.cgetname..','..self.csetname..');')
+    else
+        output(pre..'tolua_variable(tolua_S,"'..self.lname..'",'..self.cgetname..',NULL);')
+    end
+end
+
+-- Internal constructor
+function _Variable (t)
+    setmetatable(t,classVariable)
+    append(t)
+    return t
+end
+
+-- Constructor
+-- Expects a string representing the variable declaration.
+function Variable (s)
+    return _Variable (Declaration(s,'var'))
+end
+
+
Index: /sandbox_light/src/external/tolua/lua/verbatim.lua
===================================================================
--- /sandbox_light/src/external/tolua/lua/verbatim.lua	(revision 5788)
+++ /sandbox_light/src/external/tolua/lua/verbatim.lua	(revision 5788)
@@ -0,0 +1,78 @@
+-- tolua: verbatim class
+-- Written by Waldemar Celes
+-- TeCGraf/PUC-Rio
+-- Jul 1998
+-- $Id: verbatim.lua,v 1.3 2000/01/24 20:41:16 celes Exp $
+
+-- This code is free software; you can redistribute it and/or modify it.
+-- The software provided hereunder is on an "as is" basis, and
+-- the author has no obligation to provide maintenance, support, updates,
+-- enhancements, or modifications.
+
+
+
+-- Verbatim class
+-- Represents a line translated directed to the binding file.
+-- The following filds are stored:
+--   line = line text
+classVerbatim = {
+    line = '',
+    cond = nil,    -- condition: where to generate the code (s=suport, r=register)
+}
+classVerbatim.__index = classVerbatim
+setmetatable(classVerbatim,classFeature)
+
+-- preamble verbatim
+function classVerbatim:preamble ()
+    if self.cond == '' then
+        write(self.line)
+    end
+end
+
+-- support code
+function classVerbatim:supcode ()
+    if strfind(self.cond,'s') then
+        write(self.line)
+        write('\n')
+    end
+end
+
+-- register code
+function classVerbatim:register (pre)
+    if strfind(self.cond,'r') then
+        write(self.line)
+    end
+end
+
+
+-- Print method
+function classVerbatim:print (ident,close)
+    print(ident.."Verbatim{")
+    print(ident.." line = '"..self.line.."',")
+    print(ident.."}"..close)
+    end
+
+
+-- Internal constructor
+function _Verbatim (t)
+    setmetatable(t,classVerbatim)
+    append(t)
+    return t
+end
+
+-- Constructor
+-- Expects a string representing the text line
+function Verbatim (l,cond)
+    if strsub(l,1,1) == "'" then
+        l = strsub(l,2)
+    elseif strsub(l,1,1) == '$' then
+        cond = 'sr'       -- generates in both suport and register fragments
+        l = strsub(l,2)
+    end
+    return _Verbatim {
+        line = l,
+        cond = cond or '',
+    }
+end
+
+
Index: /sandbox_light/src/external/tolua/tolua++.h
===================================================================
--- /sandbox_light/src/external/tolua/tolua++.h	(revision 5788)
+++ /sandbox_light/src/external/tolua/tolua++.h	(revision 5788)
@@ -0,0 +1,182 @@
+/* tolua
+** Support code for Lua bindings.
+** Written by Waldemar Celes
+** TeCGraf/PUC-Rio
+** Apr 2003
+** $Id: $
+*/
+
+/* This code is free software; you can redistribute it and/or modify it.
+** The software provided hereunder is on an "as is" basis, and
+** the author has no obligation to provide maintenance, support, updates,
+** enhancements, or modifications.
+*/
+
+
+#ifndef TOLUA_H
+#define TOLUA_H
+
+/* original code */
+/*
+#ifndef TOLUA_API
+#define TOLUA_API extern
+#endif
+*/
+
+/********************************
+******* ORXONOX CHANGES *********
+********************************/
+
+#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined( TOLUA_STATIC_BUILD )
+#  ifdef TOLUA_SHARED_BUILD
+#    define TOLUA_API __declspec(dllexport)
+#  else
+#    if defined( __MINGW32__ )
+#      define TOLUA_API
+#    else
+#      define TOLUA_API __declspec(dllimport)
+#    endif
+#  endif
+#else
+#  define TOLUA_API extern
+#endif
+
+/********************************
+****** END ORXONOX CHANGES ******
+********************************/
+
+#define TOLUA_VERSION "tolua++-1.0.92"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define tolua_pushcppstring(x,y)	tolua_pushstring(x,y.c_str())
+#define tolua_iscppstring	tolua_isstring
+
+#define tolua_iscppstringarray tolua_isstringarray
+#define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str())
+
+#define TEMPLATE_BIND(p)
+#define TOLUA_TEMPLATE_BIND(p)
+#define TOLUA_PROTECTED_DESTRUCTOR
+#define TOLUA_PROPERTY_TYPE(p)
+
+typedef int lua_Object;
+
+#include "lua.h"
+#include "lauxlib.h"
+
+struct tolua_Error
+{
+	int index;
+	int array;
+	const char* type;
+};
+typedef struct tolua_Error tolua_Error;
+
+#define TOLUA_NOPEER	LUA_REGISTRYINDEX /* for lua 5.1 */
+
+TOLUA_API const char* tolua_typename (lua_State* L, int lo);
+TOLUA_API void tolua_error (lua_State* L, char* msg, tolua_Error* err);
+TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err);
+TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err);
+TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err);
+TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err);
+TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err);
+TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err);
+TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
+TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err);
+TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
+TOLUA_API int tolua_isvaluearray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err);
+TOLUA_API int tolua_isbooleanarray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err);
+TOLUA_API int tolua_isnumberarray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err);
+TOLUA_API int tolua_isstringarray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err);
+TOLUA_API int tolua_istablearray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err);
+TOLUA_API int tolua_isuserdataarray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err);
+TOLUA_API int tolua_isusertypearray
+ (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err);
+
+TOLUA_API void tolua_open (lua_State* L);
+
+TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size);
+TOLUA_API int tolua_register_gc (lua_State* L, int lo);
+TOLUA_API int tolua_default_collect (lua_State* tolua_S);
+
+TOLUA_API void tolua_usertype (lua_State* L, char* type);
+TOLUA_API void tolua_beginmodule (lua_State* L, char* name);
+TOLUA_API void tolua_endmodule (lua_State* L);
+TOLUA_API void tolua_module (lua_State* L, char* name, int hasvar);
+TOLUA_API void tolua_class (lua_State* L, char* name, char* base);
+TOLUA_API void tolua_cclass (lua_State* L, char* lname, char* name, char* base, lua_CFunction col);
+TOLUA_API void tolua_function (lua_State* L, char* name, lua_CFunction func);
+TOLUA_API void tolua_constant (lua_State* L, char* name, double value);
+TOLUA_API void tolua_variable (lua_State* L, char* name, lua_CFunction get, lua_CFunction set);
+TOLUA_API void tolua_array (lua_State* L,char* name, lua_CFunction get, lua_CFunction set);
+
+/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */
+/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */
+
+TOLUA_API void tolua_pushvalue (lua_State* L, int lo);
+TOLUA_API void tolua_pushboolean (lua_State* L, int value);
+TOLUA_API void tolua_pushnumber (lua_State* L, double value);
+TOLUA_API void tolua_pushstring (lua_State* L, const char* value);
+TOLUA_API void tolua_pushuserdata (lua_State* L, void* value);
+TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type);
+TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type);
+TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v);
+TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v);
+TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, double v);
+TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v);
+TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v);
+TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type);
+TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type);
+
+TOLUA_API double tolua_tonumber (lua_State* L, int narg, double def);
+TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def);
+TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def);
+TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def);
+TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def);
+TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def);
+TOLUA_API double tolua_tofieldnumber (lua_State* L, int lo, int index, double def);
+TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def);
+TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def);
+TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def);
+TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def);
+TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def);
+
+TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name);
+
+TOLUA_API int class_gc_event (lua_State* L);
+
+#ifdef __cplusplus
+static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) {
+
+	const char* s = tolua_tostring(L, narg, def);
+	return s?s:"";
+};
+
+static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) {
+
+	const char* s = tolua_tofieldstring(L, lo, index, def);
+	return s?s:"";
+};
+
+#else
+#define tolua_tocppstring tolua_tostring
+#define tolua_tofieldcppstring tolua_tofieldstring
+#endif
+
+TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /sandbox_light/src/external/tolua/tolua.c
===================================================================
--- /sandbox_light/src/external/tolua/tolua.c	(revision 5788)
+++ /sandbox_light/src/external/tolua/tolua.c	(revision 5788)
@@ -0,0 +1,211 @@
+/* tolua
+** Support code for Lua bindings.
+** Written by Waldemar Celes
+** TeCGraf/PUC-Rio
+** Aug 2003
+** $Id:$
+** Extension by Orxonox (Reto Grieder) to support working directory
+** and direct usage of lua files. (2008)
+*/
+
+/* This code is free software; you can redistribute it and/or modify it.
+** The software provided hereunder is on an "as is" basis, and
+** the author has no obligation to provide maintenance, support, updates,
+** enhancements, or modifications.
+*/
+
+#include "tolua++.h"
+
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+static void help (void)
+{
+ fprintf(stderr,"\n"
+         "usage: tolua++ [options] input_file\n"
+         "\n"
+         "Command line options are:\n"
+         "  -v       : print version information.\n"
+         "  -o  file : set output file; default is stdout.\n"
+         "  -H  file : create include file.\n"
+         "  -n  name : set package name; default is input file root name.\n"
+         "  -w  directory : set working directory; default is location of package file.\n"
+         "  -s  file : specify source lua code for the parser; all.lua is default.\n"
+         "  -p       : parse only.\n"
+         "  -P       : parse and print structure information (for debug).\n"
+         "  -S       : disable support for c++ strings.\n"
+         "  -1       : substract 1 to operator[] index (for compatibility with tolua5).\n"
+         "  -L  file : run lua file (with dofile()) before doing anything.\n"
+         "  -D       : disable automatic exporting of destructors for classes that have\n"
+         "             constructors (for compatibility with tolua5)\n"
+         "  -W       : disable warnings for unsupported features (for compatibility\n"
+         "             with tolua5)\n"
+         "  -C       : disable cleanup of included lua code (for easier debugging)\n"
+         "  -E  value[=value] : add extra values to the luastate\n"
+         "  -t       : export a list of types asociates with the C++ typeid name\n"
+         "  -h       : print this message.\n"
+         "Should the input file be omitted, stdin is assumed;\n"
+         "in that case, the package name must be explicitly set.\n\n"
+        );
+}
+
+static void version (void)
+{
+ fprintf(stderr, "%s (written by W. Celes, A. Manzur)\n",TOLUA_VERSION);
+}
+
+static void setfield (lua_State* L, int table, char* f, char* v)
+{
+ lua_pushstring(L,f);
+ lua_pushstring(L,v);
+ lua_settable(L,table);
+}
+
+static void add_extra (lua_State* L, char* value) {
+ int len;
+ lua_getglobal(L, "_extra_parameters");
+ len = luaL_getn(L, -1);
+ lua_pushstring(L, value);
+ lua_rawseti(L, -2, len+1);
+ lua_pop(L, 1);
+};
+
+static void error (char* o)
+{
+ fprintf(stderr,"tolua: unknown option '%s'\n",o);
+ help();
+ exit(1);
+}
+
+int main (int argc, char* argv[])
+{
+ char* working_directory = "";
+ char* lua_source = "";
+
+ #ifdef LUA_VERSION_NUM /* lua 5.1 */
+ lua_State* L = luaL_newstate();
+ luaL_openlibs(L);
+ #else
+ lua_State* L = lua_open();
+ luaopen_base(L);
+ luaopen_io(L);
+ luaopen_string(L);
+ luaopen_table(L);
+ luaopen_math(L);
+ luaopen_debug(L);
+ #endif
+
+ lua_pushstring(L,TOLUA_VERSION); lua_setglobal(L,"TOLUA_VERSION");
+ lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION");
+
+
+ if (argc==1)
+ {
+  help();
+  return 0;
+ }
+ else
+ {
+  int i, t;
+  lua_newtable(L);
+  lua_setglobal(L, "_extra_parameters");
+  lua_newtable(L);
+  lua_pushvalue(L,-1);
+  lua_setglobal(L,"flags");
+  t = lua_gettop(L);
+  for (i=1; i<argc; ++i)
+  {
+   if (*argv[i] == '-')
+   {
+    switch (argv[i][1])
+    {
+     case 'v': version(); return 0;
+     case 'h': help(); return 0;
+     case 'p': setfield(L,t,"p",""); break;
+     case 'P': setfield(L,t,"P",""); break;
+     case 'o': setfield(L,t,"o",argv[++i]); break;
+     case 'n': setfield(L,t,"n",argv[++i]); break;
+     case 'H': setfield(L,t,"H",argv[++i]); break;
+     case 'w':
+      working_directory = argv[++i];
+      setfield(L,t,"w",argv[i]);
+      break;
+     case 's':
+      lua_source = argv[++i];
+      setfield(L,t,"s",argv[i]);
+      break;
+     case 'S': setfield(L,t,"S",""); break;
+     case '1': setfield(L,t,"1",""); break;
+     case 'L': setfield(L,t,"L",argv[++i]); break;
+     case 'D': setfield(L,t,"D",""); break;
+     case 'W': setfield(L,t,"W",""); break;
+     case 'C': setfield(L,t,"C",""); break;
+     case 'E': add_extra(L,argv[++i]); break;
+     case 't': setfield(L,t,"t",""); break;
+     default: error(argv[i]); break;
+    }
+   }
+   else
+   {
+    setfield(L,t,"f",argv[i]);
+    break;
+   }
+  }
+  lua_pop(L,1);
+ }
+
+ {
+  char path[BUFSIZ];
+  char file[BUFSIZ];
+  path[0] = '\0';
+  file[0] = '\0';
+
+  if (strlen(lua_source) > 0 &&
+      lua_source[0] != '/' &&
+      lua_source[0] != '\\' &&
+      strlen(lua_source) > 1 &&
+      lua_source[1] != ':')
+  {
+   /* Relative path, prefix working directory */
+   strcpy(path, working_directory);
+   /* Make sure there is '\\' or '/' at the end of the path */
+   if (strlen(path) > 0)
+   {
+    char last = path[strlen(path) - 1];
+    if (last != '\\' && last != '/')
+     strcat(path, "/");
+   }
+  }
+
+  strcat(path, lua_source);
+
+  /* Extract the full path */
+  {
+   char* p;
+   p = strrchr(path, '/');
+   if (p == NULL)
+    p = strrchr(path, '\\');
+   p = (p == NULL) ? path : p + 1;
+   strcpy(file, p);
+   *p = '\0';
+  }
+  if (strlen(file) == 0)
+   strcpy(file, "all.lua");
+
+  lua_pushstring(L, path);
+  lua_setglobal(L, "path");
+  strcat(path, file);
+#ifdef LUA_VERSION_NUM /* lua 5.1 */
+  luaL_dofile(L, path);
+#else
+  lua_dofile(L, path);
+#endif
+ }
+ return 0;
+}
Index: /sandbox_light/src/external/tolua/tolua_event.c
===================================================================
--- /sandbox_light/src/external/tolua/tolua_event.c	(revision 5788)
+++ /sandbox_light/src/external/tolua/tolua_event.c	(revision 5788)
@@ -0,0 +1,513 @@
+/* tolua: event functions
+** Support code for Lua bindings.
+** Written by Waldemar Celes
+** TeCGraf/PUC-Rio
+** Apr 2003
+** $Id: $
+*/
+
+/* This code is free software; you can redistribute it and/or modify it.
+** The software provided hereunder is on an "as is" basis, and
+** the author has no obligation to provide maintenance, support, updates,
+** enhancements, or modifications.
+*/
+
+#include <stdio.h>
+
+#include "tolua++.h"
+
+/* Store at ubox
+	* It stores, creating the corresponding table if needed,
+	* the pair key/value in the corresponding ubox table
+*/
+static void storeatubox (lua_State* L, int lo)
+{
+	#ifdef LUA_VERSION_NUM
+		lua_getfenv(L, lo);
+		if (lua_rawequal(L, -1, TOLUA_NOPEER)) {
+			lua_pop(L, 1);
+			lua_newtable(L);
+			lua_pushvalue(L, -1);
+			lua_setfenv(L, lo);	/* stack: k,v,table  */
+		};
+		lua_insert(L, -3);
+		lua_settable(L, -3); /* on lua 5.1, we trade the "tolua_peers" lookup for a settable call */
+		lua_pop(L, 1);
+	#else
+	 /* stack: key value (to be stored) */
+		lua_pushstring(L,"tolua_peers");
+		lua_rawget(L,LUA_REGISTRYINDEX);        /* stack: k v ubox */
+		lua_pushvalue(L,lo);
+		lua_rawget(L,-2);                       /* stack: k v ubox ubox[u] */
+		if (!lua_istable(L,-1))
+		{
+			lua_pop(L,1);                          /* stack: k v ubox */
+			lua_newtable(L);                       /* stack: k v ubox table */
+			lua_pushvalue(L,1);
+			lua_pushvalue(L,-2);                   /* stack: k v ubox table u table */
+			lua_rawset(L,-4);                      /* stack: k v ubox ubox[u]=table */
+		}
+		lua_insert(L,-4);                       /* put table before k */
+		lua_pop(L,1);                           /* pop ubox */
+		lua_rawset(L,-3);                       /* store at table */
+		lua_pop(L,1);                           /* pop ubox[u] */
+	#endif
+}
+
+/* Module index function
+*/
+static int module_index_event (lua_State* L)
+{
+	lua_pushstring(L,".get");
+	lua_rawget(L,-3);
+	if (lua_istable(L,-1))
+	{
+		lua_pushvalue(L,2);  /* key */
+		lua_rawget(L,-2);
+		if (lua_iscfunction(L,-1))
+		{
+			lua_call(L,0,1);
+			return 1;
+		}
+		else if (lua_istable(L,-1))
+			return 1;
+	}
+	/* call old index meta event */
+	if (lua_getmetatable(L,1))
+	{
+		lua_pushstring(L,"__index");
+		lua_rawget(L,-2);
+		lua_pushvalue(L,1);
+		lua_pushvalue(L,2);
+		if (lua_isfunction(L,-1))
+		{
+			lua_call(L,2,1);
+			return 1;
+		}
+		else if (lua_istable(L,-1))
+		{
+			lua_gettable(L,-3);
+			return 1;
+		}
+	}
+	lua_pushnil(L);
+	return 1;
+}
+
+/* Module newindex function
+*/
+static int module_newindex_event (lua_State* L)
+{
+	lua_pushstring(L,".set");
+	lua_rawget(L,-4);
+	if (lua_istable(L,-1))
+	{
+		lua_pushvalue(L,2);  /* key */
+		lua_rawget(L,-2);
+		if (lua_iscfunction(L,-1))
+		{
+			lua_pushvalue(L,1); /* only to be compatible with non-static vars */
+			lua_pushvalue(L,3); /* value */
+			lua_call(L,2,0);
+			return 0;
+		}
+	}
+	/* call old newindex meta event */
+	if (lua_getmetatable(L,1) && lua_getmetatable(L,-1))
+	{
+		lua_pushstring(L,"__newindex");
+		lua_rawget(L,-2);
+		if (lua_isfunction(L,-1))
+		{
+		 lua_pushvalue(L,1);
+		 lua_pushvalue(L,2);
+		 lua_pushvalue(L,3);
+			lua_call(L,3,0);
+		}
+	}
+	lua_settop(L,3);
+	lua_rawset(L,-3);
+	return 0;
+}
+
+/* Class index function
+	* If the object is a userdata (ie, an object), it searches the field in
+	* the alternative table stored in the corresponding "ubox" table.
+*/
+static int class_index_event (lua_State* L)
+{
+ int t = lua_type(L,1);
+	if (t == LUA_TUSERDATA)
+	{
+		/* Access alternative table */
+		#ifdef LUA_VERSION_NUM /* new macro on version 5.1 */
+		lua_getfenv(L,1);
+		if (!lua_rawequal(L, -1, TOLUA_NOPEER)) {
+			lua_pushvalue(L, 2); /* key */
+			lua_gettable(L, -2); /* on lua 5.1, we trade the "tolua_peers" lookup for a gettable call */
+			if (!lua_isnil(L, -1))
+				return 1;
+		};
+		#else
+		lua_pushstring(L,"tolua_peers");
+		lua_rawget(L,LUA_REGISTRYINDEX);        /* stack: obj key ubox */
+		lua_pushvalue(L,1);
+		lua_rawget(L,-2);                       /* stack: obj key ubox ubox[u] */
+		if (lua_istable(L,-1))
+		{
+			lua_pushvalue(L,2);  /* key */
+			lua_rawget(L,-2);                      /* stack: obj key ubox ubox[u] value */
+			if (!lua_isnil(L,-1))
+				return 1;
+		}
+		#endif
+		lua_settop(L,2);                        /* stack: obj key */
+		/* Try metatables */
+		lua_pushvalue(L,1);                     /* stack: obj key obj */
+		while (lua_getmetatable(L,-1))
+		{                                       /* stack: obj key obj mt */
+			lua_remove(L,-2);                      /* stack: obj key mt */
+			if (lua_isnumber(L,2))                 /* check if key is a numeric value */
+			{
+				/* try operator[] */
+				lua_pushstring(L,".geti");
+				lua_rawget(L,-2);                      /* stack: obj key mt func */
+				if (lua_isfunction(L,-1))
+				{
+					lua_pushvalue(L,1);
+					lua_pushvalue(L,2);
+					lua_call(L,2,1);
+					return 1;
+				}
+			}
+			else
+			{
+			 lua_pushvalue(L,2);                    /* stack: obj key mt key */
+				lua_rawget(L,-2);                      /* stack: obj key mt value */
+				if (!lua_isnil(L,-1))
+					return 1;
+				else
+					lua_pop(L,1);
+				/* try C/C++ variable */
+				lua_pushstring(L,".get");
+				lua_rawget(L,-2);                      /* stack: obj key mt tget */
+				if (lua_istable(L,-1))
+				{
+					lua_pushvalue(L,2);
+					lua_rawget(L,-2);                      /* stack: obj key mt value */
+					if (lua_iscfunction(L,-1))
+					{
+						lua_pushvalue(L,1);
+						lua_pushvalue(L,2);
+						lua_call(L,2,1);
+						return 1;
+					}
+					else if (lua_istable(L,-1))
+					{
+						/* deal with array: create table to be returned and cache it in ubox */
+						void* u = *((void**)lua_touserdata(L,1));
+						lua_newtable(L);                /* stack: obj key mt value table */
+						lua_pushstring(L,".self");
+						lua_pushlightuserdata(L,u);
+						lua_rawset(L,-3);               /* store usertype in ".self" */
+						lua_insert(L,-2);               /* stack: obj key mt table value */
+						lua_setmetatable(L,-2);         /* set stored value as metatable */
+						lua_pushvalue(L,-1);            /* stack: obj key met table table */
+						lua_pushvalue(L,2);             /* stack: obj key mt table table key */
+						lua_insert(L,-2);               /*  stack: obj key mt table key table */
+						storeatubox(L,1);               /* stack: obj key mt table */
+						return 1;
+					}
+				}
+			}
+			lua_settop(L,3);
+		}
+		lua_pushnil(L);
+		return 1;
+	}
+	else if (t== LUA_TTABLE)
+	{
+		module_index_event(L);
+		return 1;
+	}
+	lua_pushnil(L);
+	return 1;
+}
+
+/* Newindex function
+	* It first searches for a C/C++ varaible to be set.
+	* Then, it either stores it in the alternative ubox table (in the case it is
+	* an object) or in the own table (that represents the class or module).
+*/
+static int class_newindex_event (lua_State* L)
+{
+ int t = lua_type(L,1);
+	if (t == LUA_TUSERDATA)
+	{
+	 /* Try accessing a C/C++ variable to be set */
+		lua_getmetatable(L,1);
+		while (lua_istable(L,-1))                /* stack: t k v mt */
+		{
+			if (lua_isnumber(L,2))                 /* check if key is a numeric value */
+			{
+				/* try operator[] */
+				lua_pushstring(L,".seti");
+				lua_rawget(L,-2);                      /* stack: obj key mt func */
+				if (lua_isfunction(L,-1))
+				{
+					lua_pushvalue(L,1);
+					lua_pushvalue(L,2);
+					lua_pushvalue(L,3);
+					lua_call(L,3,0);
+					return 0;
+				}
+			}
+			else
+			{
+				lua_pushstring(L,".set");
+				lua_rawget(L,-2);                      /* stack: t k v mt tset */
+				if (lua_istable(L,-1))
+				{
+					lua_pushvalue(L,2);
+					lua_rawget(L,-2);                     /* stack: t k v mt tset func */
+					if (lua_iscfunction(L,-1))
+					{
+						lua_pushvalue(L,1);
+						lua_pushvalue(L,3);
+						lua_call(L,2,0);
+						return 0;
+					}
+					lua_pop(L,1);                          /* stack: t k v mt tset */
+				}
+				lua_pop(L,1);                           /* stack: t k v mt */
+				if (!lua_getmetatable(L,-1))            /* stack: t k v mt mt */
+					lua_pushnil(L);
+				lua_remove(L,-2);                       /* stack: t k v mt */
+			}
+		}
+	 lua_settop(L,3);                          /* stack: t k v */
+
+		/* then, store as a new field */
+		storeatubox(L,1);
+	}
+	else if (t== LUA_TTABLE)
+	{
+		module_newindex_event(L);
+	}
+	return 0;
+}
+
+static int class_call_event(lua_State* L) {
+
+	if (lua_istable(L, 1)) {
+		lua_pushstring(L, ".call");
+		lua_rawget(L, 1);
+		if (lua_isfunction(L, -1)) {
+
+			lua_insert(L, 1);
+			lua_call(L, lua_gettop(L)-1, 1);
+
+			return 1;
+		};
+	};
+	tolua_error(L,"Attempt to call a non-callable object.",NULL);
+	return 0;
+};
+
+static int do_operator (lua_State* L, const char* op)
+{
+	if (lua_isuserdata(L,1))
+	{
+		/* Try metatables */
+		lua_pushvalue(L,1);                     /* stack: op1 op2 */
+		while (lua_getmetatable(L,-1))
+		{                                       /* stack: op1 op2 op1 mt */
+			lua_remove(L,-2);                      /* stack: op1 op2 mt */
+			lua_pushstring(L,op);                  /* stack: op1 op2 mt key */
+			lua_rawget(L,-2);                      /* stack: obj key mt func */
+			if (lua_isfunction(L,-1))
+			{
+				lua_pushvalue(L,1);
+				lua_pushvalue(L,2);
+				lua_call(L,2,1);
+				return 1;
+			}
+			lua_settop(L,3);
+		}
+	}
+	tolua_error(L,"Attempt to perform operation on an invalid operand",NULL);
+	return 0;
+}
+
+static int class_add_event (lua_State* L)
+{
+	return do_operator(L,".add");
+}
+
+static int class_sub_event (lua_State* L)
+{
+	return do_operator(L,".sub");
+}
+
+static int class_mul_event (lua_State* L)
+{
+	return do_operator(L,".mul");
+}
+
+static int class_div_event (lua_State* L)
+{
+	return do_operator(L,".div");
+}
+
+static int class_lt_event (lua_State* L)
+{
+	return do_operator(L,".lt");
+}
+
+static int class_le_event (lua_State* L)
+{
+	return do_operator(L,".le");
+}
+
+static int class_eq_event (lua_State* L)
+{
+	return do_operator(L,".eq");
+}
+
+/*
+static int class_gc_event (lua_State* L)
+{
+	void* u = *((void**)lua_touserdata(L,1));
+	fprintf(stderr, "collecting: looking at %p\n", u);
+	lua_pushstring(L,"tolua_gc");
+	lua_rawget(L,LUA_REGISTRYINDEX);
+	lua_pushlightuserdata(L,u);
+	lua_rawget(L,-2);
+	if (lua_isfunction(L,-1))
+	{
+		lua_pushvalue(L,1);
+		lua_call(L,1,0);
+ 		lua_pushlightuserdata(L,u);
+		lua_pushnil(L);
+		lua_rawset(L,-3);
+	}
+	lua_pop(L,2);
+	return 0;
+}
+*/
+TOLUA_API int class_gc_event (lua_State* L)
+{
+	void* u = *((void**)lua_touserdata(L,1));
+	int top;
+	/*fprintf(stderr, "collecting: looking at %p\n", u);*/
+	/*
+	lua_pushstring(L,"tolua_gc");
+	lua_rawget(L,LUA_REGISTRYINDEX);
+	*/
+	lua_pushvalue(L, lua_upvalueindex(1));
+	lua_pushlightuserdata(L,u);
+	lua_rawget(L,-2);            /* stack: gc umt    */
+	lua_getmetatable(L,1);       /* stack: gc umt mt */
+	/*fprintf(stderr, "checking type\n");*/
+	top = lua_gettop(L);
+	if (tolua_fast_isa(L,top,top-1, lua_upvalueindex(2))) /* make sure we collect correct type */
+	{
+		/*fprintf(stderr, "Found type!\n");*/
+		/* get gc function */
+		lua_pushliteral(L,".collector");
+		lua_rawget(L,-2);           /* stack: gc umt mt collector */
+		if (lua_isfunction(L,-1)) {
+			/*fprintf(stderr, "Found .collector!\n");*/
+		}
+		else {
+			lua_pop(L,1);
+			/*fprintf(stderr, "Using default cleanup\n");*/
+			lua_pushcfunction(L,tolua_default_collect);
+		}
+
+		lua_pushvalue(L,1);         /* stack: gc umt mt collector u */
+		lua_call(L,1,0);
+
+		lua_pushlightuserdata(L,u); /* stack: gc umt mt u */
+		lua_pushnil(L);             /* stack: gc umt mt u nil */
+		lua_rawset(L,-5);           /* stack: gc umt mt */
+	}
+	lua_pop(L,3);
+	return 0;
+}
+
+
+/* Register module events
+	* It expects the metatable on the top of the stack
+*/
+TOLUA_API void tolua_moduleevents (lua_State* L)
+{
+	lua_pushstring(L,"__index");
+	lua_pushcfunction(L,module_index_event);
+	lua_rawset(L,-3);
+	lua_pushstring(L,"__newindex");
+	lua_pushcfunction(L,module_newindex_event);
+	lua_rawset(L,-3);
+}
+
+/* Check if the object on the top has a module metatable
+*/
+TOLUA_API int tolua_ismodulemetatable (lua_State* L)
+{
+	int r = 0;
+	if (lua_getmetatable(L,-1))
+	{
+		lua_pushstring(L,"__index");
+		lua_rawget(L,-2);
+		r = (lua_tocfunction(L,-1) == module_index_event);
+		lua_pop(L,2);
+	}
+	return r;
+}
+
+/* Register class events
+	* It expects the metatable on the top of the stack
+*/
+TOLUA_API void tolua_classevents (lua_State* L)
+{
+	lua_pushstring(L,"__index");
+	lua_pushcfunction(L,class_index_event);
+	lua_rawset(L,-3);
+	lua_pushstring(L,"__newindex");
+	lua_pushcfunction(L,class_newindex_event);
+	lua_rawset(L,-3);
+
+	lua_pushstring(L,"__add");
+	lua_pushcfunction(L,class_add_event);
+	lua_rawset(L,-3);
+	lua_pushstring(L,"__sub");
+	lua_pushcfunction(L,class_sub_event);
+	lua_rawset(L,-3);
+	lua_pushstring(L,"__mul");
+	lua_pushcfunction(L,class_mul_event);
+	lua_rawset(L,-3);
+	lua_pushstring(L,"__div");
+	lua_pushcfunction(L,class_div_event);
+	lua_rawset(L,-3);
+
+	lua_pushstring(L,"__lt");
+	lua_pushcfunction(L,class_lt_event);
+	lua_rawset(L,-3);
+	lua_pushstring(L,"__le");
+	lua_pushcfunction(L,class_le_event);
+	lua_rawset(L,-3);
+	lua_pushstring(L,"__eq");
+	lua_pushcfunction(L,class_eq_event);
+	lua_rawset(L,-3);
+
+	lua_pushstring(L,"__call");
+	lua_pushcfunction(L,class_call_event);
+	lua_rawset(L,-3);
+
+	lua_pushstring(L,"__gc");
+	lua_pushstring(L, "tolua_gc_event");
+	lua_rawget(L, LUA_REGISTRYINDEX);
+	/*lua_pushcfunction(L,class_gc_event);*/
+	lua_rawset(L,-3);
+}
+
Index: /sandbox_light/src/external/tolua/tolua_event.h
===================================================================
--- /sandbox_light/src/external/tolua/tolua_event.h	(revision 5788)
+++ /sandbox_light/src/external/tolua/tolua_event.h	(revision 5788)
@@ -0,0 +1,24 @@
+/* tolua: event functions
+** Support code for Lua bindings.
+** Written by Waldemar Celes
+** TeCGraf/PUC-Rio
+** Apr 2003
+** $Id: $
+*/
+
+/* This code is free software; you can redistribute it and/or modify it.
+** The software provided hereunder is on an "as is" basis, and
+** the author has no obligation to provide maintenance, support, updates,
+** enhancements, or modifications.
+*/
+
+#ifndef TOLUA_EVENT_H
+#define TOLUA_EVENT_H
+
+#include "tolua++.h"
+
+TOLUA_API void tolua_moduleevents (lua_State* L);
+TOLUA_API int tolua_ismodulemetatable (lua_State* L);
+TOLUA_API void tolua_classevents (lua_State* L);
+
+#endif
Index: /sandbox_light/src/external/tolua/tolua_is.c
===================================================================
--- /sandbox_light/src/external/tolua/tolua_is.c	(revision 5788)
+++ /sandbox_light/src/external/tolua/tolua_is.c	(revision 5788)
@@ -0,0 +1,607 @@
+/* tolua: functions to check types.
+** Support code for Lua bindings.
+** Written by Waldemar Celes
+** TeCGraf/PUC-Rio
+** Apr 2003
+** $Id: $
+*/
+
+/* This code is free software; you can redistribute it and/or modify it.
+** The software provided hereunder is on an "as is" basis, and
+** the author has no obligation to provide maintenance, support, updates,
+** enhancements, or modifications.
+*/
+
+#include "tolua++.h"
+#include "lauxlib.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+/* a fast check if a is b, without parameter validation
+ i.e. if b is equal to a or a superclass of a. */
+TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index)
+{
+ int result;
+	if (lua_rawequal(L,mt_indexa,mt_indexb))
+		result = 1;
+	else
+	{
+		if (super_index) {
+			lua_pushvalue(L, super_index);
+		} else {
+			lua_pushliteral(L,"tolua_super");
+			lua_rawget(L,LUA_REGISTRYINDEX);  /* stack: super */
+		};
+		lua_pushvalue(L,mt_indexa);       /* stack: super mta */
+		lua_rawget(L,-2);                 /* stack: super super[mta] */
+		lua_pushvalue(L,mt_indexb);       /* stack: super super[mta] mtb */
+		lua_rawget(L,LUA_REGISTRYINDEX);  /* stack: super super[mta] typenameB */
+		lua_rawget(L,-2);                 /* stack: super super[mta] bool */
+		result = lua_toboolean(L,-1);
+		lua_pop(L,3);
+	}
+	return result;
+}
+
+/* Push and returns the corresponding object typename */
+TOLUA_API const char* tolua_typename (lua_State* L, int lo)
+{
+	int tag = lua_type(L,lo);
+ if (tag == LUA_TNONE)
+  lua_pushstring(L,"[no object]");
+ else if (tag != LUA_TUSERDATA && tag != LUA_TTABLE)
+  lua_pushstring(L,lua_typename(L,tag));
+ else if (tag == LUA_TUSERDATA)
+ {
+  if (!lua_getmetatable(L,lo))
+   lua_pushstring(L,lua_typename(L,tag));
+		else
+		{
+		 lua_rawget(L,LUA_REGISTRYINDEX);
+		 if (!lua_isstring(L,-1))
+			{
+		  lua_pop(L,1);
+				lua_pushstring(L,"[undefined]");
+			}
+		}
+	}
+	else  /* is table */
+	{
+		lua_pushvalue(L,lo);
+		lua_rawget(L,LUA_REGISTRYINDEX);
+		if (!lua_isstring(L,-1))
+		{
+			lua_pop(L,1);
+			lua_pushstring(L,"table");
+		}
+		else
+		{
+   lua_pushstring(L,"class ");
+			lua_insert(L,-2);
+			lua_concat(L,2);
+		}
+	}
+	return lua_tostring(L,-1);
+}
+
+TOLUA_API void tolua_error (lua_State* L, char* msg, tolua_Error* err)
+{
+	if (msg[0] == '#')
+	{
+  const char* expected = err->type;
+		const char* provided = tolua_typename(L,err->index);
+  if (msg[1]=='f')
+  {
+   int narg = err->index;
+			if (err->array)
+    luaL_error(L,"%s\n     argument #%d is array of '%s'; array of '%s' expected.\n",
+               msg+2,narg,provided,expected);
+			else
+    luaL_error(L,"%s\n     argument #%d is '%s'; '%s' expected.\n",
+               msg+2,narg,provided,expected);
+  }
+  else if (msg[1]=='v')
+		{
+			if (err->array)
+    luaL_error(L,"%s\n     value is array of '%s'; array of '%s' expected.\n",
+               msg+2,provided,expected);
+			else
+    luaL_error(L,"%s\n     value is '%s'; '%s' expected.\n",
+               msg+2,provided,expected);
+		}
+ }
+ else
+  luaL_error(L,msg);
+}
+
+/* the equivalent of lua_is* for usertable */
+static  int lua_isusertable (lua_State* L, int lo, const char* type)
+{
+	int r = 0;
+	if (lo < 0) lo = lua_gettop(L)+lo+1;
+	lua_pushvalue(L,lo);
+	lua_rawget(L,LUA_REGISTRYINDEX);  /* get registry[t] */
+	if (lua_isstring(L,-1))
+	{
+		r = strcmp(lua_tostring(L,-1),type)==0;
+		if (!r)
+		{
+			/* try const */
+			lua_pushstring(L,"const ");
+			lua_insert(L,-2);
+			lua_concat(L,2);
+			r = lua_isstring(L,-1) && strcmp(lua_tostring(L,-1),type)==0;
+		}
+	}
+	lua_pop(L, 1);
+	return r;
+}
+
+int push_table_instance(lua_State* L, int lo) {
+
+	if (lua_istable(L, lo)) {
+
+		lua_pushstring(L, ".c_instance");
+		lua_gettable(L, lo);
+		if (lua_isuserdata(L, -1)) {
+
+			lua_replace(L, lo);
+			return 1;
+		} else {
+
+			lua_pop(L, 1);
+			return 0;
+		};
+	} else {
+		return 0;
+	};
+
+	return 0;
+};
+
+/* the equivalent of lua_is* for usertype */
+static int lua_isusertype (lua_State* L, int lo, const char* type)
+{
+	if (!lua_isuserdata(L,lo)) {
+		if (!push_table_instance(L, lo)) {
+			return 0;
+		};
+	};
+	{
+		/* check if it is of the same type */
+		int r;
+		const char *tn;
+		if (lua_getmetatable(L,lo))        /* if metatable? */
+		{
+		 lua_rawget(L,LUA_REGISTRYINDEX);  /* get registry[mt] */
+		 tn = lua_tostring(L,-1);
+		 r = tn && (strcmp(tn,type) == 0);
+		 lua_pop(L, 1);
+			if (r)
+			 return 1;
+			else
+			{
+				/* check if it is a specialized class */
+				lua_pushstring(L,"tolua_super");
+				lua_rawget(L,LUA_REGISTRYINDEX); /* get super */
+				lua_getmetatable(L,lo);
+				lua_rawget(L,-2);                /* get super[mt] */
+				if (lua_istable(L,-1))
+				{
+					int b;
+					lua_pushstring(L,type);
+					lua_rawget(L,-2);                /* get super[mt][type] */
+					b = lua_toboolean(L,-1);
+					lua_pop(L,3);
+					if (b)
+					 return 1;
+				}
+			}
+		}
+ }
+	return 0;
+}
+
+TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err)
+{
+ if (lua_gettop(L)<abs(lo))
+		return 1;
+	err->index = lo;
+	err->array = 0;
+	err->type = "[no object]";
+ return 0;
+}
+TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err)
+{
+	if (def || abs(lo)<=lua_gettop(L))  /* any valid index */
+		return 1;
+	err->index = lo;
+	err->array = 0;
+	err->type = "value";
+	return 0;
+}
+
+TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err)
+{
+	if (def && lua_gettop(L)<abs(lo))
+		return 1;
+	if (lua_isnil(L,lo) || lua_isboolean(L,lo))
+		return 1;
+	err->index = lo;
+	err->array = 0;
+	err->type = "boolean";
+	return 0;
+}
+
+TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err)
+{
+	if (def && lua_gettop(L)<abs(lo))
+		return 1;
+	if (lua_isnumber(L,lo))
+		return 1;
+	err->index = lo;
+	err->array = 0;
+	err->type = "number";
+	return 0;
+}
+
+TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err)
+{
+	if (def && lua_gettop(L)<abs(lo))
+		return 1;
+ if (lua_isnil(L,lo) || lua_isstring(L,lo))
+		return 1;
+	err->index = lo;
+	err->array = 0;
+	err->type = "string";
+	return 0;
+}
+
+TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err)
+{
+	if (def && lua_gettop(L)<abs(lo))
+		return 1;
+	if (lua_istable(L,lo))
+		return 1;
+	err->index = lo;
+	err->array = 0;
+	err->type = "table";
+	return 0;
+}
+
+TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err)
+{
+	if (def && lua_gettop(L)<abs(lo))
+		return 1;
+	if (lua_isusertable(L,lo,type))
+		return 1;
+	err->index = lo;
+	err->array = 0;
+	err->type = type;
+	return 0;
+}
+
+
+TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err)
+{
+	if (def && lua_gettop(L)<abs(lo))
+		return 1;
+	if (lua_isnil(L,lo) || lua_isuserdata(L,lo))
+		return 1;
+	err->index = lo;
+	err->array = 0;
+	err->type = "userdata";
+	return 0;
+}
+
+TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err)
+{
+	if (def && lua_gettop(L)<abs(lo))
+		return 1;
+	if (lua_isnil(L,lo) || lua_isusertype(L,lo,type))
+		return 1;
+	err->index = lo;
+	err->array = 0;
+	err->type = type;
+	return 0;
+}
+
+TOLUA_API int tolua_isvaluearray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err)
+{
+	if (!tolua_istable(L,lo,def,err))
+		return 0;
+	else
+		return 1;
+}
+
+TOLUA_API int tolua_isbooleanarray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err)
+{
+	if (!tolua_istable(L,lo,def,err))
+		return 0;
+	else
+	{
+		int i;
+		for (i=1; i<=dim; ++i)
+		{
+			lua_pushnumber(L,i);
+			lua_gettable(L,lo);
+	  if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) &&
+					  !(def && lua_isnil(L,-1))
+						)
+			{
+				err->index = lo;
+				err->array = 1;
+				err->type = "boolean";
+				return 0;
+			}
+			lua_pop(L,1);
+		}
+ }
+ return 1;
+}
+
+TOLUA_API int tolua_isnumberarray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err)
+{
+	if (!tolua_istable(L,lo,def,err))
+		return 0;
+	else
+	{
+		int i;
+		for (i=1; i<=dim; ++i)
+		{
+			lua_pushnumber(L,i);
+			lua_gettable(L,lo);
+			if (!lua_isnumber(L,-1) &&
+					  !(def && lua_isnil(L,-1))
+						)
+			{
+				err->index = lo;
+				err->array = 1;
+				err->type = "number";
+				return 0;
+			}
+			lua_pop(L,1);
+		}
+ }
+ return 1;
+}
+
+TOLUA_API int tolua_isstringarray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err)
+{
+	if (!tolua_istable(L,lo,def,err))
+		return 0;
+	else
+	{
+		int i;
+		for (i=1; i<=dim; ++i)
+		{
+			lua_pushnumber(L,i);
+			lua_gettable(L,lo);
+   if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) &&
+			    !(def && lua_isnil(L,-1))
+						)
+			{
+				err->index = lo;
+				err->array = 1;
+				err->type = "string";
+				return 0;
+			}
+			lua_pop(L,1);
+		}
+ }
+ return 1;
+}
+
+TOLUA_API int tolua_istablearray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err)
+{
+	if (!tolua_istable(L,lo,def,err))
+		return 0;
+	else
+	{
+		int i;
+		for (i=1; i<=dim; ++i)
+		{
+			lua_pushnumber(L,i);
+			lua_gettable(L,lo);
+	  if (! lua_istable(L,-1) &&
+			    !(def && lua_isnil(L,-1))
+						)
+			{
+				err->index = lo;
+				err->array = 1;
+				err->type = "table";
+				return 0;
+			}
+			lua_pop(L,1);
+		}
+ }
+ return 1;
+}
+
+TOLUA_API int tolua_isuserdataarray
+ (lua_State* L, int lo, int dim, int def, tolua_Error* err)
+{
+	if (!tolua_istable(L,lo,def,err))
+		return 0;
+	else
+	{
+		int i;
+		for (i=1; i<=dim; ++i)
+		{
+			lua_pushnumber(L,i);
+			lua_gettable(L,lo);
+	  if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) &&
+			    !(def && lua_isnil(L,-1))
+						)
+			{
+				err->index = lo;
+				err->array = 1;
+				err->type = "userdata";
+				return 0;
+			}
+			lua_pop(L,1);
+		}
+ }
+ return 1;
+}
+
+TOLUA_API int tolua_isusertypearray
+ (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err)
+{
+	if (!tolua_istable(L,lo,def,err))
+		return 0;
+	else
+	{
+		int i;
+		for (i=1; i<=dim; ++i)
+		{
+			lua_pushnumber(L,i);
+			lua_gettable(L,lo);
+	  if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) &&
+			    !(def && lua_isnil(L,-1))
+						)
+			{
+				err->index = lo;
+				err->type = type;
+				err->array = 1;
+				return 0;
+			}
+			lua_pop(L,1);
+		}
+ }
+ return 1;
+}
+
+#if 0
+int tolua_isbooleanfield
+ (lua_State* L, int lo, int i, int def, tolua_Error* err)
+{
+	lua_pushnumber(L,i);
+	lua_gettable(L,lo);
+	if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) &&
+			  !(def && lua_isnil(L,-1))
+				)
+	{
+		err->index = lo;
+		err->array = 1;
+		err->type = "boolean";
+		return 0;
+	}
+	lua_pop(L,1);
+ return 1;
+}
+
+int tolua_isnumberfield
+ (lua_State* L, int lo, int i, int def, tolua_Error* err)
+{
+	lua_pushnumber(L,i);
+	lua_gettable(L,lo);
+	if (!lua_isnumber(L,-1) &&
+			  !(def && lua_isnil(L,-1))
+				)
+	{
+		err->index = lo;
+		err->array = 1;
+		err->type = "number";
+		return 0;
+	}
+	lua_pop(L,1);
+ return 1;
+}
+
+int tolua_isstringfield
+ (lua_State* L, int lo, int i, int def, tolua_Error* err)
+{
+	lua_pushnumber(L,i);
+	lua_gettable(L,lo);
+ if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) &&
+	    !(def && lua_isnil(L,-1))
+				)
+	{
+		err->index = lo;
+		err->array = 1;
+		err->type = "string";
+		return 0;
+	}
+	lua_pop(L,1);
+ return 1;
+}
+
+int tolua_istablefield
+ (lua_State* L, int lo, int i, int def, tolua_Error* err)
+{
+	lua_pushnumber(L,i+1);
+	lua_gettable(L,lo);
+	if (! lua_istable(L,-1) &&
+	    !(def && lua_isnil(L,-1))
+				)
+	{
+		err->index = lo;
+		err->array = 1;
+		err->type = "table";
+		return 0;
+	}
+	lua_pop(L,1);
+}
+
+int tolua_isusertablefield
+ (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err)
+{
+	lua_pushnumber(L,i);
+	lua_gettable(L,lo);
+	if (! lua_isusertable(L,-1,type) &&
+	    !(def && lua_isnil(L,-1))
+				)
+	{
+		err->index = lo;
+		err->array = 1;
+		err->type = type;
+		return 0;
+	}
+	lua_pop(L,1);
+ return 1;
+}
+
+int tolua_isuserdatafield
+ (lua_State* L, int lo, int i, int def, tolua_Error* err)
+{
+	lua_pushnumber(L,i);
+	lua_gettable(L,lo);
+	if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) &&
+	    !(def && lua_isnil(L,-1))
+				)
+	{
+		err->index = lo;
+		err->array = 1;
+		err->type = "userdata";
+		return 0;
+	}
+	lua_pop(L,1);
+ return 1;
+}
+
+int tolua_isusertypefield
+ (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err)
+{
+	lua_pushnumber(L,i);
+	lua_gettable(L,lo);
+	if (!(lua_isnil(L,-1) || lua_isusertype(L,-1,type)) &&
+	    !(def && lua_isnil(L,-1))
+				)
+	{
+		err->index = lo;
+		err->type = type;
+		err->array = 1;
+		return 0;
+	}
+	lua_pop(L,1);
+ return 1;
+}
+
+#endif
Index: /sandbox_light/src/external/tolua/tolua_map.c
===================================================================
--- /sandbox_light/src/external/tolua/tolua_map.c	(revision 5788)
+++ /sandbox_light/src/external/tolua/tolua_map.c	(revision 5788)
@@ -0,0 +1,704 @@
+/* tolua: functions to map features
+** Support code for Lua bindings.
+** Written by Waldemar Celes
+** TeCGraf/PUC-Rio
+** Apr 2003
+** $Id: $
+*/
+
+/* This code is free software; you can redistribute it and/or modify it.
+** The software provided hereunder is on an "as is" basis, and
+** the author has no obligation to provide maintenance, support, updates,
+** enhancements, or modifications.
+*/
+
+#include "tolua++.h"
+#include "tolua_event.h"
+#include "lauxlib.h"
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+/* Create metatable
+	* Create and register new metatable
+*/
+static int tolua_newmetatable (lua_State* L, char* name)
+{
+	int r = luaL_newmetatable(L,name);
+
+	#ifdef LUA_VERSION_NUM /* only lua 5.1 */
+	if (r) {
+		lua_pushvalue(L, -1);
+		lua_pushstring(L, name);
+		lua_settable(L, LUA_REGISTRYINDEX); /* reg[mt] = type_name */
+	};
+	#endif
+
+	if (r)
+		tolua_classevents(L); /* set meta events */
+	lua_pop(L,1);
+	return r;
+}
+
+/* Map super classes
+	* It sets 'name' as being also a 'base', mapping all super classes of 'base' in 'name'
+*/
+static void mapsuper (lua_State* L, const char* name, const char* base)
+{
+	/* push registry.super */
+ lua_pushstring(L,"tolua_super");
+ lua_rawget(L,LUA_REGISTRYINDEX);    /* stack: super */
+	luaL_getmetatable(L,name);          /* stack: super mt */
+ lua_rawget(L,-2);                   /* stack: super table */
+	if (lua_isnil(L,-1))
+	{
+	 /* create table */
+		lua_pop(L,1);
+	 lua_newtable(L);                    /* stack: super table */
+	 luaL_getmetatable(L,name);          /* stack: super table mt */
+		lua_pushvalue(L,-2);                /* stack: super table mt table */
+		lua_rawset(L,-4);                   /* stack: super table */
+	}
+
+	/* set base as super class */
+	lua_pushstring(L,base);
+	lua_pushboolean(L,1);
+	lua_rawset(L,-3);                    /* stack: super table */
+
+	/* set all super class of base as super class of name */
+	luaL_getmetatable(L,base);          /* stack: super table base_mt */
+	lua_rawget(L,-3);                   /* stack: super table base_table */
+	if (lua_istable(L,-1))
+	{
+		/* traverse base table */
+		lua_pushnil(L);  /* first key */
+		while (lua_next(L,-2) != 0)
+		{
+			/* stack: ... base_table key value */
+			lua_pushvalue(L,-2);    /* stack: ... base_table key value key */
+			lua_insert(L,-2);       /* stack: ... base_table key key value */
+			lua_rawset(L,-5);       /* stack: ... base_table key */
+		}
+	}
+	lua_pop(L,3);                       /* stack: <empty> */
+}
+
+/* creates a 'tolua_ubox' table for base clases, and
+// expects the metatable and base metatable on the stack */
+static void set_ubox(lua_State* L) {
+
+	/* mt basemt */
+	if (!lua_isnil(L, -1)) {
+		lua_pushstring(L, "tolua_ubox");
+		lua_rawget(L,-2);
+	} else {
+		lua_pushnil(L);
+	};
+	/* mt basemt base_ubox */
+	if (!lua_isnil(L,-1)) {
+		lua_pushstring(L, "tolua_ubox");
+		lua_insert(L, -2);
+		/* mt basemt key ubox */
+		lua_rawset(L,-4);
+		/* (mt with ubox) basemt */
+	} else {
+		/* mt basemt nil */
+		lua_pop(L, 1);
+		lua_pushstring(L,"tolua_ubox"); lua_newtable(L);
+		/* make weak value metatable for ubox table to allow userdata to be
+		garbage-collected */
+		lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3);               /* stack: string ubox mt */
+		lua_setmetatable(L, -2);  /* stack:mt basemt string ubox */
+		lua_rawset(L,-4);
+	};
+
+};
+
+/* Map inheritance
+	* It sets 'name' as derived from 'base' by setting 'base' as metatable of 'name'
+*/
+static void mapinheritance (lua_State* L, const char* name, const char* base)
+{
+	/* set metatable inheritance */
+	luaL_getmetatable(L,name);
+
+	if (base && *base)
+		luaL_getmetatable(L,base);
+	else {
+
+		if (lua_getmetatable(L, -1)) { /* already has a mt, we don't overwrite it */
+			lua_pop(L, 2);
+			return;
+		};
+		luaL_getmetatable(L,"tolua_commonclass");
+	};
+
+	set_ubox(L);
+
+	lua_setmetatable(L,-2);
+	lua_pop(L,1);
+}
+
+/* Object type
+*/
+static int tolua_bnd_type (lua_State* L)
+{
+	tolua_typename(L,lua_gettop(L));
+	return 1;
+}
+
+/* Take ownership
+*/
+static int tolua_bnd_takeownership (lua_State* L)
+{
+	int success = 0;
+	if (lua_isuserdata(L,1))
+	{
+		if (lua_getmetatable(L,1))        /* if metatable? */
+		{
+			lua_pop(L,1);             /* clear metatable off stack */
+			/* force garbage collection to avoid C to reuse a to-be-collected address */
+			#ifdef LUA_VERSION_NUM
+			lua_gc(L, LUA_GCCOLLECT, 0);
+			#else
+			lua_setgcthreshold(L,0);
+			#endif
+
+			success = tolua_register_gc(L,1);
+		}
+	}
+	lua_pushboolean(L,success!=0);
+	return 1;
+}
+
+/* Release ownership
+*/
+static int tolua_bnd_releaseownership (lua_State* L)
+{
+	int done = 0;
+	if (lua_isuserdata(L,1))
+	{
+		void* u = *((void**)lua_touserdata(L,1));
+		/* force garbage collection to avoid releasing a to-be-collected address */
+		#ifdef LUA_VERSION_NUM
+		lua_gc(L, LUA_GCCOLLECT, 0);
+		#else
+		lua_setgcthreshold(L,0);
+		#endif
+		lua_pushstring(L,"tolua_gc");
+		lua_rawget(L,LUA_REGISTRYINDEX);
+		lua_pushlightuserdata(L,u);
+		lua_rawget(L,-2);
+		lua_getmetatable(L,1);
+		if (lua_rawequal(L,-1,-2))  /* check that we are releasing the correct type */
+		{
+			lua_pushlightuserdata(L,u);
+			lua_pushnil(L);
+			lua_rawset(L,-5);
+			done = 1;
+		}
+	}
+	lua_pushboolean(L,done!=0);
+	return 1;
+}
+
+/* Type casting
+*/
+static int tolua_bnd_cast (lua_State* L)
+{
+
+/* // old code
+        void* v = tolua_tousertype(L,1,NULL);
+        const char* s = tolua_tostring(L,2,NULL);
+        if (v && s)
+         tolua_pushusertype(L,v,s);
+        else
+         lua_pushnil(L);
+        return 1;
+*/
+
+	void* v;
+	const char* s;
+	if (lua_islightuserdata(L, 1)) {
+		v = tolua_touserdata(L, 1, NULL);
+	} else {
+		v = tolua_tousertype(L, 1, 0);
+	};
+
+	s = tolua_tostring(L,2,NULL);
+	if (v && s)
+	 tolua_pushusertype(L,v,s);
+	else
+	 lua_pushnil(L);
+	return 1;
+}
+
+/* Inheritance
+*/
+static int tolua_bnd_inherit (lua_State* L) {
+
+	/* stack: lua object, c object */
+	lua_pushstring(L, ".c_instance");
+	lua_pushvalue(L, -2);
+	lua_rawset(L, -4);
+	/* l_obj[".c_instance"] = c_obj */
+
+	return 0;
+};
+
+#ifdef LUA_VERSION_NUM /* lua 5.1 */
+static int tolua_bnd_setpeer(lua_State* L) {
+
+	/* stack: userdata, table */
+	if (!lua_isuserdata(L, -2)) {
+		lua_pushstring(L, "Invalid argument #1 to setpeer: userdata expected.");
+		lua_error(L);
+	};
+	
+	if (lua_isnil(L, -1)) {
+
+		lua_pop(L, 1);
+		lua_pushvalue(L, TOLUA_NOPEER);
+	};
+	lua_setfenv(L, -2);
+
+	return 0;
+};
+
+static int tolua_bnd_getpeer(lua_State* L) {
+
+	/* stack: userdata */
+	lua_getfenv(L, -1);
+	if (lua_rawequal(L, -1, TOLUA_NOPEER)) {
+		lua_pop(L, 1);
+		lua_pushnil(L);
+	};
+	return 1;
+};
+#endif
+
+/* static int class_gc_event (lua_State* L); */
+
+TOLUA_API void tolua_open (lua_State* L)
+{
+ int top = lua_gettop(L);
+ lua_pushstring(L,"tolua_opened");
+ lua_rawget(L,LUA_REGISTRYINDEX);
+ if (!lua_isboolean(L,-1))
+ {
+  lua_pushstring(L,"tolua_opened"); lua_pushboolean(L,1); lua_rawset(L,LUA_REGISTRYINDEX);
+
+  #ifndef LUA_VERSION_NUM /* only prior to lua 5.1 */
+  /* create peer object table */
+  lua_pushstring(L, "tolua_peers"); lua_newtable(L);
+  /* make weak key metatable for peers indexed by userdata object */
+  lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "k"); lua_rawset(L, -3);                /* stack: string peers mt */
+  lua_setmetatable(L, -2);   /* stack: string peers */
+  lua_rawset(L,LUA_REGISTRYINDEX);
+  #endif
+
+  /* create object ptr -> udata mapping table */
+  lua_pushstring(L,"tolua_ubox"); lua_newtable(L);
+  /* make weak value metatable for ubox table to allow userdata to be
+     garbage-collected */
+  lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3);               /* stack: string ubox mt */
+  lua_setmetatable(L, -2);  /* stack: string ubox */
+  lua_rawset(L,LUA_REGISTRYINDEX);
+
+  lua_pushstring(L,"tolua_super"); lua_newtable(L); lua_rawset(L,LUA_REGISTRYINDEX);
+  lua_pushstring(L,"tolua_gc"); lua_newtable(L);lua_rawset(L,LUA_REGISTRYINDEX);
+
+  /* create gc_event closure */
+  lua_pushstring(L, "tolua_gc_event");
+  lua_pushstring(L, "tolua_gc");
+  lua_rawget(L, LUA_REGISTRYINDEX);
+  lua_pushstring(L, "tolua_super");
+  lua_rawget(L, LUA_REGISTRYINDEX);
+  lua_pushcclosure(L, class_gc_event, 2);
+  lua_rawset(L, LUA_REGISTRYINDEX);
+
+  tolua_newmetatable(L,"tolua_commonclass");
+
+  tolua_module(L,NULL,0);
+  tolua_beginmodule(L,NULL);
+  tolua_module(L,"tolua",0);
+  tolua_beginmodule(L,"tolua");
+  tolua_function(L,"type",tolua_bnd_type);
+  tolua_function(L,"takeownership",tolua_bnd_takeownership);
+  tolua_function(L,"releaseownership",tolua_bnd_releaseownership);
+  tolua_function(L,"cast",tolua_bnd_cast);
+  tolua_function(L,"inherit", tolua_bnd_inherit);
+  #ifdef LUA_VERSION_NUM /* lua 5.1 */
+  tolua_function(L, "setpeer", tolua_bnd_setpeer);
+  tolua_function(L, "getpeer", tolua_bnd_getpeer);
+  #endif
+
+  tolua_endmodule(L);
+  tolua_endmodule(L);
+ }
+ lua_settop(L,top);
+}
+
+/* Copy a C object
+*/
+TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size)
+{
+	void* clone = (void*)malloc(size);
+	if (clone)
+	 memcpy(clone,value,size);
+	else
+		tolua_error(L,"insuficient memory",NULL);
+	return clone;
+}
+
+/* Default collect function
+*/
+TOLUA_API int tolua_default_collect (lua_State* tolua_S)
+{
+ void* self = tolua_tousertype(tolua_S,1,0);
+ free(self);
+ return 0;
+}
+
+/* Do clone
+*/
+TOLUA_API int tolua_register_gc (lua_State* L, int lo)
+{
+ int success = 1;
+ void *value = *(void **)lua_touserdata(L,lo);
+ lua_pushstring(L,"tolua_gc");
+ lua_rawget(L,LUA_REGISTRYINDEX);
+	lua_pushlightuserdata(L,value);
+	lua_rawget(L,-2);
+	if (!lua_isnil(L,-1)) /* make sure that object is not already owned */
+		success = 0;
+	else
+	{
+		lua_pushlightuserdata(L,value);
+		lua_getmetatable(L,lo);
+		lua_rawset(L,-4);
+	}
+	lua_pop(L,2);
+	return success;
+}
+
+/* Register a usertype
+	* It creates the correspoding metatable in the registry, for both 'type' and 'const type'.
+	* It maps 'const type' as being also a 'type'
+*/
+TOLUA_API void tolua_usertype (lua_State* L, char* type)
+{
+ char ctype[128] = "const ";
+ strncat(ctype,type,120);
+
+	/* create both metatables */
+ if (tolua_newmetatable(L,ctype) && tolua_newmetatable(L,type))
+	 mapsuper(L,type,ctype);             /* 'type' is also a 'const type' */
+}
+
+
+/* Begin module
+	* It pushes the module (or class) table on the stack
+*/
+TOLUA_API void tolua_beginmodule (lua_State* L, char* name)
+{
+	if (name)
+	{
+	 lua_pushstring(L,name);
+		lua_rawget(L,-2);
+	}
+	else
+	 lua_pushvalue(L,LUA_GLOBALSINDEX);
+}
+
+/* End module
+	* It pops the module (or class) from the stack
+*/
+TOLUA_API void tolua_endmodule (lua_State* L)
+{
+	lua_pop(L,1);
+}
+
+/* Map module
+	* It creates a new module
+*/
+#if 1
+TOLUA_API void tolua_module (lua_State* L, char* name, int hasvar)
+{
+	if (name)
+	{
+		/* tolua module */
+		lua_pushstring(L,name);
+		lua_rawget(L,-2);
+		if (!lua_istable(L,-1))  /* check if module already exists */
+		{
+			lua_pop(L,1);
+		 lua_newtable(L);
+		 lua_pushstring(L,name);
+			lua_pushvalue(L,-2);
+		 lua_rawset(L,-4);       /* assing module into module */
+		}
+	}
+	else
+	{
+		/* global table */
+		lua_pushvalue(L,LUA_GLOBALSINDEX);
+	}
+	if (hasvar)
+	{
+		if (!tolua_ismodulemetatable(L))  /* check if it already has a module metatable */
+		{
+			/* create metatable to get/set C/C++ variable */
+			lua_newtable(L);
+			tolua_moduleevents(L);
+			if (lua_getmetatable(L,-2))
+				lua_setmetatable(L,-2);  /* set old metatable as metatable of metatable */
+			lua_setmetatable(L,-2);
+		}
+	}
+	lua_pop(L,1);               /* pop module */
+}
+#else
+TOLUA_API void tolua_module (lua_State* L, char* name, int hasvar)
+{
+	if (name)
+	{
+		/* tolua module */
+		lua_pushstring(L,name);
+		lua_newtable(L);
+	}
+	else
+	{
+		/* global table */
+		lua_pushvalue(L,LUA_GLOBALSINDEX);
+	}
+	if (hasvar)
+	{
+		/* create metatable to get/set C/C++ variable */
+		lua_newtable(L);
+		tolua_moduleevents(L);
+		if (lua_getmetatable(L,-2))
+			lua_setmetatable(L,-2);  /* set old metatable as metatable of metatable */
+		lua_setmetatable(L,-2);
+	}
+	if (name)
+		lua_rawset(L,-3);       /* assing module into module */
+	else
+		lua_pop(L,1);           /* pop global table */
+}
+#endif
+
+static void push_collector(lua_State* L, const char* type, lua_CFunction col) {
+
+	/* push collector function, but only if it's not NULL, or if there's no
+	   collector already */
+	if (!col) return;
+	luaL_getmetatable(L,type);
+	lua_pushstring(L,".collector");
+	/*
+	if (!col) {
+		lua_pushvalue(L, -1);
+		lua_rawget(L, -3);
+		if (!lua_isnil(L, -1)) {
+			lua_pop(L, 3);
+			return;
+		};
+		lua_pop(L, 1);
+	};
+	//	*/
+	lua_pushcfunction(L,col);
+
+	lua_rawset(L,-3);
+	lua_pop(L, 1);
+};
+
+/* Map C class
+	* It maps a C class, setting the appropriate inheritance and super classes.
+*/
+TOLUA_API void tolua_cclass (lua_State* L, char* lname, char* name, char* base, lua_CFunction col)
+{
+	char cname[128] = "const ";
+	char cbase[128] = "const ";
+	strncat(cname,name,120);
+	strncat(cbase,base,120);
+
+	mapinheritance(L,name,base);
+	mapinheritance(L,cname,name);
+
+	mapsuper(L,cname,cbase);
+	mapsuper(L,name,base);
+
+	lua_pushstring(L,lname);
+	
+	push_collector(L, name, col);
+	/*
+	luaL_getmetatable(L,name);
+	lua_pushstring(L,".collector");
+	lua_pushcfunction(L,col);
+
+	lua_rawset(L,-3);
+	*/
+	
+	luaL_getmetatable(L,name);
+	lua_rawset(L,-3);              /* assign class metatable to module */
+
+	/* now we also need to store the collector table for the const
+	   instances of the class */
+	push_collector(L, cname, col);
+	/*
+	luaL_getmetatable(L,cname);
+	lua_pushstring(L,".collector");
+	lua_pushcfunction(L,col);
+	lua_rawset(L,-3);
+	lua_pop(L,1);
+	*/
+	
+
+}
+
+/* Add base
+	* It adds additional base classes to a class (for multiple inheritance)
+	* (not for now)
+TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base) {
+
+	char cname[128] = "const ";
+	char cbase[128] = "const ";
+	strncat(cname,name,120);
+	strncat(cbase,base,120);
+
+	mapsuper(L,cname,cbase);
+	mapsuper(L,name,base);
+};
+*/
+
+/* Map function
+	* It assigns a function into the current module (or class)
+*/
+TOLUA_API void tolua_function (lua_State* L, char* name, lua_CFunction func)
+{
+ lua_pushstring(L,name);
+ lua_pushcfunction(L,func);
+	lua_rawset(L,-3);
+}
+
+/* sets the __call event for the class (expects the class' main table on top) */
+/*	never really worked :(
+TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type) {
+
+	lua_getmetatable(L, -1);
+	//luaL_getmetatable(L, type);
+	lua_pushstring(L,"__call");
+	lua_pushcfunction(L,func);
+	lua_rawset(L,-3);
+	lua_pop(L, 1);
+};
+*/
+
+/* Map constant number
+	* It assigns a constant number into the current module (or class)
+*/
+TOLUA_API void tolua_constant (lua_State* L, char* name, double value)
+{
+	lua_pushstring(L,name);
+	tolua_pushnumber(L,value);
+	lua_rawset(L,-3);
+}
+
+
+/* Map variable
+	* It assigns a variable into the current module (or class)
+*/
+TOLUA_API void tolua_variable (lua_State* L, char* name, lua_CFunction get, lua_CFunction set)
+{
+	/* get func */
+	lua_pushstring(L,".get");
+	lua_rawget(L,-2);
+	if (!lua_istable(L,-1))
+	{
+		/* create .get table, leaving it at the top */
+		lua_pop(L,1);
+		lua_newtable(L);
+	 lua_pushstring(L,".get");
+		lua_pushvalue(L,-2);
+		lua_rawset(L,-4);
+	}
+	lua_pushstring(L,name);
+	lua_pushcfunction(L,get);
+ lua_rawset(L,-3);                  /* store variable */
+	lua_pop(L,1);                      /* pop .get table */
+
+	/* set func */
+	if (set)
+	{
+		lua_pushstring(L,".set");
+		lua_rawget(L,-2);
+		if (!lua_istable(L,-1))
+		{
+			/* create .set table, leaving it at the top */
+			lua_pop(L,1);
+			lua_newtable(L);
+			lua_pushstring(L,".set");
+			lua_pushvalue(L,-2);
+			lua_rawset(L,-4);
+		}
+		lua_pushstring(L,name);
+		lua_pushcfunction(L,set);
+		lua_rawset(L,-3);                  /* store variable */
+		lua_pop(L,1);                      /* pop .set table */
+	}
+}
+
+/* Access const array
+	* It reports an error when trying to write into a const array
+*/
+static int const_array (lua_State* L)
+{
+ luaL_error(L,"value of const array cannot be changed");
+ return 0;
+}
+
+/* Map an array
+	* It assigns an array into the current module (or class)
+*/
+TOLUA_API void tolua_array (lua_State* L, char* name, lua_CFunction get, lua_CFunction set)
+{
+	lua_pushstring(L,".get");
+	lua_rawget(L,-2);
+	if (!lua_istable(L,-1))
+	{
+		/* create .get table, leaving it at the top */
+		lua_pop(L,1);
+		lua_newtable(L);
+	 lua_pushstring(L,".get");
+		lua_pushvalue(L,-2);
+		lua_rawset(L,-4);
+	}
+	lua_pushstring(L,name);
+
+ lua_newtable(L);           /* create array metatable */
+ lua_pushvalue(L,-1);
+	lua_setmetatable(L,-2);    /* set the own table as metatable (for modules) */
+ lua_pushstring(L,"__index");
+ lua_pushcfunction(L,get);
+	lua_rawset(L,-3);
+ lua_pushstring(L,"__newindex");
+ lua_pushcfunction(L,set?set:const_array);
+	lua_rawset(L,-3);
+
+ lua_rawset(L,-3);                  /* store variable */
+	lua_pop(L,1);                      /* pop .get table */
+}
+
+
+TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name) {
+
+ #ifdef LUA_VERSION_NUM /* lua 5.1 */
+ luaL_loadbuffer(L, B, size, name) || lua_pcall(L, 0, 0, 0);
+ #else
+ lua_dobuffer(L, B, size, name);
+ #endif
+};
+
Index: /sandbox_light/src/external/tolua/tolua_push.c
===================================================================
--- /sandbox_light/src/external/tolua/tolua_push.c	(revision 5788)
+++ /sandbox_light/src/external/tolua/tolua_push.c	(revision 5788)
@@ -0,0 +1,171 @@
+/* tolua: functions to push C values.
+** Support code for Lua bindings.
+** Written by Waldemar Celes
+** TeCGraf/PUC-Rio
+** Apr 2003
+** $Id: $
+*/
+
+/* This code is free software; you can redistribute it and/or modify it.
+** The software provided hereunder is on an "as is" basis, and
+** the author has no obligation to provide maintenance, support, updates,
+** enhancements, or modifications.
+*/
+
+#include "tolua++.h"
+#include "lauxlib.h"
+
+#include <stdlib.h>
+
+TOLUA_API void tolua_pushvalue (lua_State* L, int lo)
+{
+ lua_pushvalue(L,lo);
+}
+
+TOLUA_API void tolua_pushboolean (lua_State* L, int value)
+{
+ lua_pushboolean(L,value);
+}
+
+TOLUA_API void tolua_pushnumber (lua_State* L, double value)
+{
+ lua_pushnumber(L,value);
+}
+
+TOLUA_API void tolua_pushstring (lua_State* L, const char* value)
+{
+ if (value == NULL)
+  lua_pushnil(L);
+ else
+  lua_pushstring(L,value);
+}
+
+TOLUA_API void tolua_pushuserdata (lua_State* L, void* value)
+{
+ if (value == NULL)
+  lua_pushnil(L);
+ else
+  lua_pushlightuserdata(L,value);
+}
+
+TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type)
+{
+ if (value == NULL)
+  lua_pushnil(L);
+ else
+ {
+  luaL_getmetatable(L, type);
+  lua_pushstring(L,"tolua_ubox");
+  lua_rawget(L,-2);        /* stack: mt ubox */
+  if (lua_isnil(L, -1)) {
+	  lua_pop(L, 1);
+	  lua_pushstring(L, "tolua_ubox");
+	  lua_rawget(L, LUA_REGISTRYINDEX);
+  };
+  lua_pushlightuserdata(L,value);
+  lua_rawget(L,-2);                       /* stack: mt ubox ubox[u] */
+  if (lua_isnil(L,-1))
+  {
+   lua_pop(L,1);                          /* stack: mt ubox */
+   lua_pushlightuserdata(L,value);
+   *(void**)lua_newuserdata(L,sizeof(void *)) = value;   /* stack: mt ubox u newud */
+   lua_pushvalue(L,-1);                   /* stack: mt ubox u newud newud */
+   lua_insert(L,-4);                      /* stack: mt newud ubox u newud */
+   lua_rawset(L,-3);                      /* stack: mt newud ubox */
+   lua_pop(L,1);                          /* stack: mt newud */
+   /*luaL_getmetatable(L,type);*/
+   lua_pushvalue(L, -2);			/* stack: mt newud mt */
+   lua_setmetatable(L,-2);			/* stack: mt newud */
+
+   #ifdef LUA_VERSION_NUM
+   lua_pushvalue(L, TOLUA_NOPEER);
+   lua_setfenv(L, -2);
+   #endif
+  }
+  else
+  {
+   /* check the need of updating the metatable to a more specialized class */
+   lua_insert(L,-2);                       /* stack: mt ubox[u] ubox */
+   lua_pop(L,1);                           /* stack: mt ubox[u] */
+   lua_pushstring(L,"tolua_super");
+   lua_rawget(L,LUA_REGISTRYINDEX);        /* stack: mt ubox[u] super */
+   lua_getmetatable(L,-2);                 /* stack: mt ubox[u] super mt */
+   lua_rawget(L,-2);                       /* stack: mt ubox[u] super super[mt] */
+			if (lua_istable(L,-1))
+			{
+				lua_pushstring(L,type);                 /* stack: mt ubox[u] super super[mt] type */
+				lua_rawget(L,-2);                       /* stack: mt ubox[u] super super[mt] flag */
+				if (lua_toboolean(L,-1) == 1)   /* if true */
+				{
+					lua_pop(L,3);	/* mt ubox[u]*/
+					lua_remove(L, -2);
+					return;
+				}
+			}
+			/* type represents a more specilized type */
+			/*luaL_getmetatable(L,type);             // stack: mt ubox[u] super super[mt] flag mt */
+			lua_pushvalue(L, -5);					/* stack: mt ubox[u] super super[mt] flag mt */
+			lua_setmetatable(L,-5);                /* stack: mt ubox[u] super super[mt] flag */
+			lua_pop(L,3);                          /* stack: mt ubox[u] */
+  }
+  lua_remove(L, -2);	/* stack: ubox[u]*/
+ }
+}
+
+TOLUA_API void tolua_pushusertype_and_takeownership (lua_State* L, void* value, const char* type)
+{
+	tolua_pushusertype(L,value,type);
+	tolua_register_gc(L,lua_gettop(L));
+}
+
+TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v)
+{
+ lua_pushnumber(L,index);
+ lua_pushvalue(L,v);
+ lua_settable(L,lo);
+}
+
+TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v)
+{
+ lua_pushnumber(L,index);
+ lua_pushboolean(L,v);
+ lua_settable(L,lo);
+}
+
+
+TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, double v)
+{
+ lua_pushnumber(L,index);
+ tolua_pushnumber(L,v);
+ lua_settable(L,lo);
+}
+
+TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v)
+{
+ lua_pushnumber(L,index);
+ tolua_pushstring(L,v);
+ lua_settable(L,lo);
+}
+
+TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v)
+{
+ lua_pushnumber(L,index);
+ tolua_pushuserdata(L,v);
+ lua_settable(L,lo);
+}
+
+TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type)
+{
+ lua_pushnumber(L,index);
+ tolua_pushusertype(L,v,type);
+ lua_settable(L,lo);
+}
+
+TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type)
+{
+ lua_pushnumber(L,index);
+ tolua_pushusertype(L,v,type);
+	tolua_register_gc(L,lua_gettop(L));
+ lua_settable(L,lo);
+}
+
Index: /sandbox_light/src/external/tolua/tolua_to.c
===================================================================
--- /sandbox_light/src/external/tolua/tolua_to.c	(revision 5788)
+++ /sandbox_light/src/external/tolua/tolua_to.c	(revision 5788)
@@ -0,0 +1,133 @@
+/* tolua: funcitons to convert to C types
+** Support code for Lua bindings.
+** Written by Waldemar Celes
+** TeCGraf/PUC-Rio
+** Apr 2003
+** $Id: $
+*/
+
+/* This code is free software; you can redistribute it and/or modify it.
+** The software provided hereunder is on an "as is" basis, and
+** the author has no obligation to provide maintenance, support, updates,
+** enhancements, or modifications.
+*/
+
+#include "tolua++.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+TOLUA_API double tolua_tonumber (lua_State* L, int narg, double def)
+{
+ return lua_gettop(L)<abs(narg) ? def : lua_tonumber(L,narg);
+}
+
+TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def)
+{
+ return lua_gettop(L)<abs(narg) ? def : lua_tostring(L,narg);
+}
+
+TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def)
+{
+	
+	/* return lua_gettop(L)<abs(narg) ? def : lua_touserdata(L,narg); */
+
+	if (lua_gettop(L)<abs(narg)) {
+ 		return def;
+	};
+	 
+	if (lua_islightuserdata(L, narg)) {
+	
+		return lua_touserdata(L,narg);
+	};
+	
+	return tolua_tousertype(L, narg, def);
+}
+
+extern int push_table_instance(lua_State* L, int lo);
+
+TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def)
+{
+ if (lua_gettop(L)<abs(narg))
+  return def;
+ else
+ {
+  void* u;
+  if (!lua_isuserdata(L, narg)) {
+	  if (!push_table_instance(L, narg)) return NULL;
+  };
+  u = lua_touserdata(L,narg);
+  return (u==NULL) ? NULL : *((void**)u); /* nil represents NULL */
+ }
+}
+
+TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def)
+{
+ return lua_gettop(L)<abs(narg) ? def : narg;
+}
+
+TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def)
+{
+ return lua_gettop(L)<abs(narg) ?  def : lua_toboolean(L,narg);
+}
+
+TOLUA_API double tolua_tofieldnumber (lua_State* L, int lo, int index, double def)
+{
+ double v;
+ lua_pushnumber(L,index);
+ lua_gettable(L,lo);
+ v = lua_isnil(L,-1) ? def : lua_tonumber(L,-1);
+ lua_pop(L,1);
+ return v;
+}
+
+TOLUA_API const char* tolua_tofieldstring
+(lua_State* L, int lo, int index, const char* def)
+{
+ const char* v;
+ lua_pushnumber(L,index);
+ lua_gettable(L,lo);
+ v = lua_isnil(L,-1) ? def : lua_tostring(L,-1);
+ lua_pop(L,1);
+ return v;
+}
+
+TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def)
+{
+ void* v;
+ lua_pushnumber(L,index);
+ lua_gettable(L,lo);
+ v = lua_isnil(L,-1) ? def : lua_touserdata(L,-1);
+ lua_pop(L,1);
+ return v;
+}
+
+TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def)
+{
+ void* v;
+ lua_pushnumber(L,index);
+ lua_gettable(L,lo);
+ v = lua_isnil(L,-1) ? def : (*(void **)(lua_touserdata(L, -1))); /* lua_unboxpointer(L,-1); */
+ lua_pop(L,1);
+ return v;
+}
+
+TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def)
+{
+ int v;
+ lua_pushnumber(L,index);
+ lua_gettable(L,lo);
+ v = lua_isnil(L,-1) ? def : lo;
+ lua_pop(L,1);
+ return v;
+}
+
+TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def)
+{
+ int v;
+ lua_pushnumber(L,index);
+ lua_gettable(L,lo);
+ v = lua_isnil(L,-1) ? 0 : lua_toboolean(L,-1);
+ lua_pop(L,1);
+ return v;
+}
Index: /sandbox_light/src/libraries/CMakeLists.txt
===================================================================
--- /sandbox_light/src/libraries/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/src/libraries/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,28 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+
+INCLUDE_DIRECTORIES(
+  ${CMAKE_SOURCE_DIR}/src/external
+  ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+################ Sub Directories ################
+
+ADD_SUBDIRECTORY(core)
+ADD_SUBDIRECTORY(util)
Index: /sandbox_light/src/libraries/core/BaseObject.cc
===================================================================
--- /sandbox_light/src/libraries/core/BaseObject.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/BaseObject.cc	(revision 5788)
@@ -0,0 +1,60 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the BaseObject class.
+*/
+
+#include "BaseObject.h"
+#include "CoreIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(BaseObject);
+
+    /**
+        @brief Constructor: Registers the object in the BaseObject-list.
+    */
+    BaseObject::BaseObject(BaseObject* creator) : bInitialized_(false)
+    {
+        RegisterRootObject(BaseObject);
+
+        this->bInitialized_ = true;
+    }
+
+    /**
+        @brief Destructor
+    */
+    BaseObject::~BaseObject()
+    {
+        if (this->isInitialized())
+        {
+        }
+    }
+}
Index: /sandbox_light/src/libraries/core/BaseObject.h
===================================================================
--- /sandbox_light/src/libraries/core/BaseObject.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/BaseObject.h	(revision 5788)
@@ -0,0 +1,63 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the BaseObject class.
+
+    The BaseObject is the parent of all classes representing an instance in the game.
+*/
+
+#ifndef _BaseObject_H__
+#define _BaseObject_H__
+
+#include "CorePrereqs.h"
+#include "OrxonoxClass.h"
+
+namespace orxonox
+{
+    //! The BaseObject is the parent of all classes representing an instance in the game.
+    class _CoreExport BaseObject : virtual public OrxonoxClass
+    {
+        public:
+            BaseObject(BaseObject* creator);
+            virtual ~BaseObject();
+
+            /** @brief Returns if the object was initialized (passed the object registration). @return True was the object is initialized */
+            inline bool isInitialized() const { return this->bInitialized_; }
+
+            inline void setCreator(BaseObject* creator) { this->creator_ = creator; }
+            inline BaseObject* getCreator() const { return this->creator_; }
+
+        private:
+            bool                   bInitialized_;              //!< True if the object was initialized (passed the object registration)
+            BaseObject*            creator_;
+    };
+}
+
+#endif /* _BaseObject_H__ */
Index: /sandbox_light/src/libraries/core/CMakeLists.txt
===================================================================
--- /sandbox_light/src/libraries/core/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/src/libraries/core/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,70 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+
+SET_SOURCE_FILES(CORE_SRC_FILES
+  Clock.cc
+  ConfigFileManager.cc
+  ConfigValueContainer.cc
+  Core.cc
+  DynLib.cc
+  DynLibManager.cc
+  Game.cc
+  GameState.cc
+  Language.cc
+  LuaState.cc
+  ObjectListBase.cc
+  OrxonoxClass.cc
+
+  # command
+  CommandLine.cc
+  Executor.cc
+
+  # hierarchy
+  Factory.cc
+  Identifier.cc
+  MetaObjectList.cc
+
+  # level
+  BaseObject.cc
+
+  # multithreading
+  Thread.cc
+  ThreadPool.cc
+)
+
+ORXONOX_ADD_LIBRARY(core
+  FIND_HEADER_FILES
+  TOLUA_FILES
+    LuaState.h
+  DEFINE_SYMBOL
+    "CORE_SHARED_BUILD"
+  PCH_FILE
+    CorePrecompiledHeaders.h
+  LINK_LIBRARIES
+    ${OGRE_LIBRARY}
+    ${Boost_FILESYSTEM_LIBRARY}
+    ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
+    ${Boost_THREAD_LIBRARY}
+    ${Boost_DATE_TIME_LIBRARY} # Thread dependency
+    ${LUA_LIBRARIES}
+    tolua++_orxonox
+    util
+  SOURCE_FILES
+    ${CORE_SRC_FILES}
+)
Index: /sandbox_light/src/libraries/core/ClassFactory.h
===================================================================
--- /sandbox_light/src/libraries/core/ClassFactory.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/ClassFactory.h	(revision 5788)
@@ -0,0 +1,105 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition and implementation of the ClassFactory class
+
+    The ClassFactory is able to create new objects of a specific class.
+*/
+
+#ifndef _ClassFactory_H__
+#define _ClassFactory_H__
+
+#include "CorePrereqs.h"
+
+#include <string>
+
+#include "util/Debug.h"
+#include "Factory.h"
+#include "Identifier.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###      ClassFactory       ###
+    // ###############################
+    //! The ClassFactory is able to create new objects of a specific class.
+    template <class T>
+    class ClassFactory : public BaseFactory
+    {
+        public:
+            static bool create(const std::string& name);
+            BaseObject* fabricate(BaseObject* creator);
+
+        private:
+            ClassFactory() {}                               // Don't create
+            ClassFactory(const ClassFactory& factory) {}    // Don't copy
+            virtual ~ClassFactory() {}                      // Don't delete
+
+            static T* createNewObject(BaseObject* creator);
+    };
+
+    /**
+        @brief Adds the ClassFactory to the Identifier of the same type and the Identifier to the Factory.
+        @param name The name of the class
+        @param bLoadable True if the class can be loaded through XML
+        @return Always true (this is needed because the compiler only allows assignments before main())
+    */
+    template <class T>
+    bool ClassFactory<T>::create(const std::string& name)
+    {
+        COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl;
+        ClassIdentifier<T>::getIdentifier(name)->addFactory(new ClassFactory<T>);
+        Factory::add(name, ClassIdentifier<T>::getIdentifier());
+
+        return true;
+    }
+
+    /**
+        @brief Creates and returns a new object of class T.
+        @return The new object
+    */
+    template <class T>
+    inline BaseObject* ClassFactory<T>::fabricate(BaseObject* creator)
+    {
+        return ClassFactory<T>::createNewObject(creator);
+    }
+
+    /**
+        @brief Creates and returns a new object of class T; this is a wrapper for the new operator.
+        @return The new object
+    */
+    template <class T>
+    inline T* ClassFactory<T>::createNewObject(BaseObject* creator)
+    {
+        return new T(creator);
+    }
+}
+
+#endif /* _ClassFactory_H__ */
Index: /sandbox_light/src/libraries/core/Clock.cc
===================================================================
--- /sandbox_light/src/libraries/core/Clock.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/Clock.cc	(revision 5788)
@@ -0,0 +1,78 @@
+/*
+ *   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 <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 5788)
+++ /sandbox_light/src/libraries/core/Clock.h	(revision 5788)
@@ -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 "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 5788)
+++ /sandbox_light/src/libraries/core/CommandLine.cc	(revision 5788)
@@ -0,0 +1,378 @@
+/*
+ *   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 <boost/filesystem.hpp>
+
+#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();
+        boost::filesystem::path filepath(Core::getConfigPath() / filename);
+
+        // 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(filepath.string().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 5788)
+++ /sandbox_light/src/libraries/core/CommandLine.h	(revision 5788)
@@ -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::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/ConfigFileManager.cc
===================================================================
--- /sandbox_light/src/libraries/core/ConfigFileManager.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/ConfigFileManager.cc	(revision 5788)
@@ -0,0 +1,566 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ConfigFileManager.h"
+
+#include <boost/filesystem.hpp>
+
+#include "util/Convert.h"
+#include "util/Math.h"
+#include "util/StringUtils.h"
+#include "ConfigValueContainer.h"
+#include "Core.h"
+
+namespace orxonox
+{
+    bool config(const std::string& classname, const std::string& varname, const std::string& value)
+    {
+        std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseIdentifierMap().find(getLowercase(classname));
+        if (identifier != Identifier::getLowercaseIdentifierMapEnd())
+        {
+            std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
+            if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
+                return (*variable).second->set(value);
+        }
+        return false;
+    }
+
+    bool tconfig(const std::string& classname, const std::string& varname, const std::string& value)
+    {
+        std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseIdentifierMap().find(getLowercase(classname));
+        if (identifier != Identifier::getLowercaseIdentifierMapEnd())
+        {
+            std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
+            if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
+                return (*variable).second->tset(value);
+        }
+        return false;
+    }
+
+    void reloadConfig()
+    {
+        ConfigFileManager::getInstance().load();
+    }
+
+    void cleanConfig()
+    {
+        ConfigFileManager::getInstance().clean(false);
+    }
+
+    void loadSettings(const std::string& filename)
+    {
+        ConfigFileManager::getInstance().setFilename(ConfigFileType::Settings, filename);
+    }
+
+    //////////////////////////
+    // ConfigFileEntryValue //
+    //////////////////////////
+
+    void ConfigFileEntryValue::setValue(const std::string& value)
+    {
+        if (!this->bString_)
+            this->value_ = value;
+        else
+            this->value_ = "\"" + addSlashes(stripEnclosingQuotes(value)) + "\"";
+    }
+
+    std::string ConfigFileEntryValue::getValue() const
+    {
+        if (!this->bString_)
+            return this->value_;
+        else
+            return removeSlashes(stripEnclosingQuotes(this->value_));
+    }
+
+    std::string ConfigFileEntryValue::getFileEntry() const
+    {
+        if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
+            return (this->name_ + "=" + this->value_);
+        else
+            return (this->name_ + "=" + this->value_ + " " + this->additionalComment_);
+    }
+
+
+    ////////////////////////////////
+    // ConfigFileEntryVectorValue //
+    ////////////////////////////////
+    std::string ConfigFileEntryVectorValue::getFileEntry() const
+    {
+        if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
+            return (this->name_ + "[" + multi_cast<std::string>(this->index_) + "]" + "=" + this->value_);
+        else
+            return (this->name_ + "[" + multi_cast<std::string>(this->index_) + "]=" + this->value_ + " " + this->additionalComment_);
+    }
+
+
+    ///////////////////////
+    // ConfigFileSection //
+    ///////////////////////
+    ConfigFileSection::~ConfigFileSection()
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); )
+            delete (*(it++));
+    }
+
+    void ConfigFileSection::deleteVectorEntries(const std::string& name, unsigned int startindex)
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); )
+        {
+            if (((*it)->getName() == name) && ((*it)->getIndex() >= startindex))
+            {
+                delete (*it);
+                this->entries_.erase(it++);
+            }
+            else
+            {
+                ++it;
+            }
+        }
+    }
+
+    unsigned int ConfigFileSection::getVectorSize(const std::string& name)
+    {
+        unsigned int size = 0;
+        for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+            if ((*it)->getName() == name)
+                if ((*it)->getIndex() > size)
+                    size = (*it)->getIndex();
+        if (size == 0)
+            return 0;
+        else
+            return (size + 1);
+    }
+
+    std::string ConfigFileSection::getFileEntry() const
+    {
+        if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
+            return ("[" + this->name_ + "]");
+        else
+            return ("[" + this->name_ + "] " + this->additionalComment_);
+    }
+
+    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getEntryIterator(const std::string& name, const std::string& fallback, bool bString)
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+        {
+            if ((*it)->getName() == name)
+            {
+                (*it)->setString(bString);
+                return it;
+            }
+        }
+
+        this->bUpdated_ = true;
+
+        return this->entries_.insert(this->entries_.end(), static_cast<ConfigFileEntry*>(new ConfigFileEntryValue(name, fallback, bString)));
+    }
+
+    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+        {
+            if (((*it)->getName() == name) && ((*it)->getIndex() == index))
+            {
+                (*it)->setString(bString);
+                return it;
+            }
+        }
+
+        this->bUpdated_ = true;
+
+        if (index == 0)
+            return this->entries_.insert(this->entries_.end(), static_cast<ConfigFileEntry*>(new ConfigFileEntryVectorValue(name, index, fallback, bString)));
+        else
+            return this->entries_.insert(++this->getEntryIterator(name, index - 1, "", bString), static_cast<ConfigFileEntry*>(new ConfigFileEntryVectorValue(name, index, fallback, bString)));
+    }
+
+
+    ////////////////
+    // ConfigFile //
+    ////////////////
+    ConfigFile::~ConfigFile()
+    {
+        this->clear();
+    }
+
+    void ConfigFile::load(bool bCreateIfNotExisting)
+    {
+        // Be sure we start from new in the memory
+        this->clear();
+
+        // Get default file if necessary and available
+        boost::filesystem::path filepath(Core::getConfigPath() / this->filename_);
+        if (!boost::filesystem::exists(filepath))
+        {
+            // Try to get default one from the data folder
+            boost::filesystem::path defaultFilepath(Core::getDataPath() / "defaultConfig" / this->filename_);
+            if (boost::filesystem::exists(defaultFilepath))
+            {
+                COUT(3) << "Copied " << this->filename_ << " from the defaultConfig folder." << std::endl;
+                boost::filesystem::copy_file(defaultFilepath, filepath);
+            }
+        }
+
+        // Open the file
+        std::ifstream file;
+        file.open(filepath.string().c_str(), std::fstream::in);
+        if (file.is_open())
+        {
+            ConfigFileSection* newsection = 0;
+
+            while (file.good() && !file.eof())
+            {
+                std::string line;
+                std::getline(file, line);
+
+                std::string temp = getStripped(line);
+                if (!isEmpty(temp) && !isComment(temp))
+                {
+                    size_t   pos1 = temp.find('[');
+                    if (pos1 == 0) pos1 = line.find('['); else pos1 = std::string::npos;
+                    size_t   pos2 = line.find(']');
+
+                    if (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1)
+                    {
+                        // New section
+                        std::string comment = line.substr(pos2 + 1);
+                        if (isComment(comment))
+                            newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1), comment);
+                        else
+                            newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1));
+                        this->sections_.insert(this->sections_.end(), newsection);
+                        continue;
+                    }
+                }
+
+                if (newsection != 0)
+                {
+                    if (isComment(line))
+                    {
+                        // New comment
+                        newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryComment(removeTrailingWhitespaces(line)));
+                        continue;
+                    }
+                    else
+                    {
+                        size_t pos1 = line.find('=');
+
+                        if (pos1 != std::string::npos && pos1 > 0)
+                        {
+                            // New entry
+                            size_t pos2 = line.find('[');
+                            size_t pos3 = line.find(']');
+                            size_t commentposition = getNextCommentPosition(line, pos1 + 1);
+                            while (isBetweenQuotes(line, commentposition))
+                            {
+                                commentposition = getNextCommentPosition(line, commentposition + 1);
+                            }
+                            std::string value = "", comment = "";
+                            if (commentposition == std::string::npos)
+                            {
+                                value = removeTrailingWhitespaces(line.substr(pos1 + 1));
+                            }
+                            else
+                            {
+                                value = removeTrailingWhitespaces(line.substr(pos1 + 1, commentposition - pos1 - 1));
+                                comment = removeTrailingWhitespaces(line.substr(commentposition));
+                            }
+
+                            if (pos2 != std::string::npos && pos3 != std::string::npos && pos3 > pos2 + 1)
+                            {
+                                // There might be an array index
+                                unsigned int index = 0;
+                                if (convertValue(&index, line.substr(pos2 + 1, pos3 - pos2 - 1)))
+                                {
+                                    // New array
+                                    std::list<ConfigFileEntry*>::iterator it = newsection->getEntryIterator(getStripped(line.substr(0, pos2)), index, value, false);
+                                    (*it)->setValue(value);
+                                    (*it)->setComment(comment);
+                                    continue;
+                                }
+                            }
+
+                            // New value
+                            newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryValue(getStripped(line.substr(0, pos1)), value, false, comment));
+                            continue;
+                        }
+                    }
+                }
+            }
+
+            file.close();
+
+            COUT(3) << "Loaded config file \"" << this->filename_ << "\"." << std::endl;
+
+            // Save the file in case something changed (like stripped whitespaces)
+            this->save();
+
+            // Update all ConfigValueContainers
+            this->updateConfigValues();
+        } // end file.is_open()
+    }
+
+    void ConfigFile::save() const
+    {
+        std::ofstream file;
+        file.open((Core::getConfigPathString() + filename_).c_str(), std::fstream::out);
+        file.setf(std::ios::fixed, std::ios::floatfield);
+        file.precision(6);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "An error occurred in ConfigFileManager.cc:" << std::endl;
+            COUT(1) << "Error: Couldn't open config-file \"" << this->filename_ << "\"." << std::endl;
+            return;
+        }
+
+        for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
+        {
+            file << (*it)->getFileEntry() << std::endl;
+
+            for (std::list<ConfigFileEntry*>::const_iterator it_entries = (*it)->getEntriesBegin(); it_entries != (*it)->getEntriesEnd(); ++it_entries)
+            {
+                file << (*it_entries)->getFileEntry() << std::endl;
+            }
+
+            file << std::endl;
+        }
+
+        file.close();
+
+        COUT(4) << "Saved config file \"" << this->filename_ << "\"." << std::endl;
+    }
+
+    void ConfigFile::saveAs(const std::string& filename)
+    {
+        std::string temp = this->filename_;
+        this->filename_ = filename;
+        this->save();
+        this->filename_ = temp;
+    }
+
+    void ConfigFile::clean(bool bCleanComments)
+    {
+        for (std::list<ConfigFileSection*>::iterator it1 = this->sections_.begin(); it1 != this->sections_.end(); )
+        {
+            std::map<std::string, Identifier*>::const_iterator it2 = Identifier::getIdentifierMap().find((*it1)->getName());
+            if (it2 != Identifier::getIdentifierMapEnd() && (*it2).second->hasConfigValues())
+            {
+                // The section exists, delete comment
+                if (bCleanComments)
+                    (*it1)->setComment("");
+                for (std::list<ConfigFileEntry*>::iterator it3 = (*it1)->entries_.begin(); it3 != (*it1)->entries_.end(); )
+                {
+                    std::map<std::string, ConfigValueContainer*>::const_iterator it4 = (*it2).second->getConfigValueMap().find((*it3)->getName());
+                    if (it4 != (*it2).second->getConfigValueMapEnd())
+                    {
+                        // The config-value exists, delete comment
+                        if (bCleanComments)
+                            (*it3)->setComment("");
+                        ++it3;
+                    }
+                    else
+                    {
+                        // The config-value doesn't exist
+                        delete (*it3);
+                        (*it1)->entries_.erase(it3++);
+                    }
+                }
+                ++it1;
+            }
+            else
+            {
+                // The section doesn't exist
+                delete (*it1);
+                this->sections_.erase(it1++);
+            }
+        }
+
+        // Save the file
+        this->save();
+    }
+
+    void ConfigFile::clear()
+    {
+        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); )
+            delete (*(it++));
+        this->sections_.clear();
+    }
+
+    ConfigFileSection* ConfigFile::getSection(const std::string& section)
+    {
+        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
+            if ((*it)->getName() == section)
+                return (*it);
+
+        this->bUpdated_ = true;
+
+        return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(section)));
+    }
+
+    void ConfigFile::saveIfUpdated()
+    {
+        bool sectionsUpdated = false;
+
+        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
+        {
+            if ((*it)->bUpdated_)
+            {
+                sectionsUpdated = true;
+                (*it)->bUpdated_ = false;
+            }
+        }
+
+        if (this->bUpdated_ || sectionsUpdated)
+        {
+            this->bUpdated_ = false;
+            this->save();
+        }
+    }
+
+    void ConfigFile::updateConfigValues()
+    {
+        if (this->type_ == ConfigFileType::Settings)
+        {
+            for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getIdentifierMapBegin(); it != Identifier::getIdentifierMapEnd(); ++it)
+            {
+                if (it->second->hasConfigValues())
+                {
+                    for (std::map<std::string, ConfigValueContainer*>::const_iterator it2 = (*it).second->getConfigValueMapBegin(); it2 != (*it).second->getConfigValueMapEnd(); ++it2)
+                        it2->second->update();
+
+                    it->second->updateConfigValues();
+                }
+            }
+        }
+    }
+
+
+    ///////////////////////
+    // ConfigFileManager //
+    ///////////////////////
+
+    ConfigFileManager* ConfigFileManager::singletonPtr_s = 0;
+
+    std::string ConfigFileManager::DEFAULT_CONFIG_FILE = "default.ini";
+
+    ConfigFileManager::ConfigFileManager()
+         : mininmalFreeType_(ConfigFileType::numberOfReservedTypes)
+    {
+    }
+
+    ConfigFileManager::~ConfigFileManager()
+    {
+        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); )
+            delete (it++)->second;
+    }
+
+    void ConfigFileManager::setFilename(ConfigFileType type, const std::string& filename)
+    {
+        std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.find(type);
+        if (it != this->configFiles_.end())
+        {
+            assert(it->second);
+            delete it->second;
+        }
+        this->configFiles_[type] = new ConfigFile(filename, type);
+        this->load(type);
+    }
+
+    void ConfigFileManager::load()
+    {
+        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
+            it->second->load();
+    }
+
+    void ConfigFileManager::save()
+    {
+        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
+            it->second->save();
+    }
+
+    void ConfigFileManager::clean(bool bCleanComments)
+    {
+        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
+            this->clean(it->first, bCleanComments);
+    }
+
+    void ConfigFileManager::load(ConfigFileType type)
+    {
+        this->getFile(type)->load();
+    }
+
+    void ConfigFileManager::save(ConfigFileType type)
+    {
+        this->getFile(type)->save();
+    }
+
+    void ConfigFileManager::saveAs(ConfigFileType type, const std::string& saveFilename)
+    {
+        this->getFile(type)->saveAs(saveFilename);
+    }
+
+    void ConfigFileManager::clean(ConfigFileType type, bool bCleanComments)
+    {
+        this->getFile(type)->clean(bCleanComments);
+    }
+
+    void ConfigFileManager::updateConfigValues()
+    {
+        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
+            it->second->updateConfigValues();
+    }
+
+    void ConfigFileManager::updateConfigValues(ConfigFileType type)
+    {
+        this->getFile(type)->updateConfigValues();
+    }
+
+    const std::string& ConfigFileManager::getFilename(ConfigFileType type)
+    {
+        std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.find(type);
+        if (it != this->configFiles_.end())
+            return it->second->getFilename();
+        else
+            return BLANKSTRING;
+    }
+
+    ConfigFile* ConfigFileManager::getFile(ConfigFileType type)
+    {
+        std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.find(type);
+        if (it != this->configFiles_.end())
+            return it->second;
+        else
+        {
+            COUT(1) << "ConfigFileManager: Can't find a config file for type with ID " << static_cast<int>(type) << std::endl;
+            COUT(1) << "Using " << DEFAULT_CONFIG_FILE << " file." << std::endl;
+            this->setFilename(type, DEFAULT_CONFIG_FILE);
+            return getFile(type);
+        }
+    }
+}
Index: /sandbox_light/src/libraries/core/ConfigFileManager.h
===================================================================
--- /sandbox_light/src/libraries/core/ConfigFileManager.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/ConfigFileManager.h	(revision 5788)
@@ -0,0 +1,323 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ConfigFileManager_H__
+#define _ConfigFileManager_H__
+
+#include "CorePrereqs.h"
+
+#include <cassert>
+#include <string>
+#include <list>
+#include <map>
+
+#include "util/OrxEnum.h"
+#include "util/Singleton.h"
+
+namespace orxonox
+{
+    // Use int as config file type to have an arbitrary number of files
+    struct ConfigFileType : OrxEnum<ConfigFileType>
+    {
+        OrxEnumConstructors(ConfigFileType);
+
+        static const int NoType              = 0;
+        static const int Settings            = 1;
+        static const int JoyStickCalibration = 2;
+
+        static const int numberOfReservedTypes = 1024;
+    };
+
+    bool config(const std::string& classname, const std::string& varname, const std::string& value);
+    bool tconfig(const std::string& classname, const std::string& varname, const std::string& value);
+    void reloadConfig();
+    void saveConfig();
+    void cleanConfig();
+    void loadSettings(const std::string& filename);
+
+
+    /////////////////////
+    // ConfigFileEntry //
+    /////////////////////
+    class _CoreExport ConfigFileEntry
+    {
+        public:
+            virtual ~ConfigFileEntry() {};
+            virtual void setValue(const std::string& value) = 0;
+            virtual std::string getValue() const = 0;
+            virtual const std::string& getName() const = 0;
+            virtual void setComment(const std::string& comment) = 0;
+            virtual unsigned int getIndex() const { return 0; }
+            virtual void setString(bool bString) = 0;
+            virtual std::string getFileEntry() const = 0;
+    };
+
+
+    //////////////////////////
+    // ConfigFileEntryValue //
+    //////////////////////////
+    class _CoreExport ConfigFileEntryValue : public ConfigFileEntry
+    {
+        public:
+            inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "") : name_(name), value_(value), bString_(bString), additionalComment_(additionalComment) {}
+            inline virtual ~ConfigFileEntryValue() {}
+
+            inline virtual const std::string& getName() const
+                { return this->name_; }
+
+            inline virtual void setComment(const std::string& comment)
+                { this->additionalComment_ = comment; }
+
+            virtual void setValue(const std::string& value);
+            virtual std::string getValue() const;
+
+            inline bool isString() const
+                { return this->bString_; }
+            inline void setString(bool bString)
+                { this->bString_ = bString; }
+
+            virtual std::string getFileEntry() const;
+
+        protected:
+            std::string name_;
+            std::string value_;
+            bool bString_;
+            std::string additionalComment_;
+    };
+
+
+    ///////////////////////////////
+    // ConfigFileEntryVectorValue //
+    ///////////////////////////////
+    class _CoreExport ConfigFileEntryVectorValue : public ConfigFileEntryValue
+    {
+        public:
+            inline ConfigFileEntryVectorValue(const std::string& name, unsigned int index, const std::string& value = "", bool bString = false, const std::string& additionalComment = "") : ConfigFileEntryValue(name, value, bString, additionalComment), index_(index) {}
+            inline virtual ~ConfigFileEntryVectorValue() {}
+
+            inline virtual unsigned int getIndex() const
+                { return this->index_; }
+
+            virtual std::string getFileEntry() const;
+
+        private:
+            unsigned int index_;
+    };
+
+
+    ////////////////////////////
+    // ConfigFileEntryComment //
+    ////////////////////////////
+    class _CoreExport ConfigFileEntryComment : public ConfigFileEntry
+    {
+        public:
+            inline ConfigFileEntryComment(const std::string& comment) : comment_(comment) {}
+            inline virtual ~ConfigFileEntryComment() {}
+
+            inline virtual const std::string& getName() const
+                { return this->comment_; }
+
+            inline virtual void setComment(const std::string& comment)
+                { this->comment_ = comment; }
+
+            inline virtual void setValue(const std::string& value)
+                {}
+            inline virtual std::string getValue() const
+                { return this->comment_; }
+
+            inline void setString(bool bString) {}
+
+            inline virtual std::string getFileEntry() const
+                { return this->comment_; }
+
+        private:
+            std::string comment_;
+    };
+
+
+    ///////////////////////
+    // ConfigFileSection //
+    ///////////////////////
+    class _CoreExport ConfigFileSection
+    {
+        friend class ConfigFile;
+
+        public:
+            inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "") : name_(name), additionalComment_(additionalComment), bUpdated_(false) {}
+            ~ConfigFileSection();
+
+            inline const std::string& getName() const
+                { return this->name_; }
+
+            inline void setComment(const std::string& comment)
+                { this->additionalComment_ = comment; }
+
+            inline void setValue(const std::string& name, const std::string& value, bool bString)
+                { this->getEntry(name, value, bString)->setValue(value); }
+            inline std::string getValue(const std::string& name, const std::string& fallback, bool bString)
+                { return this->getEntry(name, fallback, bString)->getValue(); }
+
+            inline void setValue(const std::string& name, unsigned int index, const std::string& value, bool bString)
+                { this->getEntry(name, index, value, bString)->setValue(value); }
+            inline std::string getValue(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+                { return this->getEntry(name, index, fallback, bString)->getValue(); }
+
+            void deleteVectorEntries(const std::string& name, unsigned int startindex = 0);
+            unsigned int getVectorSize(const std::string& name);
+
+            std::string getFileEntry() const;
+
+        private:
+            std::list<ConfigFileEntry*>& getEntries()
+                { return this->entries_; }
+            std::list<ConfigFileEntry*>::const_iterator getEntriesBegin() const
+                { return this->entries_.begin(); }
+            std::list<ConfigFileEntry*>::const_iterator getEntriesEnd() const
+                { return this->entries_.end(); }
+
+            std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, const std::string& fallback, bool bString);
+            std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString);
+
+            inline ConfigFileEntry* getEntry(const std::string& name, const std::string& fallback, bool bString)
+                { return (*this->getEntryIterator(name, fallback, bString)); }
+            inline ConfigFileEntry* getEntry(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+                { return (*this->getEntryIterator(name, index, fallback, bString)); }
+
+            std::string name_;
+            std::string additionalComment_;
+            std::list<ConfigFileEntry*> entries_;
+            bool bUpdated_;
+    };
+
+
+    ////////////////
+    // ConfigFile //
+    ////////////////
+    class _CoreExport ConfigFile
+    {
+        public:
+            inline ConfigFile(const std::string& filename, ConfigFileType type)
+                : filename_(filename)
+                , type_(type)
+                , bUpdated_(false)
+            { }
+            ~ConfigFile();
+
+            void load(bool bCreateIfNotExisting = true);
+            void save() const;
+            void saveAs(const std::string& filename);
+            void clean(bool bCleanComments = false);
+            void clear();
+
+            const std::string& getFilename() { return this->filename_; }
+
+            inline void setValue(const std::string& section, const std::string& name, const std::string& value, bool bString)
+                { this->getSection(section)->setValue(name, value, bString); this->save(); }
+            inline std::string getValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString)
+                { std::string output = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; }
+
+            inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString)
+                { this->getSection(section)->setValue(name, index, value, bString); this->save(); }
+            inline std::string getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+                { std::string output = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; }
+
+            inline void deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex = 0)
+                { this->getSection(section)->deleteVectorEntries(name, startindex); }
+            inline unsigned int getVectorSize(const std::string& section, const std::string& name)
+                { return this->getSection(section)->getVectorSize(name); }
+
+            void updateConfigValues();
+
+        private:
+            ConfigFileSection* getSection(const std::string& section);
+            void saveIfUpdated();
+
+            std::string filename_;
+            ConfigFileType type_;
+            std::list<ConfigFileSection*> sections_;
+            bool bUpdated_;
+    };
+
+
+    ///////////////////////
+    // ConfigFileManager //
+    ///////////////////////
+    class _CoreExport ConfigFileManager : public Singleton<ConfigFileManager>
+    {
+        friend class Singleton<ConfigFileManager>;
+        public:
+            ConfigFileManager();
+            ~ConfigFileManager();
+
+            void load();
+            void save();
+            void clean(bool bCleanComments = false);
+
+            void setFilename(ConfigFileType type, const std::string& filename);
+            const std::string& getFilename(ConfigFileType type);
+
+            ConfigFileType getNewConfigFileType() { return mininmalFreeType_++; }
+
+            void load(ConfigFileType type);
+            void save(ConfigFileType type);
+            void saveAs(ConfigFileType type, const std::string& saveFilename);
+            void clean(ConfigFileType type, bool bCleanComments = false);
+
+            inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& value, bool bString)
+                { this->getFile(type)->setValue(section, name, value, bString); }
+            inline std::string getValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& fallback, bool bString)
+                { return this->getFile(type)->getValue(section, name, fallback, bString); }
+
+            inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString)
+                { this->getFile(type)->setValue(section, name, index, value, bString); }
+            inline std::string getValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+                { return this->getFile(type)->getValue(section, name, index, fallback, bString); }
+
+            inline void deleteVectorEntries(ConfigFileType type, const std::string& section, const std::string& name, unsigned int startindex = 0)
+                { this->getFile(type)->deleteVectorEntries(section, name, startindex); }
+            inline unsigned int getVectorSize(ConfigFileType type, const std::string& section, const std::string& name)
+                { return this->getFile(type)->getVectorSize(section, name); }
+
+            void updateConfigValues();
+            void updateConfigValues(ConfigFileType type);
+
+            static std::string DEFAULT_CONFIG_FILE;
+
+        private:
+            ConfigFileManager(const ConfigFileManager&);
+
+            ConfigFile* getFile(ConfigFileType type);
+
+            std::map<ConfigFileType, ConfigFile*> configFiles_;
+            unsigned int mininmalFreeType_;
+
+            static ConfigFileManager* singletonPtr_s;
+    };
+}
+
+#endif /* _ConfigFileManager_H__ */
Index: /sandbox_light/src/libraries/core/ConfigValueContainer.cc
===================================================================
--- /sandbox_light/src/libraries/core/ConfigValueContainer.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/ConfigValueContainer.cc	(revision 5788)
@@ -0,0 +1,344 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the ConfigValueContainer class.
+*/
+
+#include "ConfigValueContainer.h"
+
+#include "util/Convert.h"
+#include "util/SubString.h"
+#include "Language.h"
+
+namespace orxonox
+{
+    const unsigned int MAX_VECTOR_INDEX  = 255; // to avoid up to 4*10^9 vector entries in the config file after accidentally using a wrong argument
+
+    /**
+        @brief Initializes the ConfigValueContainer with defaultvalues.
+    */
+    void ConfigValueContainer::init(ConfigFileType type, Identifier* identifier, const std::string& sectionname, const std::string& varname)
+    {
+        this->type_ = type;
+        this->identifier_ = identifier;
+        this->sectionname_ = sectionname;
+        this->varname_ = varname;
+        this->callback_ = 0;
+        this->bContainerIsNew_ = true;
+        this->bDoInitialCallback_ = false;
+        this->bAddedDescription_ = false;
+    }
+
+    /**
+        @brief Does some special initialization for single config-values.
+    */
+    void ConfigValueContainer::initValue(const MultiType& defvalue)
+    {
+        this->value_ = defvalue;
+        this->bIsVector_ = false;
+
+        this->defvalueString_ = this->value_.getString();
+        this->update();
+    }
+
+    /**
+        @brief Does some special initialization for vector config-values.
+    */
+    void ConfigValueContainer::initVector()
+    {
+        this->bIsVector_ = true;
+
+        for (unsigned int i = 0; i < this->valueVector_.size(); i++)
+        {
+            ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_Type::String));
+            this->defvalueStringVector_.push_back(this->valueVector_[i]);
+        }
+
+        this->update();
+    }
+
+    /**
+        @brief Destructor: Deletes the callback object if necessary.
+    */
+    ConfigValueContainer::~ConfigValueContainer()
+    {
+        if (this->callback_)
+            delete this->callback_;
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects and writes the change into the config-file.
+        @param input The new value
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::set(const MultiType& input)
+    {
+        if (this->bIsVector_)
+        {
+            return this->callFunctionWithIndex(&ConfigValueContainer::set, input);
+        }
+        else
+        {
+            if (this->tset(input))
+            {
+                ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, input, this->value_.isType(MT_Type::String));
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects and writes the change into the config-file.
+        @param index The index in the vector
+        @param input The new value
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::set(unsigned int index, const MultiType& input)
+    {
+        if (this->bIsVector_)
+        {
+            if (this->tset(index, input))
+            {
+                ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, index, input, this->value_.isType(MT_Type::String));
+                return true;
+            }
+        }
+        else
+        {
+            COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+        }
+        return false;
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects, but doesn't change the config-file (t stands for temporary).
+        @param input The new value. If bIsVector_ then write "index value"
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::tset(const MultiType& input)
+    {
+        if (this->bIsVector_)
+        {
+            return this->callFunctionWithIndex(&ConfigValueContainer::tset, input);
+            return false;
+        }
+        else
+        {
+            this->value_ = input;
+
+            if (this->identifier_)
+                this->identifier_->updateConfigValues();
+
+            return true;
+        }
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects, but doesn't change the config-file (t stands for temporary).
+        @param index The index in the vector
+        @param input The new value
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::tset(unsigned int index, const MultiType& input)
+    {
+        if (this->bIsVector_)
+        {
+            if (index > MAX_VECTOR_INDEX)
+            {
+                COUT(1) << "Error: Index " << index << " is too large." << std::endl;
+                return false;
+            }
+
+            if (index >= this->valueVector_.size())
+            {
+                for (unsigned int i = this->valueVector_.size(); i <= index; i++)
+                {
+                    this->valueVector_.push_back(MultiType());
+                }
+            }
+
+            this->valueVector_[index] = input;
+
+            if (this->identifier_)
+                this->identifier_->updateConfigValues();
+
+            return true;
+        }
+        else
+        {
+            COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+            return false;
+        }
+    }
+
+    /**
+        @brief Adds a new entry to the end of the vector.
+        @param input The new entry
+        @return True if the new entry was successfully added
+    */
+    bool ConfigValueContainer::add(const MultiType& input)
+    {
+        if (this->bIsVector_)
+            return this->set(this->valueVector_.size(), input);
+
+        COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+        return false;
+    }
+
+    /**
+        @brief Removes an existing entry from the vector.
+        @param index The index of the entry
+        @return True if the entry was removed
+    */
+    bool ConfigValueContainer::remove(unsigned int index)
+    {
+        if (this->bIsVector_)
+        {
+            if (index < this->valueVector_.size())
+            {
+                // Erase the entry from the vector, change (shift) all entries beginning with index in the config file, remove the last entry from the file
+                this->valueVector_.erase(this->valueVector_.begin() + index);
+                for (unsigned int i = index; i < this->valueVector_.size(); i++)
+                    ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_Type::String));
+                ConfigFileManager::getInstance().deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->valueVector_.size());
+
+                return true;
+            }
+            COUT(1) << "Error: Invalid vector-index." << std::endl;
+        }
+
+        COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+        return false;
+    }
+
+    /**
+        @brief Sets the value of the variable back to the default value and resets the config-file entry.
+    */
+    bool ConfigValueContainer::reset()
+    {
+        if (!this->bIsVector_)
+            return this->set(this->defvalueString_);
+        else
+        {
+            bool success = true;
+            for (unsigned int i = 0; i < this->defvalueStringVector_.size(); i++)
+                if (!this->set(i, this->defvalueStringVector_[i]))
+                    success = false;
+            ConfigFileManager::getInstance().deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->defvalueStringVector_.size());
+            return success;
+        }
+    }
+
+    /**
+        @brief Retrieves the configured value from the currently loaded config-file.
+    */
+    void ConfigValueContainer::update()
+    {
+        if (!this->bIsVector_)
+            this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType(MT_Type::String));
+        else
+        {
+            this->valueVector_.clear();
+            unsigned int vectorSize = ConfigFileManager::getInstance().getVectorSize(this->type_, this->sectionname_, this->varname_);
+            for (unsigned int i = 0; i < vectorSize; i++)
+            {
+                if (i < this->defvalueStringVector_.size())
+                {
+                    this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType(MT_Type::String));
+                }
+                else
+                {
+                    this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, MultiType(), this->value_.isType(MT_Type::String));
+                }
+
+                this->valueVector_.push_back(this->value_);
+            }
+        }
+    }
+
+    /**
+        @brief Calls the given function with parsed index and the parsed argument from the input string.
+        @param function The function to call
+        @param input The input string
+        @return The returnvalue of the functioncall
+    */
+    bool ConfigValueContainer::callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType&), const std::string& input)
+    {
+        SubString token(input, " ", SubString::WhiteSpaces, true, '\\', false, '"', false, '(', ')', false, '\0');
+        int index = -1;
+        bool success = false;
+
+        if (token.size() > 0)
+            success = convertValue(&index, token[0]);
+
+        if (!success || index < 0 || index > (signed int)MAX_VECTOR_INDEX)
+        {
+            if (!success)
+            {
+                COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is a vector." << std::endl;
+            }
+            else
+            {
+                COUT(1) << "Error: Invalid vector-index." << std::endl;
+            }
+            return false;
+        }
+
+        if (token.size() >= 2)
+            return (this->*function)(index, token.subSet(1).join());
+        else
+            return (this->*function)(index, "");
+    }
+
+    /**
+        @brief Adds a description to the config-value.
+        @param description The description
+    */
+    ConfigValueContainer& ConfigValueContainer::description(const std::string& description)
+    {
+        if (!this->bAddedDescription_)
+        {
+            this->description_ = std::string("ConfigValueDescription::" + this->sectionname_ + "::" + this->varname_);
+            AddLanguageEntry(this->description_, description);
+            this->bAddedDescription_ = true;
+        }
+        return (*this);
+    }
+
+    /**
+        @brief Returns the description of the config-value.
+        @return The description
+    */
+    const std::string& ConfigValueContainer::getDescription() const
+    {
+        return GetLocalisation(this->description_);
+    }
+}
Index: /sandbox_light/src/libraries/core/ConfigValueContainer.h
===================================================================
--- /sandbox_light/src/libraries/core/ConfigValueContainer.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/ConfigValueContainer.h	(revision 5788)
@@ -0,0 +1,301 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the ConfigValueContainer class.
+
+    The ConfigValueContainer class contains all needed information about a configurable variable:
+     - the name of the variable
+     - the name of the class the variable belongs to
+     - the default value
+     - the user-specified value
+     - a pointer to the entry in the config-file
+
+    This is needed to assign the configured values to all newly created objects.
+*/
+
+#ifndef _ConfigValueContainer_H__
+#define _ConfigValueContainer_H__
+
+#include "CorePrereqs.h"
+
+#include <string>
+#include <vector>
+
+#include "util/MultiType.h"
+#include "ConfigFileManager.h"
+#include "Identifier.h"
+
+namespace orxonox
+{
+    class ConfigValueCallbackBase
+    {
+        public:
+            virtual void call(void* object) = 0;
+            inline virtual ~ConfigValueCallbackBase() {}
+    };
+
+    template <class T>
+    class ConfigValueCallback: public ConfigValueCallbackBase
+    {
+        public:
+            inline ConfigValueCallback(void (T::*function) (void)) : function_(function) {}
+            inline virtual ~ConfigValueCallback() {}
+            inline virtual void call(void* object)
+            {
+                if (!Identifier::isCreatingHierarchy())
+                    (static_cast<T*>(object)->*this->function_)();
+            }
+
+        private:
+            void (T::*function_) (void);
+    };
+
+
+    //! The ConfigValuecontainer contains all needed information about a configurable variable.
+    /**
+        The ConfigValueContainer class contains all needed information about a configurable variable:
+         - the name of the variable
+         - the name of the class the variable belongs to
+         - the default value
+         - the user-specified value
+         - a pointer to the entry in the config-file
+
+        This is needed to assign the configured values to all newly created objects.
+
+        The container searches for the entry in the config file.
+        If there is an entry, it parses the specified value and assigns it to the variable of the right type.
+        If there is no entry, it adds the entry with the default-value to the section of the variables class.
+        If there is no section, the section and the entry are added to the end of the config-file.
+    */
+    class _CoreExport ConfigValueContainer
+    {
+        public:
+            /**
+                @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
+                @param type The type of the corresponding config-file
+                @param identifier The identifier of the class the variable belongs to
+                @param sectionname Name of the section the configValue should be put in.
+                @param varname The name of the variable
+                @param defvalue The default-value
+                @param value Only needed do determine the right type.
+            */
+            template <class D, class V>
+            ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const D& defvalue, const V& value)
+            {
+                this->init(type, identifier, sectionname, varname);
+                this->initValue(static_cast<V>(defvalue));
+            }
+
+            /**
+                @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
+                @param type The type of the corresponding config-file
+                @param identifier The identifier of the class the variable belongs to
+                @param varname The name of the variable
+                @param defvalue The default-value
+            */
+            template <class V>
+            ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const std::vector<V>& defvalue)
+            {
+                this->init(type, identifier, sectionname, varname);
+
+                this->value_ = V();
+                for (unsigned int i = 0; i < defvalue.size(); i++)
+                    this->valueVector_.push_back(MultiType(defvalue[i]));
+
+                this->initVector();
+            }
+
+            ~ConfigValueContainer();
+
+            /**
+                @brief Returns the configured value.
+                @param value A pointer to the variable to store the value.
+                @param object The object calling this function
+                @return The ConfigValueContainer
+            */
+            template <typename T, class C>
+            ConfigValueContainer& getValue(T* value, C* object)
+            {
+                if ((this->callback_ && object) || this->bContainerIsNew_)
+                {
+                    if (this->bContainerIsNew_)
+                        this->bContainerIsNew_ = false;
+
+                    T temp = *value;
+                    this->value_.getValue(value);
+                    if ((*value) != temp)
+                    {
+                        if (this->callback_ && object)
+                            this->callback_->call(object);
+                        else
+                            this->bDoInitialCallback_ = true;
+                    }
+                }
+                else
+                {
+                    this->value_.getValue(value);
+                }
+                return *this;
+            }
+
+            /**
+                @brief Returns the configured vector.
+                @param value A pointer to the vector to store the values.
+                @param object The object calling this function
+                @return The ConfigValueContainer
+            */
+            template <typename T, class C>
+            ConfigValueContainer& getValue(std::vector<T>* value, C* object)
+            {
+                if ((this->callback_ && object) || this->bContainerIsNew_)
+                {
+                    if (this->bContainerIsNew_)
+                        this->bContainerIsNew_ = false;
+
+                    std::vector<T> temp = *value;
+                    value->clear();
+                    for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
+                        value->push_back(this->valueVector_[i]);
+
+                    if (value->size() != temp.size())
+                    {
+                        if (this->callback_ && object)
+                            this->callback_->call(object);
+                        else
+                            this->bDoInitialCallback_ = true;
+                    }
+                    else
+                    {
+                        for (unsigned int i = 0; i < value->size(); ++i)
+                        {
+                            if ((*value)[i] != temp[i])
+                            {
+                                if (this->callback_ && object)
+                                    this->callback_->call(object);
+                                else
+                                    this->bDoInitialCallback_ = true;
+                                break;
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    value->clear();
+                    for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
+                        value->push_back(this->valueVector_[i]);
+                }
+                return *this;
+            }
+
+            /** @brief Returns the name of this container. */
+            inline const std::string& getName() const
+                { return this->varname_; }
+            /** @brief Retuns the name of the section this config value is in. */
+            inline const std::string& getSectionName() const
+                { return this->sectionname_; }
+            /** @brief Returns true if this config-value is a vector */
+            inline bool isVector() const
+                { return this->bIsVector_; }
+            /** @brief Returns the vectors size (or zero if it's not a vector). */
+            inline unsigned int getVectorSize() const
+                { return this->valueVector_.size(); }
+
+            ConfigValueContainer& description(const std::string& description);
+            const std::string& getDescription() const;
+
+            /**
+                @brief Adds a callback function, that gets called after getValue() if the newly assigned value differs from the old value of the variable.
+                @param object The object to call the function
+                @param function The callback function
+            */
+            template <class T>
+            inline ConfigValueContainer& callback(T* object, void (T::*function) (void))
+            {
+                if (!this->callback_)
+                {
+                    this->callback_ = new ConfigValueCallback<T>(function);
+
+                    if (this->bDoInitialCallback_)
+                    {
+                        this->bDoInitialCallback_ = false;
+                        this->callback_->call(object);
+                    }
+                }
+
+                return (*this);
+            }
+
+            bool set(const MultiType& input);
+            bool tset(const MultiType& input);
+
+            bool set(unsigned int index, const MultiType& input);
+            bool tset(unsigned int index, const MultiType& input);
+            bool add(const MultiType& input);
+            bool remove(unsigned int index);
+
+            bool reset();
+            void update();
+
+            /** @brief Converts the config-value to a string. @return The string */
+            inline std::string toString() const
+                { return this->value_; }
+            /** @brief Returns the typename of the assigned config-value. @return The typename */
+            inline std::string getTypename() const
+                { return this->value_.getTypename(); }
+
+        private:
+            void init(ConfigFileType type, Identifier* identifier, const std::string& sectionname, const std::string& varname);
+            void initValue(const MultiType& defvalue);
+            void initVector();
+            bool callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType&), const std::string& input);
+
+            bool                       bIsVector_;                  //!< True if the container contains a std::vector
+
+            ConfigFileType             type_;                       //!< The type of the corresponding config-file
+            Identifier*                identifier_;                 //!< The identifier of the class
+            std::string                sectionname_;                //!< The name of the class the variable belongs to
+            std::string                varname_;                    //!< The name of the variable
+            std::string                defvalueString_;             //!< The string of the default-value
+            std::vector<std::string>   defvalueStringVector_;       //!< A vector, containg the strings of the default-values in case we're storing a vector
+
+            MultiType                  value_;                      //!< The value
+            std::vector<MultiType>     valueVector_;                //!< A vector, containg the values in case we're storing a vector
+
+            bool                       bAddedDescription_;          //!< True if a description was added
+            LanguageEntryLabel         description_;                //!< The description
+            ConfigValueCallbackBase*   callback_;                   //!< A callback function to call after getValue if the value changed
+
+            bool                       bContainerIsNew_;            //!< True if it's the first time getValue() gets called
+            bool                       bDoInitialCallback_;         //!< True if the callback should be called as soon as it gets created
+    };
+}
+
+#endif /* _ConfigValueContainer_H__ */
Index: /sandbox_light/src/libraries/core/ConfigValueIncludes.h
===================================================================
--- /sandbox_light/src/libraries/core/ConfigValueIncludes.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/ConfigValueIncludes.h	(revision 5788)
@@ -0,0 +1,114 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of macros for config-values.
+*/
+
+#ifndef _ConfigValueIncludes_H__
+#define _ConfigValueIncludes_H__
+
+#include "CorePrereqs.h"
+
+#include "Identifier.h"
+#include "ConfigValueContainer.h"
+#include "ConfigFileManager.h"
+
+
+/**
+    @brief Assigns the value, defined in the config-file, to the variable (or the default-value, if there is no entry in the file).
+    @param varname The name of the variable
+    @param defvalue The default-value of the variable
+*/
+#define SetConfigValueGeneric(type, varname, defvalue) \
+    static orxonox::Identifier* identifier##varname = this->getIdentifier(); \
+    orxonox::ConfigValueContainer* container##varname = identifier##varname->getConfigValueContainer(#varname); \
+    if (!container##varname) \
+    { \
+        container##varname = new orxonox::ConfigValueContainer(type, identifier##varname, identifier##varname->getName(), #varname, defvalue, varname); \
+        identifier##varname->addConfigValueContainer(#varname, container##varname); \
+    } \
+    container##varname->getValue(&varname, this)
+
+#define SetConfigValue(varname, defvalue) SetConfigValueGeneric(ConfigFileType::Settings, varname, defvalue)
+
+
+/**
+    @brief Assigns the vector-values, defined in the config-file, to the vector (or the default-value, if there are no entries in the file).
+    @param varname The name of the std::vector
+    @param defvalue The default-value
+*/
+#define SetConfigValueVectorGeneric(type, varname, defvalue) \
+    static orxonox::Identifier* identifier##varname = this->getIdentifier(); \
+    orxonox::ConfigValueContainer* container##varname = identifier##varname->getConfigValueContainer(#varname); \
+    if (!container##varname) \
+    { \
+        container##varname = new orxonox::ConfigValueContainer(type, identifier##varname, identifier##varname->getName(), #varname, defvalue); \
+        identifier##varname->addConfigValueContainer(#varname, container##varname); \
+    } \
+    container##varname->getValue(&varname, this)
+
+#define SetConfigValueVector(varname, defvalue) SetConfigValueVectorGeneric(ConfigFileType::Settings, varname, defvalue)
+
+
+/**
+    @brief Sets the variable and the config-file entry back to the previously defined default-value.
+    @param varname The name of the variable
+*/
+#define ResetConfigValue(varname) \
+    orxonox::ConfigValueContainer* container##varname##reset = this->getIdentifier()->getConfigValueContainer(#varname); \
+    if (container##varname##reset) \
+    { \
+        container##varname##reset->reset(); \
+        container##varname##reset->getValue(&varname, this); \
+    } \
+    else \
+    { \
+        COUT(2) << "Warning: Couldn't reset config-value '" << #varname << "', corresponding container doesn't exist." << std::endl; \
+    }
+
+
+/**
+    @brief Modifies a config-value by using a modifier and some arguments.
+    @param varname The name of the config-value
+    @param modifier The name of the modifier: set, tset, add, remove, reset, update
+*/
+#define ModifyConfigValue(varname, modifier, ...) \
+    orxonox::ConfigValueContainer* container##varname##modify##modifier = this->getIdentifier()->getConfigValueContainer(#varname); \
+    if (container##varname##modify##modifier) \
+    { \
+        container##varname##modify##modifier->modifier(__VA_ARGS__); \
+        container##varname##modify##modifier->getValue(&varname, this); \
+    } \
+    else \
+    { \
+        COUT(2) << "Warning: Couln't modify config-value '" << #varname << "', corresponding container doesn't exist." << std::endl; \
+    }
+
+#endif /* _ConfigValueIncludes_H__ */
Index: /sandbox_light/src/libraries/core/Core.cc
===================================================================
--- /sandbox_light/src/libraries/core/Core.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/Core.cc	(revision 5788)
@@ -0,0 +1,636 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Implementation of the Core singleton with its global variables (avoids boost include)
+*/
+
+#include "Core.h"
+
+#include <cassert>
+#include <fstream>
+#include <cstdlib>
+#include <cstdio>
+#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 "util/SignalHandler.h"
+#include "Clock.h"
+#include "CommandLine.h"
+#include "ConfigFileManager.h"
+#include "ConfigValueIncludes.h"
+#include "CoreIncludes.h"
+#include "DynLibManager.h"
+#include "Factory.h"
+#include "Identifier.h"
+#include "Language.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
+{
+    //! Static pointer to the singleton
+    Core* Core::singletonPtr_s  = 0;
+
+    SetCommandLineArgument(externalDataPath, "").information("Path to the external data files");
+    SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
+    SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
+#ifdef ORXONOX_PLATFORM_WINDOWS
+    SetCommandLineArgument(limitToCPU, 0).information("Limits the program to one cpu/core (1, 2, 3, etc.). 0 turns it off (default)");
+#endif
+
+    /**
+    @brief
+        Helper class for the Core singleton: we cannot derive
+        Core from OrxonoxClass because we need to handle the Identifier
+        destruction in the Core destructor.
+    */
+    class CoreConfiguration : public OrxonoxClass
+    {
+    public:
+        CoreConfiguration()
+        {
+        }
+
+        void initialise()
+        {
+            RegisterRootObject(CoreConfiguration);
+            this->setConfigValues();
+        }
+
+        /**
+            @brief Function to collect the SetConfigValue-macro calls.
+        */
+        void setConfigValues()
+        {
+#ifdef NDEBUG
+            const unsigned int defaultLevelConsole = 1;
+            const unsigned int defaultLevelLogfile = 3;
+            const unsigned int defaultLevelShell   = 1;
+#else
+            const unsigned int defaultLevelConsole = 3;
+            const unsigned int defaultLevelLogfile = 4;
+            const unsigned int defaultLevelShell   = 3;
+#endif
+            SetConfigValue(softDebugLevelConsole_, defaultLevelConsole)
+                .description("The maximal level of debug output shown in the console")
+                .callback(this, &CoreConfiguration::debugLevelChanged);
+            SetConfigValue(softDebugLevelLogfile_, defaultLevelLogfile)
+                .description("The maximal level of debug output shown in the logfile")
+                .callback(this, &CoreConfiguration::debugLevelChanged);
+            SetConfigValue(softDebugLevelShell_, defaultLevelShell)
+                .description("The maximal level of debug output shown in the ingame shell")
+                .callback(this, &CoreConfiguration::debugLevelChanged);
+
+            SetConfigValue(language_, Language::getInstance().defaultLanguage_)
+                .description("The language of the ingame text")
+                .callback(this, &CoreConfiguration::languageChanged);
+            SetConfigValue(bInitializeRandomNumberGenerator_, true)
+                .description("If true, all random actions are different each time you start the game")
+                .callback(this, &CoreConfiguration::initializeRandomNumberGenerator);
+        }
+
+        /**
+            @brief Callback function if the debug level has changed.
+        */
+        void debugLevelChanged()
+        {
+            // softDebugLevel_ is the maximum of the 3 variables
+            this->softDebugLevel_ = this->softDebugLevelConsole_;
+            if (this->softDebugLevelLogfile_ > this->softDebugLevel_)
+                this->softDebugLevel_ = this->softDebugLevelLogfile_;
+            if (this->softDebugLevelShell_ > this->softDebugLevel_)
+                this->softDebugLevel_ = this->softDebugLevelShell_;
+
+            OutputHandler::setSoftDebugLevel(OutputHandler::LD_All,     this->softDebugLevel_);
+            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Console, this->softDebugLevelConsole_);
+            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Logfile, this->softDebugLevelLogfile_);
+            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Shell,   this->softDebugLevelShell_);
+        }
+
+        /**
+            @brief Callback function if the language has changed.
+        */
+        void languageChanged()
+        {
+            // Read the translation file after the language was configured
+            Language::getInstance().readTranslatedLanguageFile();
+        }
+
+        /**
+            @brief Sets the language in the config-file back to the default.
+        */
+        void resetLanguage()
+        {
+            ResetConfigValue(language_);
+        }
+
+        void initializeRandomNumberGenerator()
+        {
+            static bool bInitialized = false;
+            if (!bInitialized && this->bInitializeRandomNumberGenerator_)
+            {
+                srand(static_cast<unsigned int>(time(0)));
+                rand();
+                bInitialized = true;
+            }
+        }
+
+        int softDebugLevel_;                            //!< The debug level
+        int softDebugLevelConsole_;                     //!< The debug level for the console
+        int softDebugLevelLogfile_;                     //!< The debug level for the logfile
+        int softDebugLevelShell_;                       //!< The debug level for the ingame shell
+        std::string language_;                          //!< The language
+        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 modulePath_;            //!< Path to the modules
+        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
+    };
+
+
+    Core::Core(const std::string& cmdLine)
+        // Cleanup guard for identifier destruction (incl. XMLPort, configValues, consoleCommands)
+        : identifierDestroyer_(Identifier::destroyAllIdentifiers)
+        , configuration_(new CoreConfiguration()) // Don't yet create config values!
+        , bDevRun_(false)
+    {
+        // Set the hard coded fixed paths
+        this->setFixedPaths();
+
+        // Create a new dynamic library manager
+        this->dynLibManager_.reset(new DynLibManager());
+
+        // Load modules
+        try
+        {
+            // We search for helper files with the following extension
+            std::string moduleextension = specialConfig::moduleExtension;
+            size_t moduleextensionlength = moduleextension.size();
+
+            // Search in the directory of our executable
+            boost::filesystem::path searchpath = this->configuration_->modulePath_;
+
+            // Add that path to the PATH variable in case a module depends on another one
+            std::string pathVariable = getenv("PATH");
+            putenv(const_cast<char*>(("PATH=" + pathVariable + ";" + configuration_->modulePath_.string()).c_str()));
+
+            boost::filesystem::directory_iterator file(searchpath);
+            boost::filesystem::directory_iterator end;
+
+            // Iterate through all files
+            while (file != end)
+            {
+                std::string filename = file->BOOST_LEAF_FUNCTION();
+
+                // Check if the file ends with the exension in question
+                if (filename.size() > moduleextensionlength)
+                {
+                    if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)
+                    {
+                        // We've found a helper file - now load the library with the same name
+                        std::string library = filename.substr(0, filename.size() - moduleextensionlength);
+                        boost::filesystem::path librarypath = searchpath / library;
+
+                        try
+                        {
+                            DynLibManager::getInstance().load(librarypath.string());
+                        }
+                        catch (...)
+                        {
+                            COUT(1) << "Couldn't load module \"" << librarypath.string() << "\": " << Exception::handleMessage() << std::endl;
+                        }
+                    }
+                }
+
+                ++file;
+            }
+        }
+        catch (...)
+        {
+            COUT(1) << "An error occurred while loading modules: " << Exception::handleMessage() << std::endl;
+        }
+
+        // Parse command line arguments AFTER the modules have been loaded (static code!)
+        CommandLine::parseCommandLine(cmdLine);
+
+        // Set configurable paths like log, config and media
+        this->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");
+
+        // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used
+        OutputHandler::getOutStream().setLogPath(Core::getLogPathString());
+
+        // Parse additional options file now that we know its path
+        CommandLine::parseFile();
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+        // limit the main thread to the first core so that QueryPerformanceCounter doesn't jump
+        // do this after ogre has initialised. Somehow Ogre changes the settings again (not through
+        // the timer though).
+        int limitToCPU = CommandLine::getValue("limitToCPU");
+        if (limitToCPU > 0)
+            setThreadAffinity(static_cast<unsigned int>(limitToCPU));
+#endif
+
+        // Manage ini files and set the default settings file (usually orxonox.ini)
+        this->configFileManager_.reset(new ConfigFileManager());
+        this->configFileManager_->setFilename(ConfigFileType::Settings,
+            CommandLine::getValue("settingsFile").getString());
+
+        // Required as well for the config values
+        this->languageInstance_.reset(new Language());
+
+        // creates the class hierarchy for all classes with factories
+        Factory::createClassHierarchy();
+
+        // Do this soon after the ConfigFileManager has been created to open up the
+        // possibility to configure everything below here
+        this->configuration_->initialise();
+    }
+
+    /**
+    @brief
+        All destruction code is handled by scoped_ptrs and ScopeGuards.
+    */
+    Core::~Core()
+    {
+    }
+
+    /**
+        @brief Returns the softDebugLevel for the given device (returns a default-value if the class is right about to be created).
+        @param device The device
+        @return The softDebugLevel
+    */
+    /*static*/ int Core::getSoftDebugLevel(OutputHandler::OutputDevice device)
+    {
+        switch (device)
+        {
+        case OutputHandler::LD_All:
+            return Core::getInstance().configuration_->softDebugLevel_;
+        case OutputHandler::LD_Console:
+            return Core::getInstance().configuration_->softDebugLevelConsole_;
+        case OutputHandler::LD_Logfile:
+            return Core::getInstance().configuration_->softDebugLevelLogfile_;
+        case OutputHandler::LD_Shell:
+            return Core::getInstance().configuration_->softDebugLevelShell_;
+        default:
+            assert(0);
+            return 2;
+        }
+    }
+
+     /**
+        @brief Sets the softDebugLevel for the given device. Please use this only temporary and restore the value afterwards, as it overrides the configured value.
+        @param device The device
+        @param level The level
+    */
+    /*static*/ void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
+    {
+        if (device == OutputHandler::LD_All)
+            Core::getInstance().configuration_->softDebugLevel_ = level;
+        else if (device == OutputHandler::LD_Console)
+            Core::getInstance().configuration_->softDebugLevelConsole_ = level;
+        else if (device == OutputHandler::LD_Logfile)
+            Core::getInstance().configuration_->softDebugLevelLogfile_ = level;
+        else if (device == OutputHandler::LD_Shell)
+            Core::getInstance().configuration_->softDebugLevelShell_ = level;
+
+        OutputHandler::setSoftDebugLevel(device, level);
+    }
+
+    /**
+        @brief Returns the configured language.
+    */
+    /*static*/ const std::string& Core::getLanguage()
+    {
+        return Core::getInstance().configuration_->language_;
+    }
+
+    /**
+        @brief Sets the language in the config-file back to the default.
+    */
+    /*static*/ void Core::resetLanguage()
+    {
+        Core::getInstance().configuration_->resetLanguage();
+    }
+
+    /*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
+        The code of this function has been copied and adjusted from OGRE, an open source graphics engine.
+            (Object-oriented Graphics Rendering Engine)
+        For the latest info, see http://www.ogre3d.org/
+
+        Copyright (c) 2000-2008 Torus Knot Software Ltd
+
+        OGRE is licensed under the LGPL. For more info, see OGRE license.
+    */
+    void Core::setThreadAffinity(int limitToCPU)
+    {
+#ifdef ORXONOX_PLATFORM_WINDOWS
+
+        if (limitToCPU <= 0)
+            return;
+
+        unsigned int coreNr = limitToCPU - 1;
+        // Get the current process core mask
+        DWORD procMask;
+        DWORD sysMask;
+#  if _MSC_VER >= 1400 && defined (_M_X64)
+        GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR)&procMask, (PDWORD_PTR)&sysMask);
+#  else
+        GetProcessAffinityMask(GetCurrentProcess(), &procMask, &sysMask);
+#  endif
+
+        // If procMask is 0, consider there is only one core available
+        // (using 0 as procMask will cause an infinite loop below)
+        if (procMask == 0)
+            procMask = 1;
+
+        // if the core specified with coreNr is not available, take the lowest one
+        if (!(procMask & (1 << coreNr)))
+            coreNr = 0;
+
+        // Find the lowest core that this process uses and coreNr suggests
+        DWORD threadMask = 1;
+        while ((threadMask & procMask) == 0 || (threadMask < (1u << coreNr)))
+            threadMask <<= 1;
+
+        // Set affinity to the first core
+        SetThreadAffinityMask(GetCurrentThread(), threadMask);
+#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;
+            configuration_->modulePath_ = specialConfig::moduleDevDirectory;
+        }
+        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?");
+
+            // Module path is fixed as well
+            configuration_->modulePath_ = configuration_->rootPath_ / specialConfig::defaultModulePath;
+
+#else
+
+            // There is no root path, so don't set it at all
+            // Module path is fixed as well
+            configuration_->modulePath_ = specialConfig::moduleInstallDirectory;
+
+#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;
+            }
+        }
+    }
+
+    void Core::preUpdate(const Clock& time)
+    {
+    }
+
+    void Core::postUpdate(const Clock& time)
+    {
+    }
+}
Index: /sandbox_light/src/libraries/core/Core.h
===================================================================
--- /sandbox_light/src/libraries/core/Core.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/Core.h	(revision 5788)
@@ -0,0 +1,130 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    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__
+
+#include "CorePrereqs.h"
+
+#include <cassert>
+#include <boost/scoped_ptr.hpp>
+#include "util/OutputHandler.h"
+#include "util/ScopeGuard.h"
+#include "util/Singleton.h"
+
+namespace orxonox
+{
+    class CoreConfiguration;
+
+    /**
+    @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!
+    */
+    class _CoreExport Core : public Singleton<Core>
+    {
+        typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard;
+        friend class Singleton<Core>;
+        friend class Game;
+
+        public:
+            /**
+            @brief
+                Determines the executable path, checks for build directory runs, creates
+                the output directories and sets up the other core library singletons.
+            @throws
+                GeneralException
+            */
+            Core(const std::string& cmdLine);
+            ~Core();
+
+            void setConfigValues();
+
+            static int   getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
+            static void  setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
+            static const std::string& getLanguage();
+            static void  resetLanguage();
+
+            //! 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 preUpdate(const Clock& time);
+            void postUpdate(const Clock& time);
+
+            void setFixedPaths();
+            void setConfigurablePaths();
+            void setThreadAffinity(int limitToCPU);
+
+            // Mind the order for the destruction!
+            scoped_ptr<DynLibManager>     dynLibManager_;
+            scoped_ptr<SignalHandler>     signalHandler_;
+            SimpleScopeGuard              identifierDestroyer_;
+            scoped_ptr<ConfigFileManager> configFileManager_;
+            scoped_ptr<Language>          languageInstance_;
+            scoped_ptr<CoreConfiguration> configuration_;
+
+            bool                          bDevRun_;             //!< True for runs in the build directory (not installed)
+
+            static Core* singletonPtr_s;
+    };
+}
+
+#endif /* _Core_H__ */
Index: /sandbox_light/src/libraries/core/CoreIncludes.h
===================================================================
--- /sandbox_light/src/libraries/core/CoreIncludes.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/CoreIncludes.h	(revision 5788)
@@ -0,0 +1,113 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of macros for Identifier and Factory.
+
+    Every class needs the RegisterObject(class) macro in its constructor. If the class is an interface
+    or the BaseObject itself, it needs the macro RegisterRootObject(class) instead.
+
+    To allow the object being created through the factory, use the CreateFactory(class) macro outside
+    the of the class implementation, so it gets executed before main().
+*/
+
+#ifndef _CoreIncludes_H__
+#define _CoreIncludes_H__
+
+#include "CorePrereqs.h"
+
+#include "util/Debug.h"
+#include "Identifier.h"
+#include "Factory.h"
+#include "ClassFactory.h"
+#include "ObjectList.h"
+
+
+/**
+    @brief Intern macro, containing the common parts of RegisterObject and RegisterRootObject.
+    @param ClassName The name of the class
+    @param bRootClass True if the class is directly derived from OrxonoxClass
+*/
+#define InternRegisterObject(ClassName, bRootClass) \
+    if (ClassIdentifier<ClassName>::getIdentifier(#ClassName)->initialiseObject(this, #ClassName, bRootClass)) \
+        return; \
+    else \
+        ((void)0)
+
+/**
+    @brief RegisterObject - with and without debug output.
+    @param ClassName The name of the class
+*/
+#define RegisterObject(ClassName) \
+    InternRegisterObject(ClassName, false)
+
+/**
+    @brief RegisterRootObject - with and without debug output.
+    @param ClassName The name of the class
+*/
+#define RegisterRootObject(ClassName) \
+    InternRegisterObject(ClassName, true)
+
+/**
+    @brief Creates the entry in the Factory.
+    @param ClassName The name of the class
+*/
+#define CreateFactory(ClassName) \
+    bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName)
+
+/**
+    @brief Returns the Identifier of the given class.
+    @param ClassName The name of the class
+*/
+#define Class(ClassName) \
+    orxonox::ClassIdentifier<ClassName>::getIdentifier()
+
+
+namespace orxonox
+{
+    /**
+        @brief Returns the Identifier with a given name through the factory.
+        @param String The name of the class
+    */
+    inline Identifier* ClassByString(const std::string& name)
+    {
+        return Factory::getIdentifier(name);
+    }
+
+    /**
+        @brief Returns the Identifier with a given network ID through the factory.
+        @param networkID The network ID of the class
+    */
+    inline Identifier* ClassByID(uint32_t id)
+    {
+        return Factory::getIdentifier(id);
+    }
+}
+
+#endif /* _CoreIncludes_H__ */
Index: /sandbox_light/src/libraries/core/CorePrecompiledHeaders.h
===================================================================
--- /sandbox_light/src/libraries/core/CorePrecompiledHeaders.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/CorePrecompiledHeaders.h	(revision 5788)
@@ -0,0 +1,82 @@
+/*
+ *   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
+    Compilation of the most often used header files in the core library
+@details
+    Updated: 13. September 2009
+    Total Files: 56
+*/
+
+#include "OrxonoxConfig.h"
+
+///////////////////////////////////////////
+/////          Stable Headers         /////
+///////////////////////////////////////////
+
+#include <string>   // 54
+#include <vector>   // 54
+#include <cassert>  // 53
+#include <fstream>  // 53
+#include <iostream> // 53
+#include <map>      // 53
+#include <sstream>  // 53
+#include <set>      // 50
+
+#include "util/Debug.h" // 48
+
+#include <deque>    // 43
+#include <list>     // 44
+#include <cmath>    // 42
+
+#include "util/ScopeGuard.h" // 38
+
+#include <OgreMath.h>        // 36
+#include <OgreVector2.h>     // 36
+#include <OgreVector3.h>     // 36
+#include <OgreVector4.h>     // 36
+#include <OgreQuaternion.h>  // 36
+#include <OgreColourValue.h> // 36
+#include <boost/preprocessor/cat.hpp> // 27
+#include <boost/shared_ptr.hpp> // 21
+
+#ifdef ORXONOX_COMPILER_MSVC
+
+#include "util/SubString.h"  // 14
+
+#include <boost/scoped_ptr.hpp> // 13
+#include <stack> // 12
+
+#endif /*ORXONOX_COMPILER_MSVC */
+
+
+// Just in case some header included windows.h
+#undef min
+#undef max
Index: /sandbox_light/src/libraries/core/CorePrereqs.h
===================================================================
--- /sandbox_light/src/libraries/core/CorePrereqs.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/CorePrereqs.h	(revision 5788)
@@ -0,0 +1,294 @@
+/*
+ *   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 Contains all the necessary forward declarations for all classes and structs.
+*/
+
+#ifndef _CorePrereqs_H__
+#define _CorePrereqs_H__
+
+#include "OrxonoxConfig.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( CORE_STATIC_BUILD )
+#  ifdef CORE_SHARED_BUILD
+#    define _CoreExport __declspec(dllexport)
+#  else
+#    if defined( __MINGW32__ )
+#      define _CoreExport
+#    else
+#      define _CoreExport __declspec(dllimport)
+#    endif
+#  endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+#  define _CoreExport  __attribute__ ((visibility("default")))
+#else
+#  define _CoreExport
+#endif
+
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+namespace orxonox
+{
+    namespace XMLPort
+    {
+        enum Mode
+        {
+            LoadObject,
+            SaveObject,
+            ExpandObject
+        };
+    }
+
+    namespace KeybindMode
+    {
+        enum Value
+        {
+            OnPress,
+            OnHold,
+            OnRelease,
+            None
+        };
+    };
+
+    typedef std::string LanguageEntryLabel;
+
+    class ArgumentCompleter;
+    class ArgumentCompletionListElement;
+    class BaseFactory;
+    class BaseMetaObjectListElement;
+    class BaseObject;
+    template <class T>
+    class ClassFactory;
+    template <class T>
+    class ClassIdentifier;
+    class ClassTreeMask;
+    class ClassTreeMaskIterator;
+    class ClassTreeMaskNode;
+    class ClassTreeMaskObjectIterator;
+    class Clock;
+    class CommandEvaluation;
+    class CommandExecutor;
+    class CommandLine;
+    class CommandLineArgument;
+    class ConfigFile;
+    class ConfigFileEntry;
+    class ConfigFileEntryComment;
+    class ConfigFileEntryValue;
+    class ConfigFileManager;
+    class ConfigFileSection;
+    class ConfigValueContainer;
+    class ConsoleCommand;
+    class Core;
+    class DynLib;
+    class DynLibManager;
+    struct Event;
+    class EventContainer;
+    class Executor;
+    template <class T>
+    class ExecutorMember;
+    class ExecutorStatic;
+    class Factory;
+    class Functor;
+    template <class T>
+    class FunctorMember;
+    class FunctorStatic;
+    class GraphicsManager;
+    class GUIManager;
+    class Identifier;
+    class IRC;
+    template <class T>
+    class Iterator;
+    class IteratorBase;
+    class Language;
+    class LanguageEntry;
+    class Loader;
+    class LuaState;
+    class MemoryArchive;
+    class MemoryArchiveFactory;
+    class MetaObjectList;
+    class MetaObjectListElement;
+    class Namespace;
+    class NamespaceNode;
+    template <class T>
+    class ObjectList;
+    class ObjectListBase;
+    class ObjectListBaseElement;
+    template <class T>
+    class ObjectListElement;
+    template <class T>
+    class ObjectListIterator;
+    class OgreWindowEventListener;
+    class OrxonoxClass;
+    struct ResourceInfo;
+    class Shell;
+    class ShellListener;
+    template <class T>
+    class SubclassIdentifier;
+    class TclBind;
+    struct TclInterpreterBundle;
+    template <class T>
+    class TclThreadList;
+    class TclThreadManager;
+    class Template;
+    class WindowEventListener;
+    class XMLFile;
+    class XMLNameListener;
+    template <class T, class O>
+    class XMLPortClassObjectContainer;
+    template <class T>
+    class XMLPortClassParamContainer;
+    class XMLPortObjectContainer;
+    class XMLPortParamContainer;
+
+    // game states
+    class Game;
+    class GameState;
+    struct GameStateInfo;
+    struct GameStateTreeNode;
+
+    // input
+    class BaseCommand;
+    class BufferedParamCommand;
+    class Button;
+    class CalibratorCallback;
+    class HalfAxis;
+    class InputBuffer;
+    class InputDevice;
+    template <class Traits>
+    class InputDeviceTemplated;
+    class InputHandler;
+    class InputManager;
+    class InputState;
+    class JoyStick;
+    class Mouse;
+    class Keyboard;
+    class KeyBinder;
+    class KeyDetector;
+    class ParamCommand;
+    class SimpleCommand;
+
+
+    // multithreading
+    class Thread;
+    class ThreadPool;
+}
+
+// CppTcl
+namespace Tcl
+{
+    class interpreter;
+    class object;
+}
+
+// Boost
+namespace boost
+{
+    namespace filesystem
+    {
+        struct path_traits;
+        template <class String, class Traits> class basic_path;
+        typedef basic_path<std::string, path_traits> path;
+    }
+    class thread;
+    class mutex;
+    class shared_mutex;
+    class condition_variable;
+}
+
+// Ogre
+namespace Ogre
+{
+    class DataStream;
+    template <class T> class SharedPtr;
+    typedef SharedPtr<DataStream> DataStreamPtr;
+}
+namespace orxonox
+{
+    // Import the Ogre::DataStream
+    using Ogre::DataStream;
+    using Ogre::DataStreamPtr;
+}
+
+// CEGUI
+namespace CEGUI
+{
+    class DefaultLogger;
+    class Logger;
+    class LuaScriptModule;
+
+    class OgreCEGUIRenderer;
+    class OgreCEGUIResourceProvider;
+    class OgreCEGUITexture;
+}
+
+// Lua
+struct lua_State;
+
+// TinyXML and TinyXML++
+class TiXmlString;
+class TiXmlOutStream;
+class TiXmlNode;
+class TiXmlHandle;
+class TiXmlDocument;
+class TiXmlElement;
+class TiXmlComment;
+class TiXmlUnknown;
+class TiXmlAttribute;
+class TiXmlText;
+class TiXmlDeclaration;
+class TiXmlParsingData;
+namespace ticpp
+{
+    class Document;
+    class Element;
+    class Declaration;
+    class StylesheetReference;
+    class Text;
+    class Comment;
+    class Attribute;
+}
+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/DynLib.cc
===================================================================
--- /sandbox_light/src/libraries/core/DynLib.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/DynLib.cc	(revision 5788)
@@ -0,0 +1,138 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2006 Torus Knot Software Ltd
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+
+You may alternatively use this source under the terms of a specific version of
+the OGRE Unrestricted License provided you have obtained such a license from
+Torus Knot Software Ltd.
+-----------------------------------------------------------------------------
+*/
+
+// 08/11/2009: Small adjustments for Orxonox by Fabian 'x3n' Landau
+
+#include "DynLib.h"
+
+#include "util/Exception.h"
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+#  define WIN32_LEAN_AND_MEAN
+#  ifndef NOMINMAX
+#    define NOMINMAX // required to stop windows.h messing up std::min
+#  endif
+#  include <windows.h>
+#endif
+
+#ifdef ORXONOX_PLATFORM_LINUX
+#  include <dlfcn.h>
+#endif
+
+#ifdef ORXONOX_PLATFORM_APPLE
+#  include <macPlugins.h>
+#endif
+
+namespace orxonox
+{
+    //-----------------------------------------------------------------------
+    DynLib::DynLib( const std::string& name )
+    {
+        mName = name;
+        m_hInst = NULL;
+    }
+
+    //-----------------------------------------------------------------------
+    DynLib::~DynLib()
+    {
+    }
+
+    //-----------------------------------------------------------------------
+    void DynLib::load()
+    {
+        // Log library load
+        COUT(2) << "Loading module " << mName << std::endl;
+
+		std::string name = mName;
+#ifdef ORXONOX_PLATFORM_LINUX
+        // dlopen() does not add .so to the filename, like windows does for .dll
+        if (name.substr(name.length() - 3, 3) != ".so")
+           name += ".so";
+#endif
+
+        m_hInst = (DYNLIB_HANDLE)DYNLIB_LOAD( name.c_str() );
+
+        if( !m_hInst )
+            ThrowException(
+                General,
+                "Could not load dynamic library " + mName +
+                ".  System Error: " + dynlibError());
+    }
+
+    //-----------------------------------------------------------------------
+    void DynLib::unload()
+    {
+        // Log library unload
+        COUT(4) << "Unloading module " << mName << std::endl;
+
+        if( DYNLIB_UNLOAD( m_hInst ) )
+		{
+            ThrowException(
+                General,
+                "Could not unload dynamic library " + mName +
+                ".  System Error: " + dynlibError());
+		}
+
+    }
+
+    //-----------------------------------------------------------------------
+    void* DynLib::getSymbol( const std::string& strName ) const throw()
+    {
+        return (void*)DYNLIB_GETSYM( m_hInst, strName.c_str() );
+    }
+    //-----------------------------------------------------------------------
+    std::string DynLib::dynlibError( void )
+    {
+#if defined(ORXONOX_PLATFORM_WINDOWS)
+        LPVOID lpMsgBuf;
+        FormatMessage(
+            FORMAT_MESSAGE_ALLOCATE_BUFFER |
+            FORMAT_MESSAGE_FROM_SYSTEM |
+            FORMAT_MESSAGE_IGNORE_INSERTS,
+            NULL,
+            GetLastError(),
+            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+            (LPTSTR) &lpMsgBuf,
+            0,
+            NULL
+            );
+        std::string ret = (char*)lpMsgBuf;
+        // Free the buffer.
+        LocalFree( lpMsgBuf );
+        return ret;
+#elif defined(ORXONOX_PLATFORM_LINUX)
+        return std::string(dlerror());
+#elif defined(ORXONOX_PLATFORM_APPLE)
+        return std::string(mac_errorBundle());
+#else
+        return std::string("");
+#endif
+    }
+
+}
Index: /sandbox_light/src/libraries/core/DynLib.h
===================================================================
--- /sandbox_light/src/libraries/core/DynLib.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/DynLib.h	(revision 5788)
@@ -0,0 +1,121 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2006 Torus Knot Software Ltd
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+
+You may alternatively use this source under the terms of a specific version of
+the OGRE Unrestricted License provided you have obtained such a license from
+Torus Knot Software Ltd.
+-----------------------------------------------------------------------------
+*/
+
+// 08/11/2009: Small adjustments for Orxonox by Fabian 'x3n' Landau
+
+#ifndef _Core_DynLib_H__
+#define _Core_DynLib_H__
+
+#include "CorePrereqs.h"
+
+#include <string>
+
+#if defined(ORXONOX_PLATFORM_WINDOWS)
+#    define DYNLIB_HANDLE hInstance
+#    define DYNLIB_LOAD( a ) LoadLibraryEx( a, NULL, LOAD_WITH_ALTERED_SEARCH_PATH )
+#    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
+#    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
+
+struct HINSTANCE__;
+typedef struct HINSTANCE__* hInstance;
+
+#elif defined(ORXONOX_PLATFORM_LINUX)
+#    define DYNLIB_HANDLE void*
+#    define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL)
+#    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
+#    define DYNLIB_UNLOAD( a ) dlclose( a )
+
+#elif defined(ORXONOX_PLATFORM_APPLE)
+#    define DYNLIB_HANDLE CFBundleRef
+#    define DYNLIB_LOAD( a ) mac_loadExeBundle( a )
+#    define DYNLIB_GETSYM( a, b ) mac_getBundleSym( a, b )
+#    define DYNLIB_UNLOAD( a ) mac_unloadExeBundle( a )
+#endif
+
+namespace orxonox
+{
+    /** Resource holding data about a dynamic library.
+        @remarks
+            This class holds the data required to get symbols from
+            libraries loaded at run-time (i.e. from DLL's for so's)
+        @author
+            Adrian Cearnãu (cearny@cearny.ro)
+        @since
+            27 January 2002
+        @see
+            Resource
+    */
+	class _CoreExport DynLib
+    {
+	protected:
+		std::string mName;
+        /// Gets the last loading error
+        std::string dynlibError(void);
+    public:
+        /** Default constructor - used by DynLibManager.
+            @warning
+                Do not call directly
+        */
+        DynLib( const std::string& name );
+
+        /** Default destructor.
+        */
+        ~DynLib();
+
+        /** Load the library
+        */
+        void load();
+        /** Unload the library
+        */
+        void unload();
+		/// Get the name of the library
+		const std::string& getName(void) const { return mName; }
+
+        /**
+            Returns the address of the given symbol from the loaded library.
+            @param
+                strName The name of the symbol to search for
+            @returns
+                If the function succeeds, the returned value is a handle to
+                the symbol.
+            @par
+                If the function fails, the returned value is <b>NULL</b>.
+
+        */
+        void* getSymbol( const std::string& strName ) const throw();
+
+    protected:
+
+        /// Handle to the loaded library.
+        DYNLIB_HANDLE m_hInst;
+    };
+
+}
+
+#endif /* _Core_DynLib_H__ */
Index: /sandbox_light/src/libraries/core/DynLibManager.cc
===================================================================
--- /sandbox_light/src/libraries/core/DynLibManager.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/DynLibManager.cc	(revision 5788)
@@ -0,0 +1,86 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2006 Torus Knot Software Ltd
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+
+You may alternatively use this source under the terms of a specific version of
+the OGRE Unrestricted License provided you have obtained such a license from
+Torus Knot Software Ltd.
+-----------------------------------------------------------------------------
+*/
+
+// 08/11/2009: Small adjustments for Orxonox by Fabian 'x3n' Landau
+
+#include "DynLibManager.h"
+
+#include "DynLib.h"
+
+namespace orxonox
+{
+    //-----------------------------------------------------------------------
+    //! Static pointer to the singleton
+    DynLibManager* DynLibManager::singletonPtr_s  = 0;
+
+    //-----------------------------------------------------------------------
+	DynLibManager::DynLibManager()
+	{
+	}
+	//-----------------------------------------------------------------------
+    DynLib* DynLibManager::load( const std::string& filename)
+    {
+		DynLibList::iterator i = mLibList.find(filename);
+		if (i != mLibList.end())
+		{
+			return i->second;
+		}
+		else
+		{
+	        DynLib* pLib = new DynLib(filename);
+			pLib->load();
+        	mLibList[filename] = pLib;
+	        return pLib;
+		}
+    }
+	//-----------------------------------------------------------------------
+	void DynLibManager::unload(DynLib* lib)
+	{
+		DynLibList::iterator i = mLibList.find(lib->getName());
+		if (i != mLibList.end())
+		{
+			mLibList.erase(i);
+		}
+		lib->unload();
+		delete lib;
+	}
+	//-----------------------------------------------------------------------
+    DynLibManager::~DynLibManager()
+    {
+        // Unload & delete resources in turn
+        for( DynLibList::iterator it = mLibList.begin(); it != mLibList.end(); ++it )
+        {
+            it->second->unload();
+            delete it->second;
+        }
+
+        // Empty the list
+        mLibList.clear();
+    }
+}
Index: /sandbox_light/src/libraries/core/DynLibManager.h
===================================================================
--- /sandbox_light/src/libraries/core/DynLibManager.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/DynLibManager.h	(revision 5788)
@@ -0,0 +1,90 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2006 Torus Knot Software Ltd
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+
+You may alternatively use this source under the terms of a specific version of
+the OGRE Unrestricted License provided you have obtained such a license from
+Torus Knot Software Ltd.
+-----------------------------------------------------------------------------
+*/
+
+// 08/11/2009: Small adjustments for Orxonox by Fabian 'x3n' Landau
+
+#ifndef _Core_DynLibManager_H__
+#define _Core_DynLibManager_H__
+
+#include "CorePrereqs.h"
+
+#include <map>
+#include <string>
+#include "util/Singleton.h"
+
+namespace orxonox
+{
+    /** Manager for Dynamic-loading Libraries.
+        @remarks
+            This manager keeps a track of all the open dynamic-loading
+            libraries, opens them and returns references to already-open
+            libraries.
+    */
+    class _CoreExport DynLibManager: public Singleton<DynLibManager>
+    {
+        friend class Singleton<DynLibManager>;
+
+        protected:
+            typedef std::map<std::string, DynLib*> DynLibList;
+            DynLibList mLibList;
+
+        public:
+            /** Default constructor.
+                @note
+                    <br>Should never be called as the singleton is automatically
+                    created during the creation of the Root object.
+                @see
+                    Root::Root
+            */
+            DynLibManager();
+
+            /** Default destructor.
+                @see
+                    Root::~Root
+            */
+            virtual ~DynLibManager();
+
+            /** Loads the passed library.
+                @param
+                    filename The name of the library. The extension can be omitted
+            */
+            DynLib* load(const std::string& filename);
+
+            /** Unloads the passed library.
+            @param
+            filename The name of the library. The extension can be omitted
+            */
+            void unload(DynLib* lib);
+
+        private:
+            static DynLibManager* singletonPtr_s;
+    };
+}
+
+#endif /* _Core_DynLibManager_H__ */
Index: /sandbox_light/src/libraries/core/Executor.cc
===================================================================
--- /sandbox_light/src/libraries/core/Executor.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/Executor.cc	(revision 5788)
@@ -0,0 +1,252 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ *   Inspiration: Executor by Benjamin Grauer
+ */
+
+#include "Executor.h"
+
+#include "util/Convert.h"
+#include "Language.h"
+
+namespace orxonox
+{
+    Executor::Executor(Functor* functor, const std::string& name)
+    {
+        this->functor_ = functor;
+        this->name_ = name;
+
+        this->bAddedDescription_ = false;
+        this->bAddedDescriptionReturnvalue_ = false;
+
+        this->bAddedDescriptionParam_[0] = false;
+        this->bAddedDescriptionParam_[1] = false;
+        this->bAddedDescriptionParam_[2] = false;
+        this->bAddedDescriptionParam_[3] = false;
+        this->bAddedDescriptionParam_[4] = false;
+
+        this->bAddedDefaultValue_[0] = false;
+        this->bAddedDefaultValue_[1] = false;
+        this->bAddedDefaultValue_[2] = false;
+        this->bAddedDefaultValue_[3] = false;
+        this->bAddedDefaultValue_[4] = false;
+    }
+
+    Executor::~Executor()
+    {
+        delete this->functor_;
+    }
+
+    bool Executor::parse(const std::string& params, const std::string& delimiter) const
+    {
+        EXECUTOR_PARSE(normal);
+    }
+
+    bool Executor::evaluate(const std::string& params, MultiType param[5], const std::string& delimiter) const
+    {
+        unsigned int paramCount = this->functor_->getParamCount();
+
+        if (paramCount == 1)
+        {
+            // only one param: check if there are params given, otherwise try to use default values
+            std::string temp = getStripped(params);
+            if ((temp != "") && (temp.size() != 0))
+            {
+                param[0] = params;
+                this->functor_->evaluateParam(0, param[0]);
+                return true;
+            }
+            else if (this->bAddedDefaultValue_[0])
+            {
+                param[0] = this->defaultValue_[0];
+                this->functor_->evaluateParam(0, param[0]);
+                return true;
+            }
+            return false;
+        }
+        else
+        {
+            // more than one param
+            SubString tokens(params, delimiter, SubString::WhiteSpaces, false, '\\', true, '"', true, '(', ')', true, '\0');
+
+            // if there are not enough params given, check if there are default values
+            for (unsigned int i = tokens.size(); i < this->functor_->getParamCount(); i++)
+                if (!this->bAddedDefaultValue_[i])
+                    return false;
+
+            // assign all given arguments to the multitypes
+            for (unsigned int i = 0; i < std::min(tokens.size(), MAX_FUNCTOR_ARGUMENTS); i++)
+                param[i] = tokens[i];
+
+            // fill the remaining multitypes with default values
+            for (unsigned int i = tokens.size(); i < std::min(paramCount, MAX_FUNCTOR_ARGUMENTS); i++)
+                param[i] = this->defaultValue_[i];
+
+            // evaluate the param types through the functor
+            for (unsigned int i = 0; i < std::min(paramCount, MAX_FUNCTOR_ARGUMENTS); i++)
+                this->functor_->evaluateParam(i, param[i]);
+
+            return true;
+        }
+    }
+
+    Executor& Executor::setDescription(const std::string& description)
+    {
+        if (!this->bAddedDescription_)
+        {
+            this->description_ = std::string("ExecutorDescription::" + this->name_ + "::function");
+            AddLanguageEntry(this->description_, description);
+            this->bAddedDescription_ = true;
+        }
+        return (*this);
+    }
+
+    const std::string& Executor::getDescription() const
+    {
+        return GetLocalisation(this->description_);
+    }
+
+    Executor& Executor::setDescriptionParam(unsigned int param, const std::string& description)
+    {
+        if (param < MAX_FUNCTOR_ARGUMENTS)
+        {
+            if (!this->bAddedDescriptionParam_[param])
+            {
+                std::string paramnumber;
+                if (!convertValue(&paramnumber, param))
+                    return (*this);
+
+                this->descriptionParam_[param] = std::string("ExecutorDescription::" + this->name_ + "::param" + paramnumber);
+                AddLanguageEntry(this->descriptionParam_[param], description);
+                this->bAddedDescriptionParam_[param] = true;
+            }
+        }
+        return (*this);
+    }
+
+    const std::string& Executor::getDescriptionParam(unsigned int param) const
+    {
+        if (param < MAX_FUNCTOR_ARGUMENTS)
+            return GetLocalisation(this->descriptionParam_[param]);
+
+        return this->descriptionParam_[0];
+    }
+
+    Executor& Executor::setDescriptionReturnvalue(const std::string& description)
+    {
+        if (!this->bAddedDescriptionReturnvalue_)
+        {
+            this->descriptionReturnvalue_ = std::string("ExecutorDescription::" + this->name_ + "::returnvalue");
+            AddLanguageEntry(this->descriptionReturnvalue_, description);
+            this->bAddedDescriptionReturnvalue_ = true;
+        }
+        return (*this);
+    }
+
+    const std::string& Executor::getDescriptionReturnvalue(int param) const
+    {
+        return GetLocalisation(this->descriptionReturnvalue_);
+    }
+
+    Executor& Executor::setDefaultValues(const MultiType& param1)
+    {
+        this->defaultValue_[0] = param1;
+        this->bAddedDefaultValue_[0] = true;
+
+        return (*this);
+    }
+
+    Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2)
+    {
+        this->defaultValue_[0] = param1;
+        this->bAddedDefaultValue_[0] = true;
+        this->defaultValue_[1] = param2;
+        this->bAddedDefaultValue_[1] = true;
+
+        return (*this);
+    }
+
+    Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3)
+    {
+        this->defaultValue_[0] = param1;
+        this->bAddedDefaultValue_[0] = true;
+        this->defaultValue_[1] = param2;
+        this->bAddedDefaultValue_[1] = true;
+        this->defaultValue_[2] = param3;
+        this->bAddedDefaultValue_[2] = true;
+
+        return (*this);
+    }
+
+    Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4)
+    {
+        this->defaultValue_[0] = param1;
+        this->bAddedDefaultValue_[0] = true;
+        this->defaultValue_[1] = param2;
+        this->bAddedDefaultValue_[1] = true;
+        this->defaultValue_[2] = param3;
+        this->bAddedDefaultValue_[2] = true;
+        this->defaultValue_[3] = param4;
+        this->bAddedDefaultValue_[3] = true;
+
+        return (*this);
+    }
+
+    Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5)
+    {
+        this->defaultValue_[0] = param1;
+        this->bAddedDefaultValue_[0] = true;
+        this->defaultValue_[1] = param2;
+        this->bAddedDefaultValue_[1] = true;
+        this->defaultValue_[2] = param3;
+        this->bAddedDefaultValue_[2] = true;
+        this->defaultValue_[3] = param4;
+        this->bAddedDefaultValue_[3] = true;
+        this->defaultValue_[4] = param5;
+        this->bAddedDefaultValue_[4] = true;
+
+        return (*this);
+    }
+
+    Executor& Executor::setDefaultValue(unsigned int index, const MultiType& param)
+    {
+        if (index < MAX_FUNCTOR_ARGUMENTS)
+        {
+            this->defaultValue_[index] = param;
+            this->bAddedDefaultValue_[index] = true;
+        }
+        return (*this);
+    }
+
+    bool Executor::allDefaultValuesSet() const
+    {
+        for (unsigned int i = 0; i < this->functor_->getParamCount(); i++)
+            if (!this->bAddedDefaultValue_[i])
+                return false;
+
+        return true;
+    }
+}
Index: /sandbox_light/src/libraries/core/Executor.h
===================================================================
--- /sandbox_light/src/libraries/core/Executor.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/Executor.h	(revision 5788)
@@ -0,0 +1,312 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ *   Inspiration: Executor by Benjamin Grauer
+ */
+
+#ifndef _Executor_H__
+#define _Executor_H__
+
+#include "CorePrereqs.h"
+
+#include <algorithm>
+#include <string>
+
+#include "util/Debug.h"
+#include "util/Math.h"
+#include "util/StringUtils.h"
+#include "util/SubString.h"
+#include "Functor.h"
+
+
+#define EXECUTOR_PARSE_FUNCTORCALL(mode) EXECUTOR_PARSE_FUNCTORCALL##mode
+#define EXECUTOR_PARSE_FUNCTORCALLnormal (*this->functor_)
+#define EXECUTOR_PARSE_FUNCTORCALLobject (*((FunctorMember<T>*)this->functor_))
+
+#define EXECUTOR_PARSE_OBJECT(mode, comma) EXECUTOR_PARSE_OBJECT##mode##comma
+#define EXECUTOR_PARSE_OBJECTnormal0
+#define EXECUTOR_PARSE_OBJECTnormal1
+#define EXECUTOR_PARSE_OBJECTobject0 object
+#define EXECUTOR_PARSE_OBJECTobject1 object,
+
+#define EXECUTOR_PARSE(mode) \
+    unsigned int paramCount = this->functor_->getParamCount(); \
+    \
+    if (paramCount == 0) \
+    { \
+        COUT(5) << "Calling Executor " << this->name_ << " through parser without parameters." << std::endl; \
+        EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 0)); \
+    } \
+    else if (paramCount == 1) \
+    { \
+        std::string temp = getStripped(params); \
+        if ((temp != "") && (temp.size() != 0)) \
+        { \
+            COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using whole string: " << params << std::endl; \
+            EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) MultiType(params)); \
+        } \
+        else if (this->bAddedDefaultValue_[0]) \
+        { \
+            COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using default value: " << this->defaultValue_[0] << std::endl; \
+            EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) this->defaultValue_[0]); \
+        } \
+        else \
+        { \
+            COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given (input: " << temp << ")." << std::endl; \
+            return false; \
+        } \
+    } \
+    else \
+    { \
+        SubString tokens(params, delimiter, SubString::WhiteSpaces, false, '\\', true, '"', true, '(', ')', true, '\0'); \
+        \
+        for (unsigned int i = tokens.size(); i < this->functor_->getParamCount(); i++) \
+        { \
+            if (!this->bAddedDefaultValue_[i]) \
+            { \
+                COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given (input:" << params << ")." << std::endl; \
+                return false; \
+            } \
+        } \
+        \
+        MultiType param[MAX_FUNCTOR_ARGUMENTS]; \
+        COUT(5) << "Calling Executor " << this->name_ << " through parser with " << paramCount << " parameters, using " << tokens.size() << " tokens ("; \
+        for (unsigned int i = 0; i < tokens.size() && i < MAX_FUNCTOR_ARGUMENTS; i++) \
+        { \
+            param[i] = tokens[i]; \
+            if (i != 0) \
+            { \
+                COUT(5) << ", "; \
+            } \
+            COUT(5) << tokens[i]; \
+        } \
+        COUT(5) << ") and " << std::max(static_cast<int>(paramCount) - static_cast<int>(tokens.size()), 0) << " default values ("; \
+        for (unsigned int i = tokens.size(); i < paramCount; i++) \
+        { \
+            param[i] = this->defaultValue_[i]; \
+            if (i != 0) \
+            { \
+                COUT(5) << ", "; \
+            } \
+            COUT(5) << this->defaultValue_[i]; \
+        } \
+        COUT(5) << ")." << std::endl; \
+        \
+        if ((tokens.size() > paramCount) && (this->functor_->getTypenameParam(paramCount - 1) == "string")) \
+            param[paramCount - 1] = tokens.subSet(paramCount - 1).join(); \
+        \
+        switch(paramCount) \
+        { \
+            case 2: \
+                EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) param[0], param[1]); \
+                break; \
+            case 3: \
+                EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) param[0], param[1], param[2]); \
+                break; \
+            case 4: \
+                EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) param[0], param[1], param[2], param[3]); \
+                break; \
+            case 5: \
+                EXECUTOR_PARSE_FUNCTORCALL(mode)(EXECUTOR_PARSE_OBJECT(mode, 1) param[0], param[1], param[2], param[3], param[4]); \
+                break; \
+        } \
+    } \
+    \
+    return true
+
+namespace orxonox
+{
+    class _CoreExport Executor
+    {
+        public:
+            Executor(Functor* functor, const std::string& name = "");
+            virtual ~Executor();
+
+            inline void operator()() const
+                { (*this->functor_)(this->defaultValue_[0], this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const MultiType& param1) const
+                { (*this->functor_)(param1, this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const MultiType& param1, const MultiType& param2) const
+                { (*this->functor_)(param1, param2, this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const MultiType& param1, const MultiType& param2, const MultiType& param3) const
+                { (*this->functor_)(param1, param2, param3, this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4) const
+                { (*this->functor_)(param1, param2, param3, param4, this->defaultValue_[4]); }
+            inline void operator()(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) const
+                { (*this->functor_)(param1, param2, param3, param4, param5); }
+
+            bool parse(const std::string& params, const std::string& delimiter = " ") const;
+
+            bool evaluate(const std::string& params, MultiType param[5], const std::string& delimiter = " ") const;
+
+            Executor& setDescription(const std::string& description);
+            const std::string& getDescription() const;
+
+            Executor& setDescriptionParam(unsigned int param, const std::string& description);
+            const std::string& getDescriptionParam(unsigned int param) const;
+
+            Executor& setDescriptionReturnvalue(const std::string& description);
+            const std::string& getDescriptionReturnvalue(int param) const;
+
+            inline Functor* getFunctor() const
+                { return this->functor_; }
+            inline unsigned int getParamCount() const
+                { return this->functor_->getParamCount(); }
+            inline bool hasReturnvalue() const
+                { return this->functor_->hasReturnvalue(); }
+            inline FunctionType::Value getType() const
+                { return this->functor_->getType(); }
+            inline const MultiType& getReturnvalue() const
+                { return this->functor_->getReturnvalue(); }
+            inline const std::string& getTypenameParam(unsigned int param) const
+                { return this->functor_->getTypenameParam(param); }
+            inline const std::string& getTypenameReturnvalue() const
+                { return this->functor_->getTypenameReturnvalue(); }
+
+            inline void setName(const std::string name)
+                { this->name_ = name; }
+            inline const std::string& getName() const
+                { return this->name_; }
+
+            Executor& setDefaultValues(const MultiType& param1);
+            Executor& setDefaultValues(const MultiType& param1, const MultiType& param2);
+            Executor& setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3);
+            Executor& setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4);
+            Executor& setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5);
+            Executor& setDefaultValue(unsigned int index, const MultiType& param);
+
+            inline MultiType getDefaultValue(unsigned int index) const
+            {
+                if (index < MAX_FUNCTOR_ARGUMENTS)
+                    return this->defaultValue_[index];
+
+                return MT_Type::Null;
+            }
+
+            bool allDefaultValuesSet() const;
+            inline bool defaultValueSet(unsigned int index) const
+            {
+                if (index < MAX_FUNCTOR_ARGUMENTS)
+                    return this->bAddedDefaultValue_[index];
+
+                return false;
+            }
+
+        protected:
+            Functor* functor_;
+            std::string name_;
+            MultiType defaultValue_[MAX_FUNCTOR_ARGUMENTS];
+            bool bAddedDefaultValue_[MAX_FUNCTOR_ARGUMENTS];
+
+        private:
+            LanguageEntryLabel description_;
+            LanguageEntryLabel descriptionReturnvalue_;
+            LanguageEntryLabel descriptionParam_[MAX_FUNCTOR_ARGUMENTS];
+
+            bool bAddedDescription_;
+            bool bAddedDescriptionReturnvalue_;
+            bool bAddedDescriptionParam_[MAX_FUNCTOR_ARGUMENTS];
+    };
+
+    class _CoreExport ExecutorStatic : public Executor
+    {
+        public:
+            ExecutorStatic(FunctorStatic* functor, const std::string& name = "") : Executor(functor, name) {}
+            virtual ~ExecutorStatic() {}
+    };
+
+    template <class T>
+    class ExecutorMember : public Executor
+    {
+        public:
+            ExecutorMember(FunctorMember<T>* functor, const std::string& name = "") : Executor(functor, name) {}
+            virtual ~ExecutorMember() {}
+
+            using Executor::operator();
+
+            inline void operator()(T* object) const
+                { (*((FunctorMember<T>*)this->functor_))(object, this->defaultValue_[0], this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(T* object, const MultiType& param1) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(T* object, const MultiType& param1, const MultiType& param2) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(T* object, const MultiType& param1, const MultiType& param2, const MultiType& param3) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(T* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, param4, this->defaultValue_[4]); }
+            inline void operator()(T* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, param4, param5); }
+
+
+            inline void operator()(const T* object) const
+                { (*((FunctorMember<T>*)this->functor_))(object, this->defaultValue_[0], this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const T* object, const MultiType& param1) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const T* object, const MultiType& param1, const MultiType& param2) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const T* object, const MultiType& param1, const MultiType& param2, const MultiType& param3) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, this->defaultValue_[3], this->defaultValue_[4]); }
+            inline void operator()(const T* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, param4, this->defaultValue_[4]); }
+            inline void operator()(const T* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) const
+                { (*((FunctorMember<T>*)this->functor_))(object, param1, param2, param3, param4, param5); }
+
+            inline void setObject(T* object) const
+                { ((FunctorMember<T>*)this->functor_)->setObject(object); }
+            inline void setObject(const T* object) const
+                { ((FunctorMember<T>*)this->functor_)->setObject(object); }
+
+            using Executor::parse;
+
+            bool parse(T* object, const std::string& params, const std::string& delimiter = " ") const
+            {
+                EXECUTOR_PARSE(object);
+            }
+
+            bool parse(const T* object, const std::string& params, const std::string& delimiter = " ") const
+            {
+                EXECUTOR_PARSE(object);
+            }
+    };
+
+    inline Executor* createExecutor(Functor* functor, const std::string& name = "")
+    {
+        return new Executor(functor, name);
+    }
+
+    template <class T>
+    inline ExecutorMember<T>* createExecutor(FunctorMember<T>* functor, const std::string& name = "")
+    {
+        return new ExecutorMember<T>(functor, name);
+    }
+
+    inline ExecutorStatic* createExecutor(FunctorStatic* functor, const std::string& name = "")
+    {
+        return new ExecutorStatic(functor, name);
+    }
+}
+
+#endif /* _Executor_H__ */
Index: /sandbox_light/src/libraries/core/Factory.cc
===================================================================
--- /sandbox_light/src/libraries/core/Factory.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/Factory.cc	(revision 5788)
@@ -0,0 +1,94 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the Factory class.
+*/
+
+#include "Factory.h"
+
+#include "util/Debug.h"
+#include "Identifier.h"
+#include "BaseObject.h"
+
+namespace orxonox
+{
+    /**
+        @brief Returns the Identifier with a given name.
+        @param name The name of the wanted Identifier
+        @return The Identifier
+    */
+    Identifier* Factory::getIdentifier(const std::string& name)
+    {
+        std::map<std::string, Identifier*>::const_iterator it = getFactoryPointer()->identifierStringMap_.find(name);
+        if (it != getFactoryPointer()->identifierStringMap_.end())
+            return it->second;
+        else
+            return 0;
+    }
+
+    /**
+        @brief Adds a new Identifier to both maps.
+        @param name The name of the identifier
+        @param identifier The identifier to add
+    */
+    void Factory::add(const std::string& name, Identifier* identifier)
+    {
+        getFactoryPointer()->identifierStringMap_[name] = identifier;
+    }
+
+    /**
+        @brief Creates the class-hierarchy by creating and destroying one object of each type.
+    */
+    void Factory::createClassHierarchy()
+    {
+        COUT(3) << "*** Factory: Create class-hierarchy" << std::endl;
+        std::map<std::string, Identifier*>::iterator it;
+        it = getFactoryPointer()->identifierStringMap_.begin();
+        (*getFactoryPointer()->identifierStringMap_.begin()).second->startCreatingHierarchy();
+        for (it = getFactoryPointer()->identifierStringMap_.begin(); it != getFactoryPointer()->identifierStringMap_.end(); ++it)
+        {
+            // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
+            BaseObject* temp = (*it).second->fabricate(0);
+            delete temp;
+        }
+        (*getFactoryPointer()->identifierStringMap_.begin()).second->stopCreatingHierarchy();
+        COUT(3) << "*** Factory: Finished class-hierarchy creation" << std::endl;
+    }
+
+    /**
+        @brief Ensures the Factory gets created in the right moment.
+        @return The Factory.
+    */
+    Factory* Factory::getFactoryPointer()
+    {
+      static Factory theOneAndOnlyFactoryInstance = Factory();
+      return &theOneAndOnlyFactoryInstance;
+    }
+}
Index: /sandbox_light/src/libraries/core/Factory.h
===================================================================
--- /sandbox_light/src/libraries/core/Factory.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/Factory.h	(revision 5788)
@@ -0,0 +1,98 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the Factory and the BaseFactory class.
+
+    The Factory is a singleton, containing two maps to map either the name or the network ID
+    of a class with the corresponding Identifier.
+
+    Usage:
+    ID(classname) or ID(networkID) returns the corresponding Identifier.
+
+
+    BaseObject is the parent of ClassFactory which is defined in ClassFactory.h.
+    It can't be defined in ClassFactory.h, because of circular dependencies.
+*/
+
+#ifndef _Factory_H__
+#define _Factory_H__
+
+#include "CorePrereqs.h"
+
+#include <map>
+#include <string>
+
+namespace orxonox
+{
+    // ###############################
+    // ###         Factory         ###
+    // ###############################
+    //! The Factory is used to map the name or the network ID of a class with its Identifier.
+    class _CoreExport Factory
+    {
+        public:
+            static Identifier* getIdentifier(const std::string& name);
+            static Identifier* getIdentifier(const uint32_t id);
+            static void add(const std::string& name, Identifier* identifier);
+            static void createClassHierarchy();
+
+            static Factory* getFactoryPointer();    // avoid overriding order problem in the static intialisation process
+
+            /** @brief Returns the factory-map. */
+            static const std::map<std::string, Identifier*>& getFacbtoryMap()
+                { return Factory::getFactoryPointer()->identifierStringMap_; }
+            /** @brief Returns the begin-iterator of the factory-map. */
+            static std::map<std::string, Identifier*>::const_iterator getFactoryMapBegin()
+                { return Factory::getFactoryPointer()->identifierStringMap_.begin(); }
+            /** @brief Returns the end-iterator of the factory-map. */
+            static std::map<std::string, Identifier*>::const_iterator getFactoryMapEnd()
+                { return Factory::getFactoryPointer()->identifierStringMap_.end(); }
+
+        private:
+            Factory() {}                            // don't create
+            Factory(const Factory& factory);        // don't copy
+            ~Factory() {}                           // don't delete
+
+            std::map<std::string, Identifier*> identifierStringMap_;            //!< The map, mapping the name with the Identifier
+    };
+
+    // ###############################
+    // ###       BaseFactory       ###
+    // ###############################
+    //! Base-class of ClassFactory. Has to be defined separate because of circular dependencies.
+    class _CoreExport BaseFactory
+    {
+        public:
+            virtual BaseObject* fabricate(BaseObject* creator) = 0;
+            virtual ~BaseFactory() {};
+    };
+}
+
+#endif /* _Factory_H__ */
Index: /sandbox_light/src/libraries/core/Functor.h
===================================================================
--- /sandbox_light/src/libraries/core/Functor.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/Functor.h	(revision 5788)
@@ -0,0 +1,483 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ *   Inspiration: Functor by Benjamin Grauer
+ */
+
+#ifndef _Functor_H__
+#define _Functor_H__
+
+#include "CorePrereqs.h"
+
+#include "util/Debug.h"
+#include "util/MultiType.h"
+#include "util/StringUtils.h"
+
+namespace orxonox
+{
+    const unsigned int MAX_FUNCTOR_ARGUMENTS = 5;
+
+    namespace FunctionType
+    {
+        enum Value
+        {
+            Member,
+            ConstMember,
+            Static
+        };
+    }
+
+
+    template <class T>
+    inline std::string typeToString() { return "unknown"; }
+
+#define CreateTypeToStringTemplate(type) \
+    template <> \
+    inline std::string typeToString<type>() { return #type; } \
+    template <> \
+    inline std::string typeToString<type&>() { return #type; } \
+    template <> \
+    inline std::string typeToString<const type>() { return #type; } \
+    template <> \
+    inline std::string typeToString<const type&>() { return #type; }
+
+    CreateTypeToStringTemplate(int);
+    CreateTypeToStringTemplate(unsigned int);
+    CreateTypeToStringTemplate(char);
+    CreateTypeToStringTemplate(unsigned char);
+    CreateTypeToStringTemplate(short);
+    CreateTypeToStringTemplate(unsigned short);
+    CreateTypeToStringTemplate(long);
+    CreateTypeToStringTemplate(unsigned long);
+    CreateTypeToStringTemplate(long long);
+    CreateTypeToStringTemplate(unsigned long long);
+    CreateTypeToStringTemplate(float);
+    CreateTypeToStringTemplate(double);
+    CreateTypeToStringTemplate(long double);
+    CreateTypeToStringTemplate(bool);
+    CreateTypeToStringTemplate(Vector2);
+    CreateTypeToStringTemplate(Vector3);
+    CreateTypeToStringTemplate(Quaternion);
+    CreateTypeToStringTemplate(ColourValue);
+    CreateTypeToStringTemplate(Radian);
+    CreateTypeToStringTemplate(Degree);
+
+    template <>
+    inline std::string typeToString<std::string>() { return "string"; }
+    template <>
+    inline std::string typeToString<std::string&>() { return "string"; }
+    template <>
+    inline std::string typeToString<const std::string>() { return "string"; }
+    template <>
+    inline std::string typeToString<const std::string&>() { return "string"; }
+
+    class _CoreExport Functor
+    {
+        public:
+            Functor() {}
+            virtual ~Functor() {}
+
+            virtual void operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
+
+            inline unsigned int getParamCount() const { return this->numParams_; }
+            inline bool hasReturnvalue() const { return this->hasReturnValue_; }
+            inline FunctionType::Value getType() const { return this->type_; }
+            inline const MultiType& getReturnvalue() const { return this->returnedValue_; }
+
+            const std::string& getTypenameParam(unsigned int param) const { return (param < 5) ? this->typeParam_[param] : BLANKSTRING; }
+            const std::string& getTypenameReturnvalue() const { return this->typeReturnvalue_; }
+
+            virtual void evaluateParam(unsigned int index, MultiType& param) const = 0;
+
+        protected:
+            unsigned int numParams_;
+            bool hasReturnValue_;
+            FunctionType::Value type_;
+            MultiType returnedValue_;
+
+            std::string typeReturnvalue_;
+            std::string typeParam_[MAX_FUNCTOR_ARGUMENTS];
+    };
+
+    class _CoreExport FunctorStatic : public Functor
+    {
+        public:
+            virtual ~FunctorStatic() {}
+            virtual void operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
+    };
+
+    template <class T>
+    class FunctorMember : public Functor
+    {
+        public:
+            FunctorMember()
+            {
+                constObject_ = 0;
+                object_ = 0;
+                bConstObject_ = false;
+            }
+            virtual ~FunctorMember() {}
+
+            virtual void operator()(T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
+            virtual void operator()(const T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
+
+            virtual void operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null)
+            {
+                if (this->bConstObject_)
+                {
+                    if (this->constObject_)
+                        (*this)(this->constObject_, param1, param2, param3, param4, param5);
+                    else
+                    {
+                        COUT(1) << "An error occurred in Functor.h:" << std::endl;
+                        COUT(1) << "Error: No const object set." << std::endl;
+                    }
+                }
+                else
+                {
+                    if (this->object_)
+                        (*this)(this->object_, param1, param2, param3, param4, param5);
+                    else
+                    {
+                        COUT(1) << "An error occurred in Functor.h:" << std::endl;
+                        COUT(1) << "Error: No object set." << std::endl;
+                    }
+                }
+            }
+
+            FunctorMember<T>* setObject(T* object)
+            {
+                this->bConstObject_ = false;
+                this->object_ = object;
+                return this;
+            }
+
+            FunctorMember<T>* setObject(const T* object)
+            {
+                this->bConstObject_ = true;
+                this->constObject_ = object;
+                return this;
+            }
+
+        private:
+            const T* constObject_;
+            T* object_;
+            bool bConstObject_;
+    };
+
+
+
+#define FUNCTOR_TEMPLATE(ismember, returnvalue, numparams) FUNCTOR_TEMPLATE##ismember##returnvalue##numparams
+#define FUNCTOR_TEMPLATE000
+#define FUNCTOR_TEMPLATE001 template <class P1>
+#define FUNCTOR_TEMPLATE002 template <class P1, class P2>
+#define FUNCTOR_TEMPLATE003 template <class P1, class P2, class P3>
+#define FUNCTOR_TEMPLATE004 template <class P1, class P2, class P3, class P4>
+#define FUNCTOR_TEMPLATE005 template <class P1, class P2, class P3, class P4, class P5>
+#define FUNCTOR_TEMPLATE010 template <class R>
+#define FUNCTOR_TEMPLATE011 template <class R, class P1>
+#define FUNCTOR_TEMPLATE012 template <class R, class P1, class P2>
+#define FUNCTOR_TEMPLATE013 template <class R, class P1, class P2, class P3>
+#define FUNCTOR_TEMPLATE014 template <class R, class P1, class P2, class P3, class P4>
+#define FUNCTOR_TEMPLATE015 template <class R, class P1, class P2, class P3, class P4, class P5>
+#define FUNCTOR_TEMPLATE100 template <class T>
+#define FUNCTOR_TEMPLATE101 template <class T, class P1>
+#define FUNCTOR_TEMPLATE102 template <class T, class P1, class P2>
+#define FUNCTOR_TEMPLATE103 template <class T, class P1, class P2, class P3>
+#define FUNCTOR_TEMPLATE104 template <class T, class P1, class P2, class P3, class P4>
+#define FUNCTOR_TEMPLATE105 template <class T, class P1, class P2, class P3, class P4, class P5>
+#define FUNCTOR_TEMPLATE110 template <class T, class R>
+#define FUNCTOR_TEMPLATE111 template <class T, class R, class P1>
+#define FUNCTOR_TEMPLATE112 template <class T, class R, class P1, class P2>
+#define FUNCTOR_TEMPLATE113 template <class T, class R, class P1, class P2, class P3>
+#define FUNCTOR_TEMPLATE114 template <class T, class R, class P1, class P2, class P3, class P4>
+#define FUNCTOR_TEMPLATE115 template <class T, class R, class P1, class P2, class P3, class P4, class P5>
+
+
+
+#define FUNCTOR_TEMPLATE_CLASSES(ismember, returnvalue, numparams) FUNCTOR_TEMPLATE_CLASSES##ismember##returnvalue##numparams
+#define FUNCTOR_TEMPLATE_CLASSES000
+#define FUNCTOR_TEMPLATE_CLASSES001 <P1>
+#define FUNCTOR_TEMPLATE_CLASSES002 <P1, P2>
+#define FUNCTOR_TEMPLATE_CLASSES003 <P1, P2, P3>
+#define FUNCTOR_TEMPLATE_CLASSES004 <P1, P2, P3, P4>
+#define FUNCTOR_TEMPLATE_CLASSES005 <P1, P2, P3, P4, P5>
+#define FUNCTOR_TEMPLATE_CLASSES010 <R>
+#define FUNCTOR_TEMPLATE_CLASSES011 <R, P1>
+#define FUNCTOR_TEMPLATE_CLASSES012 <R, P1, P2>
+#define FUNCTOR_TEMPLATE_CLASSES013 <R, P1, P2, P3>
+#define FUNCTOR_TEMPLATE_CLASSES014 <R, P1, P2, P3, P4>
+#define FUNCTOR_TEMPLATE_CLASSES015 <R, P1, P2, P3, P4, P5>
+#define FUNCTOR_TEMPLATE_CLASSES100 <T>
+#define FUNCTOR_TEMPLATE_CLASSES101 <T, P1>
+#define FUNCTOR_TEMPLATE_CLASSES102 <T, P1, P2>
+#define FUNCTOR_TEMPLATE_CLASSES103 <T, P1, P2, P3>
+#define FUNCTOR_TEMPLATE_CLASSES104 <T, P1, P2, P3, P4>
+#define FUNCTOR_TEMPLATE_CLASSES105 <T, P1, P2, P3, P4, P5>
+#define FUNCTOR_TEMPLATE_CLASSES110 <T, R>
+#define FUNCTOR_TEMPLATE_CLASSES111 <T, R, P1>
+#define FUNCTOR_TEMPLATE_CLASSES112 <T, R, P1, P2>
+#define FUNCTOR_TEMPLATE_CLASSES113 <T, R, P1, P2, P3>
+#define FUNCTOR_TEMPLATE_CLASSES114 <T, R, P1, P2, P3, P4>
+#define FUNCTOR_TEMPLATE_CLASSES115 <T, R, P1, P2, P3, P4, P5>
+
+
+
+#define FUNCTOR_TYPENAME_PARAMS(numparams) FUNCTOR_TYPENAME_PARAMS##numparams
+#define FUNCTOR_TYPENAME_PARAMS0
+#define FUNCTOR_TYPENAME_PARAMS1 this->typeParam_[0] = typeToString<P1>();
+#define FUNCTOR_TYPENAME_PARAMS2 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>();
+#define FUNCTOR_TYPENAME_PARAMS3 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>();
+#define FUNCTOR_TYPENAME_PARAMS4 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>(); this->typeParam_[3] = typeToString<P4>();
+#define FUNCTOR_TYPENAME_PARAMS5 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>(); this->typeParam_[3] = typeToString<P4>(); this->typeParam_[4] = typeToString<P5>();
+
+#define FUNCTOR_TYPENAME_RETURN(returnvalue) FUNCTOR_TYPENAME_RETURN##returnvalue
+#define FUNCTOR_TYPENAME_RETURN0
+#define FUNCTOR_TYPENAME_RETURN1 this->typeReturnvalue_ = typeToString<R>();
+
+
+
+#define FUNCTOR_FUNCTION_PARAMS(numparams) FUNCTOR_FUNCTION_PARAMS##numparams
+#define FUNCTOR_FUNCTION_PARAMS0
+#define FUNCTOR_FUNCTION_PARAMS1 P1 param1
+#define FUNCTOR_FUNCTION_PARAMS2 P1 param1, P2 param2
+#define FUNCTOR_FUNCTION_PARAMS3 P1 param1, P2 param2, P3 param3
+#define FUNCTOR_FUNCTION_PARAMS4 P1 param1, P2 param2, P3 param3, P4 param4
+#define FUNCTOR_FUNCTION_PARAMS5 P1 param1, P2 param2, P3 param3, P4 param4, P5 param5
+
+#define FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) FUNCTOR_FUNCTION_RETURNVALUE##returnvalue
+#define FUNCTOR_FUNCTION_RETURNVALUE0 void
+#define FUNCTOR_FUNCTION_RETURNVALUE1 R
+
+
+
+#define FUNCTOR_FUNCTION_CALL(numparams) FUNCTOR_FUNCTION_CALL##numparams
+#define FUNCTOR_FUNCTION_CALL0
+#define FUNCTOR_FUNCTION_CALL1 param1
+#define FUNCTOR_FUNCTION_CALL2 param1, param2
+#define FUNCTOR_FUNCTION_CALL3 param1, param2, param3
+#define FUNCTOR_FUNCTION_CALL4 param1, param2, param3, param4
+#define FUNCTOR_FUNCTION_CALL5 param1, param2, param3, param4, param5
+
+#define FUNCTOR_STORE_RETURNVALUE(returnvalue, functioncall) FUNCTOR_STORE_RETURNVALUE##returnvalue(functioncall)
+#define FUNCTOR_STORE_RETURNVALUE0(functioncall) functioncall
+#define FUNCTOR_STORE_RETURNVALUE1(functioncall) this->returnedValue_ = functioncall
+
+
+
+#define FUNCTOR_EVALUATE_PARAM(numparams) FUNCTOR_EVALUATE_PARAM##numparams
+#define FUNCTOR_EVALUATE_PARAM0
+#define FUNCTOR_EVALUATE_PARAM1 \
+    if (index == 0) { param.convert<P1>(); }
+#define FUNCTOR_EVALUATE_PARAM2 \
+    if (index == 0) { param.convert<P1>(); } \
+    else if (index == 1) { param.convert<P2>(); }
+#define FUNCTOR_EVALUATE_PARAM3 \
+    if (index == 0) { param.convert<P1>(); } \
+    else if (index == 1) { param.convert<P2>(); } \
+    else if (index == 2) { param.convert<P3>(); }
+#define FUNCTOR_EVALUATE_PARAM4 \
+    if (index == 0) { param.convert<P1>(); } \
+    else if (index == 1) { param.convert<P2>(); } \
+    else if (index == 2) { param.convert<P3>(); } \
+    else if (index == 3) { param.convert<P4>(); }
+#define FUNCTOR_EVALUATE_PARAM5 \
+    if (index == 0) { param.convert<P1>(); } \
+    else if (index == 1) { param.convert<P2>(); } \
+    else if (index == 2) { param.convert<P3>(); } \
+    else if (index == 3) { param.convert<P4>(); } \
+    else if (index == 4) { param.convert<P5>(); }
+
+
+
+
+
+#define CREATE_STATIC_FUNCTOR(returnvalue, numparams) \
+    FUNCTOR_TEMPLATE(0, returnvalue, numparams) \
+    class FunctorStatic##returnvalue##numparams : public FunctorStatic \
+    { \
+        public: \
+            FunctorStatic##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
+            { \
+                this->numParams_ = numparams; \
+                this->hasReturnValue_ = returnvalue; \
+                this->type_ = FunctionType::Static; \
+                this->functionPointer_ = functionPointer; \
+                \
+                FUNCTOR_TYPENAME_PARAMS(numparams); \
+                FUNCTOR_TYPENAME_RETURN(returnvalue); \
+            } \
+    \
+            void operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
+            { \
+                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
+            } \
+    \
+            virtual void evaluateParam(unsigned int index, MultiType& param) const \
+            { \
+                FUNCTOR_EVALUATE_PARAM(numparams); \
+            } \
+    \
+        private: \
+            FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)); \
+    }; \
+    \
+    \
+    FUNCTOR_TEMPLATE(0, returnvalue, numparams) \
+    inline FunctorStatic##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(0, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
+    { \
+        return new FunctorStatic##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(0, returnvalue, numparams) (functionPointer); \
+    }
+
+
+
+
+
+#define CREATE_MEMBER_FUNCTOR(returnvalue, numparams) \
+    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
+    class FunctorMember##returnvalue##numparams : public FunctorMember<T> \
+    { \
+        public: \
+            FunctorMember##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
+            { \
+                this->numParams_ = numparams; \
+                this->hasReturnValue_ = returnvalue; \
+                this->type_ = FunctionType::Member; \
+                this->functionPointer_ = functionPointer; \
+            } \
+    \
+            void operator()(T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
+            { \
+                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
+            } \
+    \
+            void operator()(const T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
+            { \
+                COUT(1) << "An error occurred in Functor.h:" << std::endl; \
+                COUT(1) << "Error: Function is not const." << std::endl; \
+            } \
+    \
+            virtual void evaluateParam(unsigned int index, MultiType& param) const \
+            { \
+                FUNCTOR_EVALUATE_PARAM(numparams); \
+            } \
+    \
+        private: \
+            FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)); \
+    }; \
+    \
+    \
+    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
+    class FunctorConstMember##returnvalue##numparams : public FunctorMember<T> \
+    { \
+        public: \
+            FunctorConstMember##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const) \
+            { \
+                this->numParams_ = numparams; \
+                this->hasReturnValue_ = returnvalue; \
+                this->type_ = FunctionType::ConstMember; \
+                this->functionPointer_ = functionPointer; \
+            } \
+    \
+            void operator()(T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
+            { \
+                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
+            } \
+    \
+            void operator()(const T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
+            { \
+                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
+            } \
+    \
+            virtual void evaluateParam(unsigned int index, MultiType& param) const \
+            { \
+                FUNCTOR_EVALUATE_PARAM(numparams); \
+            } \
+    \
+        private: \
+            FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)) const; \
+    }; \
+    \
+    \
+    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
+    inline FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
+    { \
+        return new FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
+    } \
+    \
+    \
+    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
+    inline FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const) \
+    { \
+        return new FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
+    }
+
+
+// disable annoying warning about forcing value to boolean
+#ifdef ORXONOX_COMPILER_MSVC
+#pragma warning(push)
+#pragma warning(disable:4100 4800)
+#endif
+
+#define CREATE_ALL_STATIC_FUNCTORS() \
+    CREATE_STATIC_FUNCTOR(0, 0); \
+    CREATE_STATIC_FUNCTOR(0, 1); \
+    CREATE_STATIC_FUNCTOR(0, 2); \
+    CREATE_STATIC_FUNCTOR(0, 3); \
+    CREATE_STATIC_FUNCTOR(0, 4); \
+    CREATE_STATIC_FUNCTOR(0, 5); \
+    CREATE_STATIC_FUNCTOR(1, 0); \
+    CREATE_STATIC_FUNCTOR(1, 1); \
+    CREATE_STATIC_FUNCTOR(1, 2); \
+    CREATE_STATIC_FUNCTOR(1, 3); \
+    CREATE_STATIC_FUNCTOR(1, 4); \
+    CREATE_STATIC_FUNCTOR(1, 5)
+
+
+#define CREATE_ALL_MEMBER_FUNCTORS() \
+    CREATE_MEMBER_FUNCTOR(0, 0); \
+    CREATE_MEMBER_FUNCTOR(0, 1); \
+    CREATE_MEMBER_FUNCTOR(0, 2); \
+    CREATE_MEMBER_FUNCTOR(0, 3); \
+    CREATE_MEMBER_FUNCTOR(0, 4); \
+    CREATE_MEMBER_FUNCTOR(0, 5); \
+    CREATE_MEMBER_FUNCTOR(1, 0); \
+    CREATE_MEMBER_FUNCTOR(1, 1); \
+    CREATE_MEMBER_FUNCTOR(1, 2); \
+    CREATE_MEMBER_FUNCTOR(1, 3); \
+    CREATE_MEMBER_FUNCTOR(1, 4); \
+    CREATE_MEMBER_FUNCTOR(1, 5)
+
+
+    CREATE_ALL_STATIC_FUNCTORS();
+    CREATE_ALL_MEMBER_FUNCTORS();
+}
+
+#ifdef ORXONOX_COMPILER_MSVC
+#pragma warning(pop)
+#endif
+
+#endif /* _Functor_H__ */
Index: /sandbox_light/src/libraries/core/Game.cc
===================================================================
--- /sandbox_light/src/libraries/core/Game.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/Game.cc	(revision 5788)
@@ -0,0 +1,576 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Implementation of the Game class.
+*/
+
+#include "Game.h"
+
+#include <exception>
+#include <boost/weak_ptr.hpp>
+
+#include "util/Debug.h"
+#include "util/Exception.h"
+#include "util/ScopeGuard.h"
+#include "util/Sleep.h"
+#include "util/SubString.h"
+#include "Clock.h"
+#include "CommandLine.h"
+#include "Core.h"
+#include "CoreIncludes.h"
+#include "ConfigValueIncludes.h"
+#include "GameState.h"
+
+namespace orxonox
+{
+    std::map<std::string, GameStateInfo> Game::gameStateDeclarations_s;
+    Game* Game::singletonPtr_s = 0;
+
+
+    /**
+    @brief
+        Represents one node of the game state tree.
+    */
+    struct GameStateTreeNode
+    {
+        std::string name_;
+        weak_ptr<GameStateTreeNode> parent_;
+        std::vector<shared_ptr<GameStateTreeNode> > children_;
+    };
+
+
+    /**
+    @brief
+        Another helper class for the Game singleton: we cannot derive
+        Game from OrxonoxClass because we need to handle the Identifier
+        destruction in the Core destructor.
+    */
+    class GameConfiguration : public OrxonoxClass
+    {
+    public:
+        GameConfiguration()
+        {
+            RegisterRootObject(GameConfiguration);
+            this->setConfigValues();
+        }
+
+        void setConfigValues()
+        {
+            SetConfigValue(statisticsRefreshCycle_, 250000)
+                .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
+            SetConfigValue(statisticsAvgLength_, 1000000)
+                .description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
+            SetConfigValue(fpsLimit_, 50)
+                .description("Sets the desired framerate (0 for no limit).");
+        }
+
+        unsigned int statisticsRefreshCycle_;
+        unsigned int statisticsAvgLength_;
+        unsigned int fpsLimit_;
+    };
+
+
+    /**
+    @brief
+        Non-initialising constructor.
+    */
+    Game::Game(const std::string& cmdLine)
+        // Destroy factories before the Core!
+        : gsFactoryDestroyer_(Game::GameStateFactory::factories_s, &std::map<std::string, shared_ptr<GameStateFactory> >::clear)
+    {
+        this->bAbort_ = false;
+        bChangingState_ = false;
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+        minimumSleepTime_ = 1000/*us*/;
+#else
+        minimumSleepTime_ = 0/*us*/;
+#endif
+
+        // Create an empty root state
+        this->declareGameState<GameState>("GameState", "emptyRootGameState", true, false);
+
+        // Set up a basic clock to keep time
+        this->gameClock_.reset(new Clock());
+
+        // Create the Core
+        this->core_.reset(new Core(cmdLine));
+
+        // After the core has been created, we can safely instantiate the GameStates that don't require graphics
+        for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
+            it != gameStateDeclarations_s.end(); ++it)
+        {
+            if (!it->second.bGraphicsMode)
+                constructedStates_[it->second.stateName] = GameStateFactory::fabricate(it->second);
+        }
+
+        // The empty root state is ALWAYS loaded!
+        this->rootStateNode_ = shared_ptr<GameStateTreeNode>(new GameStateTreeNode());
+        this->rootStateNode_->name_ = "emptyRootGameState";
+        this->loadedTopStateNode_ = this->rootStateNode_;
+        this->loadedStates_.push_back(this->getState(rootStateNode_->name_));
+
+        // Do this after the Core creation!
+        this->configuration_.reset(new GameConfiguration());
+    }
+
+    /**
+    @brief
+        All destruction code is handled by scoped_ptrs and SimpleScopeGuards.
+    */
+    Game::~Game()
+    {
+    }
+
+    /**
+    @brief
+        Main loop of the orxonox game.
+    @note
+        We use the Ogre::Timer to measure time since it uses the most precise
+        method an any platform (however the windows timer lacks time when under
+        heavy kernel load!).
+    */
+    void Game::run()
+    {
+        if (this->requestedStateNodes_.empty())
+            COUT(0) << "Warning: Starting game without requesting GameState. This automatically terminates the program." << std::endl;
+
+        // reset statistics
+        this->statisticsStartTime_ = 0;
+        this->statisticsTickTimes_.clear();
+        this->periodTickTime_ = 0;
+        this->periodTime_ = 0;
+        this->avgFPS_ = 0.0f;
+        this->avgTickTime_ = 0.0f;
+        this->excessSleepTime_ = 0;
+
+        // START GAME
+        // first delta time should be about 0 seconds
+        this->gameClock_->capture();
+        // A first item is required for the fps limiter
+        StatisticsTickInfo tickInfo = {0, 0};
+        statisticsTickTimes_.push_back(tickInfo);
+        while (!this->bAbort_ && (!this->loadedStates_.empty() || this->requestedStateNodes_.size() > 0))
+        {
+            // Generate the dt
+            this->gameClock_->capture();
+
+            // Statistics init
+            StatisticsTickInfo tickInfo = {gameClock_->getMicroseconds(), 0};
+            statisticsTickTimes_.push_back(tickInfo);
+            this->periodTime_ += this->gameClock_->getDeltaTimeMicroseconds();
+
+            // Update the GameState stack if required
+            this->updateGameStateStack();
+
+            // Core preUpdate (doesn't throw)
+            try
+                { this->core_->preUpdate(*this->gameClock_); }
+            catch (...)
+            {
+                COUT(0) << "An exception occurred in the Core preUpdate: " << Exception::handleMessage() << std::endl;
+                COUT(0) << "This should really never happen! Closing the program." << std::endl;
+                this->stop();
+                break;
+            }
+
+            // Update the GameStates bottom up in the stack
+            this->updateGameStates();
+
+            // Core postUpdate (doesn't throw)
+            try
+                { this->core_->postUpdate(*this->gameClock_); }
+            catch (...)
+            {
+                COUT(0) << "An exception occurred in the Core postUpdate: " << Exception::handleMessage() << std::endl;
+                COUT(0) << "This should really never happen! Closing the program." << std::endl;
+                this->stop();
+                break;
+            }
+
+            // Evaluate statistics
+            this->updateStatistics();
+
+            // Limit framerate
+            this->updateFPSLimiter();
+        }
+
+        // UNLOAD all remaining states
+        while (this->loadedStates_.size() > 1)
+            this->unloadState(this->loadedStates_.back()->getName());
+        this->loadedTopStateNode_ = this->rootStateNode_;
+        this->requestedStateNodes_.clear();
+    }
+
+    void Game::updateGameStateStack()
+    {
+        while (this->requestedStateNodes_.size() > 0)
+        {
+            shared_ptr<GameStateTreeNode> requestedStateNode = this->requestedStateNodes_.front();
+            assert(this->loadedTopStateNode_);
+            if (!this->loadedTopStateNode_->parent_.expired() && requestedStateNode == this->loadedTopStateNode_->parent_.lock())
+                this->unloadState(loadedTopStateNode_->name_);
+            else // has to be child
+            {
+                try
+                {
+                    this->loadState(requestedStateNode->name_);
+                }
+                catch (...)
+                {
+                    COUT(1) << "Error: Loading GameState '" << requestedStateNode->name_ << "' failed: " << Exception::handleMessage() << std::endl;
+                    // All scheduled operations have now been rendered inert --> flush them and issue a warning
+                    if (this->requestedStateNodes_.size() > 1)
+                        COUT(4) << "All " << this->requestedStateNodes_.size() - 1 << " scheduled transitions have been ignored." << std::endl;
+                    this->requestedStateNodes_.clear();
+                    break;
+                }
+            }
+            this->loadedTopStateNode_ = requestedStateNode;
+            this->requestedStateNodes_.erase(this->requestedStateNodes_.begin());
+        }
+    }
+
+    void Game::updateGameStates()
+    {
+        // Note: The first element is the empty root state, which doesn't need ticking
+        for (GameStateVector::const_iterator it = this->loadedStates_.begin() + 1;
+            it != this->loadedStates_.end(); ++it)
+        {
+            try
+            {
+                // Add tick time for most of the states
+                uint64_t timeBeforeTick = 0;
+                if ((*it)->getInfo().bIgnoreTickTime)
+                    timeBeforeTick = this->gameClock_->getRealMicroseconds();
+                (*it)->update(*this->gameClock_);
+                if ((*it)->getInfo().bIgnoreTickTime)
+                    this->subtractTickTime(static_cast<int32_t>(this->gameClock_->getRealMicroseconds() - timeBeforeTick));
+            }
+            catch (...)
+            {
+                COUT(1) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << std::endl;
+                COUT(1) << "This should really never happen!" << std::endl;
+                COUT(1) << "Unloading all GameStates depending on the one that crashed." << std::endl;
+                shared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_;
+                while (current->name_ != (*it)->getName() && current)
+                    current = current->parent_.lock();
+                if (current && current->parent_.lock())
+                    this->requestState(current->parent_.lock()->name_);
+                else
+                    this->stop();
+                break;
+            }
+        }
+    }
+
+    void Game::updateStatistics()
+    {
+        // Add the tick time of this frame (rendering time has already been subtracted)
+        uint64_t currentTime = gameClock_->getMicroseconds();
+        uint64_t currentRealTime = gameClock_->getRealMicroseconds();
+        this->statisticsTickTimes_.back().tickLength += currentRealTime - currentTime;
+        this->periodTickTime_ += currentRealTime - currentTime;
+        if (this->periodTime_ > this->configuration_->statisticsRefreshCycle_)
+        {
+            std::list<StatisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
+            assert(it != this->statisticsTickTimes_.end());
+            int64_t lastTime = currentTime - this->configuration_->statisticsAvgLength_;
+            if (static_cast<int64_t>(it->tickTime) < lastTime)
+            {
+                do
+                {
+                    assert(this->periodTickTime_ >= it->tickLength);
+                    this->periodTickTime_ -= it->tickLength;
+                    ++it;
+                    assert(it != this->statisticsTickTimes_.end());
+                } while (static_cast<int64_t>(it->tickTime) < lastTime);
+                this->statisticsTickTimes_.erase(this->statisticsTickTimes_.begin(), it);
+            }
+
+            uint32_t framesPerPeriod = this->statisticsTickTimes_.size();
+            this->avgFPS_ = static_cast<float>(framesPerPeriod) / (currentTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0f;
+            this->avgTickTime_ = static_cast<float>(this->periodTickTime_) / framesPerPeriod / 1000.0f;
+
+            this->periodTime_ -= this->configuration_->statisticsRefreshCycle_;
+        }
+    }
+
+    void Game::updateFPSLimiter()
+    {
+        // Why configuration_->fpsLimit_ - 1? No idea, but otherwise the fps rate is always (from 10 to 200!) one frame too high
+        uint32_t nextTime = gameClock_->getMicroseconds() - excessSleepTime_ + static_cast<uint32_t>(1000000.0f / (configuration_->fpsLimit_ - 1));
+        uint64_t currentRealTime = gameClock_->getRealMicroseconds();
+        while (currentRealTime < nextTime - minimumSleepTime_)
+        {
+            usleep(nextTime - currentRealTime);
+            currentRealTime = gameClock_->getRealMicroseconds();
+        }
+        // Integrate excess to avoid steady state error
+        excessSleepTime_ = currentRealTime - nextTime;
+        // Anti windup
+        if (excessSleepTime_ > 50000) // 20ms is about the maximum time Windows would sleep for too long
+            excessSleepTime_ = 50000;
+    }
+
+    void Game::stop()
+    {
+        this->bAbort_ = true;
+    }
+
+    void Game::subtractTickTime(int32_t length)
+    {
+        assert(!this->statisticsTickTimes_.empty());
+        this->statisticsTickTimes_.back().tickLength -= length;
+        this->periodTickTime_ -= length;
+    }
+
+
+    /***** GameState related *****/
+
+    void Game::requestState(const std::string& name)
+    {
+        if (!this->checkState(name))
+        {
+            COUT(2) << "Warning: GameState named '" << name << "' doesn't exist!" << std::endl;
+            return;
+        }
+
+        if (this->bChangingState_)
+        {
+            COUT(2) << "Warning: Requesting GameStates while loading/unloading a GameState is illegal! Ignoring." << std::endl;
+            return;
+        }
+
+        shared_ptr<GameStateTreeNode> lastRequestedNode;
+        if (this->requestedStateNodes_.empty())
+            lastRequestedNode = this->loadedTopStateNode_;
+        else
+            lastRequestedNode = this->requestedStateNodes_.back();
+        if (name == lastRequestedNode->name_)
+        {
+            COUT(2) << "Warning: Requesting the currently active state! Ignoring." << std::endl;
+            return;
+        }
+
+        // Check children first
+        std::vector<shared_ptr<GameStateTreeNode> > requestedNodes;
+        for (unsigned int i = 0; i < lastRequestedNode->children_.size(); ++i)
+        {
+            if (lastRequestedNode->children_[i]->name_ == name)
+            {
+                requestedNodes.push_back(lastRequestedNode->children_[i]);
+                break;
+            }
+        }
+
+        if (requestedNodes.empty())
+        {
+            // Check parent and all its grand parents
+            shared_ptr<GameStateTreeNode> currentNode = lastRequestedNode;
+            while (currentNode != NULL)
+            {
+                if (currentNode->name_ == name)
+                    break;
+                currentNode = currentNode->parent_.lock();
+                requestedNodes.push_back(currentNode);
+            }
+        }
+
+        if (requestedNodes.empty())
+            COUT(1) << "Error: Requested GameState transition is not allowed. Ignoring." << std::endl;
+        else
+            this->requestedStateNodes_.insert(requestedStateNodes_.end(), requestedNodes.begin(), requestedNodes.end());
+    }
+
+    void Game::requestStates(const std::string& names)
+    {
+        SubString tokens(names, ",;", " ");
+        for (unsigned int i = 0; i < tokens.size(); ++i)
+            this->requestState(tokens[i]);
+    }
+
+    void Game::popState()
+    {
+        shared_ptr<GameStateTreeNode> lastRequestedNode;
+        if (this->requestedStateNodes_.empty())
+            lastRequestedNode = this->loadedTopStateNode_;
+        else
+            lastRequestedNode = this->requestedStateNodes_.back();
+        if (lastRequestedNode != this->rootStateNode_)
+            this->requestState(lastRequestedNode->parent_.lock()->name_);
+        else
+            COUT(2) << "Warning: Can't pop the internal dummy root GameState" << std::endl;
+    }
+
+    shared_ptr<GameState> Game::getState(const std::string& name)
+    {
+        GameStateMap::const_iterator it = constructedStates_.find(name);
+        if (it != constructedStates_.end())
+            return it->second;
+        else
+        {
+            std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.find(name);
+            if (it != gameStateDeclarations_s.end())
+                COUT(1) << "Error: GameState '" << name << "' has not yet been loaded." << std::endl;
+            else
+                COUT(1) << "Error: Could not find GameState '" << name << "'." << std::endl;
+            return shared_ptr<GameState>();
+        }
+    }
+
+    void Game::setStateHierarchy(const std::string& str)
+    {
+        // Split string into pieces of the form whitespacesText
+        std::vector<std::pair<std::string, unsigned> > stateStrings;
+        size_t pos = 0;
+        size_t startPos = 0;
+        while (pos < str.size())
+        {
+            unsigned indentation = 0;
+            while(pos < str.size() && str[pos] == ' ')
+                ++indentation, ++pos;
+            startPos = pos;
+            while(pos < str.size() && str[pos] != ' ')
+                ++pos;
+            stateStrings.push_back(std::make_pair(str.substr(startPos, pos - startPos), indentation));
+        }
+        unsigned int currentLevel = 0;
+        shared_ptr<GameStateTreeNode> currentNode = this->rootStateNode_;
+        for (std::vector<std::pair<std::string, unsigned> >::const_iterator it = stateStrings.begin(); it != stateStrings.end(); ++it)
+        {
+            std::string newStateName = it->first;
+            unsigned newLevel = it->second + 1; // empty root is 0
+            if (!this->checkState(newStateName))
+                ThrowException(GameState, "GameState with name '" << newStateName << "' not found!");
+            if (newStateName == this->rootStateNode_->name_)
+                ThrowException(GameState, "You shouldn't use 'emptyRootGameState' in the hierarchy...");
+            shared_ptr<GameStateTreeNode> newNode(new GameStateTreeNode);
+            newNode->name_ = newStateName;
+
+            if (newLevel <= currentLevel)
+            {
+                do
+                    currentNode = currentNode->parent_.lock();
+                while (newLevel <= --currentLevel);
+            }
+            if (newLevel == currentLevel + 1)
+            {
+                // Add the child
+                newNode->parent_ = currentNode;
+                currentNode->children_.push_back(newNode);
+            }
+            else
+                ThrowException(GameState, "Indentation error while parsing the hierarchy.");
+            currentNode = newNode;
+            currentLevel = newLevel;
+        }
+    }
+
+    /*** Internal ***/
+
+    void Game::loadGraphics()
+    {
+    }
+
+    void Game::unloadGraphics()
+    {
+    }
+
+    bool Game::checkState(const std::string& name) const
+    {
+        std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.find(name);
+        if (it == gameStateDeclarations_s.end())
+            return false;
+        else
+            return true;
+    }
+
+    void Game::loadState(const std::string& name)
+    {
+        this->bChangingState_ = true;
+        LOKI_ON_BLOCK_EXIT_OBJ(*this, &Game::resetChangingState);
+
+        // If state requires graphics, load it
+        Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics);
+        if (gameStateDeclarations_s[name].bGraphicsMode)
+            this->loadGraphics();
+        else
+            graphicsUnloader.Dismiss();
+
+        shared_ptr<GameState> state = this->getState(name);
+        state->activate();
+        if (!this->loadedStates_.empty())
+            this->loadedStates_.back()->activity_.topState = false;
+        this->loadedStates_.push_back(state);
+        state->activity_.topState = true;
+
+        graphicsUnloader.Dismiss();
+    }
+
+    void Game::unloadState(const std::string& name)
+    {
+        this->bChangingState_ = true;
+        try
+        {
+            shared_ptr<GameState> state = this->getState(name);
+            state->activity_.topState = false;
+            this->loadedStates_.pop_back();
+            if (!this->loadedStates_.empty())
+                this->loadedStates_.back()->activity_.topState = true;
+            state->deactivate();
+        }
+        catch (...)
+        {
+            COUT(2) << "Warning: Unloading GameState '" << name << "' threw an exception: " << Exception::handleMessage() << std::endl;
+            COUT(2) << "         There might be potential resource leaks involved! To avoid this, improve exception-safety." << std::endl;
+        }
+        // Check if graphics is still required
+        if (!bAbort_)
+        {
+            bool graphicsRequired = false;
+            for (unsigned i = 0; i < loadedStates_.size(); ++i)
+                graphicsRequired |= loadedStates_[i]->getInfo().bGraphicsMode;
+            if (!graphicsRequired)
+                this->unloadGraphics();
+        }
+        this->bChangingState_ = false;
+    }
+
+    std::map<std::string, shared_ptr<Game::GameStateFactory> > Game::GameStateFactory::factories_s;
+
+    /*static*/ shared_ptr<GameState> Game::GameStateFactory::fabricate(const GameStateInfo& info)
+    {
+        std::map<std::string, shared_ptr<Game::GameStateFactory> >::const_iterator it = factories_s.find(info.className);
+        assert(it != factories_s.end());
+        return it->second->fabricateInternal(info);
+    }
+}
Index: /sandbox_light/src/libraries/core/Game.h
===================================================================
--- /sandbox_light/src/libraries/core/Game.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/Game.h	(revision 5788)
@@ -0,0 +1,212 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Declaration of Game Singleton.
+ */
+
+#ifndef _Game_H__
+#define _Game_H__
+
+#include "CorePrereqs.h"
+
+#include <cassert>
+#include <list>
+#include <map>
+#include <string>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/preprocessor/cat.hpp>
+
+#include "util/Debug.h"
+#include "util/ScopeGuard.h"
+#include "util/Singleton.h"
+
+/**
+@def
+    Adds a new GameState to the Game. The second parameter is the name as string
+    and every following paramter is a constructor argument (which is usually non existent)
+*/
+#define DeclareGameState(className, stateName, bIgnoreTickTime, bGraphicsMode) \
+    static bool BOOST_PP_CAT(bGameStateDummy_##className, __LINE__) = orxonox::Game::declareGameState<className>(#className, stateName, bIgnoreTickTime, bGraphicsMode)
+
+namespace orxonox
+{
+    class GameConfiguration;
+
+    //! Helper object required before GameStates are being constructed
+    struct GameStateInfo
+    {
+        std::string stateName;
+        std::string className;
+        bool bIgnoreTickTime;
+        bool bGraphicsMode;
+    };
+
+    /**
+    @brief
+        Main class responsible for running the game.
+    @remark
+        You should only create this singleton once because it owns the Core class! (see remark there)
+    */
+    class _CoreExport Game : public Singleton<Game>
+    {
+        friend class Singleton<Game>;
+        typedef std::vector<shared_ptr<GameState> > GameStateVector;
+        typedef std::map<std::string, shared_ptr<GameState> > GameStateMap;
+        typedef shared_ptr<GameStateTreeNode> GameStateTreeNodePtr;
+
+    public:
+        Game(const std::string& cmdLine);
+        ~Game();
+
+        void setStateHierarchy(const std::string& str);
+        shared_ptr<GameState> getState(const std::string& name);
+
+        void run();
+        void stop();
+
+        void requestState(const std::string& name);
+        void requestStates(const std::string& names);
+        void popState();
+
+        const Clock& getGameClock() { return *this->gameClock_; }
+
+        float getAvgTickTime() { return this->avgTickTime_; }
+        float getAvgFPS()      { return this->avgFPS_; }
+
+        void subtractTickTime(int32_t length);
+
+        template <class T>
+        static bool declareGameState(const std::string& className, const std::string& stateName, bool bIgnoreTickTime, bool bConsoleMode);
+
+    private:
+        class _CoreExport GameStateFactory
+        {
+        public:
+            virtual ~GameStateFactory() { }
+            static shared_ptr<GameState> fabricate(const GameStateInfo& info);
+            template <class T>
+            static void createFactory(const std::string& className)
+                { factories_s[className].reset(new TemplateGameStateFactory<T>()); }
+
+            virtual shared_ptr<GameState> fabricateInternal(const GameStateInfo& info) = 0;
+            static std::map<std::string, shared_ptr<GameStateFactory> > factories_s;
+        };
+        template <class T>
+        class TemplateGameStateFactory : public GameStateFactory
+        {
+        public:
+            shared_ptr<GameState> fabricateInternal(const GameStateInfo& info)
+                { return shared_ptr<GameState>(new T(info)); }
+        };
+        // For the factory destruction
+        typedef Loki::ObjScopeGuardImpl0<std::map<std::string, shared_ptr<GameStateFactory> >, void (std::map<std::string, shared_ptr<GameStateFactory> >::*)()> ObjScopeGuard;
+
+        struct StatisticsTickInfo
+        {
+            uint64_t    tickTime;
+            uint32_t    tickLength;
+        };
+
+        Game(Game&); // don't mess with singletons
+
+        void loadGraphics();
+        void unloadGraphics();
+
+        bool checkState(const std::string& name) const;
+        void loadState(const std::string& name);
+        void unloadState(const std::string& name);
+
+        // Main loop structuring
+        void updateGameStateStack();
+        void updateGameStates();
+        void updateStatistics();
+        void updateFPSLimiter();
+
+        // ScopeGuard helper function
+        void resetChangingState() { this->bChangingState_ = false; }
+
+        scoped_ptr<Clock>                  gameClock_;
+        scoped_ptr<Core>                   core_;
+        ObjScopeGuard                      gsFactoryDestroyer_;
+        scoped_ptr<GameConfiguration>      configuration_;
+
+        GameStateMap                       constructedStates_;
+        GameStateVector                    loadedStates_;
+        GameStateTreeNodePtr               rootStateNode_;
+        GameStateTreeNodePtr               loadedTopStateNode_;
+        std::vector<GameStateTreeNodePtr>  requestedStateNodes_;
+
+        bool                               bChangingState_;
+        bool                               bAbort_;
+
+        // variables for time statistics
+        uint64_t                           statisticsStartTime_;
+        std::list<StatisticsTickInfo>      statisticsTickTimes_;
+        uint32_t                           periodTime_;
+        uint32_t                           periodTickTime_;
+        float                              avgFPS_;
+        float                              avgTickTime_;
+        int                                excessSleepTime_;
+        unsigned int                       minimumSleepTime_;
+
+        static std::map<std::string, GameStateInfo> gameStateDeclarations_s;
+        static Game* singletonPtr_s;        //!< Pointer to the Singleton
+    };
+
+    template <class T>
+    /*static*/ bool Game::declareGameState(const std::string& className, const std::string& stateName, bool bIgnoreTickTime, bool bGraphicsMode)
+    {
+        std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.find(stateName);
+        if (it == gameStateDeclarations_s.end())
+        {
+            GameStateInfo& info = gameStateDeclarations_s[stateName];
+            info.stateName = stateName;
+            info.className = className;
+            info.bIgnoreTickTime = bIgnoreTickTime;
+            info.bGraphicsMode = bGraphicsMode;
+        }
+        else
+        {
+            COUT(0) << "Error: Cannot declare two GameStates with the same name." << std::endl;
+            COUT(0) << "       Ignoring second one ('" << stateName << "')." << std::endl;
+        }
+
+        // Create a factory to delay GameState creation
+        GameStateFactory::createFactory<T>(className);
+
+        // just a required dummy return value
+        return true;
+    }
+}
+
+#endif /* _Game_H__ */
Index: /sandbox_light/src/libraries/core/GameState.cc
===================================================================
--- /sandbox_light/src/libraries/core/GameState.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/GameState.cc	(revision 5788)
@@ -0,0 +1,97 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Implementation of GameState class.
+*/
+
+#include "GameState.h"
+
+#include "util/Debug.h"
+#include "util/Exception.h"
+#include "util/OrxAssert.h"
+#include "Game.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Constructor only initialises variables and sets the name permanently.
+    */
+    GameState::GameState(const GameStateInfo& info)
+        : info_(info)
+    {
+        this->activity_.activating   = false;
+        this->activity_.active       = false;
+        this->activity_.deactivating = false;
+        this->activity_.suspended    = false;
+        this->activity_.topState     = false;
+        this->activity_.updating     = false;
+    }
+
+    /**
+    @brief
+        Destructor only checks that we don't delete an active state.
+    */
+    GameState::~GameState()
+    {
+        OrxAssert(this->activity_.active == false, "Deleting an active GameState is a very bad idea..");
+    }
+
+    const std::string& GameState::getName() const
+    {
+        return info_.stateName;
+    }
+
+    void GameState::activateInternal()
+    {
+        this->activity_.activating = true;
+        this->activate();
+        this->activity_.activating = false;
+        this->activity_.active = true;
+    }
+
+    void GameState::deactivateInternal()
+    {
+        this->activity_.active = false;
+        this->activity_.deactivating = true;
+        this->activate();
+        this->activity_.deactivating = false;
+        this->activity_.suspended = false;
+        this->activity_.updating = false;
+    }
+
+    void GameState::updateInternal(const Clock& time)
+    {
+        this->activity_.updating = true;
+        this->update(time);
+        this->activity_.updating = false;
+    }
+}
Index: /sandbox_light/src/libraries/core/GameState.h
===================================================================
--- /sandbox_light/src/libraries/core/GameState.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/GameState.h	(revision 5788)
@@ -0,0 +1,102 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Definition of GameState class.
+*/
+
+#ifndef _GameState_H__
+#define _GameState_H__
+
+#include "CorePrereqs.h"
+
+#include <map>
+#include <string>
+
+namespace orxonox
+{
+    /**
+    @brief
+        An implementation of a tree to manage game states.
+        This leads to a certain hierarchy that is created at runtime.
+        To actually use the structure, you will have to derive from it and
+        implement 'enter', 'leave' and 'tick'. The latter corresponds to an
+        update function.
+
+        Internally the tree is managed by two maps per node: One stores all its
+        children, grandchildren, etc. by name of the state. The other maps these
+        children states to the actual child of the node.
+        An example: Foo is a grandchildren of Bar and Foofoo is the Foo's parent.
+        Then Bar stores Foo in map by its name. The other one then maps Foo to Foofoo.
+    */
+    class _CoreExport GameState
+    {
+        friend class Game;
+
+    public:
+        /**
+        @brief
+            Gives information about what the GameState is currently doing
+        */
+        struct State
+        {
+            unsigned active       : 1;
+            unsigned activating   : 1;
+            unsigned deactivating : 1;
+            unsigned updating     : 1;
+            unsigned suspended    : 1;
+            unsigned topState     : 1;
+        };
+
+    public:
+        GameState(const GameStateInfo& info);
+        virtual ~GameState();
+
+        const std::string& getName()   const;
+        State getActivity()            const { return activity_; }
+        const GameStateInfo& getInfo() const { return info_; }
+
+    protected:
+        virtual void activate() { }
+        virtual void deactivate() { }
+        virtual void update(const Clock& time) { }
+
+    private:
+        void setActivity(State activity);
+        void activateInternal();
+        void deactivateInternal();
+        void updateInternal(const Clock& time);
+
+        const GameStateInfo& info_;
+        State                activity_;
+    };
+}
+
+#endif /* _GameState_H__ */
Index: /sandbox_light/src/libraries/core/Identifier.cc
===================================================================
--- /sandbox_light/src/libraries/core/Identifier.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/Identifier.cc	(revision 5788)
@@ -0,0 +1,359 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the Identifier class.
+*/
+
+#include "Identifier.h"
+
+#include <ostream>
+
+#include "util/StringUtils.h"
+#include "ConfigValueContainer.h"
+#include "Factory.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###       Identifier        ###
+    // ###############################
+    int Identifier::hierarchyCreatingCounter_s = 0;
+    unsigned int Identifier::classIDCounter_s = 0;
+
+    /**
+        @brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
+    */
+    Identifier::Identifier()
+        : classID_(classIDCounter_s++)
+    {
+        this->objects_ = new ObjectListBase(this);
+
+        this->bCreatedOneObject_ = false;
+        this->bSetName_ = false;
+        this->factory_ = 0;
+
+        this->bHasConfigValues_ = false;
+
+        this->children_ = new std::set<const Identifier*>();
+        this->directChildren_ = new std::set<const Identifier*>();
+    }
+
+    /**
+        @brief Destructor: Deletes the list containing the children.
+    */
+    Identifier::~Identifier()
+    {
+        delete this->children_;
+        delete this->directChildren_;
+        delete this->objects_;
+
+        if (this->factory_)
+            delete this->factory_;
+
+        for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it)
+            delete (it->second);
+    }
+
+    /**
+        @brief Returns the identifier map with the names as received by typeid(). This is only used internally.
+    */
+    std::map<std::string, Identifier*>& Identifier::getTypeIDIdentifierMap()
+    {
+        static std::map<std::string, Identifier*> identifiers;    //!< The map to store all Identifiers.
+        return identifiers;
+    }
+
+    /**
+        @brief Returns an identifier by name and adds it if not available
+        @param name The name of the identifier as typeid().name() suggests
+        @param proposal A pointer to a newly created identifier for the case of non existance in the map
+        @return The identifier (unique instance)
+    */
+    Identifier* Identifier::getIdentifierSingleton(const std::string& name, Identifier* proposal)
+    {
+        std::map<std::string, Identifier*>::const_iterator it = getTypeIDIdentifierMap().find(name);
+
+        if (it != getTypeIDIdentifierMap().end())
+        {
+            // There is already an entry: return it and delete the proposal
+            delete proposal;
+            return (*it).second;
+        }
+        else
+        {
+            // There is no entry: put the proposal into the map and return it
+            getTypeIDIdentifierMap()[name] = proposal;
+            return proposal;
+        }
+    }
+
+    /**
+        @brief Registers a class, which means that the name and the parents get stored.
+        @param parents A list, containing the Identifiers of all parents of the class
+        @param bRootClass True if the class is either an Interface or the BaseObject itself
+    */
+    void Identifier::initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass)
+    {
+        // Check if at least one object of the given type was created
+        if (!this->bCreatedOneObject_ && Identifier::isCreatingHierarchy())
+        {
+            // If no: We have to store the information and initialize the Identifier
+            COUT(4) << "*** ClassIdentifier: Register Class in " << this->getName() << "-Singleton -> Initialize Singleton." << std::endl;
+            if (bRootClass)
+                this->initialize(0); // If a class is derived from two interfaces, the second interface might think it's derived from the first because of the order of constructor-calls. Thats why we set parents to zero in that case.
+            else
+                this->initialize(parents);
+        }
+    }
+
+    /**
+        @brief Initializes the Identifier with a list containing all parents of the class the Identifier belongs to.
+        @param parents A list containing all parents
+    */
+    void Identifier::initialize(std::set<const Identifier*>* parents)
+    {
+        COUT(4) << "*** Identifier: Initialize " << this->name_ << "-Singleton." << std::endl;
+        this->bCreatedOneObject_ = true;
+
+        if (parents)
+        {
+            this->parents_ = (*parents);
+            this->directParents_ = (*parents);
+
+            // Iterate through all parents
+            for (std::set<const Identifier*>::iterator it = parents->begin(); it != parents->end(); ++it)
+            {
+                // Tell the parent we're one of it's children
+                (*it)->getChildrenIntern().insert((*it)->getChildrenIntern().end(), this);
+
+                // Erase all parents of our parent from our direct-parent-list
+                for (std::set<const Identifier*>::const_iterator it1 = (*it)->getParents().begin(); it1 != (*it)->getParents().end(); ++it1)
+                {
+                    // Search for the parent's parent in our direct-parent-list
+                    for (std::set<const Identifier*>::iterator it2 = this->directParents_.begin(); it2 != this->directParents_.end(); ++it2)
+                    {
+                        if ((*it1) == (*it2))
+                        {
+                            // We've found a non-direct parent in our list: Erase it
+                            this->directParents_.erase(it2);
+                            break;
+                        }
+                    }
+                }
+            }
+
+            // Now iterate through all direct parents
+            for (std::set<const Identifier*>::iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
+            {
+                // Tell the parent we're one of it's direct children
+                (*it)->getDirectChildrenIntern().insert((*it)->getDirectChildrenIntern().end(), this);
+            }
+        }
+    }
+
+    /**
+        @brief Destroys all Identifiers. Called when exiting the program.
+    */
+    void Identifier::destroyAllIdentifiers()
+    {
+        for (std::map<std::string, Identifier*>::iterator it = Identifier::getTypeIDIdentifierMap().begin(); it != Identifier::getTypeIDIdentifierMap().end(); ++it)
+            delete (it->second);
+    }
+
+    /**
+        @brief Sets the name of the class.
+        @param name The name
+    */
+    void Identifier::setName(const std::string& name)
+    {
+        if (!this->bSetName_)
+        {
+            this->name_ = name;
+            this->bSetName_ = true;
+            Identifier::getIdentifierMapIntern()[name] = this;
+            Identifier::getLowercaseIdentifierMapIntern()[getLowercase(name)] = this;
+        }
+    }
+
+    /**
+        @brief Creates an object of the type the Identifier belongs to.
+        @return The new object
+    */
+    BaseObject* Identifier::fabricate(BaseObject* creator)
+    {
+        if (this->factory_)
+        {
+            return this->factory_->fabricate(creator); // We have to return a BaseObject, because we don't know the exact type.
+        }
+        else
+        {
+            COUT(1) << "An error occurred in Identifier.cc:" << std::endl;
+            COUT(1) << "Error: Cannot fabricate an object of type '" << this->name_ << "'. Class has no factory." << std::endl;
+            COUT(1) << "Aborting..." << std::endl;
+            abort();
+            return NULL;
+        }
+    }
+
+    /**
+        @brief Returns true, if the Identifier is at least of the given type.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isA(const Identifier* identifier) const
+    {
+        return (identifier == this || (this->parents_.find(identifier) != this->parents_.end()));
+    }
+
+    /**
+        @brief Returns true, if the Identifier is exactly of the given type.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isExactlyA(const Identifier* identifier) const
+    {
+        return (identifier == this);
+    }
+
+    /**
+        @brief Returns true, if the assigned identifier is a child of the given identifier.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isChildOf(const Identifier* identifier) const
+    {
+        return (this->parents_.find(identifier) != this->parents_.end());
+    }
+
+    /**
+        @brief Returns true, if the assigned identifier is a direct child of the given identifier.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isDirectChildOf(const Identifier* identifier) const
+    {
+        return (this->directParents_.find(identifier) != this->directParents_.end());
+    }
+
+    /**
+        @brief Returns true, if the assigned identifier is a parent of the given identifier.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isParentOf(const Identifier* identifier) const
+    {
+        return (this->children_->find(identifier) != this->children_->end());
+    }
+
+    /**
+        @brief Returns true, if the assigned identifier is a direct parent of the given identifier.
+        @param identifier The identifier to compare with
+    */
+    bool Identifier::isDirectParentOf(const Identifier* identifier) const
+    {
+        return (this->directChildren_->find(identifier) != this->directChildren_->end());
+    }
+
+    /**
+        @brief Returns the map that stores all Identifiers.
+        @return The map
+    */
+    std::map<std::string, Identifier*>& Identifier::getIdentifierMapIntern()
+    {
+        static std::map<std::string, Identifier*> identifierMap;
+        return identifierMap;
+    }
+
+    /**
+        @brief Returns the map that stores all Identifiers.
+        @return The map
+    */
+    std::map<std::string, Identifier*>& Identifier::getLowercaseIdentifierMapIntern()
+    {
+        static std::map<std::string, Identifier*> lowercaseIdentifierMap;
+        return lowercaseIdentifierMap;
+    }
+
+    /**
+        @brief Adds the ConfigValueContainer of a variable, given by the string of its name.
+        @param varname The name of the variablee
+        @param container The container
+    */
+    void Identifier::addConfigValueContainer(const std::string& varname, ConfigValueContainer* container)
+    {
+        std::map<std::string, ConfigValueContainer*>::const_iterator it = this->configValues_.find(varname);
+        if (it != this->configValues_.end())
+        {
+            COUT(2) << "Warning: Overwriting config-value with name " << varname << " in class " << this->getName() << "." << std::endl;
+            delete (it->second);
+        }
+
+        this->bHasConfigValues_ = true;
+        this->configValues_[varname] = container;
+        this->configValues_LC_[getLowercase(varname)] = container;
+    }
+
+    /**
+        @brief Returns the ConfigValueContainer of a variable, given by the string of its name.
+        @param varname The name of the variable
+        @return The ConfigValueContainer
+    */
+    ConfigValueContainer* Identifier::getConfigValueContainer(const std::string& varname)
+    {
+        std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_.find(varname);
+        if (it != configValues_.end())
+            return ((*it).second);
+        else
+            return 0;
+    }
+
+    /**
+        @brief Returns the ConfigValueContainer of a variable, given by the string of its name in lowercase.
+        @param varname The name of the variable in lowercase
+        @return The ConfigValueContainer
+    */
+    ConfigValueContainer* Identifier::getLowercaseConfigValueContainer(const std::string& varname)
+    {
+        std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_LC_.find(varname);
+        if (it != configValues_LC_.end())
+            return ((*it).second);
+        else
+            return 0;
+    }
+
+    /**
+        @brief Lists the names of all Identifiers in a std::set<const Identifier*>.
+        @param out The outstream
+        @param list The list (or set) of Identifiers
+        @return The outstream
+    */
+    std::ostream& operator<<(std::ostream& out, const std::set<const Identifier*>& list)
+    {
+        for (std::set<const Identifier*>::const_iterator it = list.begin(); it != list.end(); ++it)
+            out << (*it)->getName() << " ";
+
+        return out;
+    }
+}
Index: /sandbox_light/src/libraries/core/Identifier.h
===================================================================
--- /sandbox_light/src/libraries/core/Identifier.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/Identifier.h	(revision 5788)
@@ -0,0 +1,559 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the Identifier, ClassIdentifier and SubclassIdentifier classes, implementation of the ClassIdentifier and SubclassIdentifier classes.
+
+    The Identifier contains all needed information about the class it belongs to:
+     - the name
+     - a list with all objects
+     - parents and children
+     - the factory (if available)
+     - the networkID that can be synchronised with the server
+     - all configurable variables (if available)
+
+    Every object has a pointer to the Identifier of its class. This allows the use isA(...),
+    isExactlyA(...), isChildOf(...) and isParentOf(...).
+
+    To create the class-hierarchy, the Identifier has some intern functions and variables.
+
+    Every Identifier is in fact a ClassIdentifier, but they are derived from Identifier.
+
+    SubclassIdentifier is a separated class, acting like an Identifier, but has a given class.
+    You can only assign Identifiers of exactly the given class or of a derivative to a SubclassIdentifier.
+*/
+
+#ifndef _Identifier_H__
+#define _Identifier_H__
+
+#include "CorePrereqs.h"
+
+#include <cassert>
+#include <map>
+#include <set>
+#include <string>
+#include <typeinfo>
+
+#include "util/Debug.h"
+#include "util/TypeTraits.h"
+#include "MetaObjectList.h"
+#include "ObjectList.h"
+#include "ObjectListBase.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###       Identifier        ###
+    // ###############################
+    //! The Identifier is used to identify the class of an object and to store information about the class.
+    /**
+        The Identifier contains all needed information about the class it belongs to:
+         - the name
+         - a list with all objects
+         - parents and children
+         - the factory (if available)
+         - the networkID that can be synchronised with the server
+         - all configurable variables (if available)
+
+        Every object has a pointer to the Identifier of its class. This allows the use isA(...),
+        isExactlyA(...), isChildOf(...) and isParentOf(...).
+
+        You can't directly create an Identifier, it's just the base-class for ClassIdentifier.
+    */
+    class _CoreExport Identifier
+    {
+        template <class T>
+        friend class SubclassIdentifier;
+
+        friend class Factory;
+
+        public:
+            /** @brief Sets the Factory. @param factory The factory to assign */
+            inline void addFactory(BaseFactory* factory) { this->factory_ = factory; }
+
+            BaseObject* fabricate(BaseObject* creator);
+            bool isA(const Identifier* identifier) const;
+            bool isExactlyA(const Identifier* identifier) const;
+            bool isChildOf(const Identifier* identifier) const;
+            bool isDirectChildOf(const Identifier* identifier) const;
+            bool isParentOf(const Identifier* identifier) const;
+            bool isDirectParentOf(const Identifier* identifier) const;
+
+            /** @brief Returns the list of all existing objects of this class. @return The list */
+            inline ObjectListBase* getObjects() const
+                { return this->objects_; }
+
+            /** @brief Returns the name of the class the Identifier belongs to. @return The name */
+            inline const std::string& getName() const { return this->name_; }
+            void setName(const std::string& name);
+
+            virtual void updateConfigValues(bool updateChildren = true) const = 0;
+
+            /** @brief Returns the parents of the class the Identifier belongs to. @return The list of all parents */
+            inline const std::set<const Identifier*>& getParents() const { return this->parents_; }
+            /** @brief Returns the begin-iterator of the parents-list. @return The begin-iterator */
+            inline std::set<const Identifier*>::const_iterator getParentsBegin() const { return this->parents_.begin(); }
+            /** @brief Returns the end-iterator of the parents-list. @return The end-iterator */
+            inline std::set<const Identifier*>::const_iterator getParentsEnd() const { return this->parents_.end(); }
+
+            /** @brief Returns the children of the class the Identifier belongs to. @return The list of all children */
+            inline const std::set<const Identifier*>& getChildren() const { return (*this->children_); }
+            /** @brief Returns the begin-iterator of the children-list. @return The begin-iterator */
+            inline std::set<const Identifier*>::const_iterator getChildrenBegin() const { return this->children_->begin(); }
+            /** @brief Returns the end-iterator of the children-list. @return The end-iterator */
+            inline std::set<const Identifier*>::const_iterator getChildrenEnd() const { return this->children_->end(); }
+
+            /** @brief Returns the direct parents of the class the Identifier belongs to. @return The list of all direct parents */
+            inline const std::set<const Identifier*>& getDirectParents() const { return this->directParents_; }
+            /** @brief Returns the begin-iterator of the direct-parents-list. @return The begin-iterator */
+            inline std::set<const Identifier*>::const_iterator getDirectParentsBegin() const { return this->directParents_.begin(); }
+            /** @brief Returns the end-iterator of the direct-parents-list. @return The end-iterator */
+            inline std::set<const Identifier*>::const_iterator getDirectParentsEnd() const { return this->directParents_.end(); }
+
+            /** @brief Returns the direct children the class the Identifier belongs to. @return The list of all direct children */
+            inline const std::set<const Identifier*>& getDirectChildren() const { return (*this->directChildren_); }
+            /** @brief Returns the begin-iterator of the direct-children-list. @return The begin-iterator */
+            inline std::set<const Identifier*>::const_iterator getDirectChildrenBegin() const { return this->directChildren_->begin(); }
+            /** @brief Returns the end-iterator of the direct-children-list. @return The end-iterator */
+            inline std::set<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_->end(); }
+
+
+            /** @brief Returns the map that stores all Identifiers. @return The map */
+            static inline const std::map<std::string, Identifier*>& getIdentifierMap() { return Identifier::getIdentifierMapIntern(); }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all Identifiers. @return The const_iterator */
+            static inline std::map<std::string, Identifier*>::const_iterator getIdentifierMapBegin() { return Identifier::getIdentifierMap().begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all Identifiers. @return The const_iterator */
+            static inline std::map<std::string, Identifier*>::const_iterator getIdentifierMapEnd() { return Identifier::getIdentifierMap().end(); }
+
+            /** @brief Returns the map that stores all Identifiers with their names in lowercase. @return The map */
+            static inline const std::map<std::string, Identifier*>& getLowercaseIdentifierMap() { return Identifier::getLowercaseIdentifierMapIntern(); }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase. @return The const_iterator */
+            static inline std::map<std::string, Identifier*>::const_iterator getLowercaseIdentifierMapBegin() { return Identifier::getLowercaseIdentifierMap().begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase. @return The const_iterator */
+            static inline std::map<std::string, Identifier*>::const_iterator getLowercaseIdentifierMapEnd() { return Identifier::getLowercaseIdentifierMap().end(); }
+
+
+            /** @brief Returns the map that stores all config values. @return The const_iterator */
+            inline const std::map<std::string, ConfigValueContainer*>& getConfigValueMap() const { return this->configValues_; }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all config values. @return The const_iterator */
+            inline std::map<std::string, ConfigValueContainer*>::const_iterator getConfigValueMapBegin() const { return this->configValues_.begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all config values. @return The const_iterator */
+            inline std::map<std::string, ConfigValueContainer*>::const_iterator getConfigValueMapEnd() const { return this->configValues_.end(); }
+
+            /** @brief Returns the map that stores all config values with their names in lowercase. @return The const_iterator */
+            inline const std::map<std::string, ConfigValueContainer*>& getLowercaseConfigValueMap() const { return this->configValues_LC_; }
+            /** @brief Returns a const_iterator to the beginning of the map that stores all config values with their names in lowercase. @return The const_iterator */
+            inline std::map<std::string, ConfigValueContainer*>::const_iterator getLowercaseConfigValueMapBegin() const { return this->configValues_LC_.begin(); }
+            /** @brief Returns a const_iterator to the end of the map that stores all config values with their names in lowercase. @return The const_iterator */
+            inline std::map<std::string, ConfigValueContainer*>::const_iterator getLowercaseConfigValueMapEnd() const { return this->configValues_LC_.end(); }
+
+
+            /** @brief Returns true if this class has at least one config value. @return True if this class has at least one config value */
+            inline bool hasConfigValues() const { return this->bHasConfigValues_; }
+
+            /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */
+            inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
+
+            /** @brief Returns the unique ID of the class */
+            FORCEINLINE unsigned int getClassID() const { return this->classID_; }
+
+            void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container);
+            ConfigValueContainer* getConfigValueContainer(const std::string& varname);
+            ConfigValueContainer* getLowercaseConfigValueContainer(const std::string& varname);
+
+            void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
+
+            static void destroyAllIdentifiers();
+
+        protected:
+            Identifier();
+            Identifier(const Identifier& identifier); // don't copy
+            virtual ~Identifier();
+
+            static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
+
+            /** @brief Returns the map that stores all Identifiers. @return The map */
+            static std::map<std::string, Identifier*>& getIdentifierMapIntern();
+            /** @brief Returns the map that stores all Identifiers with their names in lowercase. @return The map */
+            static std::map<std::string, Identifier*>& getLowercaseIdentifierMapIntern();
+
+            /** @brief Returns the children of the class the Identifier belongs to. @return The list of all children */
+            inline std::set<const Identifier*>& getChildrenIntern() const { return (*this->children_); }
+            /** @brief Returns the direct children of the class the Identifier belongs to. @return The list of all direct children */
+            inline std::set<const Identifier*>& getDirectChildrenIntern() const { return (*this->directChildren_); }
+
+            ObjectListBase* objects_;                                      //!< The list of all objects of this class
+
+        private:
+            /**
+                @brief Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.
+            */
+            inline static void startCreatingHierarchy()
+            {
+                hierarchyCreatingCounter_s++;
+                COUT(4) << "*** Identifier: Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl;
+            }
+
+            /**
+                @brief Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents.
+            */
+            inline static void stopCreatingHierarchy()
+            {
+                hierarchyCreatingCounter_s--;
+                COUT(4) << "*** Identifier: Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl;
+            }
+
+            static std::map<std::string, Identifier*>& getTypeIDIdentifierMap();
+
+            void initialize(std::set<const Identifier*>* parents);
+
+            std::set<const Identifier*> parents_;                          //!< The parents of the class the Identifier belongs to
+            std::set<const Identifier*>* children_;                        //!< The children of the class the Identifier belongs to
+
+            std::set<const Identifier*> directParents_;                    //!< The direct parents of the class the Identifier belongs to
+            std::set<const Identifier*>* directChildren_;                  //!< The direct children of the class the Identifier belongs to
+
+            bool bCreatedOneObject_;                                       //!< True if at least one object of the given type was created (used to determine the need of storing the parents)
+            bool bSetName_;                                                //!< True if the name is set
+            std::string name_;                                             //!< The name of the class the Identifier belongs to
+            BaseFactory* factory_;                                         //!< The Factory, able to create new objects of the given class (if available)
+            static int hierarchyCreatingCounter_s;                         //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
+            const unsigned int classID_;                                   //!< Uniquely identifies a class (might not be the same as the networkID_)
+            static unsigned int classIDCounter_s;                          //!< Static counter for the unique classIDs
+
+            bool bHasConfigValues_;                                        //!< True if this class has at least one assigned config value
+            std::map<std::string, ConfigValueContainer*> configValues_;    //!< A map to link the string of configurable variables with their ConfigValueContainer
+            std::map<std::string, ConfigValueContainer*> configValues_LC_; //!< A map to link the string of configurable variables with their ConfigValueContainer
+    };
+
+    _CoreExport std::ostream& operator<<(std::ostream& out, const std::set<const Identifier*>& list);
+
+
+    // ###############################
+    // ###     ClassIdentifier     ###
+    // ###############################
+    //! The ClassIdentifier is derived from Identifier and holds all class-specific functions and variables the Identifier cannot have.
+    /**
+        ClassIdentifier is a Singleton, which means that only one object of a given type T exists.
+        This makes it possible to store information about a class, sharing them with all
+        objects of that class without defining static variables in every class.
+
+        To be really sure that not more than exactly one object exists (even with libraries),
+        ClassIdentifiers are stored in the Identifier Singleton.
+    */
+    template <class T>
+    class ClassIdentifier : public Identifier
+    {
+        public:
+            static ClassIdentifier<T> *getIdentifier();
+            static ClassIdentifier<T> *getIdentifier(const std::string& name);
+
+            bool initialiseObject(T* object, const std::string& className, bool bRootClass);
+
+            void updateConfigValues(bool updateChildren = true) const;
+
+        private:
+            static void initialiseIdentifier();
+            ClassIdentifier(const ClassIdentifier<T>& identifier) {}    // don't copy
+            ClassIdentifier()
+            {
+            }
+            ~ClassIdentifier()
+            {
+            }
+
+            static ClassIdentifier<T>* classIdentifier_s;
+    };
+
+    template <class T>
+    ClassIdentifier<T>* ClassIdentifier<T>::classIdentifier_s = 0;
+
+    /**
+        @brief Returns the only instance of this class.
+        @return The unique Identifier
+    */
+    template <class T>
+    inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier()
+    {
+        // check if the static field has already been filled
+        if (ClassIdentifier<T>::classIdentifier_s == 0)
+            ClassIdentifier<T>::initialiseIdentifier();
+
+        return ClassIdentifier<T>::classIdentifier_s;
+    }
+
+    /**
+        @brief Does the same as getIdentifier() but sets the name if this wasn't done yet.
+        @param name The name of this Identifier
+        @return The Identifier
+    */
+    template <class T>
+    inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier(const std::string& name)
+    {
+        ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
+        identifier->setName(name);
+        return identifier;
+    }
+
+    /**
+        @brief Assigns the static field for the identifier singleton.
+    */
+    template <class T>
+    void ClassIdentifier<T>::initialiseIdentifier()
+    {
+        // Get the name of the class
+        std::string name = typeid(T).name();
+
+        // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used.
+        ClassIdentifier<T>* proposal = new ClassIdentifier<T>();
+
+        // Get the entry from the map
+        ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)Identifier::getIdentifierSingleton(name, proposal);
+
+        if (ClassIdentifier<T>::classIdentifier_s == proposal)
+        {
+            COUT(4) << "*** Identifier: Requested Identifier for " << name << " was not yet existing and got created." << std::endl;
+        }
+        else
+        {
+            COUT(4) << "*** Identifier: Requested Identifier for " << name << " was already existing and got assigned." << std::endl;
+        }
+    }
+
+    /**
+        @brief Adds an object of the given type to the ObjectList.
+        @param object The object to add
+    */
+    template <class T>
+    bool ClassIdentifier<T>::initialiseObject(T* object, const std::string& className, bool bRootClass)
+    {
+        if (bRootClass)
+            COUT(5) << "*** Register Root-Object: " << className << std::endl;
+        else
+            COUT(5) << "*** Register Object: " << className << std::endl;
+
+        object->identifier_ = this;
+        if (Identifier::isCreatingHierarchy())
+        {
+            if (bRootClass && !object->parents_)
+                object->parents_ = new std::set<const Identifier*>();
+
+            if (object->parents_)
+            {
+                this->initializeClassHierarchy(object->parents_, bRootClass);
+                object->parents_->insert(object->parents_->end(), this);
+            }
+
+            object->setConfigValues();
+            return true;
+        }
+        else
+        {
+            COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
+            object->metaList_->add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
+
+            // Add pointer of type T to the map in the OrxonoxClass instance that enables "dynamic_casts"
+            object->objectPointers_.push_back(std::make_pair(this->getClassID(), static_cast<void*>(object)));
+            return false;
+        }
+    }
+
+    /**
+        @brief Updates the config-values of all existing objects of this class by calling their setConfigValues() function.
+    */
+    template <class T>
+    void ClassIdentifier<T>::updateConfigValues(bool updateChildren) const
+    {
+        if (!this->hasConfigValues())
+            return;
+
+        for (ObjectListIterator<T> it = ObjectList<T>::begin(); it; ++it)
+            it->setConfigValues();
+
+        if (updateChildren)
+            for (std::set<const Identifier*>::const_iterator it = this->getChildrenBegin(); it != this->getChildrenEnd(); ++it)
+                (*it)->updateConfigValues(false);
+    }
+
+
+    // ###############################
+    // ###      orxonox_cast       ###
+    // ###############################
+    /**
+    @brief
+        Casts on object of type OrxonoxClass to any derived type that is
+        registered in the class hierarchy.
+    @return
+        Returns NULL if the cast is not possible
+    @note
+        In case of NULL return (and using MSVC), a dynamic_cast might still be possible if
+        a class forgot to register its objects.
+        Also note that the function is implemented differently for GCC/MSVC.
+    */
+    template <class T, class U>
+    FORCEINLINE T orxonox_cast(U source)
+    {
+#ifdef ORXONOX_COMPILER_MSVC
+        typedef Loki::TypeTraits<typename Loki::TypeTraits<T>::PointeeType>::NonConstType ClassType;
+        if (source != NULL)
+            return source->template getDerivedPointer<ClassType>(ClassIdentifier<ClassType>::getIdentifier()->getClassID());
+        else
+            return NULL;
+#else
+        return dynamic_cast<T>(source);
+#endif
+    }
+
+
+    // ###############################
+    // ###   SubclassIdentifier    ###
+    // ###############################
+    //! The SubclassIdentifier acts almost like an Identifier, but has some prerequisites.
+    /**
+        You can only assign an Identifier that belongs to a class T (or derived) to a SubclassIdentifier<T>.
+        If you assign something else, the program aborts.
+        Because we know the minimum type, a dynamic_cast is done, which makes it easier to create a new object.
+    */
+    template <class T>
+    class SubclassIdentifier
+    {
+        public:
+            /**
+                @brief Constructor: Automaticaly assigns the Identifier of the given class.
+            */
+            SubclassIdentifier()
+            {
+                this->identifier_ = ClassIdentifier<T>::getIdentifier();
+            }
+
+            /**
+                @brief Copyconstructor: Assigns the given Identifier.
+                @param identifier The Identifier
+            */
+            SubclassIdentifier(Identifier* identifier)
+            {
+                this->operator=(identifier);
+            }
+
+            /**
+                @brief Overloading of the = operator: assigns the identifier and checks its type.
+                @param identifier The Identifier to assign
+                @return The SubclassIdentifier itself
+            */
+            SubclassIdentifier<T>& operator=(Identifier* identifier)
+            {
+                if (!identifier || !identifier->isA(ClassIdentifier<T>::getIdentifier()))
+                {
+                    COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
+                    if (identifier)
+                    {
+                        COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl;
+                        COUT(1) << "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl;
+                    }
+                    else
+                    {
+                        COUT(1) << "Error: Can't assign NULL identifier" << std::endl;
+                    }
+                }
+                else
+                {
+                    this->identifier_ = identifier;
+                }
+                return *this;
+            }
+
+            /**
+                @brief Overloading of the * operator: returns the assigned identifier.
+            */
+            inline Identifier* operator*() const
+            {
+                return this->identifier_;
+            }
+
+            /**
+                @brief Overloading of the -> operator: returns the assigned identifier.
+            */
+            inline Identifier* operator->() const
+            {
+                return this->identifier_;
+            }
+
+            /**
+                @brief Returns the assigned identifier. This allows you to assign a SubclassIdentifier to a normal Identifier*.
+            */
+            inline operator Identifier*() const
+            {
+                return this->identifier_;
+            }
+
+            /**
+                @brief Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.
+                @return The new object
+            */
+            T* fabricate(BaseObject* creator) const
+            {
+                BaseObject* newObject = this->identifier_->fabricate(creator);
+
+                // Check if the creation was successful
+                if (newObject)
+                {
+                    return orxonox_cast<T*>(newObject);
+                }
+                else
+                {
+                    // Something went terribly wrong
+                    if (this->identifier_)
+                    {
+                        COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
+                        COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl;
+                        COUT(1) << "Error: Couldn't fabricate a new Object." << std::endl;
+                        COUT(1) << "Aborting..." << std::endl;
+                    }
+                    else
+                    {
+                        COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
+                        COUT(1) << "Error: Couldn't fabricate a new Object - Identifier is undefined." << std::endl;
+                        COUT(1) << "Aborting..." << std::endl;
+                    }
+
+                    assert(false);
+                    return 0;
+                }
+            }
+
+            /** @brief Returns the assigned identifier. @return The identifier */
+            inline Identifier* getIdentifier() const
+                { return this->identifier_; }
+
+        private:
+            Identifier* identifier_;            //!< The assigned identifier
+    };
+}
+
+#endif /* _Identifier_H__ */
Index: /sandbox_light/src/libraries/core/Iterator.h
===================================================================
--- /sandbox_light/src/libraries/core/Iterator.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/Iterator.h	(revision 5788)
@@ -0,0 +1,306 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition and implementation of the Iterator class.
+
+    The Iterator of a given class allows to iterate through an ObjectList. Objects in
+    this list are casted to the template argument of the Iterator.
+
+    Usage:
+    for (Iterator<myClass> it = anyidentifier->getObjects()->begin(); it != anyidentifier->getObjects()->end(); ++it)
+    {
+        it->someFunction(...);
+        myClass* myObject = *it;
+    }
+*/
+
+#ifndef _Iterator_H__
+#define _Iterator_H__
+
+#include "CorePrereqs.h"
+
+#include "Identifier.h"
+#include "ObjectListBase.h"
+
+namespace orxonox
+{
+    //! The Iterator allows to iterate through a given ObjectList
+    template <class T = OrxonoxClass>
+    class Iterator
+    {
+        public:
+            /**
+                @brief Constructor: Sets the element, whereon the iterator points, to zero.
+            */
+            inline Iterator()
+            {
+                this->element_ = 0;
+                this->list_ = 0;
+            }
+
+            /**
+                @brief Constructor: Sets this element to the exported element.
+                @param exp The exported element
+            */
+            inline Iterator(const ObjectListBase::Export& exp)
+            {
+                this->element_ = exp.element_;
+                this->list_ = exp.list_;
+                this->list_->registerIterator(this);
+            }
+
+            /**
+                @brief Constructor: Sets this element to the element of another Iterator.
+                @param other The other Iterator
+            */
+            inline Iterator(const Iterator<T>& other)
+            {
+                this->element_ = other.element_;
+                this->list_ = other.list_;
+                this->list_->registerIterator(this);
+            }
+
+            /**
+                @brief Constructor: Sets this element to a given element
+                @param element The element
+            */
+            template <class O>
+            inline Iterator(ObjectListElement<O>* element)
+            {
+                this->element_ = (element) ? static_cast<ObjectListBaseElement*>(element) : 0;
+                this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
+                this->list_->registerIterator(this);
+            }
+
+            /**
+                @brief Constructor: Sets this element to the element an ObjectListIterator.
+                @param other The ObjectListIterator
+            */
+            template <class O>
+            inline Iterator(const ObjectListIterator<O>& other)
+            {
+                this->element_ = (other.element_) ? static_cast<ObjectListBaseElement*>(other.element_) : 0;
+                this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
+                this->list_->registerIterator(this);
+            }
+
+            /**
+                @brief Unregisters the Iterator from the ObjectList.
+            */
+            inline ~Iterator()
+            {
+                this->list_->unregisterIterator(this);
+            }
+
+            /**
+                @brief Assigns an exported element.
+                @param exp The exported element
+            */
+            inline const Iterator<T>& operator=(const ObjectListBase::Export& exp)
+            {
+                if (this->list_)
+                    this->list_->unregisterIterator(this);
+
+                this->element_ = exp.element_;
+                this->list_ = exp.list_;
+                this->list_->registerIterator(this);
+
+                return (*this);
+            }
+
+            /**
+                @brief Assigns the element of another Iterator.
+                @param other The other Iterator
+            */
+            inline const Iterator<T>& operator=(const Iterator<T>& other)
+            {
+                if (this->list_)
+                    this->list_->unregisterIterator(this);
+
+                this->element_ = other.element_;
+                this->list_ = other.list_;
+                this->list_->registerIterator(this);
+
+                return (*this);
+            }
+
+            /**
+                @brief Assigns a given element.
+                @param element The element
+            */
+            template <class O>
+            inline const Iterator<T>& operator=(ObjectListElement<O>* element)
+            {
+                if (this->list_)
+                    this->list_->unregisterIterator(this);
+
+                this->element_ = (element) ? static_cast<ObjectListBaseElement*>(element) : 0;
+                this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
+                this->list_->registerIterator(this);
+
+                return (*this);
+                return *this;
+            }
+
+            /**
+                @brief Assigns the element of an ObjectListIterator.
+                @param other The ObjectListIterator
+            */
+            template <class O>
+            inline const Iterator<T>& operator=(const ObjectListIterator<O>& other)
+            {
+                if (this->list_)
+                    this->list_->unregisterIterator(this);
+
+                this->element_ = (other.element_) ? static_cast<ObjectListBaseElement*>(other.element_) : 0;
+                this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
+                this->list_->registerIterator(this);
+
+                return (*this);
+            }
+
+            /**
+                @brief Overloading of the ++it operator: Iterator points to the next object in the list.
+                @return The Iterator itself
+            */
+            inline const Iterator<T>& operator++()
+            {
+                if (this->element_)
+                    this->element_ = this->element_->next_;
+                return *this;
+            }
+
+            /**
+                @brief Overloading of the it++ operator: Iterator points to the next object in the list.
+                @return The Iterator itself
+            */
+            inline Iterator<T> operator++(int i)
+            {
+                Iterator<T> copy = *this;
+                if (this->element_)
+                    this->element_ = this->element_->next_;
+                return copy;
+            }
+
+            /**
+                @brief Overloading of the --it operator: Iterator points to the previous object in the list.
+                @return The Iterator itself
+            */
+            inline const Iterator<T>& operator--()
+            {
+                if (this->element_)
+                    this->element_ = this->element_->prev_;
+                return *this;
+            }
+
+            /**
+                @brief Overloading of the it-- operator: Iterator points to the previous object in the list.
+                @return The Iterator itself
+            */
+            inline Iterator<T> operator--(int i)
+            {
+                Iterator<T> copy = *this;
+                if (this->element_)
+                    this->element_ = this->element_->prev_;
+                return copy;
+            }
+
+            /**
+                @brief Overloading of the *it operator: returns the pointer to the object.
+                @return The object the Iterator points at
+            */
+            inline T* operator*() const
+            {
+                if (this->element_)
+                    return orxonox_cast<T*>(this->element_->objectBase_);
+                else
+                    return 0;
+            }
+
+            /**
+                @brief Overloading of the it-> operator: returns the pointer to the object.
+                @return The object the Iterator points at
+            */
+            inline T* operator->() const
+            {
+                if (this->element_)
+                    return orxonox_cast<T*>(this->element_->objectBase_);
+                else
+                    return 0;
+            }
+
+            /**
+                @brief Overloading of the typecast-operator to bool: returns true if the iterator points to an existing object.
+                @return True if the Iterator points to an existing object.
+            */
+            inline operator bool() const
+            {
+                return (this->element_ != 0);
+            }
+
+            /**
+                @brief Overloading of the == operator to compare with another Iterator.
+                @param compare The other Iterator
+                @return True if the iterators point to the same element
+            */
+            inline bool operator==(const Iterator<T>& compare) const
+            {
+                return (this->element_ == compare.element_);
+            }
+
+            /**
+                @brief Overloading of the != operator to compare with another Iterator.
+                @param compare The other Iterator
+                @return True if the iterators point to different elements
+            */
+            inline bool operator!=(const Iterator<T>& compare) const
+            {
+                return (this->element_ != compare.element_);
+            }
+
+            /**
+                @brief Increments the Iterator if it points at the given object.
+                @param object The object to compare with
+            */
+            inline void incrementIfEqual(OrxonoxClass* object)
+            {
+                if (this->element_ && this->element_->objectBase_ == object)
+                    this->operator++();
+            }
+
+        protected:
+            ObjectListBaseElement* element_;       //!< The element the Iterator points at
+            ObjectListBase* list_;                 //!< The list wherein the element is
+    };
+
+    typedef Iterator<OrxonoxClass> BaseIterator;
+}
+
+#endif /* _Iterator_H__ */
Index: /sandbox_light/src/libraries/core/Language.cc
===================================================================
--- /sandbox_light/src/libraries/core/Language.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/Language.cc	(revision 5788)
@@ -0,0 +1,326 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the Language and the LanguageEntry classes.
+*/
+
+#include "Language.h"
+
+#include <fstream>
+#include <boost/filesystem.hpp>
+
+#include "util/Debug.h"
+#include "Core.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###      LanguageEntry      ###
+    // ###############################
+    /**
+        @brief Constructor: Sets the default entry.
+        @param fallbackEntry The default entry
+    */
+    LanguageEntry::LanguageEntry(const std::string& fallbackEntry)
+    {
+        this->fallbackEntry_ = fallbackEntry;
+        this->localisedEntry_ = fallbackEntry; // Set the localisation to the fallback entry, for the case that no translation gets assigned
+        this->bLocalisationSet_ = false;
+    }
+
+    /**
+        @brief Sets the localisation of the entry.
+        @param localisation The localisation
+    */
+    void LanguageEntry::setLocalisation(const std::string& localisation)
+    {
+        // Check if the translation is more than just an empty string
+        if ((localisation != "") && (localisation.size() > 0))
+        {
+            this->localisedEntry_ = localisation;
+            this->bLocalisationSet_ = true;
+        }
+        else
+            this->localisedEntry_ = this->fallbackEntry_;
+    }
+
+    /**
+        @brief Sets the default entry.
+        @param fallbackEntry The default entry
+    */
+    void LanguageEntry::setDefault(const std::string& fallbackEntry)
+    {
+        // If the default entry changes and the translation wasn't set yet, use the new default entry as translation
+        if (!this->bLocalisationSet_)
+            this->localisedEntry_ = fallbackEntry;
+
+        this->fallbackEntry_ = fallbackEntry;
+    }
+
+    // ###############################
+    // ###        Language         ###
+    // ###############################
+
+    Language* Language::singletonPtr_s = 0;
+
+    /**
+        @brief Constructor: Reads the default language file and sets some values.
+    */
+    Language::Language()
+    {
+        this->defaultLanguage_ = "default";
+        this->defaultLocalisation_ = "ERROR: LANGUAGE ENTRY DOESN'T EXIST!";
+
+        // Read the default language file to create all known LanguageEntry objects
+        this->readDefaultLanguageFile();
+    }
+
+    /**
+        @brief Destructor: Deletes all language entries.
+    */
+    Language::~Language()
+    {
+        for (std::map<std::string, LanguageEntry*>::iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
+            delete (it->second);
+    }
+
+    /**
+        @brief Creates a new LanguageEntry with a given label and a given default entry.
+        @param label The label of the entry
+        @param entry The default entry
+        @return The created LanguageEntry object
+    */
+    LanguageEntry* Language::createEntry(const LanguageEntryLabel& label, const std::string& entry)
+    {
+        std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(label);
+
+        // Make sure we don't create a duplicate entry
+        if (it == this->languageEntries_.end())
+        {
+            LanguageEntry* newEntry = new LanguageEntry(entry);
+            newEntry->setLabel(label);
+            this->languageEntries_[label] = newEntry;
+            return newEntry;
+        }
+
+        COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFilename(this->defaultLanguage_) << "!" << std::endl;
+        return it->second;
+    }
+
+    /**
+        @brief Adds a new LanguageEntry, if it's not already existing.
+        @param label The label of the entry
+        @param entry The default entry
+    */
+    void Language::addEntry(const LanguageEntryLabel& label, const std::string& entry)
+    {
+        COUT(5) << "Language: Called addEntry with\n  label: " << label << "\n  entry: " <<  entry << std::endl;
+        std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(label);
+        if (it == this->languageEntries_.end())
+        {
+            // The entry isn't available yet, meaning it's new, so create it
+            this->createEntry(label, entry);
+        }
+        else if (it->second->getDefault().compare(entry) == 0)
+        {
+            // The entry is available and the default string is the same, so return because everything is fine
+            return;
+        }
+        else
+        {
+            // The defined default entry is not the same as in the default language file - change it to the new entry
+            it->second->setDefault(entry);
+        }
+
+        // Write the default language file because either a new entry was created or an existing entry has changed
+        this->writeDefaultLanguageFile();
+
+    }
+
+    /**
+        @brief Returns the localisation of a given entry.
+        @param label The label of the entry
+        @return The localisation
+    */
+    const std::string& Language::getLocalisation(const LanguageEntryLabel& label) const
+    {
+        std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(label);
+        if (it != this->languageEntries_.end())
+            return it->second->getLocalisation();
+        else
+        {
+            // Uh, oh, an undefined entry was requested: return the default string
+            COUT(2) << "Warning: Language entry \"" << label << "\" not found!" << std::endl;
+            return this->defaultLocalisation_;
+        }
+    }
+
+    /**
+        @brief Creates the name of the language file out of the languages name.
+        @param language The name of the language
+        @return The filename
+    */
+    std::string Language::getFilename(const std::string& language)
+    {
+        return std::string("translation_" + language + ".lang");
+    }
+
+    /**
+        @brief Reads the default language file and creates a LanguageEntry objects for every entry.
+    */
+    void Language::readDefaultLanguageFile()
+    {
+        COUT(4) << "Read default language file." << std::endl;
+
+        boost::filesystem::path filepath(Core::getConfigPath() / getFilename(this->defaultLanguage_));
+
+        // This creates the file if it's not existing
+        std::ofstream createFile;
+        createFile.open(filepath.string().c_str(), std::fstream::app);
+        createFile.close();
+
+        // Open the file
+        std::ifstream file;
+        file.open(filepath.string().c_str(), std::fstream::in);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "An error occurred in Language.cc:" << std::endl;
+            COUT(1) << "Error: Couldn't open file " << getFilename(this->defaultLanguage_) << " to read the default language entries!" << std::endl;
+            return;
+        }
+
+        // Iterate through the file and create the LanguageEntries
+        while (file.good() && !file.eof())
+        {
+            std::string lineString;
+            std::getline(file, lineString);
+
+            // Check if the line is empty
+            if ((lineString != "") && (lineString.size() > 0))
+            {
+                size_t pos = lineString.find('=');
+
+                // Check if the length is at least 3 and if there's an entry before and behind the =
+                if (pos > 0 && pos < (lineString.size() - 1) && lineString.size() >= 3)
+                    this->createEntry(lineString.substr(0, pos), lineString.substr(pos + 1));
+                else
+                {
+                    COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFilename(this->defaultLanguage_) << std::endl;
+                }
+            }
+        }
+
+        file.close();
+    }
+
+    /**
+        @brief Reads the language file of the configured language and assigns the localisation to the corresponding LanguageEntry object.
+    */
+    void Language::readTranslatedLanguageFile()
+    {
+        COUT(4) << "Read translated language file (" << Core::getLanguage() << ")." << std::endl;
+
+        boost::filesystem::path filepath(Core::getConfigPath() / getFilename(Core::getLanguage()));
+
+        // Open the file
+        std::ifstream file;
+        file.open(filepath.string().c_str(), std::fstream::in);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "An error occurred in Language.cc:" << std::endl;
+            COUT(1) << "Error: Couldn't open file " << getFilename(Core::getLanguage()) << " to read the translated language entries!" << std::endl;
+            Core::resetLanguage();
+            COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << "." << std::endl;
+            return;
+        }
+
+        // Iterate through the file and create the LanguageEntries
+        while (file.good() && !file.eof())
+        {
+            std::string lineString;
+            std::getline(file, lineString);
+
+            // Check if the line is empty
+            if ((lineString != "") && (lineString.size() > 0))
+            {
+                size_t pos = lineString.find('=');
+
+                // Check if the length is at least 3 and if there's an entry before and behind the =
+                if (pos > 0 && pos < (lineString.size() - 1) && lineString.size() >= 3)
+                {
+                    std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(lineString.substr(0, pos));
+
+                    // Check if the entry exists
+                    if (it != this->languageEntries_.end())
+                        it->second->setLocalisation(lineString.substr(pos + 1));
+                    else
+                        this->createEntry(lineString.substr(0, pos), this->defaultLocalisation_)->setLocalisation(lineString.substr(pos + 1));
+                }
+                else
+                {
+                    COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFilename(Core::getLanguage()) << std::endl;
+                }
+            }
+        }
+
+        file.close();
+    }
+
+    /**
+        @brief Writes all default entries to the default language file.
+    */
+    void Language::writeDefaultLanguageFile() const
+    {
+        COUT(4) << "Language: Write default language file." << std::endl;
+
+        boost::filesystem::path filepath(Core::getConfigPath() / getFilename(this->defaultLanguage_));
+
+        // Open the file
+        std::ofstream file;
+        file.open(filepath.string().c_str(), std::fstream::out);
+
+        if (!file.is_open())
+        {
+            COUT(1) << "An error occurred in Language.cc:" << std::endl;
+            COUT(1) << "Error: Couldn't open file " << getFilename(this->defaultLanguage_) << " to write the default language entries!" << std::endl;
+            return;
+        }
+
+        // Iterate through the list an write the lines into the file
+        for (std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
+        {
+            file << (*it).second->getLabel() << "=" << (*it).second->getDefault() << std::endl;
+        }
+
+        file.close();
+    }
+}
Index: /sandbox_light/src/libraries/core/Language.h
===================================================================
--- /sandbox_light/src/libraries/core/Language.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/Language.h	(revision 5788)
@@ -0,0 +1,144 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the Language and the LanguageEntry class.
+
+    The Language class is used, to get a localisation of a string in the configured language.
+    The string is identified by another string, the label of the entry.
+    If the translation in the configured language isn't available, the default entry, defined in the code, is used.
+
+    Usage:
+     - Set the entry with the default string:
+       Language::getInstance()->addEntry("label of the entry", "the string to translate");
+
+     - Get the localisation of the entry in the configured language:
+       std::cout << Language::getInstance()->getLocalisation("name of the entry") << std::endl;
+*/
+
+#ifndef _Language_H__
+#define _Language_H__
+
+#include "CorePrereqs.h"
+
+#include <map>
+#include <string>
+#include <cassert>
+#include "util/Singleton.h"
+
+#define AddLanguageEntry(label, fallbackstring) \
+    orxonox::Language::getInstance().addEntry(label, fallbackstring)
+
+#define GetLocalisation(label) \
+    orxonox::Language::getInstance().getLocalisation(label)
+
+
+namespace orxonox
+{
+    // ###############################
+    // ###      LanguageEntry      ###
+    // ###############################
+    //! The LanguageEntry class stores the default- and the translated string of a given entry in the language file.
+    class _CoreExport LanguageEntry
+    {
+        public:
+            explicit LanguageEntry(const std::string& fallbackEntry);
+            void setLocalisation(const std::string& localisation);
+            void setDefault(const std::string& fallbackEntry);
+
+            /**
+              @brief Returns the localised entry in the configured language.
+              @return The translated entry
+            */
+            inline const std::string& getLocalisation()
+                { return this->localisedEntry_; }
+
+            /**
+              @brief Returns the default entry.
+              @return The default entry
+            */
+            inline const std::string& getDefault()
+                { return this->fallbackEntry_; }
+
+            /**
+                @brief Sets the label of this entry.
+                @param label The label
+            */
+            inline void setLabel(const LanguageEntryLabel& label)
+                { this->label_ = label; }
+
+            /**
+                @brief Returns the label of this entry.
+                @return The label
+            */
+            inline const LanguageEntryLabel& getLabel() const
+                { return this->label_; }
+
+        private:
+            LanguageEntryLabel label_;              //!< The label of the entry
+            std::string fallbackEntry_;             //!< The default entry: Used, if no translation is available or no language configured
+            std::string localisedEntry_;            //!< The localised entry in the configured language
+            bool bLocalisationSet_;                 //!< True if the translation was set
+    };
+
+
+    // ###############################
+    // ###         Language        ###
+    // ###############################
+    //! The Language class manges the language files and entries and stores the LanguageEntry objects in a map.
+    class _CoreExport Language : public Singleton<Language>
+    {
+        friend class Singleton<Language>;
+        friend class CoreConfiguration;
+
+        public:
+            Language();
+            ~Language();
+
+            void addEntry(const LanguageEntryLabel& label, const std::string& entry);
+            const std::string& getLocalisation(const LanguageEntryLabel& label) const;
+
+        private:
+            Language(const Language&);
+
+            void readDefaultLanguageFile();
+            void readTranslatedLanguageFile();
+            void writeDefaultLanguageFile() const;
+            static std::string getFilename(const std::string& language);
+            LanguageEntry* createEntry(const LanguageEntryLabel& label, const std::string& entry);
+
+            std::string defaultLanguage_;                           //!< The default language
+            std::string defaultLocalisation_;                       //!< The returned string, if an entry unavailable entry is requested
+            std::map<std::string, LanguageEntry*> languageEntries_; //!< A map to store all LanguageEntry objects and their labels
+
+            static Language* singletonPtr_s;
+    };
+}
+
+#endif /* _Language_H__ */
Index: /sandbox_light/src/libraries/core/LuaState.cc
===================================================================
--- /sandbox_light/src/libraries/core/LuaState.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/LuaState.cc	(revision 5788)
@@ -0,0 +1,284 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "LuaState.h"
+
+#include <boost/filesystem.hpp>
+#include <tolua/tolua++.h>
+extern "C" {
+#include <lua.h>
+#include <lualib.h>
+}
+
+#include "util/Debug.h"
+#include "Core.h"
+#include "ToluaBindCore.h"
+
+namespace orxonox
+{
+    LuaState::ToluaInterfaceMap LuaState::toluaInterfaces_s;
+    std::vector<LuaState*> LuaState::instances_s;
+
+    // Do this after declaring toluaInterfaces_s and instances_s to avoid larger problems
+    DeclareToluaInterface(Core);
+
+    LuaState::LuaState()
+        : bIsRunning_(false)
+        , includeParseFunction_(NULL)
+    {
+        // Create new lua state and configure it
+        luaState_ = lua_open();
+#if LUA_VERSION_NUM == 501
+        luaL_openlibs(luaState_);
+#else
+        luaopen_base(luaState_);
+        luaopen_string(luaState_);
+        luaopen_table(luaState_);
+        luaopen_math(luaState_);
+        luaopen_io(luaState_);
+        luaopen_debug(luaState_);
+#endif
+
+        // Open all available tolua interfaces
+        this->openToluaInterfaces(luaState_);
+
+        // Create dummy file info
+        sourceFileInfo_.reset(new ResourceInfo());
+
+        // Push 'this' pointer
+        tolua_pushusertype(luaState_, static_cast<void*>(this), "orxonox::LuaState");
+        lua_setglobal(luaState_, "luaState");
+
+        // Parse init script
+        this->doFile("LuaStateInit.lua");
+    }
+
+    LuaState::~LuaState()
+    {
+        lua_close(luaState_);
+    }
+
+    shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename, bool bSearchOtherPaths)
+    {
+        shared_ptr<ResourceInfo> sourceInfo;
+        sourceInfo = this->getFileInfo(filename);
+
+        // Continue search if not explicitely forbidden
+        if (bSearchOtherPaths && sourceInfo == NULL)
+        {
+            // Call might be relative to the file currently being processed
+            sourceInfo = this->getFileInfo(sourceFileInfo_->path + filename);
+            if (sourceInfo == NULL)
+            {
+                // Maybe find something in the same group but in the root path
+                sourceInfo = this->getFileInfo(filename);
+            }
+        }
+        return sourceInfo;
+    }
+
+    shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename)
+    {
+        boost::filesystem::path filepath = Core::getDataPath() / "lua" / filename;
+        if (boost::filesystem::exists(filepath))
+        {
+            shared_ptr<ResourceInfo> info(new ResourceInfo());
+            info->filename = filepath.string();
+            info->path = filepath.branch_path().string();
+            info->basename = filepath.leaf();
+            return info;
+        }
+        else
+            return shared_ptr<ResourceInfo>();
+    }
+
+    std::string LuaState::loadFile(const std::string& filename)
+    {
+        std::ifstream file(filename.c_str());
+        std::ostringstream oss;
+        oss << file.rdbuf();
+        return oss.str();
+    }
+
+    void LuaState::includeFile(const std::string& filename, bool bSearchOtherPaths)
+    {
+        shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename, bSearchOtherPaths);
+        if (sourceInfo != NULL)
+            this->includeString(this->loadFile(sourceInfo->filename), sourceInfo);
+        else
+            COUT(2) << "LuaState: Cannot include file '" << filename << std::endl;
+    }
+
+    void LuaState::includeString(const std::string& code, shared_ptr<ResourceInfo> sourceFileInfo)
+    {
+        // Parse string with provided include parser (otherwise don't preparse at all)
+        std::string luaInput;
+        if (includeParseFunction_ != NULL)
+            luaInput = (*includeParseFunction_)(code);
+        else
+            luaInput = code;
+
+        this->doString(luaInput, sourceFileInfo);
+    }
+
+    void LuaState::doFile(const std::string& filename, bool bSearchOtherPaths)
+    {
+        shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename, bSearchOtherPaths);
+        if (sourceInfo != NULL)
+            this->doString(this->loadFile(sourceInfo->filename), sourceInfo);
+        else
+            COUT(2) << "LuaState: Cannot do file '" << filename << std::endl;
+    }
+
+    void LuaState::doString(const std::string& code, shared_ptr<ResourceInfo> sourceFileInfo)
+    {
+        // Save the oold source file info
+        shared_ptr<ResourceInfo> oldSourceFileInfo = sourceFileInfo_;
+        // Only override if sourceFileInfo provides useful information
+        if (sourceFileInfo != NULL)
+            sourceFileInfo_ = sourceFileInfo;
+
+        int error = 0;
+#if LUA_VERSION_NUM != 501
+        LoadS ls;
+        ls.s = code.c_str();
+        ls.size = code.size();
+        error = lua_load(luaState_, &orxonox::LuaState::lua_Chunkreader, &ls, code.c_str());
+#else
+        error = luaL_loadstring(luaState_, code.c_str());
+#endif
+
+        // execute the chunk
+        if (error == 0)
+            error = lua_pcall(luaState_, 0, 1, 0);
+        if (error != 0)
+        {
+            std::string origin;
+            if (sourceFileInfo != NULL)
+                origin = " originating from " + sourceFileInfo_->filename;
+            COUT(2) << "Error in Lua-script" << origin << ": " << lua_tostring(luaState_, -1) << std::endl;
+            // return value is nil
+            lua_pushnil(luaState_);
+        }
+        // push return value because it will get lost since the return value of this function is void
+        lua_setglobal(luaState_, "LuaStateReturnValue");
+
+        // Load the old info again
+        sourceFileInfo_ = oldSourceFileInfo;
+    }
+
+    void LuaState::luaPrint(const std::string& str)
+    {
+        output_ << str;
+    }
+
+    void LuaState::luaLog(unsigned int level, const std::string& message)
+    {
+        OutputHandler::getOutStream().setOutputLevel(level) << message << std::endl;
+    }
+
+    bool LuaState::fileExists(const std::string& filename, bool bSearchOtherPaths)
+    {
+        shared_ptr<ResourceInfo> info =  this->getFileInfo(filename, bSearchOtherPaths);
+        if (info == NULL)
+            return false;
+        else
+            return true;
+    }
+
+#if LUA_VERSION_NUM != 501
+    const char * LuaState::lua_Chunkreader(lua_State *L, void *data, size_t *size)
+    {
+        LoadS* ls = static_cast<LoadS*>(data);
+        if (ls->size == 0)
+            return NULL;
+        *size = ls->size;
+        ls->size = 0;
+        return ls->s;
+    }
+#endif
+
+    /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
+    {
+        for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
+        {
+            if (it->first == name || it->second == function)
+            {
+                COUT(2) << "Warning: Trying to add a Tolua interface with the same name or function." << std::endl;
+                return true;
+            }
+        }
+        toluaInterfaces_s[name] = function;
+
+        // Open interface in all LuaStates
+        for (std::vector<LuaState*>::const_iterator it = instances_s.begin(); it != instances_s.end(); ++it)
+            (*function)((*it)->luaState_);
+
+        // Return dummy bool
+        return true;
+    }
+
+    /*static*/ bool LuaState::removeToluaInterface(const std::string& name)
+    {
+        ToluaInterfaceMap::iterator it = toluaInterfaces_s.find(name);
+        if (it == toluaInterfaces_s.end())
+        {
+            COUT(2) << "Warning: Cannot remove Tolua interface '" << name << "': Not found" << std::endl;
+            return true;
+        }
+
+        // Close interface in all LuaStates
+        for (std::vector<LuaState*>::const_iterator itState = instances_s.begin(); itState != instances_s.end(); ++itState)
+        {
+            lua_pushnil((*itState)->luaState_);
+            lua_setglobal((*itState)->luaState_, it->first.c_str());
+        }
+
+        // Remove entry
+        toluaInterfaces_s.erase(it);
+
+        // Return dummy bool
+        return true;
+    }
+
+    /*static*/ void LuaState::openToluaInterfaces(lua_State* state)
+    {
+        for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
+            (*it->second)(state);
+    }
+
+    /*static*/ void LuaState::closeToluaInterfaces(lua_State* state)
+    {
+        for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
+        {
+            lua_pushnil(state);
+            lua_setglobal(state, it->first.c_str());
+        }
+    }
+}
Index: /sandbox_light/src/libraries/core/LuaState.h
===================================================================
--- /sandbox_light/src/libraries/core/LuaState.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/LuaState.h	(revision 5788)
@@ -0,0 +1,117 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _LuaState_H__
+#define _LuaState_H__
+
+#include "CorePrereqs.h"
+
+#include <map>
+#include <sstream>
+#include <string>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+#include "util/ScopeGuard.h"
+#include "ToluaInterface.h"
+
+// tolua_begin
+namespace orxonox
+{
+    //! Stores basic information about a File
+    struct ResourceInfo
+    {
+        //! The file's fully qualified name
+        std::string filename;
+        //! Path name; separated by '/' and ending with '/'
+        std::string path;
+        //! Base filename
+        std::string basename;
+    };
+
+    /**
+    @brief
+        Representation of an interface to lua
+    */
+    class _CoreExport LuaState
+    {
+// tolua_end
+    public:
+        LuaState();
+        ~LuaState();
+
+        void doFile(const std::string& filename, bool bSearchOtherPaths = true); // tolua_export
+        void doString(const std::string& code, shared_ptr<ResourceInfo> sourceFileInfo = shared_ptr<ResourceInfo>());
+
+        void includeFile(const std::string& filename, bool bSearchOtherPaths = true); // tolua_export
+        void includeString(const std::string& code, shared_ptr<ResourceInfo> sourceFileInfo = shared_ptr<ResourceInfo>());
+
+        void luaPrint(const std::string& str); // tolua_export
+        void luaLog(unsigned int level, const std::string& message); // tolua_export
+        bool fileExists(const std::string& filename, bool bSearchOtherPaths = true); // tolua_export
+
+        const std::stringstream& getOutput() const { return output_; }
+        void clearOutput() { output_.clear(); } // tolua_export
+
+        void setIncludeParser(std::string (*function)(const std::string&)) { includeParseFunction_ = function; }
+        lua_State* getInternalLuaState() { return luaState_; }
+
+        static bool addToluaInterface(int (*function)(lua_State*), const std::string& name);
+        static bool removeToluaInterface(const std::string& name);
+        static void openToluaInterfaces(lua_State* state);
+        static void closeToluaInterfaces(lua_State* state);
+
+    private:
+        shared_ptr<ResourceInfo> getFileInfo(const std::string& filename, bool bSearchOtherPaths);
+        shared_ptr<ResourceInfo> getFileInfo(const std::string& filename);
+        std::string loadFile(const std::string& filename);
+
+#if LUA_VERSION_NUM != 501
+        struct LoadS
+        {
+            const char* s;
+            size_t size;
+        };
+
+        static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size);
+#endif
+
+        std::stringstream output_;
+        lua_State* luaState_;
+        bool bIsRunning_;
+        shared_ptr<ResourceInfo> sourceFileInfo_;
+        std::string (*includeParseFunction_)(const std::string&);
+
+        typedef std::map<std::string, int (*)(lua_State *L)> ToluaInterfaceMap;
+        static ToluaInterfaceMap toluaInterfaces_s;
+        static std::vector<LuaState*> instances_s;
+    }; // tolua_export
+} // tolua_export
+
+#endif /* _LuaState_H__ */
Index: /sandbox_light/src/libraries/core/MetaObjectList.cc
===================================================================
--- /sandbox_light/src/libraries/core/MetaObjectList.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/MetaObjectList.cc	(revision 5788)
@@ -0,0 +1,103 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the MetaObjectList class.
+*/
+
+#include "MetaObjectList.h"
+
+#include "util/Debug.h"
+#include "Identifier.h"
+#include "ObjectListBase.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###  MetaObjectListElement  ###
+    // ###############################
+    /**
+        @brief Destructor: Removes the ObjectListBaseElement from the ObjectListBase by linking next_ and prev_ of the ObjectListBaseElement.
+    */
+    MetaObjectListElement::~MetaObjectListElement()
+    {
+        COUT(5) << "*** MetaObjectList: Removing Object from " << this->list_->getIdentifier()->getName() << "-list." << std::endl;
+        this->list_->notifyIterators(this->element_->objectBase_);
+
+        if (this->element_->next_)
+            this->element_->next_->prev_ = this->element_->prev_;
+        else
+            this->list_->last_ = this->element_->prev_; // If there is no next_, we deleted the last object and have to update the last_ pointer of the list
+
+        if (this->element_->prev_)
+            this->element_->prev_->next_ = this->element_->next_;
+        else
+            this->list_->first_ = this->element_->next_; // If there is no prev_, we deleted the first object and have to update the first_ pointer of the list
+
+        delete this->element_;
+    }
+
+
+    // ###############################
+    // ###     MetaObjectList      ###
+    // ###############################
+    /**
+        @brief Constructor: Sets first_ to zero.
+    */
+    MetaObjectList::MetaObjectList()
+    {
+        this->first_ = 0;
+    }
+
+    /**
+        @brief Destructor: Removes all elements from the list, causing them to remove the stored ObjectListElement from the ObjectList.
+    */
+    MetaObjectList::~MetaObjectList()
+    {
+        MetaObjectListElement* temp;
+        while (this->first_)
+        {
+            temp = this->first_->next_;
+            delete this->first_;
+            this->first_ = temp;
+        }
+    }
+
+    /**
+        @brief Adds an ObjectList and an element of that list to the MetaObjectList.
+        @param list The ObjectList wherein the element is
+        @param element The element wherein the object is
+    */
+    void MetaObjectList::add(ObjectListBase* list, ObjectListBaseElement* element)
+    {
+        MetaObjectListElement* temp = this->first_;
+        this->first_ = new MetaObjectListElement(list, element);
+        this->first_->next_ = temp;
+    }
+}
Index: /sandbox_light/src/libraries/core/MetaObjectList.h
===================================================================
--- /sandbox_light/src/libraries/core/MetaObjectList.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/MetaObjectList.h	(revision 5788)
@@ -0,0 +1,84 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the MetaObjectList class.
+
+    The MetaObjectList is a single-linked list, containing all list-elements and their
+    lists wherein the object, owning the MetaObjectList, is registered.
+    This allows much faster deletion of objects because no iteration is needed.
+*/
+
+#ifndef _MetaObjectList_H__
+#define _MetaObjectList_H__
+
+#include "CorePrereqs.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###  MetaObjectListElement  ###
+    // ###############################
+    //! The list-element of the MetaObjectList
+    class _CoreExport MetaObjectListElement
+    {
+        public:
+            /**
+                @brief Constructor: Creates the list-element with given list and element.
+            */
+            MetaObjectListElement(ObjectListBase* list, ObjectListBaseElement* element) : next_(0), element_(element), list_(list) {}
+            ~MetaObjectListElement();
+
+            MetaObjectListElement* next_;       //!< The next Element in the list
+            ObjectListBaseElement* element_;    //!< The list element, containing the object
+            ObjectListBase* list_;              //!< The list, containing the element
+    };
+
+
+    // ###############################
+    // ###     MetaObjectList      ###
+    // ###############################
+    //!  The MetaObjectList contains ObjectListBaseElements and their ObjectListBases.
+    /**
+        The MetaObjectList is a single-linked list, containing all list-elements and their
+        lists wherein the object that owns the MetaObjectList is registered.
+        This allows much faster deletion of objects because no iteration is needed.
+    */
+    class _CoreExport MetaObjectList
+    {
+        public:
+            MetaObjectList();
+            ~MetaObjectList();
+            void add(ObjectListBase* list, ObjectListBaseElement* element);
+
+            MetaObjectListElement* first_;      //!< The first element in the list
+    };
+}
+
+#endif /* _MetaObjectList_H__ */
Index: /sandbox_light/src/libraries/core/ObjectList.h
===================================================================
--- /sandbox_light/src/libraries/core/ObjectList.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/ObjectList.h	(revision 5788)
@@ -0,0 +1,79 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition and implementation of the ObjectList class.
+
+    The ObjectList is a wrapper of an ObjectListBase of a given class.
+    Use Iterator<class> to iterate through all objects of the class.
+*/
+
+#ifndef _ObjectList_H__
+#define _ObjectList_H__
+
+#include "CorePrereqs.h"
+
+#include "Identifier.h"
+#include "ObjectListIterator.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###       ObjectList        ###
+    // ###############################
+    //! The ObjectList contains all objects of the given class.
+    /**
+        Wraps the ObjectListBase of the corresponding Identifier.
+        Use ObjectListIterator<class> to iterate through all objects in the list.
+    */
+    template <class T>
+    class ObjectList
+    {
+        public:
+            typedef ObjectListIterator<T> iterator;
+
+            /** @brief Returns an Iterator to the first element in the list. @return The Iterator */
+            inline static ObjectListElement<T>* begin()
+                { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->begin().element_); }
+
+            /** @brief Returns an Iterator to the element after the last element in the list. @return The Iterator */
+            inline static ObjectListElement<T>* end()
+                { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->end().element_); }
+
+            /** @brief Returns an Iterator to the last element in the list. @return The Iterator */
+            inline static ObjectListElement<T>* rbegin()
+                { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->rbegin().element_); }
+
+            /** @brief Returns an Iterator to the element before the first element in the list. @return The Iterator */
+            inline static ObjectListElement<T>* rend()
+                { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->rend().element_); }
+    };
+}
+
+#endif /* _ObjectList_H__ */
Index: /sandbox_light/src/libraries/core/ObjectListBase.cc
===================================================================
--- /sandbox_light/src/libraries/core/ObjectListBase.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/ObjectListBase.cc	(revision 5788)
@@ -0,0 +1,106 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the ObjectListBase class.
+
+    The ObjectListBase is a double-linked list, used by Identifiers to store all objects of a given class.
+    Newly created objects are added through the RegisterObject-macro in its constructor.
+*/
+
+#include "ObjectListBase.h"
+
+#include <set>
+#include "Identifier.h"
+#include "Iterator.h"
+#include "ObjectListIterator.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor: Sets default values.
+    */
+    ObjectListBase::ObjectListBase(Identifier* identifier)
+    {
+        this->identifier_ = identifier;
+        this->first_ = 0;
+        this->last_ = 0;
+    }
+
+    /**
+        @brief Destructor: Deletes all list-elements, but NOT THE OBJECTS.
+    */
+    ObjectListBase::~ObjectListBase()
+    {
+        ObjectListBaseElement* temp;
+        while (this->first_)
+        {
+            temp = this->first_->next_;
+            delete this->first_;
+            this->first_ = temp;
+        }
+    }
+
+    /**
+        @brief Increases all Iterators that currently point on the given element (because it gets removed).
+        @param element The element that gets removed
+    */
+    void ObjectListBase::notifyIterators(OrxonoxClass* object) const
+    {
+        for (std::vector<void*>::const_iterator it = this->iterators_.begin(); it != this->iterators_.end(); ++it)
+            ((Iterator<OrxonoxClass>*)(*it))->incrementIfEqual(object);
+        for (std::vector<void*>::const_iterator it = this->objectListIterators_.begin(); it != this->objectListIterators_.end(); ++it)
+            ((ObjectListIterator<OrxonoxClass>*)(*it))->incrementIfEqual(object);
+    }
+
+    /**
+        @brief Adds a new object to the end of the list.
+        @param object The object to add
+        @return The pointer to the new ObjectListBaseElement, needed by the MetaObjectList of the added object
+    */
+    ObjectListBaseElement* ObjectListBase::add(ObjectListBaseElement* element)
+    {
+        if (!this->last_)
+        {
+            // If the list is empty
+            this->last_ = element;
+            this->first_ = this->last_; // There's only one object in the list now
+        }
+        else
+        {
+            // If the list isn't empty
+            ObjectListBaseElement* temp = this->last_;
+            this->last_ = element;
+            this->last_->prev_ = temp;
+            temp->next_ = this->last_;
+        }
+
+        return this->last_;
+    }
+}
Index: /sandbox_light/src/libraries/core/ObjectListBase.h
===================================================================
--- /sandbox_light/src/libraries/core/ObjectListBase.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/ObjectListBase.h	(revision 5788)
@@ -0,0 +1,150 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the ObjectListBase class.
+
+    The ObjectListBase is a double-linked list, used by Identifiers to store all objects of a given class.
+    Newly created objects are added through the RegisterObject-macro in its constructor.
+*/
+
+#ifndef _ObjectListBase_H__
+#define _ObjectListBase_H__
+
+#include "CorePrereqs.h"
+
+#include <vector>
+#include "OrxonoxClass.h"
+
+namespace orxonox
+{
+    // ###############################
+    // ###  ObjectListBaseElement  ###
+    // ###############################
+    //! The list-element of the ObjectListBase
+    class _CoreExport ObjectListBaseElement
+    {
+        public:
+            /**
+                @brief Constructor: Creates the list-element with an object.
+                @param object The object to store
+            */
+            ObjectListBaseElement(OrxonoxClass* objectBase) : next_(0), prev_(0), objectBase_(objectBase) {}
+
+            ObjectListBaseElement* next_;       //!< The next element in the list
+            ObjectListBaseElement* prev_;       //!< The previous element in the list
+            OrxonoxClass* objectBase_;
+    };
+
+
+    // ###############################
+    // ###    ObjectListElement    ###
+    // ###############################
+    //! The list-element that actually contains the object
+    template <class T>
+    class ObjectListElement : public ObjectListBaseElement
+    {
+        public:
+            ObjectListElement(T* object) : ObjectListBaseElement(static_cast<OrxonoxClass*>(object)), object_(object) {}
+            T* object_;              //!< The object
+    };
+
+
+    // ###############################
+    // ###     ObjectListBase      ###
+    // ###############################
+    //! The ObjectListBase contains all objects of a given class.
+    /**
+        The ObjectListBase is used by Identifiers to store all objects of their given class.
+        Use ObjectList<T> to get the list of all T's and Iterator<T> to iterate through them.
+    */
+    class _CoreExport ObjectListBase
+    {
+        friend class MetaObjectListElement;
+
+        public:
+            ObjectListBase(Identifier* identifier);
+            ~ObjectListBase();
+
+            ObjectListBaseElement* add(ObjectListBaseElement* element);
+
+            struct Export
+            {
+                Export(ObjectListBase* list, ObjectListBaseElement* element) : list_(list), element_(element) {}
+                ObjectListBase* list_;
+                ObjectListBaseElement* element_;
+            };
+
+            /** @brief Returns a pointer to the first element in the list. @return The element */
+            inline Export begin() { return ObjectListBase::Export(this, this->first_); }
+            /** @brief Returns a pointer to the element after the last element in the list. @return The element */
+            inline Export end() { return ObjectListBase::Export(this, 0); }
+            /** @brief Returns a pointer to the last element in the list. @return The element */
+            inline Export rbegin() { return ObjectListBase::Export(this, this->last_); }
+            /** @brief Returns a pointer to the element in front of the first element in the list. @return The element */
+            inline Export rend() { return ObjectListBase::Export(this, 0); }
+
+            inline void registerIterator(void* iterator) { this->iterators_.push_back(iterator); }
+            inline void unregisterIterator(void* iterator)
+            {
+                for (unsigned int i = 0; i < this->iterators_.size(); ++i)
+                {
+                    if (iterators_[i] == iterator)
+                    {
+                        iterators_.erase(iterators_.begin() + i);
+                        break;
+                    }
+                }
+            }
+            inline void registerObjectListIterator(void* iterator) { this->objectListIterators_.push_back(iterator); }
+            inline void unregisterObjectListIterator(void* iterator)
+            {
+                for (unsigned int i = 0; i < this->objectListIterators_.size(); ++i)
+                {
+                    if (objectListIterators_[i] == iterator)
+                    {
+                        objectListIterators_.erase(objectListIterators_.begin() + i);
+                        break;
+                    }
+                }
+            }
+            void notifyIterators(OrxonoxClass* object) const;
+
+            inline Identifier* getIdentifier() const { return this->identifier_; }
+
+        private:
+            Identifier* identifier_;                 //!< The Iterator owning this list
+            ObjectListBaseElement* first_;           //!< The first element in the list
+            ObjectListBaseElement* last_;            //!< The last element in the list
+            std::vector<void*> iterators_;           //!< A list of Iterators pointing on an element in this list
+            std::vector<void*> objectListIterators_; //!< A list of ObjectListIterators pointing on an element in this list
+    };
+}
+
+#endif /* _ObjectListBase_H__ */
Index: /sandbox_light/src/libraries/core/ObjectListIterator.h
===================================================================
--- /sandbox_light/src/libraries/core/ObjectListIterator.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/ObjectListIterator.h	(revision 5788)
@@ -0,0 +1,233 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition and implementation of the Iterator class.
+
+    The ObjectListIterator of a given class allows to iterate through the
+    ObjectList of this class, containing all objects of that type.
+    This is the only way to access the objects stored in an ObjectList.
+
+    Usage:
+    for (ObjectListIterator<myClass> it = ObjectList<myClass>::begin(); it != ObjectList<myClass>::end(); ++it)
+    {
+        it->someFunction(...);
+        myClass* myObject = *it;
+    }
+*/
+
+#ifndef _ObjectListIterator_H__
+#define _ObjectListIterator_H__
+
+#include "CorePrereqs.h"
+#include "Identifier.h"
+#include "ObjectList.h"
+
+namespace orxonox
+{
+    //! The Iterator allows to iterate through the ObjectList of a given class.
+    template <class T>
+    class ObjectListIterator
+    {
+        template <class I>
+        friend class Iterator;
+
+        public:
+            /**
+                @brief Constructor: Sets the element, whereon the ObjectListIterator points, to zero.
+            */
+            inline ObjectListIterator()
+            {
+                this->element_ = 0;
+                ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
+            }
+
+            /**
+                @brief Constructor: Sets this element to a given element.
+                @param element The element to start with
+            */
+            inline ObjectListIterator(ObjectListElement<T>* element)
+            {
+                this->element_ = element;
+                ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
+            }
+
+            /**
+                @brief Constructor: Sets this element to the element of another ObjectListIterator.
+                @param other The other ObjectListIterator
+            */
+            inline ObjectListIterator(const ObjectListIterator<T>& other)
+            {
+                this->element_ = other.element_;
+                ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
+            }
+
+            /**
+                @brief Unregisters the ObjectListIterator from the ObjectList.
+            */
+            inline ~ObjectListIterator()
+            {
+                ClassIdentifier<T>::getIdentifier()->getObjects()->unregisterObjectListIterator(this);
+            }
+
+            /**
+                @brief Assigns an ObjectListElement.
+                @param element The ObjectListElement
+            */
+            inline const ObjectListIterator<T>& operator=(ObjectListElement<T>* element)
+            {
+                this->element_ = element;
+                return (*this);
+            }
+
+            /**
+                @brief Assigns the element of another ObjectListIterator.
+                @param element The other ObjectListIterator
+            */
+            inline const ObjectListIterator<T>& operator=(const ObjectListIterator<T>& other)
+            {
+                this->element_ = other.element_;
+                return (*this);
+            }
+
+            /**
+                @brief Overloading of the ++it operator: ObjectListIterator points to the next object in the list.
+                @return The ObjectListIterator itself
+            */
+            inline const ObjectListIterator<T>& operator++()
+            {
+                if (this->element_)
+                    this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_);
+                return *this;
+            }
+
+            /**
+                @brief Overloading of the it++ operator: ObjectListIterator points to the next object in the list.
+                @return The ObjectListIterator itself
+            */
+            inline ObjectListIterator<T> operator++(int i)
+            {
+                ObjectListIterator<T> copy = *this;
+                if (this->element_)
+                    this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_);
+                return copy;
+            }
+
+            /**
+                @brief Overloading of the --it operator: ObjectListIterator points to the previous object in the list.
+                @return The ObjectListIterator itself
+            */
+            inline const ObjectListIterator<T>& operator--()
+            {
+                if (this->element_)
+                    this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_);
+                return *this;
+            }
+
+            /**
+                @brief Overloading of the it-- operator: ObjectListIterator points to the previous object in the list.
+                @return The ObjectListIterator itself
+            */
+            inline ObjectListIterator<T> operator--(int i)
+            {
+                ObjectListIterator<T> copy = *this;
+                if (this->element_)
+                    this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_);
+                return copy;
+            }
+
+            /**
+                @brief Overloading of the *it operator: returns the pointer to the object.
+                @return The object the ObjectListIterator points at
+            */
+            inline T* operator*() const
+            {
+                if (this->element_)
+                    return this->element_->object_;
+                else
+                    return 0;
+            }
+
+            /**
+                @brief Overloading of the it-> operator: returns the pointer to the object.
+                @return The object the ObjectListIterator points at
+            */
+            inline T* operator->() const
+            {
+                if (this->element_)
+                    return this->element_->object_;
+                else
+                    return 0;
+            }
+
+            /**
+                @brief Overloading of the typecast-operator to bool: returns true if the ObjectListIterator points to an existing object.
+                @return True if the ObjectListIterator points to an existing object.
+            */
+            inline operator bool() const
+            {
+                return (this->element_ != 0);
+            }
+
+            /**
+                @brief Overloading of the == operator to compare with another ObjectListIterator.
+                @param compare The other ObjectListIterator
+                @return True if the ObjectListIterator point to the same element
+            */
+            inline bool operator==(const ObjectListIterator<T>& compare) const
+            {
+                return (this->element_ == compare.element_);
+            }
+
+            /**
+                @brief Overloading of the != operator to compare with another ObjectListIterator.
+                @param compare The other ObjectListIterator
+                @return True if the ObjectListIterator point to different elements
+            */
+            inline bool operator!=(const ObjectListIterator<T>& compare) const
+            {
+                return (this->element_ != compare.element_);
+            }
+
+            /**
+                @brief Increments the ObjectListIterator if it points at the given object.
+                @param object The object to compare with
+            */
+            inline void incrementIfEqual(OrxonoxClass* object)
+            {
+                if (this->element_ && this->element_->objectBase_ == object)
+                    this->operator++();
+            }
+
+        private:
+            ObjectListElement<T>* element_;        //!< The element the Iterator points at
+    };
+}
+
+#endif /* _ObjectListIterator_H__ */
Index: /sandbox_light/src/libraries/core/OrxonoxClass.cc
===================================================================
--- /sandbox_light/src/libraries/core/OrxonoxClass.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/OrxonoxClass.cc	(revision 5788)
@@ -0,0 +1,137 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the OrxonoxClass Class.
+*/
+
+#include "OrxonoxClass.h"
+
+#include "MetaObjectList.h"
+#include "Identifier.h"
+
+namespace orxonox
+{
+    /** @brief Constructor: Sets the default values. */
+    OrxonoxClass::OrxonoxClass()
+    {
+        this->identifier_ = 0;
+        this->parents_ = 0;
+        this->metaList_ = new MetaObjectList();
+    }
+
+    /** @brief Destructor: Deletes, if existing, the list of the parents. */
+    OrxonoxClass::~OrxonoxClass()
+    {
+        delete this->metaList_;
+
+        // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class
+        if (this->parents_)
+            delete this->parents_;
+    }
+
+    /** @brief Returns true if the objects class is of the given type or a derivative. */
+    bool OrxonoxClass::isA(const Identifier* identifier)
+        { return this->getIdentifier()->isA(identifier); }
+    /** @brief Returns true if the objects class is exactly of the given type. */
+    bool OrxonoxClass::isExactlyA(const Identifier* identifier)
+        { return this->getIdentifier()->isExactlyA(identifier); }
+    /** @brief Returns true if the objects class is a child of the given type. */
+    bool OrxonoxClass::isChildOf(const Identifier* identifier)
+        { return this->getIdentifier()->isChildOf(identifier); }
+    /** @brief Returns true if the objects class is a direct child of the given type. */
+    bool OrxonoxClass::isDirectChildOf(const Identifier* identifier)
+        { return this->getIdentifier()->isDirectChildOf(identifier); }
+    /** @brief Returns true if the objects class is a parent of the given type. */
+    bool OrxonoxClass::isParentOf(const Identifier* identifier)
+        { return this->getIdentifier()->isParentOf(identifier); }
+    /** @brief Returns true if the objects class is a direct parent of the given type. */
+    bool OrxonoxClass::isDirectParentOf(const Identifier* identifier)
+        { return this->getIdentifier()->isDirectParentOf(identifier); }
+
+
+    /** @brief Returns true if the objects class is of the given type or a derivative. */
+    template <class B> bool OrxonoxClass::isA(const SubclassIdentifier<B>* identifier)
+        { return this->getIdentifier()->isA(identifier->getIdentifier()); }
+    /** @brief Returns true if the objects class is exactly of the given type. */
+    template <class B> bool OrxonoxClass::isExactlyA(const SubclassIdentifier<B>* identifier)
+        { return this->getIdentifier()->isExactlyA(identifier->getIdentifier()); }
+    /** @brief Returns true if the objects class is a child of the given type. */
+    template <class B> bool OrxonoxClass::isChildOf(const SubclassIdentifier<B>* identifier)
+        { return this->getIdentifier()->isChildOf(identifier->getIdentifier()); }
+    /** @brief Returns true if the objects class is a direct child of the given type. */
+    template <class B> bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<B>* identifier)
+        { return this->getIdentifier()->isDirectChildOf(identifier->getIdentifier()); }
+    /** @brief Returns true if the objects class is a parent of the given type. */
+    template <class B> bool OrxonoxClass::isParentOf(const SubclassIdentifier<B>* identifier)
+        { return this->getIdentifier()->isParentOf(identifier->getIdentifier()); }
+    /** @brief Returns true if the objects class is a direct parent of the given type. */
+    template <class B> bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<B>* identifier)
+        { return this->getIdentifier()->isDirectParentOf(identifier->getIdentifier()); }
+
+
+    /** @brief Returns true if the objects class is of the given type or a derivative. */
+    template <class B> bool OrxonoxClass::isA(const SubclassIdentifier<B> identifier)
+        { return this->getIdentifier()->isA(identifier.getIdentifier()); }
+    /** @brief Returns true if the objects class is exactly of the given type. */
+    template <class B> bool OrxonoxClass::isExactlyA(const SubclassIdentifier<B> identifier)
+        { return this->getIdentifier()->isExactlyA(identifier.getIdentifier()); }
+    /** @brief Returns true if the objects class is a child of the given type. */
+    template <class B> bool OrxonoxClass::isChildOf(const SubclassIdentifier<B> identifier)
+        { return this->getIdentifier()->isChildOf(identifier.getIdentifier()); }
+    /** @brief Returns true if the objects class is a direct child of the given type. */
+    template <class B> bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<B> identifier)
+        { return this->getIdentifier()->isDirectChildOf(identifier.getIdentifier()); }
+    /** @brief Returns true if the objects class is a parent of the given type. */
+    template <class B> bool OrxonoxClass::isParentOf(const SubclassIdentifier<B> identifier)
+        { return this->getIdentifier()->isParentOf(identifier.getIdentifier()); }
+    /** @brief Returns true if the objects class is a direct parent of the given type. */
+    template <class B> bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<B> identifier)
+        { return this->getIdentifier()->isDirectParentOf(identifier.getIdentifier()); }
+
+
+    /** @brief Returns true if the objects class is of the given type or a derivative. */
+    bool OrxonoxClass::isA(const OrxonoxClass* object)
+        { return this->getIdentifier()->isA(object->getIdentifier()); }
+    /** @brief Returns true if the objects class is exactly of the given type. */
+    bool OrxonoxClass::isExactlyA(const OrxonoxClass* object)
+        { return this->getIdentifier()->isExactlyA(object->getIdentifier()); }
+    /** @brief Returns true if the objects class is a child of the given type. */
+    bool OrxonoxClass::isChildOf(const OrxonoxClass* object)
+        { return this->getIdentifier()->isChildOf(object->getIdentifier()); }
+    /** @brief Returns true if the objects class is a direct child of the given type. */
+    bool OrxonoxClass::isDirectChildOf(const OrxonoxClass* object)
+        { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); }
+    /** @brief Returns true if the objects class is a parent of the given type. */
+    bool OrxonoxClass::isParentOf(const OrxonoxClass* object)
+        { return this->getIdentifier()->isParentOf(object->getIdentifier()); }
+    /** @brief Returns true if the objects class is a direct child of the given type. */
+    bool OrxonoxClass::isDirectParentOf(const OrxonoxClass* object)
+        { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); }
+}
Index: /sandbox_light/src/libraries/core/OrxonoxClass.h
===================================================================
--- /sandbox_light/src/libraries/core/OrxonoxClass.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/OrxonoxClass.h	(revision 5788)
@@ -0,0 +1,128 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Declaration of the OrxonoxClass Class.
+
+    All objects and interfaces of the game-logic (not the engine) are derived from OrxonoxClass.
+    It stores the Identifier and the MetaObjectList and has all needed functions to create and use the class-hierarchy.
+*/
+
+#ifndef _OrxonoxClass_H__
+#define _OrxonoxClass_H__
+
+#include "CorePrereqs.h"
+
+#include <set>
+#include <vector>
+
+namespace orxonox
+{
+    //! The class all objects and interfaces of the game-logic (not the engine) are derived from.
+    /**
+        The BaseObject and Interfaces are derived with 'virtual public OrxonoxClass' from OrxonoxClass.
+        OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the MetaObjectList.
+    */
+    class _CoreExport OrxonoxClass
+    {
+        template <class T>
+        friend class ClassIdentifier;
+
+        public:
+            OrxonoxClass();
+            virtual ~OrxonoxClass();
+
+            /** @brief Function to collect the SetConfigValue-macro calls. */
+            void setConfigValues() {};
+
+            /** @brief Returns the Identifier of the object. @return The Identifier */
+            inline Identifier* getIdentifier() const { return this->identifier_; }
+
+            bool isA(const Identifier* identifier);
+            bool isExactlyA(const Identifier* identifier);
+            bool isChildOf(const Identifier* identifier);
+            bool isDirectChildOf(const Identifier* identifier);
+            bool isParentOf(const Identifier* identifier);
+            bool isDirectParentOf(const Identifier* identifier);
+
+            template <class B> bool isA(const SubclassIdentifier<B>* identifier);
+            template <class B> bool isExactlyA(const SubclassIdentifier<B>* identifier);
+            template <class B> bool isChildOf(const SubclassIdentifier<B>* identifier);
+            template <class B> bool isDirectChildOf(const SubclassIdentifier<B>* identifier);
+            template <class B> bool isParentOf(const SubclassIdentifier<B>* identifier);
+            template <class B> bool isDirectParentOf(const SubclassIdentifier<B>* identifier);
+
+            template <class B> bool isA(const SubclassIdentifier<B> identifier);
+            template <class B> bool isExactlyA(const SubclassIdentifier<B> identifier);
+            template <class B> bool isChildOf(const SubclassIdentifier<B> identifier);
+            template <class B> bool isDirectChildOf(const SubclassIdentifier<B> identifier);
+            template <class B> bool isParentOf(const SubclassIdentifier<B> identifier);
+            template <class B> bool isDirectParentOf(const SubclassIdentifier<B> identifier);
+
+            bool isA(const OrxonoxClass* object);
+            bool isExactlyA(const OrxonoxClass* object);
+            bool isChildOf(const OrxonoxClass* object);
+            bool isDirectChildOf(const OrxonoxClass* object);
+            bool isParentOf(const OrxonoxClass* object);
+            bool isDirectParentOf(const OrxonoxClass* object);
+
+            /**
+            @brief
+                Returns a valid pointer of any derived type that is
+                registered in the class hierarchy.
+            @return
+                Returns NULL if the no pointer was found.
+            */
+            template <class T>
+            FORCEINLINE T* getDerivedPointer(unsigned int classID)
+            {
+                for (int i = this->objectPointers_.size() - 1; i >= 0; --i)
+                {
+                    if (this->objectPointers_[i].first == classID)
+                        return static_cast<T*>(this->objectPointers_[i].second);
+                }
+                return NULL;
+            }
+            //! Const version of getDerivedPointer
+            template <class T>
+            FORCEINLINE const T* getDerivedPointer(unsigned int classID) const
+            {
+                return const_cast<OrxonoxClass*>(this)->getDerivedPointer<T>(classID);
+            }
+
+        private:
+            Identifier* identifier_;                   //!< The Identifier of the object
+            std::set<const Identifier*>* parents_;     //!< List of all parents of the object
+            MetaObjectList* metaList_;                 //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
+            //! 'Fast map' that holds this-pointers of all derived types
+            std::vector<std::pair<unsigned int, void*> > objectPointers_;
+    };
+}
+
+#endif /* _OrxonoxClass_H__ */
Index: /sandbox_light/src/libraries/core/Thread.cc
===================================================================
--- /sandbox_light/src/libraries/core/Thread.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/Thread.cc	(revision 5788)
@@ -0,0 +1,129 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Thread.h"
+
+#include <cassert>
+#include <boost/thread/thread.hpp>
+#include <boost/bind.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/thread_time.hpp>
+
+#include "util/Sleep.h"
+#include "Executor.h"
+
+namespace orxonox
+{
+    boost::posix_time::millisec THREAD_WAIT_BEFORE_DETACH(1000);
+    
+    
+    Thread::Thread():
+        executor_(0),
+        isWorking_(false),
+        stopThread_(false)
+    {
+        this->executorMutex_ = new boost::mutex;
+        this->isWorkingMutex_ = new boost::mutex;
+        this->stopThreadMutex_ = new boost::mutex;
+        this->workerThread_ = new boost::thread( boost::bind(&Thread::threadLoop, this) );
+    }
+    
+    Thread::~Thread()
+    {
+        this->stopThreadMutex_->lock();
+        this->stopThread_ = true;
+        this->stopThreadMutex_->unlock();
+        if( !this->workerThread_->timed_join( THREAD_WAIT_BEFORE_DETACH ) )
+            assert(0); // this should not happen
+        delete this->workerThread_;
+        delete this->executorMutex_;
+        delete this->stopThreadMutex_;
+        delete this->isWorkingMutex_;
+    }
+    
+    bool Thread::isWorking()
+    {
+      this->isWorkingMutex_->lock();
+      bool isWorking = this->isWorking_;
+      this->isWorkingMutex_->unlock();
+      return isWorking;
+    }
+    
+    bool Thread::evaluateExecutor( Executor* executor )
+    {
+        this->isWorkingMutex_->lock();
+        this->isWorking_=true;
+        this->isWorkingMutex_->unlock();
+        this->executorMutex_->lock();
+        this->executor_ = executor;
+        this->executorMutex_->unlock();
+        return true;
+    }
+    
+    void Thread::threadLoop()
+    {
+        bool stopThread = false;
+        while( !stopThread )
+        {
+            //this->executorMutex_->lock();
+            Executor* executor = this->executor_;
+            //this->executorMutex_->unlock();
+            if( executor )
+            {
+                (*executor)();
+                this->executorMutex_->lock();
+                delete this->executor_;
+                this->executor_ = 0;
+                this->executorMutex_->unlock();
+                this->isWorkingMutex_->lock();
+                this->isWorking_=false;
+                this->isWorkingMutex_->unlock();
+            }
+            else
+            {
+                this->workerThread_->yield();
+            }
+            //this->stopThreadMutex_->lock();
+            stopThread = this->stopThread_;
+            //this->stopThreadMutex_->unlock();
+        }
+    }
+    
+    void Thread::waitUntilFinished()
+    {
+        bool stillWorking = true;
+        while( stillWorking )
+        {
+            this->isWorkingMutex_->lock();
+            stillWorking = this->isWorking_;
+            this->isWorkingMutex_->unlock();
+            if( stillWorking )
+                msleep( 1 );
+        }
+    }
+}
Index: /sandbox_light/src/libraries/core/Thread.h
===================================================================
--- /sandbox_light/src/libraries/core/Thread.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/Thread.h	(revision 5788)
@@ -0,0 +1,64 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Thread_H__
+#define _Thread_H__
+
+#include "CorePrereqs.h"
+
+namespace boost{
+  class recursive_mutex;
+}
+
+ namespace orxonox
+{
+    class _CoreExport Thread
+    {
+    public:
+        Thread();
+        virtual ~Thread();
+
+        bool isWorking();
+        void waitUntilFinished();
+        bool evaluateExecutor( Executor* executor );
+
+    private:
+        void            threadLoop();
+        
+        Executor*       executor_;
+        bool            isWorking_;
+        bool            stopThread_;
+        boost::thread*  workerThread_;
+        boost::mutex*   executorMutex_;
+        boost::mutex*     isWorkingMutex_;
+        boost::mutex*   stopThreadMutex_;
+    };
+
+ }
+
+#endif /* _Thread_H__ */
Index: /sandbox_light/src/libraries/core/ThreadPool.cc
===================================================================
--- /sandbox_light/src/libraries/core/ThreadPool.cc	(revision 5788)
+++ /sandbox_light/src/libraries/core/ThreadPool.cc	(revision 5788)
@@ -0,0 +1,115 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ThreadPool.h"
+#include "Thread.h"
+#include <cassert>
+
+namespace orxonox
+{
+
+    ThreadPool::ThreadPool()
+    {
+    }
+    
+    ThreadPool::~ThreadPool()
+    {
+        unsigned int a = this->setNrOfThreads(0);
+        assert(a == 0);
+    }
+    
+    void ThreadPool::addThreads( unsigned int nr )
+    {
+        for( unsigned int i=0; i<nr; i++ )
+            this->threadPool_.push_back(new Thread());
+    }
+    unsigned int ThreadPool::removeThreads( unsigned int nr )
+    {
+        unsigned int i=0;
+        std::vector<Thread*>::iterator it;
+        for( it = this->threadPool_.begin(); it != threadPool_.end() && i<nr; )
+        {
+            if( ! (*it)->isWorking() )
+            {
+                Thread* temp = *it;
+                it=this->threadPool_.erase( it );
+                delete temp;
+                ++i;
+            }
+            else
+              ++it;
+        }
+        return i;
+    }
+    unsigned int ThreadPool::setNrOfThreads( unsigned int nr )
+    {
+        unsigned int currentsize = this->threadPool_.size();
+        if ( nr < currentsize )
+            return currentsize - removeThreads( currentsize - nr );
+        else if ( nr == currentsize )
+            return currentsize;
+        else
+        {
+            addThreads( nr - currentsize );
+            return nr;
+        }
+    }
+    
+    bool ThreadPool::passFunction( Executor* executor, bool addThread )
+    {
+        std::vector<Thread*>::iterator it;
+        for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it )
+        {
+            if ( ! (*it)->isWorking() )
+            {
+                bool b = (*it)->evaluateExecutor( executor );
+                assert(b); // if b is false then there is some code error
+                return true;
+            }
+        }
+        if ( addThread )
+        {
+            addThreads( 1 );
+            bool b = this->threadPool_.back()->evaluateExecutor( executor ); // access the last element
+            assert(b);
+            return true;
+        }
+        else
+            return false;
+    }
+    
+    void ThreadPool::synchronise()
+    {
+        std::vector<Thread*>::iterator it;
+        for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it )
+        {
+            (*it)->waitUntilFinished();
+        }
+    }
+
+}
Index: /sandbox_light/src/libraries/core/ThreadPool.h
===================================================================
--- /sandbox_light/src/libraries/core/ThreadPool.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/ThreadPool.h	(revision 5788)
@@ -0,0 +1,57 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ThreadPool_H__
+#define _ThreadPool_H__
+
+#include "CorePrereqs.h"
+
+#include <vector>
+
+ namespace orxonox
+{
+    class _CoreExport ThreadPool
+    {
+    public:
+        ThreadPool();
+        virtual ~ThreadPool();
+        
+        void addThreads( unsigned int nr );
+        unsigned int removeThreads( unsigned int nr );
+        unsigned int setNrOfThreads( unsigned int nr );
+        
+        bool passFunction( Executor* executor, bool addThread=false );
+        void synchronise();
+        
+    private:
+        std::vector<Thread*> threadPool_;
+        
+    };
+}
+
+#endif /* _ThreadPool_H__ */
Index: /sandbox_light/src/libraries/core/ToluaInterface.h
===================================================================
--- /sandbox_light/src/libraries/core/ToluaInterface.h	(revision 5788)
+++ /sandbox_light/src/libraries/core/ToluaInterface.h	(revision 5788)
@@ -0,0 +1,45 @@
+/*
+ *   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
+    This is required because tolua would parse this macro in LuaState.h and fail
+*/
+
+#ifndef _ToluaInterface_H__
+#define _ToluaInterface_H__
+
+#include "CorePrereqs.h"
+#include <boost/preprocessor/cat.hpp>
+
+// Macro for declaring a tolua interface of a library/module
+#define DeclareToluaInterface(libraryName) \
+    static bool BOOST_PP_CAT(bDummy##libraryName, __LINE__) = orxonox::LuaState::addToluaInterface(&tolua_##libraryName##_open, #libraryName); \
+    static Loki::ScopeGuardImpl1<bool (*)(const std::string&), std::string> BOOST_PP_CAT(dummy##libraryName, __LINE__)(&orxonox::LuaState::removeToluaInterface, #libraryName)
+
+#endif /* _ToluaInterface_H__ */
Index: /sandbox_light/src/libraries/util/CMakeLists.txt
===================================================================
--- /sandbox_light/src/libraries/util/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/src/libraries/util/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,49 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+
+SET_SOURCE_FILES(UTIL_SRC_FILES
+  CRC32.cc
+  Exception.cc
+  ExprParser.cc
+  Math.cc
+  MultiType.cc
+  OutputBuffer.cc
+  OutputHandler.cc
+  Scope.cc
+  SignalHandler.cc
+  Sleep.cc
+  StringUtils.cc
+  SubString.cc
+)
+
+IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
+  # Get around displaying a few hundred lines of warning code
+  SET_SOURCE_FILES_PROPERTIES(MultiType.cc PROPERTIES COMPILE_FLAGS "-w")
+ENDIF()
+
+ORXONOX_ADD_LIBRARY(util
+  FIND_HEADER_FILES
+  DEFINE_SYMBOL
+    "UTIL_SHARED_BUILD"
+  LINK_LIBRARIES
+    ${CEGUI_LIBRARY}
+    ${OGRE_LIBRARY}
+  SOURCE_FILES
+    ${UTIL_SRC_FILES}
+)
Index: /sandbox_light/src/libraries/util/CRC32.cc
===================================================================
--- /sandbox_light/src/libraries/util/CRC32.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/CRC32.cc	(revision 5788)
@@ -0,0 +1,59 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      ...
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "CRC32.h"
+
+namespace orxonox
+{
+    void calcCRCBit(uint32_t &crc32, int bit)
+    {
+        int hbit = (crc32 & 0x80000000) ? 1 : 0;
+        if (hbit != bit)
+            crc32 = (crc32 << 1) ^ UTIL_CRC32POLY;
+        else
+            crc32 = crc32 << 1;
+      }
+
+    uint32_t calcCRC(unsigned char *data, unsigned int dataLength)
+    {
+        uint32_t crc32 = 0;
+        for(unsigned int i = 0; i < dataLength; i++)
+        {
+            calcCRCBit(crc32, (data[i] & 0x1) >> 0); // 1st bit
+            calcCRCBit(crc32, (data[i] & 0x2) >> 1); // 2nd bit
+            calcCRCBit(crc32, (data[i] & 0x3) >> 2); // 3rd bit
+            calcCRCBit(crc32, (data[i] & 0x4) >> 3); // 4th bit
+            calcCRCBit(crc32, (data[i] & 0x5) >> 4); // 5th bit
+            calcCRCBit(crc32, (data[i] & 0x6) >> 5); // 6th bit
+            calcCRCBit(crc32, (data[i] & 0x7) >> 6); // 7th bit
+            calcCRCBit(crc32, (data[i] & 0x8) >> 7); // 8th bit
+        }
+        return crc32;
+    }
+}
+
Index: /sandbox_light/src/libraries/util/CRC32.h
===================================================================
--- /sandbox_light/src/libraries/util/CRC32.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/CRC32.h	(revision 5788)
@@ -0,0 +1,43 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      ...
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Util_CRC_H__
+#define _Util_CRC_H__
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    const unsigned int UTIL_CRC32POLY = 0x04C11DB7; /* CRC-32 Polynom */
+
+    _UtilExport void calcCRCBit(uint32_t &crc32, int bit);
+
+    _UtilExport uint32_t calcCRC(unsigned char *data, unsigned int dataLength);
+}
+
+#endif /* _Util_CRC_H__ */
Index: /sandbox_light/src/libraries/util/Convert.h
===================================================================
--- /sandbox_light/src/libraries/util/Convert.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/Convert.h	(revision 5788)
@@ -0,0 +1,418 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *      Fabian 'x3n' Landau
+ *      Benjamin Grauer
+ *   Co-authors:
+ *      ...
+ */
+
+/*!
+    @file
+    @brief Definition and Implementation of the Convert class.
+*/
+
+#ifndef _Converter_H__
+#define _Converter_H__
+
+#include "UtilPrereqs.h"
+
+#include <string>
+#include <sstream>
+#include <typeinfo>
+
+#include "Debug.h"
+#include "StringUtils.h"
+#include "TemplateUtils.h"
+
+////////////////////////////////////
+//// ACTUAL CONVERSION SEQUENCE ////
+////////////////////////////////////
+/*
+    There is a distinct priority when choosing the right conversion function:
+    Overwrite:
+    1. (Partial) template specialisation of ConverterExplicit::convert()
+    Fallbacks:
+    2. Any possible implicit conversion. This includes 'FooBar' --> 'int' if FooBar defines operator float().
+    3. Global or member operators for stringstream when converting from or to std::string (or FROM const char*)
+    4. (Partial) template specialisation of ConverterFallback::convert()
+    5. Function that simply displays "Could not convert value" with type information obtained from typeid().
+
+    Notes:
+    There has to be an exact type match when using template specialisations.
+    Template specialisations can be defined after including this file. Any implicit cast function or iostream
+    operator has to be declared BEFORE this file gets parsed.
+
+    Defining your own functions:
+    There are obviously 4 ways to specifiy a user defined conversion. What should I use?
+
+    Usually, ConverterFallback fits quite well. You won't have to deal with the conversion from
+    'MyClass' to 'MyClass' by using another explicit template specialisation to avoid ambiguities.
+
+    However if you want to overwrite an implicit conversion or an iostream operator, you really need to
+    make use of ConverterExplicit.
+*/
+
+namespace orxonox
+{
+    namespace detail
+    {
+        //! Little template that maps integers to entire types (Alexandrescu 2001)
+        template <int I>
+        struct Int2Type { };
+    }
+
+
+    ///////////////////
+    // No Conversion //
+    ///////////////////
+
+    // Default template. No conversion available at all.
+    template <class FromType, class ToType>
+    struct ConverterFallback
+    {
+        FORCEINLINE static bool convert(ToType* output, const FromType& input)
+        {
+            COUT(2) << "Could not convert value of type " << typeid(FromType).name()
+                    << " to type " << typeid(ToType).name() << std::endl;
+            return false;
+        }
+    };
+
+    // If all else fails, try a dynamic_cast for pointer types.
+    template <class FromType, class ToType>
+    struct ConverterFallback<FromType*, ToType*>
+    {
+        FORCEINLINE static bool convert(ToType** output, FromType* const input)
+        {
+            ToType* temp = dynamic_cast<ToType*>(input);
+            if (temp)
+            {
+                *output = temp;
+                return true;
+            }
+            else
+                return false;
+        }
+    };
+}
+
+
+///////////////////////
+// ConverterFallback //
+///////////////////////
+
+// Default template for stringstream
+template <class FromType, class ToType>
+struct ConverterStringStream
+{
+    FORCEINLINE static bool convert(ToType* output, const FromType& input)
+    {
+        return orxonox::ConverterFallback<FromType, ToType>::convert(output, input);
+    }
+};
+
+
+/////////////
+// OStream //
+/////////////
+
+namespace fallbackTemplates
+{
+    template <class FromType>
+    FORCEINLINE bool operator <<(std::ostream& outstream,  const FromType& input)
+    {
+        std::string temp;
+        if (orxonox::ConverterFallback<FromType, std::string>::convert(&temp, input))
+        {
+            std::operator <<(outstream, temp);
+            return true;
+        }
+        else
+            return false;
+    }
+}
+
+// template that evaluates whether we can convert to std::string via ostringstream
+template <class FromType>
+struct ConverterStringStream<FromType, std::string>
+{
+    FORCEINLINE static bool convert(std::string* output, const FromType& input)
+    {
+        using namespace fallbackTemplates;
+        // this operator call only chooses fallbackTemplates::operator<< if there's no other fitting function
+        std::ostringstream oss;
+        if (oss << input)
+        {
+            (*output) = oss.str();
+            return true;
+        }
+        else
+            return false;
+    }
+};
+
+
+/////////////
+// IStream //
+/////////////
+
+namespace fallbackTemplates
+{
+    template <class ToType>
+    FORCEINLINE bool operator >>(std::istream& instream, ToType& output)
+    {
+        return orxonox::ConverterFallback<std::string, ToType>
+            ::convert(&output, static_cast<std::istringstream&>(instream).str());
+    }
+}
+
+// template that evaluates whether we can convert from std::string via ostringstream
+template <class ToType>
+struct ConverterStringStream<std::string, ToType>
+{
+    FORCEINLINE static bool convert(ToType* output, const std::string& input)
+    {
+        using namespace fallbackTemplates;
+        std::istringstream iss(input);
+        // this operator call only chooses fallbackTemplates::operator>> if there's no other fitting function
+        if (iss >> (*output))
+        {
+            return true;
+        }
+        else
+            return false;
+    }
+};
+
+namespace orxonox
+{
+
+    ///////////////////
+    // Implicit Cast //
+    ///////////////////
+
+    // implicit cast not possible, try stringstream conversion next
+    template <class FromType, class ToType>
+    FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, detail::Int2Type<false>)
+    {
+        return ConverterStringStream<FromType, ToType>::convert(output, input);
+    }
+
+    // We can cast implicitely
+    template <class FromType, class ToType>
+    FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, detail::Int2Type<true>)
+    {
+        (*output) = static_cast<ToType>(input);
+        return true;
+    }
+
+
+    ////////////////////////////////
+    // ConverterExplicit Fallback //
+    ////////////////////////////////
+
+    // Default template if no specialisation is available
+    template <class FromType, class ToType>
+    struct ConverterExplicit
+    {
+        enum { probe = ImplicitConversion<FromType, ToType>::exists };
+        FORCEINLINE static bool convert(ToType* output, const FromType& input)
+        {
+            // Try implict cast and probe first. If a simple cast is not possible, it will not compile
+            // We therefore have to out source it into another template function
+            return convertImplicitely(output, input, detail::Int2Type<probe>());
+        }
+    };
+
+
+    //////////////////////
+    // Public Functions //
+    //////////////////////
+
+    /**
+    @brief
+        Converts any value to any other as long as there exists a conversion.
+        Otherwise, the conversion will generate a runtime warning and return false.
+        For information about the different conversion methods (user defined too), see the section
+        'Actual conversion sequence' in this file above.
+    */
+    template <class FromType, class ToType>
+    FORCEINLINE bool convertValue(ToType* output, const FromType& input)
+    {
+        return ConverterExplicit<FromType, ToType>::convert(output, input);
+    }
+
+    // Calls convertValue and returns true if the conversion was successful.
+    // Otherwise the fallback is used.
+    /**
+    @brief
+        Converts any value to any other as long as there exists a conversion.
+        Otherwise, the conversion will generate a runtime warning and return false.
+        For information about the different conversion methods (user defined too), see the section
+        'Actual conversion sequence' in this file above.
+        If the conversion doesn't succeed, 'fallback' is written to '*output'.
+    @param fallback
+        A default value that gets written to '*output' if there is no conversion.
+    */
+    template<class FromType, class ToType>
+    FORCEINLINE bool convertValue(ToType* output, const FromType& input, const ToType& fallback)
+    {
+        if (convertValue(output, input))
+            return true;
+        else
+        {
+            (*output) = fallback;
+            return false;
+        }
+    }
+
+    // Directly returns the converted value, even if the conversion was not successful.
+    template<class FromType, class ToType>
+    FORCEINLINE ToType getConvertedValue(const FromType& input)
+    {
+        ToType output;
+        convertValue(&output, input);
+        return output;
+    }
+
+    // Directly returns the converted value, but uses the fallback on failure.
+    template<class FromType, class ToType>
+    FORCEINLINE ToType getConvertedValue(const FromType& input, const ToType& fallback)
+    {
+        ToType output;
+        convertValue(&output, input, fallback);
+        return output;
+    }
+
+    // Like getConvertedValue, but the template argument order is in reverse.
+    // That means you can call it exactly like static_cast<ToType>(fromTypeValue).
+    template<class ToType, class FromType>
+    FORCEINLINE ToType multi_cast(const FromType& input)
+    {
+        ToType output;
+        convertValue(&output, input);
+        return output;
+    }
+
+    ////////////////////////////////
+    // Special string conversions //
+    ////////////////////////////////
+
+    // Delegate conversion from const char* to std::string
+    template <class ToType>
+    struct ConverterExplicit<const char*, ToType>
+    {
+        FORCEINLINE static bool convert(ToType* output, const char* input)
+        {
+            return convertValue<std::string, ToType>(output, input);
+        }
+    };
+
+    // These conversions would exhibit ambiguous << or >> operators when using stringstream
+    template <>
+    struct ConverterExplicit<char, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const char input)
+        {
+            *output = std::string(1, input);
+            return true;
+        }
+    };
+    template <>
+    struct ConverterExplicit<unsigned char, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const unsigned char input)
+        {
+            *output = std::string(1, input);
+            return true;
+        }
+    };
+    template <>
+    struct ConverterExplicit<std::string, char>
+    {
+        FORCEINLINE static bool convert(char* output, const std::string input)
+        {
+            if (input != "")
+                *output = input[0];
+            else
+                *output = '\0';
+            return true;
+        }
+    };
+    template <>
+    struct ConverterExplicit<std::string, unsigned char>
+    {
+        FORCEINLINE static bool convert(unsigned char* output, const std::string input)
+        {
+            if (input != "")
+                *output = input[0];
+            else
+                *output = '\0';
+            return true;
+        }
+    };
+
+
+    // bool to std::string
+    template <>
+    struct ConverterExplicit<bool, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const bool& input)
+        {
+            if (input)
+              *output = "true";
+            else
+              *output = "false";
+            return true;
+        }
+    };
+
+    // std::string to bool
+    template <>
+    struct ConverterExplicit<std::string, bool>
+    {
+        static bool convert(bool* output, const std::string& input)
+        {
+            std::string stripped = getLowercase(removeTrailingWhitespaces(input));
+            if (stripped == "true" || stripped == "on" || stripped == "yes")
+            {
+              *output = true;
+              return true;
+            }
+            else if (stripped == "false" || stripped == "off" || stripped == "no")
+            {
+              *output = false;
+              return true;
+            }
+
+            std::istringstream iss(input);
+            if (iss >> (*output))
+                return true;
+            else
+                return false;
+        }
+    };
+}
+
+#endif /* _Convert_H__ */
Index: /sandbox_light/src/libraries/util/Debug.h
===================================================================
--- /sandbox_light/src/libraries/util/Debug.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/Debug.h	(revision 5788)
@@ -0,0 +1,259 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Grauer
+ *   Co-authors:
+ *      Fabian 'x3n' Landau
+ *
+ */
+
+/**
+    @file
+    @brief Handles different output-levels of errors, warnings, infos and debug information.
+
+    The COUT(level) macro acts like std::cout, but the output is only performed if the given
+    level is <= the soft debug level.
+
+    There are two used values in this file:
+     - The hard debug level is used during compiletime. It describes the highest allowed output level.
+     - The soft debug level is used during runtime and is the maximum of the three configurable
+       output-levels for console, logfile and ingame shell.
+
+    The separation between the three devices is done by the OutputHandler.
+
+    Possible levels are:
+     0: Very important output
+     1: Errors
+     2: Warnings
+     3: Information
+     4: Debug information
+     5: More debug information
+     6: Crazy debug information
+
+    @example
+    COUT(0) << "Very important output" << std::endl;
+    COUT(1) << "Error: Something went wrong!" << std::endl;
+    COUT(2) << "Warning: There might be a problem." << std::endl;
+    COUT(3) << "Info: It's monday" << std::endl;
+    COUT(4) << "Debug: x is 1.23456" << std::endl;
+ */
+
+#ifndef _Debug_H__
+#define _Debug_H__
+
+#include "UtilPrereqs.h"
+
+#include "OutputHandler.h"
+
+namespace orxonox
+{
+    /**
+        @brief Returns the soft debug level, stored in the only existing instance of the OutputHandler class, configured in the config-file.
+        @return The soft debug level
+    */
+    inline int getSoftDebugLevel()
+    {
+        return OutputHandler::getSoftDebugLevel();
+    }
+
+    using std::endl;
+}
+
+// DEFINE ERROR MODES
+#define ORX_NONE            0
+#define ORX_ERROR           1
+#define ORX_WARNING         2
+#define ORX_INFO            3
+#define ORX_DEBUG           4
+#define ORX_VERBOSE         5
+#define ORX_ULTRA           6
+
+//definitions
+#define ORX_PRINT_DEBUG_OUTPUT 1
+#define ORX_HARD_DEBUG_LEVEL ORX_VERBOSE
+
+#define COUT_EXEC(x) orxonox::OutputHandler::getOutStream().setOutputLevel(x)
+
+////////////////////////////////////////////////////////
+///  COUT: just prints output as is with std::cout   ///
+////////////////////////////////////////////////////////
+#define COUTORX_NONE    COUT0
+#define COUTORX_ERROR   COUT1
+#define COUTORX_WARNING COUT2
+#define COUTORX_INFO    COUT3
+#define COUTORX_DEBUG   COUT4
+#define COUTORX_VERBOSE COUT5
+#define COUTORX_ULTRA   COUT6
+
+#ifndef COUT
+ #if ORX_PRINT_DEBUG_OUTPUT
+  #define COUT(x) \
+   COUT ## x
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_NONE
+   #define COUT0 \
+   (orxonox::getSoftDebugLevel() < ORX_NONE) ? COUT_EXEC(0) : COUT_EXEC(0)
+  #else
+   #define COUT0 \
+    false ? COUT_EXEC(0) : COUT_EXEC(0)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
+   #define COUT1 \
+    (orxonox::getSoftDebugLevel() < ORX_ERROR) ? COUT_EXEC(1) : COUT_EXEC(1)
+  #else
+   #define COUT1 \
+    false ? COUT_EXEC(1) : COUT_EXEC(1)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
+   #define COUT2 \
+    (orxonox::getSoftDebugLevel() < ORX_WARNING) ? COUT_EXEC(2) : COUT_EXEC(2)
+  #else
+   #define COUT2 \
+    false ? COUT_EXEC(2) : COUT_EXEC(2)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
+   #define COUT3 \
+    (orxonox::getSoftDebugLevel() < ORX_INFO) ? COUT_EXEC(3) : COUT_EXEC(3)
+  #else
+   #define COUT3 \
+    false ? COUT_EXEC(3) : COUT_EXEC(3)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
+   #define COUT4 \
+    (orxonox::getSoftDebugLevel() < ORX_DEBUG) ? COUT_EXEC(4) : COUT_EXEC(4)
+  #else
+   #define COUT4 \
+    false ? COUT_EXEC(4) : COUT_EXEC(4)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_VERBOSE
+   #define COUT5 \
+    (orxonox::getSoftDebugLevel() < ORX_VERBOSE) ? COUT_EXEC(5) : COUT_EXEC(5)
+  #else
+   #define COUT5 \
+    false ? COUT_EXEC(5) : COUT_EXEC(5)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ULTRA
+   #define COUT6 \
+    (orxonox::getSoftDebugLevel() < ORX_ULTRA) ? COUT_EXEC(6) : COUT_EXEC(6)
+  #else
+   #define COUT6 \
+    false ? COUT_EXEC(6) : COUT_EXEC(6)
+  #endif
+
+ #else /* if ORX_PRINT_DEBUG_OUTPUT */
+  #define COUT(x) \
+    false ? COUT_EXEC(6) : COUT_EXEC(6)
+ #endif /* if ORX_PRINT_DEBUG_OUTPUT */
+
+#endif /* ifndef COUT */
+
+
+/////////////////////////////////////////////////////////////////////
+///  CCOUT: Prints output with std::cout and adds the classname   ///
+/////////////////////////////////////////////////////////////////////
+#define CCOUTORX_NONE    CCOUT0
+#define CCOUTORX_ERROR   CCOUT1
+#define CCOUTORX_WARNING CCOUT2
+#define CCOUTORX_INFO    CCOUT3
+#define CCOUTORX_DEBUG   CCOUT4
+#define CCOUTORX_VERBOSE CCOUT5
+#define CCOUTORX_ULTRA   CCOUT6
+
+#define CCOUT_EXEC(x) \
+  orxonox::OutputHandler::getOutStream().setOutputLevel(x) \
+  << this->getIdentifier()->getName() << ": "
+
+#ifndef CCOUT
+ #if ORX_PRINT_DEBUG_OUTPUT
+  #define CCOUT(x) \
+   CCOUT ## x
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_NONE
+   #define CCOUT0 \
+    (orxonox::getSoftDebugLevel() < ORX_NONE) ? COUT_EXEC(0) : CCOUT_EXEC(0)
+  #else
+   #define CCOUT0 \
+    false ? COUT_EXEC(0) : CCOUT_EXEC(0)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
+   #define CCOUT1 \
+    (orxonox::getSoftDebugLevel() < ORX_ERROR) ? COUT_EXEC(1) : CCOUT_EXEC(1)
+  #else
+   #define CCOUT1 \
+    false ? COUT_EXEC(1) : CCOUT_EXEC(1)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
+   #define CCOUT2 \
+    (orxonox::getSoftDebugLevel() < ORX_WARNING) ? COUT_EXEC(2) : CCOUT_EXEC(2)
+  #else
+   #define CCOUT2 \
+    false ? COUT_EXEC(2) : CCOUT_EXEC(2)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
+   #define CCOUT3 \
+    (orxonox::getSoftDebugLevel() < ORX_INFO) ? COUT_EXEC(3) : CCOUT_EXEC(3)
+  #else
+   #define CCOUT3 \
+    false ? COUT_EXEC(3) : CCOUT_EXEC(3)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
+   #define CCOUT4 \
+    (orxonox::getSoftDebugLevel() < ORX_DEBUG) ? COUT_EXEC(4) : CCOUT_EXEC(4)
+  #else
+   #define CCOUT4 \
+    false ? COUT_EXEC(4) : CCOUT_EXEC(4)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_VERBOSE
+   #define CCOUT5 \
+    (orxonox::getSoftDebugLevel() < ORX_VERBOSE) ? COUT_EXEC(5) : CCOUT_EXEC(5)
+  #else
+   #define CCOUT5 \
+    false ? COUT_EXEC(5) : CCOUT_EXEC(5)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ULTRA
+   #define CCOUT6 \
+    (orxonox::getSoftDebugLevel() < ORX_ULTRA) ? COUT_EXEC(6) : CCOUT_EXEC(6)
+  #else
+   #define CCOUT6 \
+    false ? COUT_EXEC(6) : CCOUT_EXEC(6)
+  #endif
+
+ #else /* if ORX_PRINT_DEBUG_OUTPUT */
+  #define CCOUT(x) \
+   false ? CCOUT_EXEC(6) : CCOUT_EXEC(6)
+ #endif /* if ORX_PRINT_DEBUG_OUTPUT */
+
+#endif /* ifndef CCOUT */
+
+#endif /* _Debug_H__ */
Index: /sandbox_light/src/libraries/util/Exception.cc
===================================================================
--- /sandbox_light/src/libraries/util/Exception.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/Exception.cc	(revision 5788)
@@ -0,0 +1,112 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Implementation of the Exception class.
+*/
+
+#include "Exception.h"
+
+namespace orxonox
+{
+    Exception::Exception(const std::string& description, unsigned int lineNumber,
+                         const char* filename, const char* functionName)
+        : description_(description)
+        , lineNumber_(lineNumber)
+        , functionName_(functionName)
+        , filename_(filename)
+    { }
+
+    Exception::Exception(const std::string& description)
+        : description_(description)
+        , lineNumber_(0)
+        , functionName_("")
+        , filename_("")
+    { }
+
+    /**
+    @remarks
+        The composed full description gets stored to fullDescription_. But for compliance
+        with std::exception, this method has to be const. Hence fullDescription_ is declared
+        as mutable.
+    */
+    const std::string& Exception::getFullDescription() const
+    {
+        if (fullDescription_ == "")
+        {
+            std::ostringstream fullDesc;
+
+            fullDesc << this->getTypeName() << "Exception";
+
+            if (this->filename_ != "")
+            {
+                fullDesc << " in " << this->filename_;
+                if (this->lineNumber_)
+                    fullDesc << "(" << this->lineNumber_ << ")";
+            }
+
+            if (this->functionName_ != "")
+                fullDesc << " in function '" << this->functionName_ << "'";
+
+            fullDesc << ": ";
+            if (this->description_ != "")
+                fullDesc << this->description_;
+            else
+                fullDesc << "No description available.";
+
+            this->fullDescription_ = std::string(fullDesc.str());
+        }
+
+        return fullDescription_;
+    }
+
+    //! Returns the error description
+    const char* Exception::what() const throw()
+    {
+        return getDescription().c_str();
+    }
+
+    /*static*/ std::string Exception::handleMessage()
+    {
+        try
+        {
+            // rethrow
+            throw;
+        }
+        catch (const std::exception& ex)
+        {
+            return ex.what();
+        }
+        catch (...)
+        {
+            return "Unknown exception";
+        }
+    }
+}
Index: /sandbox_light/src/libraries/util/Exception.h
===================================================================
--- /sandbox_light/src/libraries/util/Exception.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/Exception.h	(revision 5788)
@@ -0,0 +1,166 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Declaration of facilities to handle exceptions.
+*/
+
+#ifndef _Exception_H__
+#define _Exception_H__
+
+#include "UtilPrereqs.h"
+
+#include <exception>
+#include <sstream>
+#include <string>
+#include "Debug.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Base class for all exceptions (derived from std::exception).
+    @details
+        This class provides support for information about the file, the line
+        and the function the error occured.
+    */
+    class _UtilExport Exception : public std::exception
+    {
+    public:
+        /**
+        @brief
+            Creates the exception but doesn't yet compose the full descrption (because of the virtual functions)
+        @param description
+            Exception description as string. This message is supposed to help developers!
+        */
+        Exception(const std::string& description, unsigned int lineNumber,
+                  const char* filename, const char* functionName);
+        //! Simplified constructor with just a description. If you need more, use the other one.
+        Exception(const std::string& description);
+
+        //! Needed for compatibility with std::exception
+        virtual ~Exception() throw() { }
+        const char* what() const throw();
+
+        //! Returns a full description with type, line, file and function
+        virtual const std::string& getFullDescription() const;
+        //! Returns the string name of the exception type
+        virtual std::string        getTypeName()        const = 0;
+        //! Returns the short developer written exception
+        virtual const std::string& getDescription()     const { return this->description_; }
+        //! Returns the line number on which the exception occurred.
+        virtual const unsigned int getLineNumber()      const { return this->lineNumber_; }
+        //! Returns the function in which the exception occurred.
+        virtual const std::string& getFunctionName()    const { return this->functionName_; }
+        //! Returns the filename in which the exception occurred.
+        virtual const std::string& getFilename()        const { return this->filename_; }
+
+        /**
+        @brief
+            Retrieves information from an exception caught with "..."
+            Works for std::exception and CEGUI::Exception
+        @remarks
+            Never ever call this function without an exception in the stack!
+        */
+        static std::string handleMessage();
+
+    protected:
+        std::string description_;             //!< User typed text about why the exception occurred
+        unsigned int lineNumber_;             //!< Line on which the exception occurred
+        std::string functionName_;            //!< Function (including namespace and class) where the exception occurred
+        std::string filename_;                //!< File where the exception occurred
+        // mutable because "what()" is a const method
+        mutable std::string fullDescription_; //!< Full description with line, file and function
+    };
+
+//! Creates a new type of exception that inherits from tracker::Exception
+#define CREATE_ORXONOX_EXCEPTION(ExceptionName)                                     \
+    class ExceptionName##Exception : public Exception                               \
+    {                                                                               \
+    public:                                                                         \
+        ExceptionName##Exception(const std::string& description,                    \
+                unsigned int lineNumber, const char* filename,                      \
+                const char* functionName)                                           \
+            : Exception(description, lineNumber, filename, functionName)            \
+        { }                                                                         \
+                                                                                    \
+        ExceptionName##Exception(const std::string& description)                    \
+            : Exception(description)                                                \
+        { }                                                                         \
+                                                                                    \
+        ~ExceptionName##Exception() throw() { }                                     \
+                                                                                    \
+        std::string getTypeName() const { return #ExceptionName; }                  \
+    }
+
+    // Creates all possible exception types.
+    // If you want to add a new type, simply copy and adjust a new line here.
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+    CREATE_ORXONOX_EXCEPTION(General);
+    CREATE_ORXONOX_EXCEPTION(FileNotFound);
+    CREATE_ORXONOX_EXCEPTION(Argument);
+    CREATE_ORXONOX_EXCEPTION(PhysicsViolation);
+    CREATE_ORXONOX_EXCEPTION(ParseError);
+    CREATE_ORXONOX_EXCEPTION(PluginsNotFound);
+    CREATE_ORXONOX_EXCEPTION(InitialisationFailed);
+    CREATE_ORXONOX_EXCEPTION(NotImplemented);
+    CREATE_ORXONOX_EXCEPTION(GameState);
+    CREATE_ORXONOX_EXCEPTION(NoGraphics);
+    CREATE_ORXONOX_EXCEPTION(AbortLoading);
+#endif
+
+    /**
+    @brief
+        Helper function that forwards an exception and displays the message.
+    @details
+        This is necessary because only when using 'throw' the objects storage is managed.
+    */
+    template <class T>
+    inline const T& exceptionThrowerHelper(const T& exception)
+    {
+        // let the catcher decide whether to display the message below level 4
+        COUT(4) << exception.getFullDescription() << std::endl;
+        return exception;
+    }
+
+/**
+@brief
+    Throws an exception and logs a message beforehand.
+@param type
+    Type of the exception as literal (General, Initialisation, etc.)
+@param description
+    Exception description as string
+*/
+#define ThrowException(type, description) \
+    throw orxonox::exceptionThrowerHelper(type##Exception(static_cast<std::ostringstream&>(std::ostringstream().flush() << description).str(), __LINE__, __FILE__, __FUNCTIONNAME__))
+
+} /* namespace orxonox */
+
+#endif /* _Exception_H__ */
Index: /sandbox_light/src/libraries/util/ExprParser.cc
===================================================================
--- /sandbox_light/src/libraries/util/ExprParser.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/ExprParser.cc	(revision 5788)
@@ -0,0 +1,453 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+  @file
+  @brief Declaration of FloatParser
+*/
+
+#include "ExprParser.h"
+#include <cmath>
+#include <cstring>
+#include <cstdlib>
+
+// macros for easier if, else statements
+#define CASE_1(var) if (!strcmp(SWITCH,var))
+#define CASE(var) else if (!strcmp(SWITCH,var))
+#define CASE_ELSE else
+
+//! skip white spaces
+#define PARSE_BLANKS while (*reading_stream == ' ') ++reading_stream
+
+namespace orxonox
+{
+    ExprParser::ExprParser(const std::string& str)
+    {
+        this->failed_ = false;
+        this->reading_stream = str.c_str();
+        if (str.size() == 0 || *reading_stream == '\0')
+        {
+            this->failed_ = true;
+            this->result_ = 0.0;
+        }
+        else
+        {
+            this->result_ = parse_expr_8();
+            this->remains_ = reading_stream;
+        }
+    }
+
+    //Private functions:
+    /******************/
+    double ExprParser::parse_argument()
+    {
+        double value = parse_expr_8();
+        if (*reading_stream == ',')
+        {
+            ++reading_stream;
+            return value;
+        }
+        else
+        {
+            this->failed_ = true;
+            return 0;
+        }
+    }
+
+    double ExprParser::parse_last_argument()
+    {
+        double value = parse_expr_8();
+        if (*reading_stream == ')')
+        {
+            ++reading_stream;
+            return value;
+        }
+        else
+        {
+            this->failed_ = true;
+            return 0;
+        }
+    }
+
+    double ExprParser::parse_expr_8()
+    {
+        double value = parse_expr_7();
+        for(;;)
+        {
+            switch (op)
+            {
+            case oder:
+                value = parse_expr_7() || value;
+                break;
+            default: return value;
+            }
+        };
+    }
+
+
+    double ExprParser::parse_expr_7()
+    {
+        double value = parse_expr_6();
+        for(;;)
+        {
+            switch (op)
+            {
+            case und:
+                value = value && parse_expr_6();
+                break;
+            default: return value;
+            }
+        };
+    }
+
+    double ExprParser::parse_expr_6()
+    {
+        double value = parse_expr_5();
+        for(;;)
+        {
+            switch (op)
+            {
+            case gleich:
+                value = (value == parse_expr_5());
+                break;
+            case ungleich:
+                value = (value != parse_expr_5());
+                break;
+            default:
+                return value;
+            }
+        };
+    }
+
+    double ExprParser::parse_expr_5()
+    {
+        double value = parse_expr_4();
+        for(;;)
+        {
+            switch (op)
+            {
+            case kleiner:
+                value = (value < parse_expr_4());
+                break;
+            case kleinergleich:
+                value = (value <= parse_expr_4());
+                break;
+            case groesser:
+                value = (value > parse_expr_4());
+                break;
+            case groessergleich:
+                value = (value >= parse_expr_4());
+                break;
+            default:
+                return value;
+            }
+        };
+    }
+
+    double ExprParser::parse_expr_4()
+    {
+        double value = parse_expr_3();
+        for(;;)
+        {
+            switch (op)
+            {
+            case b_plus:
+                value += parse_expr_3();
+                break;
+            case b_minus:
+                value -= parse_expr_3();
+                break;
+            default:
+                return value;
+            }
+        };
+    }
+
+    double ExprParser::parse_expr_3()
+    {
+        double value = parse_expr_2();
+        for(;;)
+        {
+            switch (op)
+            {
+            case mal:
+                value *= parse_expr_2();
+                break;
+            case durch:
+                value /= parse_expr_2();
+                break;
+            case modulo:
+                {
+                    double temp = parse_expr_2();
+                    value = value - floor(value/temp)*temp;
+                    break;
+                }
+            default:
+                return value;
+            }
+        };
+    }
+
+    double ExprParser::parse_expr_2()
+    {
+        double value = parse_expr_1();
+        while (*reading_stream != '\0')
+        {
+            op = parse_binary_operator();
+            switch (op)
+            {
+            case hoch:
+                value = pow(value,parse_expr_1());
+                break;
+            default:
+                return value;
+            }
+        };
+        op = undef;
+        return value;
+    }
+
+    double ExprParser::parse_expr_1()
+    {
+        PARSE_BLANKS;
+        double value;
+
+        unary_operator op = parse_unary_operator();
+        PARSE_BLANKS;
+
+        if (*reading_stream == '\0')
+        {
+            // end of string
+            this->failed_ = true;
+            return 0;
+        }
+        else if ((*reading_stream > 47 && *reading_stream < 59) || *reading_stream == 46)
+        {  // number
+            value = strtod(reading_stream, const_cast<char**>(&reading_stream));
+        }
+        else if ((*reading_stream > 64 && *reading_stream < 91) || (*reading_stream > 96 && *reading_stream < 123) || *reading_stream == 46)
+        {  // variable or function
+            char* word = new char[256];
+            parse_word(word);
+            PARSE_BLANKS;
+            if (*reading_stream == '(')
+            {
+                ++reading_stream;
+#define SWITCH word
+                CASE_1("sin")
+                    value = sin(parse_last_argument());
+                CASE("asin")
+                    value = asin(parse_last_argument());
+                CASE("sinh")
+                    value = sinh(parse_last_argument());
+                CASE("asinh")
+                {
+                    value = parse_last_argument();
+                    value = log(sqrt(pow(value, 2) + 1) + value);
+                }
+                CASE("cos")
+                    value = cos(parse_last_argument());
+                CASE("acos")
+                    value = acos(parse_last_argument());
+                CASE("cosh")
+                    value = cosh(parse_last_argument());
+                CASE("acosh")
+                {
+                    value = parse_last_argument();
+                    value = log(sqrt(pow(value, 2) - 1) + value);
+                }
+                CASE("tan")
+                    value = tan(parse_last_argument());
+                CASE("atan")
+                    value = atan(parse_last_argument());
+                CASE("atan2")
+                    value = atan2(parse_argument(),parse_last_argument());
+                CASE("tanh")
+                    value = tanh(parse_last_argument());
+                CASE("atanh")
+                {
+                    value = parse_last_argument();
+                    value = 0.5*log((value + 1)/(value - 1));
+                }
+                CASE("int")
+                    value = floor(parse_last_argument());
+                CASE("floor")
+                    value = floor(parse_last_argument());
+                CASE("ceil")
+                    value = ceil(parse_last_argument());
+                CASE("abs")
+                    value = fabs(parse_last_argument());
+                CASE("exp")
+                    value = exp(parse_last_argument());
+                CASE("log")
+                    value = log10(parse_last_argument());
+                CASE("ln")
+                    value = log(parse_last_argument());
+                CASE("sign")
+                {
+                    value = parse_last_argument();
+                    value = (value>0 ? 1 : (value<0 ? -1 : 0));
+                }
+                CASE("sqrt")
+                    value = sqrt(parse_last_argument());
+                CASE("degrees")
+                    value = parse_last_argument()*180/3.1415926535897932;
+                CASE("radians")
+                    value = parse_last_argument()*3.1415926535897932/180;
+                CASE("mod")
+                {
+                    value = parse_argument();
+                    double value2 = parse_last_argument();
+                    value = value - floor(value/value2)*value2;
+                }
+                CASE("pow")
+                    value = pow(parse_argument(),parse_last_argument());
+                CASE("div")
+                    value = floor(parse_argument()/parse_last_argument());
+                CASE("max")
+                    value = std::max(parse_argument(),parse_last_argument());
+                CASE("min")
+                    value = std::min(parse_argument(),parse_last_argument());
+                CASE_ELSE
+                {
+                    this->failed_ = true;
+                    delete[] word;
+                    return 0;
+                }
+            }
+            else
+            {
+#define SWITCH word
+                CASE_1("pi")
+                    value = 3.1415926535897932;
+                CASE("e")
+                    value = 2.7182818284590452;
+                CASE_ELSE
+                {
+                    this->failed_ = true;
+                    delete[] word;
+                    return 0;
+                }
+            }
+            delete[] word;
+        }
+        else if (*reading_stream == 40)
+        {  // expresion in paranthesis
+            ++reading_stream;
+            value = parse_last_argument();
+        }
+        else
+        {
+            this->failed_ = true;
+            return 0;
+        }
+
+        PARSE_BLANKS;
+        switch (op)
+        {
+        case u_nicht: return !value;
+        case u_plus:  return  value;
+        case u_minus: return -value;
+        default:
+            this->failed_ = true;
+            return 0;
+        }
+    }
+
+    char* ExprParser::parse_word(char* str)
+    {
+        char* word = str;
+        int counter = 0;
+        while ((*reading_stream > 47 && *reading_stream < 58) || (*reading_stream > 64 && *reading_stream < 91) || (*reading_stream > 96 && *reading_stream < 123) || *reading_stream == 46)
+        {
+            *word++ = *reading_stream++;
+            counter++;
+            if (counter > 255)
+            {
+                this->failed_ = true;
+                return '\0';
+            }
+        };
+        *word = '\0';
+        return str;
+    }
+
+    ExprParser::binary_operator ExprParser::parse_binary_operator()
+    {
+        binary_operator op;
+        switch (*reading_stream)
+        {
+        case '+': op = b_plus; break;
+        case '-': op = b_minus; break;
+        case '*': op = mal; break;
+        case '/': op = durch; break;
+        case '^': op = hoch; break;
+        case '%': op = modulo; break;
+        case '&': op = und; break;
+        case '|': op = oder; break;
+        case '=': op = gleich; break;
+        case '!': op = b_nicht; break;
+        case '<': op = kleiner; break;
+        case '>': op = groesser; break;
+        default: return undef;
+        }
+        if (*++reading_stream == '=')
+        {
+            if (op > 9)
+            {
+                ++reading_stream;
+                return (binary_operator)(op + 3);
+            }
+            else
+            {
+                --reading_stream;
+                return undef;
+            }
+        }
+        else
+            return op;
+    }
+
+    ExprParser::unary_operator ExprParser::parse_unary_operator()
+    {
+        switch (*reading_stream)
+        {
+        case '!':
+            ++reading_stream;
+            return u_nicht;
+        case '+':
+            ++reading_stream;
+            return u_plus;
+        case '-':
+            ++reading_stream;
+            return u_minus;
+        default :
+            return u_plus;
+        }
+    }
+}
Index: /sandbox_light/src/libraries/util/ExprParser.h
===================================================================
--- /sandbox_light/src/libraries/util/ExprParser.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/ExprParser.h	(revision 5788)
@@ -0,0 +1,110 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+  @file
+  @brief Declaration of FloatParser
+*/
+
+#ifndef _FloatParser_H__
+#define _FloatParser_H__
+
+#include "UtilPrereqs.h"
+#include <string>
+
+namespace orxonox
+{
+    class _UtilExport ExprParser
+    {
+    public:
+        enum binary_operator
+        {
+            b_plus,
+            b_minus,
+            mal,
+            durch,
+            modulo,
+            hoch,
+            undef,
+            oder,
+            und,
+            gleich,
+            b_nicht,
+            kleiner,
+            groesser,
+            ungleich,
+            kleinergleich,
+            groessergleich
+        };
+
+        enum unary_operator
+        {
+            u_plus,
+            u_minus,
+            u_nicht
+        };
+
+
+        ExprParser(const std::string& str);
+        const std::string& getRemains() { return  this->remains_; }
+        double             getResult()  { return  this->result_; }
+        bool               getSuccess() { return !this->failed_; }
+
+    private:
+        double parse_expr_1();
+        double parse_expr_2();
+        double parse_expr_3();
+        double parse_expr_4();
+        double parse_expr_5();
+        double parse_expr_6();
+        double parse_expr_7();
+        double parse_expr_8();
+        char* parse_word(char* str);
+        binary_operator parse_binary_operator();
+        unary_operator parse_unary_operator();
+
+        double parse_argument();
+        double parse_last_argument();
+
+        binary_operator op;
+        const char* reading_stream;
+        bool failed_;
+        double result_;
+        std::string remains_;
+
+    };
+
+    //Endzeichen für float expression: ')', '}', ']', ',', ';'
+    _UtilExport bool parse_float(char* const, char**, double*);
+    //Endzeichen angegeben
+    _UtilExport bool parse_float(char* const, char**, char, double*);
+    //Letzter Teil-float eines Vektors parsen (keine Vergleichs- und Logikoperationen)
+    _UtilExport bool parse_vector_float(char* const, char**, bool, double*);
+}
+
+#endif /* _FloatParser_H__ */
Index: /sandbox_light/src/libraries/util/Math.cc
===================================================================
--- /sandbox_light/src/libraries/util/Math.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/Math.cc	(revision 5788)
@@ -0,0 +1,356 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of several math-functions.
+*/
+
+#include "Math.h"
+
+#include <OgrePlane.h>
+
+#include "MathConvert.h"
+#include "SubString.h"
+// Do not remove this include, it avoids linker errors.
+#include "mbool.h"
+
+namespace orxonox
+{
+    /**
+        @brief Function for writing a Radian to a stream.
+    */
+    std::ostream& operator<<(std::ostream& out, const orxonox::Radian& radian)
+    {
+        out << radian.valueRadians();
+        return out;
+    }
+
+    /**
+        @brief Function for reading a Radian from a stream.
+    */
+    std::istream& operator>>(std::istream& in, orxonox::Radian& radian)
+    {
+        float temp;
+        in >> temp;
+        radian = temp;
+        return in;
+    }
+
+    /**
+        @brief Function for writing a Degree to a stream.
+    */
+    std::ostream& operator<<(std::ostream& out, const orxonox::Degree& degree)
+    {
+        out << degree.valueDegrees();
+        return out;
+    }
+
+    /**
+        @brief Function for reading a Degree from a stream.
+    */
+    std::istream& operator>>(std::istream& in, orxonox::Degree& degree)
+    {
+        float temp;
+        in >> temp;
+        degree = temp;
+        return in;
+    }
+
+
+    /**
+        @brief Gets the angle between my viewing direction and the direction to the position of the other object.
+        @param myposition My position
+        @param mydirection My viewing direction
+        @param otherposition The position of the other object
+        @return The angle
+
+        @example
+        If the other object is exactly in front of me, the function returns 0.
+        If the other object is exactly behind me, the function returns pi.
+        If the other object is exactly right/left to me (or above/below), the function returns pi/2.
+    */
+    float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition)
+    {
+        orxonox::Vector3 distance = otherposition - myposition;
+        float distancelength = distance.length();
+        if (distancelength == 0)
+            return 0;
+        else
+            return acos(clamp<float>(mydirection.dotProduct(distance) / distancelength, -1, 1));
+    }
+
+    /**
+        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object.
+        @param myposition My position
+        @param mydirection My viewing direction
+        @param myorthonormal My orthonormalvector (pointing upwards through my head)
+        @param otherposition The position of the other object
+        @return The viewing direction
+
+        @example
+        If the other object is exactly in front of me, the function returns Vector2(0, 0).
+        If the other object is exactly at my left, the function returns Vector2(-1, 0).
+        If the other object is exactly at my right, the function returns Vector2(1, 0).
+        If the other object is only a bit at my right, the function still returns Vector2(1, 0).
+        If the other object is exactly above me, the function returns Vector2(0, 1).
+    */
+    orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
+    {
+        orxonox::Vector3 distance = otherposition - myposition;
+
+        // project difference vector on our plane
+        orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
+
+        float projectionlength = projection.length();
+        if (projectionlength == 0)
+        {
+            if (myposition.dotProduct(otherposition) >= 0)
+                return orxonox::Vector2(0, 0);
+            else
+                return orxonox::Vector2(0, 1);
+        }
+        
+        float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
+        float sin_value = sqrt( 1 - cos_value*cos_value );
+        
+        if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
+            return orxonox::Vector2( sin_value, cos_value );
+        else
+            return orxonox::Vector2( -sin_value, cos_value );
+    }
+
+    /**
+        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1).
+        @param myposition My position
+        @param mydirection My viewing direction
+        @param myorthonormal My orthonormalvector (pointing upwards through my head)
+        @param otherposition The position of the other object
+        @return The viewing direction
+
+        @example
+        If the other object is exactly in front of me, the function returns Vector2(0, 0).
+        If the other object is exactly at my left, the function returns Vector2(-0.5, 0).
+        If the other object is exactly at my right, the function returns Vector2(0.5, 0).
+        If the other object is only a bit at my right, the function still returns Vector2(0.01, 0).
+        If the other object is exactly above me, the function returns Vector2(0, 0.5).
+    */
+    orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
+    {
+        orxonox::Vector3 distance = otherposition - myposition;
+
+        // project difference vector on our plane
+        orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
+
+        float projectionlength = projection.length();
+        if (projectionlength == 0)
+        {
+            if (myposition.dotProduct(otherposition) >= 0)
+                return orxonox::Vector2(0, 0);
+            else
+                return orxonox::Vector2(0, 1);
+        }
+        //float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
+        
+        float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
+        float sin_value = sqrt( 1 - cos_value*cos_value );
+
+        float distancelength = distance.length();
+        if (distancelength == 0) return orxonox::Vector2(0, 0);
+        float radius = acos(clamp<float>(mydirection.dotProduct(distance) / distancelength, -1, 1)) / Ogre::Math::PI;
+
+        if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
+            return orxonox::Vector2( sin_value * radius, cos_value * radius);
+        else
+            return orxonox::Vector2( -sin_value * radius, cos_value * radius);
+    }
+
+    /**
+        @brief Returns the predicted position I have to aim at, if I want to hit a moving target with a moving projectile.
+        @param myposition My position
+        @param projectilespeed The speed of my projectile
+        @param targetposition The position of my target
+        @param targetvelocity The velocity of my target
+        @return The predicted position
+
+        The function predicts the position based on a linear velocity of the target. If the target changes speed or direction, the projectile will miss.
+    */
+    orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity)
+    {
+        float squaredProjectilespeed = projectilespeed * projectilespeed;
+        orxonox::Vector3 distance = targetposition - myposition;
+        float a = distance.squaredLength();
+        float b = 2 * (distance.x + distance.y + distance.z) * (targetvelocity.x + targetvelocity.y + targetvelocity.z);
+        float c = targetvelocity.squaredLength();
+
+        float temp = 4*squaredProjectilespeed*c + a*a - 4*b*c;
+        if (temp < 0)
+            return orxonox::Vector3::ZERO;
+
+        temp = sqrt(temp);
+        float time = (temp + a) / (2 * (squaredProjectilespeed - b));
+        return (targetposition + targetvelocity * time);
+    }
+
+    unsigned long getUniqueNumber()
+    {
+        static unsigned long aNumber = 135;
+        return aNumber++;
+    }
+
+
+    //////////////////////////
+    // Conversion functions //
+    //////////////////////////
+
+    // std::string to Vector2
+    bool ConverterFallback<std::string, orxonox::Vector2>::convert(orxonox::Vector2* output, const std::string& input)
+    {
+        size_t opening_parenthesis, closing_parenthesis = input.find(')');
+        if ((opening_parenthesis = input.find('(')) == std::string::npos)
+            opening_parenthesis = 0;
+        else
+            opening_parenthesis++;
+
+        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
+                         ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (tokens.size() >= 2)
+        {
+            if (!convertValue(&(output->x), tokens[0]))
+                return false;
+            if (!convertValue(&(output->y), tokens[1]))
+                return false;
+
+            return true;
+        }
+        return false;
+    }
+
+    // std::string to Vector3
+    bool ConverterFallback<std::string, orxonox::Vector3>::convert(orxonox::Vector3* output, const std::string& input)
+    {
+        size_t opening_parenthesis, closing_parenthesis = input.find(')');
+        if ((opening_parenthesis = input.find('(')) == std::string::npos)
+            opening_parenthesis = 0;
+        else
+            opening_parenthesis++;
+
+        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
+                         ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (tokens.size() >= 3)
+        {
+            if (!convertValue(&(output->x), tokens[0]))
+                return false;
+            if (!convertValue(&(output->y), tokens[1]))
+                return false;
+            if (!convertValue(&(output->z), tokens[2]))
+                return false;
+
+            return true;
+        }
+        return false;
+    }
+
+    // std::string to Vector4
+    bool ConverterFallback<std::string, orxonox::Vector4>::convert(orxonox::Vector4* output, const std::string& input)
+    {
+        size_t opening_parenthesis, closing_parenthesis = input.find(')');
+        if ((opening_parenthesis = input.find('(')) == std::string::npos)
+            opening_parenthesis = 0;
+        else
+            opening_parenthesis++;
+
+        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
+                         ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (tokens.size() >= 4)
+        {
+            if (!convertValue(&(output->x), tokens[0]))
+                return false;
+            if (!convertValue(&(output->y), tokens[1]))
+                return false;
+            if (!convertValue(&(output->z), tokens[2]))
+                return false;
+            if (!convertValue(&(output->w), tokens[3]))
+                return false;
+
+            return true;
+        }
+        return false;
+    }
+
+    // std::string to Quaternion
+    bool ConverterFallback<std::string, orxonox::Quaternion>::convert(orxonox::Quaternion* output, const std::string& input)
+    {
+        size_t opening_parenthesis, closing_parenthesis = input.find(')');
+        if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
+
+        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (tokens.size() >= 4)
+        {
+            if (!convertValue(&(output->w), tokens[0]))
+                return false;
+            if (!convertValue(&(output->x), tokens[1]))
+                return false;
+            if (!convertValue(&(output->y), tokens[2]))
+                return false;
+            if (!convertValue(&(output->z), tokens[3]))
+                return false;
+
+            return true;
+        }
+        return false;
+    }
+
+    // std::string to ColourValue
+    bool ConverterFallback<std::string, orxonox::ColourValue>::convert(orxonox::ColourValue* output, const std::string& input)
+    {
+        size_t opening_parenthesis, closing_parenthesis = input.find(')');
+        if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
+
+        SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
+        if (tokens.size() >= 3)
+        {
+            if (!convertValue(&(output->r), tokens[0]))
+                return false;
+            if (!convertValue(&(output->g), tokens[1]))
+                return false;
+            if (!convertValue(&(output->b), tokens[2]))
+                return false;
+            if (tokens.size() >= 4)
+            {
+                if (!convertValue(&(output->a), tokens[3]))
+                    return false;
+            }
+            else
+                output->a = 1.0;
+
+            return true;
+        }
+        return false;
+    }
+}
Index: /sandbox_light/src/libraries/util/Math.h
===================================================================
--- /sandbox_light/src/libraries/util/Math.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/Math.h	(revision 5788)
@@ -0,0 +1,270 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Declaration and implementation of several math-functions, typedefs of some Ogre::Math classes to the orxonox namespace.
+*/
+
+#ifndef _Util_Math_H__
+#define _Util_Math_H__
+
+#include "UtilPrereqs.h"
+
+#include <string>
+#include <cmath>
+
+#include <OgreMath.h>
+#include <OgreVector2.h>
+#include <OgreVector3.h>
+#include <OgreVector4.h>
+#include <OgreQuaternion.h>
+#include <OgreColourValue.h>
+
+// Certain headers might define unwanted macros...
+#undef max
+#undef min
+#undef sgn
+#undef clamp
+#undef sqrt
+#undef square
+#undef mod
+#undef rnd
+
+namespace orxonox
+{
+    _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Radian& radian);
+    _UtilExport std::istream& operator>>(std::istream& in, orxonox::Radian& radian);
+    _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Degree& degree);
+    _UtilExport std::istream& operator>>(std::istream& in, orxonox::Degree& degree);
+
+    _UtilExport float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition);
+    _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
+    _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
+    _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity);
+
+    /**
+        @brief Returns the sign of the given value.
+        @param x The value
+        @return 1 if the value is positive or zero, -1 if the value is negative
+    */
+    template <typename T>
+    inline T sgn(T x)
+    {
+        return (x >= 0) ? 1 : -1;
+    }
+
+    /**
+        @brief Keeps a value between a lower and an upper limit.
+        @param x The value
+        @param min The lower limit
+        @param max The upper limit
+    */
+    template <typename T>
+    inline T clamp(T x, T min, T max)
+    {
+        if (x < min)
+            return min;
+
+        if (x > max)
+            return max;
+
+        return x;
+    }
+
+    /**
+        @brief Returns the square value (x^2).
+    */
+    template <typename T>
+    inline T square(T x)
+    {
+        return x*x;
+    }
+
+    /**
+        @brief Returns the cube value (x^3).
+    */
+    template <typename T>
+    inline T cube(T x)
+    {
+        return x*x*x;
+    }
+
+    /**
+        @brief Rounds the value.
+    */
+    template <typename T>
+    inline int round(T x)
+    {
+        return static_cast<int>(x + 0.5);
+    }
+
+    /**
+        @brief The modulo operation, enhanced to work properly with negative values.
+        @param x The value
+        @param max The operand
+    */
+    template <typename T>
+    inline int mod(T x, int max)
+    {
+        if (x >= 0)
+            return (x % max);
+        else
+            return ((x % max) + max);
+    }
+
+    template <typename T>
+    inline T zeroise()
+    {
+        // Default, raise a compiler error without including large boost header cascade.
+        T temp();
+        *********temp; // If you reach this code, you abused zeroise()!
+        return temp;
+    }
+
+    template <> inline char                 zeroise<char>()                 { return 0; }
+    template <> inline unsigned char        zeroise<unsigned char>()        { return 0; }
+    template <> inline short                zeroise<short>()                { return 0; }
+    template <> inline unsigned short       zeroise<unsigned short>()       { return 0; }
+    template <> inline int                  zeroise<int>()                  { return 0; }
+    template <> inline unsigned int         zeroise<unsigned int>()         { return 0; }
+    template <> inline long                 zeroise<long>()                 { return 0; }
+    template <> inline unsigned long        zeroise<unsigned long>()        { return 0; }
+    template <> inline long long            zeroise<long long>()            { return 0; }
+    template <> inline unsigned long long   zeroise<unsigned long long>()   { return 0; }
+    template <> inline float                zeroise<float>()                { return 0; }
+    template <> inline double               zeroise<double>()               { return 0; }
+    template <> inline long double          zeroise<long double>()          { return 0; }
+    template <> inline bool                 zeroise<bool>()                 { return 0; }
+    template <> inline void*                zeroise<void*>()                { return 0; }
+    template <> inline std::string          zeroise<std::string>()          { return ""; }
+    template <> inline orxonox::Radian      zeroise<orxonox::Radian>()      { return orxonox::Radian(0.0f); }
+    template <> inline orxonox::Degree      zeroise<orxonox::Degree>()      { return orxonox::Degree(0.0f); }
+    template <> inline orxonox::Vector2     zeroise<orxonox::Vector2>()     { return orxonox::Vector2    (0, 0)      ; }
+    template <> inline orxonox::Vector3     zeroise<orxonox::Vector3>()     { return orxonox::Vector3    (0, 0, 0)   ; }
+    template <> inline orxonox::Vector4     zeroise<orxonox::Vector4>()     { return orxonox::Vector4    (0, 0, 0, 0); }
+    template <> inline orxonox::ColourValue zeroise<orxonox::ColourValue>() { return orxonox::ColourValue(0, 0, 0, 0); }
+    template <> inline orxonox::Quaternion  zeroise<orxonox::Quaternion>()  { return orxonox::Quaternion (0, 0, 0, 0); }
+
+    //! Provides zero value symbols that can be returned as reference
+    template <typename T>
+    struct NilValue
+    {
+        inline operator const T&() const
+        {
+            return value;
+        }
+        static T value;
+    };
+    template <typename T>
+    T NilValue<T>::value = zeroise<T>();
+
+    /**
+        @brief Interpolates between two values for a time between 0 and 1.
+        @param time The time is a value between 0 and 1 - the function returns start if time is 0 and end if time is 1 and interpolates if time is between 0 and 1.
+        @param start The value at time = 0
+        @param end The value at time = 1
+        @return The interpolation at a given time
+    */
+    template <typename T>
+    inline T interpolate(float time, const T& start, const T& end)
+    {
+        return time * (end - start) + start;
+    }
+
+    /**
+        @brief Interpolates smoothly between two values for a time between 0 and 1. The function starts slowly, increases faster and stops slowly again.
+        @param time The time is a value between 0 and 1 - the function returns start if time is 0 and end if time is 1 and interpolates if time is between 0 and 1.
+        @param start The value at time = 0
+        @param end The value at time = 1
+        @return The smoothed interpolation at a given time
+    */
+    template <typename T>
+    inline T interpolateSmooth(float time, const T& start, const T& end)
+    {
+        return (-2 * (end - start) * cube(time)) + (3 * (end - start) * square(time)) + start;
+    }
+
+    /**
+        @brief Returns a random number between 0 and almost 1: 0 <= rnd < 1.
+    */
+    inline float rnd()
+    {
+        return rand() / (RAND_MAX + 1.0f);
+    }
+
+    /**
+        @brief Returns a random number between 0 and almost max: 0 <= rnd < max.
+        @param max The maximum
+    */
+    inline float rnd(float max)
+    {
+        return rnd() * max;
+    }
+
+    /**
+        @brief Returns a random number between min and almost max: min <= rnd < max.
+        @param min The minimum
+        @param max The maximum
+    */
+    inline float rnd(float min, float max)
+    {
+        return rnd(max - min) + min;
+    }
+
+    /**
+        @brief Returns randomly 1 or -1 with equal probability.
+    */
+    inline float rndsgn()
+    {
+        return static_cast<float>((rand() & 0x2) - 1); // rand() & 0x2 is either 2 or 0
+    }
+
+    _UtilExport unsigned long getUniqueNumber();
+
+    class IntVector2
+    {
+    public:
+        IntVector2() : x(0), y(0) { }
+        IntVector2(int _x, int _y) : x(_x), y(_y) { }
+        int x;
+        int y;
+    };
+
+    class IntVector3
+    {
+    public:
+        IntVector3() : x(0), y(0), z(0) { }
+        IntVector3(int _x, int _y, int _z) : x(_x), y(_y), z(_z) { }
+        int x;
+        int y;
+        int z;
+    };
+}
+
+#endif /* _Util_Math_H__ */
Index: /sandbox_light/src/libraries/util/MathConvert.h
===================================================================
--- /sandbox_light/src/libraries/util/MathConvert.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/MathConvert.h	(revision 5788)
@@ -0,0 +1,209 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ */
+
+/**
+    @file
+    @brief
+        Math conversion functions. Definitions are in Math.cc
+*/
+
+#ifndef _MathConvert_H__
+#define _MathConvert_H__
+
+#include "UtilPrereqs.h"
+#include "Math.h"
+#include "Convert.h"
+
+namespace orxonox
+{
+    ////////////////////
+    // Math to string //
+    ////////////////////
+
+    // Vector2 to std::string
+    template <>
+    struct ConverterExplicit<orxonox::Vector2, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const orxonox::Vector2& input)
+        {
+            std::ostringstream ostream;
+            if (ostream << input.x << "," << input.y)
+            {
+                (*output) = ostream.str();
+                return true;
+            }
+            return false;
+        }
+    };
+
+    // Vector3 to std::string
+    template <>
+    struct ConverterExplicit<orxonox::Vector3, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const orxonox::Vector3& input)
+        {
+            std::ostringstream ostream;
+            if (ostream << input.x << "," << input.y << "," << input.z)
+            {
+                (*output) = ostream.str();
+                return true;
+            }
+            return false;
+        }
+    };
+
+    // Vector4 to std::string
+    template <>
+    struct ConverterExplicit<orxonox::Vector4, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const orxonox::Vector4& input)
+        {
+            std::ostringstream ostream;
+            if (ostream << input.x << "," << input.y << "," << input.z << "," << input.w)
+            {
+                (*output) = ostream.str();
+                return true;
+            }
+            return false;
+        }
+    };
+
+    // Quaternion to std::string
+    template <>
+    struct ConverterExplicit<orxonox::Quaternion, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const orxonox::Quaternion& input)
+        {
+            std::ostringstream ostream;
+            if (ostream << input.w << "," << input.x << "," << input.y << "," << input.z)
+            {
+                (*output) = ostream.str();
+                return true;
+            }
+            return false;
+        }
+    };
+
+    // ColourValue to std::string
+    template <>
+    struct ConverterExplicit<orxonox::ColourValue, std::string>
+    {
+        FORCEINLINE static bool convert(std::string* output, const orxonox::ColourValue& input)
+        {
+            std::ostringstream ostream;
+            if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a)
+            {
+                (*output) = ostream.str();
+                return true;
+            }
+            return false;
+        }
+    };
+
+
+    ////////////////////
+    // string to Math //
+    ////////////////////
+
+    // std::string to Vector2
+    template <> struct _UtilExport ConverterFallback<std::string, orxonox::Vector2>
+    { static bool convert(orxonox::Vector2*     output, const std::string& input); };
+    // std::string to Vector3
+    template <> struct _UtilExport ConverterFallback<std::string, orxonox::Vector3>
+    { static bool convert(orxonox::Vector3*     output, const std::string& input); };
+    // std::string to Vector4
+    template <> struct _UtilExport ConverterFallback<std::string, orxonox::Vector4>
+    { static bool convert(orxonox::Vector4*     output, const std::string& input); };
+    // std::string to Quaternion
+    template <> struct _UtilExport ConverterFallback<std::string, orxonox::Quaternion>
+    { static bool convert(orxonox::Quaternion*  output, const std::string& input); };
+    // std::string to ColourValue
+    template <> struct _UtilExport ConverterFallback<std::string, orxonox::ColourValue>
+    { static bool convert(orxonox::ColourValue* output, const std::string& input); };
+
+
+    ///////////////////////////////
+    // From and to Radian/Degree //
+    ///////////////////////////////
+
+    // From Radian
+    template <class ToType>
+    struct ConverterFallback<orxonox::Radian, ToType>
+    {
+        FORCEINLINE static bool convert(ToType* output, const orxonox::Radian& input)
+        {
+            return convertValue<Ogre::Real, ToType>(output, input.valueRadians());
+        }
+    };
+
+    // From Degree
+    template <class ToType>
+    struct ConverterFallback<orxonox::Degree, ToType>
+    {
+        FORCEINLINE static bool convert(ToType* output, const orxonox::Degree& input)
+        {
+            return convertValue<Ogre::Real, ToType>(output, input.valueDegrees());
+        }
+    };
+
+    // To Radian
+    template <class FromType>
+    struct ConverterFallback<FromType, orxonox::Radian>
+    {
+        FORCEINLINE static bool convert(orxonox::Radian* output, const FromType& input)
+        {
+            float temp;
+            if (convertValue(&temp, input))
+            {
+                *output = temp;
+                return true;
+            }
+            else
+                return false;
+        }
+    };
+
+    // To Degree
+    template <class FromType>
+    struct ConverterFallback<FromType, orxonox::Degree>
+    {
+        FORCEINLINE static bool convert(orxonox::Degree* output, const FromType& input)
+        {
+            float temp;
+            if (convertValue(&temp, input))
+            {
+                *output = temp;
+                return true;
+            }
+            else
+                return false;
+        }
+    };
+}
+
+#endif /* _MathConvert_H__ */
Index: /sandbox_light/src/libraries/util/MultiType.cc
===================================================================
--- /sandbox_light/src/libraries/util/MultiType.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/MultiType.cc	(revision 5788)
@@ -0,0 +1,208 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the MultiType.
+*/
+
+#include "MultiType.h"
+#include "MultiTypeValue.h"
+
+namespace orxonox
+{
+    /**
+        @brief Converts the current value of the MultiType to a new type.
+        @param type The type
+    */
+    bool MultiType::convert(MT_Type::Value type)
+    {
+        switch (type)
+        {
+            case MT_Type::Null:
+                this->reset(); return true;
+            case MT_Type::Char:
+                return this->convert<char>(); break;
+            case MT_Type::UnsignedChar:
+                return this->convert<unsigned char>(); break;
+            case MT_Type::Short:
+                return this->convert<short>(); break;
+            case MT_Type::UnsignedShort:
+                return this->convert<unsigned short>(); break;
+            case MT_Type::Int:
+                return this->convert<int>(); break;
+            case MT_Type::UnsignedInt:
+                return this->convert<unsigned int>(); break;
+            case MT_Type::Long:
+                return this->convert<long>(); break;
+            case MT_Type::UnsignedLong:
+                return this->convert<unsigned long>(); break;
+            case MT_Type::LongLong:
+                return this->convert<long long>(); break;
+            case MT_Type::UnsignedLongLong:
+                return this->convert<unsigned long long>(); break;
+            case MT_Type::Float:
+                return this->convert<float>(); break;
+            case MT_Type::Double:
+                return this->convert<double>(); break;
+            case MT_Type::LongDouble:
+                return this->convert<long double>(); break;
+            case MT_Type::Bool:
+                return this->convert<bool>(); break;
+            case MT_Type::VoidPointer:
+                return this->convert<void*>(); break;
+            case MT_Type::String:
+                return this->convert<std::string>(); break;
+            case MT_Type::Vector2:
+                return this->convert<orxonox::Vector2>(); break;
+            case MT_Type::Vector3:
+                return this->convert<orxonox::Vector3>(); break;
+            case MT_Type::Vector4:
+                return this->convert<orxonox::Vector4>(); break;
+            case MT_Type::ColourValue:
+                return this->convert<orxonox::ColourValue>(); break;
+            case MT_Type::Quaternion:
+                return this->convert<orxonox::Quaternion>(); break;
+            case MT_Type::Radian:
+                return this->convert<orxonox::Radian>(); break;
+            case MT_Type::Degree:
+                return this->convert<orxonox::Degree>(); break;
+            default:
+                this->reset(); return false; break;
+        };
+    }
+
+    /**
+        @brief Returns the name of the current type.
+        @return The name
+    */
+    std::string MultiType::getTypename() const
+    {
+        MT_Type::Value type = (this->value_) ? this->value_->type_ : MT_Type::Null;
+
+        switch (type)
+        {
+            case MT_Type::Char:
+                return "char"; break;
+            case MT_Type::UnsignedChar:
+                return "unsigned char"; break;
+            case MT_Type::Short:
+                return "short"; break;
+            case MT_Type::UnsignedShort:
+                return "unsigned short"; break;
+            case MT_Type::Int:
+                return "int"; break;
+            case MT_Type::UnsignedInt:
+                return "unsigned int"; break;
+            case MT_Type::Long:
+                return "long"; break;
+            case MT_Type::UnsignedLong:
+                return "unsigned long"; break;
+            case MT_Type::LongLong:
+                return "long long"; break;
+            case MT_Type::UnsignedLongLong:
+                return "unsigned long long"; break;
+            case MT_Type::Float:
+                return "float"; break;
+            case MT_Type::Double:
+                return "double"; break;
+            case MT_Type::LongDouble:
+                return "long double"; break;
+            case MT_Type::Bool:
+                return "bool"; break;
+            case MT_Type::VoidPointer:
+                return "void*"; break;
+            case MT_Type::String:
+                return "std::string"; break;
+            case MT_Type::Vector2:
+                return "orxonox::Vector2"; break;
+            case MT_Type::Vector3:
+                return "orxonox::Vector3"; break;
+            case MT_Type::Vector4:
+                return "orxonox::Vector4"; break;
+            case MT_Type::ColourValue:
+                return "orxonox::ColourValue"; break;
+            case MT_Type::Quaternion:
+                return "orxonox::Quaternion"; break;
+            case MT_Type::Radian:
+                return "orxonox::Radian"; break;
+            case MT_Type::Degree:
+                return "orxonox::Degree"; break;
+            default:
+                return "unknown"; break;
+        };
+    }
+
+    MultiType::operator char()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Char            ) ? (static_cast<MT_Value<char>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned char()        const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedChar    ) ? (static_cast<MT_Value<unsigned char>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator short()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::Short           ) ? (static_cast<MT_Value<short>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned short()       const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedShort   ) ? (static_cast<MT_Value<unsigned short>      *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator int()                  const { return (this->value_) ? ((this->value_->type_ == MT_Type::Int             ) ? (static_cast<MT_Value<int>                 *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned int()         const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedInt     ) ? (static_cast<MT_Value<unsigned int>        *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator long()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Long            ) ? (static_cast<MT_Value<long>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned long()        const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedLong    ) ? (static_cast<MT_Value<unsigned long>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator long long()            const { return (this->value_) ? ((this->value_->type_ == MT_Type::LongLong        ) ? (static_cast<MT_Value<long long>           *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned long long()   const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedLongLong) ? (static_cast<MT_Value<unsigned long long>  *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator float()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::Float           ) ? (static_cast<MT_Value<float>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator double()               const { return (this->value_) ? ((this->value_->type_ == MT_Type::Double          ) ? (static_cast<MT_Value<double>              *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator long double()          const { return (this->value_) ? ((this->value_->type_ == MT_Type::LongDouble      ) ? (static_cast<MT_Value<long double>         *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator bool()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Bool            ) ? (static_cast<MT_Value<bool>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator void*()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::VoidPointer     ) ? (static_cast<MT_Value<void*>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator std::string()          const { return (this->value_) ? ((this->value_->type_ == MT_Type::String          ) ? (static_cast<MT_Value<std::string>         *>(this->value_))->value_ : (*this->value_)) : NilValue<std::string>();          } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Vector2()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector2         ) ? (static_cast<MT_Value<orxonox::Vector2>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector2>();     } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Vector3()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector3         ) ? (static_cast<MT_Value<orxonox::Vector3>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector3>();     } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Vector4()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector4         ) ? (static_cast<MT_Value<orxonox::Vector4>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector4>();     } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_Type::ColourValue     ) ? (static_cast<MT_Value<orxonox::ColourValue>*>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::ColourValue>(); } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Quaternion()  const { return (this->value_) ? ((this->value_->type_ == MT_Type::Quaternion      ) ? (static_cast<MT_Value<orxonox::Quaternion> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Quaternion>();  } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Radian()      const { return (this->value_) ? ((this->value_->type_ == MT_Type::Radian          ) ? (static_cast<MT_Value<orxonox::Radian>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Radian>();      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Degree()      const { return (this->value_) ? ((this->value_->type_ == MT_Type::Degree          ) ? (static_cast<MT_Value<orxonox::Degree>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Degree>();      } /** @brief Returns the current value, converted to the requested type. */
+
+    template <> void MultiType::createNewValueContainer(const char& value)                 { this->value_ = new MT_Value<char>                (value, MT_Type::Char            ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned char& value)        { this->value_ = new MT_Value<unsigned char>       (value, MT_Type::UnsignedChar    ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const short& value)                { this->value_ = new MT_Value<short>               (value, MT_Type::Short           ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned short& value)       { this->value_ = new MT_Value<unsigned short>      (value, MT_Type::UnsignedShort   ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const int& value)                  { this->value_ = new MT_Value<int>                 (value, MT_Type::Int             ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned int& value)         { this->value_ = new MT_Value<unsigned int>        (value, MT_Type::UnsignedInt     ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const long& value)                 { this->value_ = new MT_Value<long>                (value, MT_Type::Long            ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned long& value)        { this->value_ = new MT_Value<unsigned long>       (value, MT_Type::UnsignedLong    ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const long long& value)            { this->value_ = new MT_Value<long long>           (value, MT_Type::LongLong        ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned long long& value)   { this->value_ = new MT_Value<unsigned long long>  (value, MT_Type::UnsignedLongLong); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const float& value)                { this->value_ = new MT_Value<float>               (value, MT_Type::Float           ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const double& value)               { this->value_ = new MT_Value<double>              (value, MT_Type::Double          ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const long double& value)          { this->value_ = new MT_Value<long double>         (value, MT_Type::LongDouble      ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const bool& value)                 { this->value_ = new MT_Value<bool>                (value, MT_Type::Bool            ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(      void* const& value)          { this->value_ = new MT_Value<void*>               (value, MT_Type::VoidPointer     ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const std::string& value)          { this->value_ = new MT_Value<std::string>         (value, MT_Type::String          ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector2& value)     { this->value_ = new MT_Value<orxonox::Vector2>    (value, MT_Type::Vector2         ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector3& value)     { this->value_ = new MT_Value<orxonox::Vector3>    (value, MT_Type::Vector3         ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector4& value)     { this->value_ = new MT_Value<orxonox::Vector4>    (value, MT_Type::Vector4         ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::ColourValue& value) { this->value_ = new MT_Value<orxonox::ColourValue>(value, MT_Type::ColourValue     ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Quaternion& value)  { this->value_ = new MT_Value<orxonox::Quaternion> (value, MT_Type::Quaternion      ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Radian& value)      { this->value_ = new MT_Value<orxonox::Radian>     (value, MT_Type::Radian          ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Degree& value)      { this->value_ = new MT_Value<orxonox::Degree>     (value, MT_Type::Degree          ); } /** @brief Creates a new value container for the given type. */
+}
Index: /sandbox_light/src/libraries/util/MultiType.h
===================================================================
--- /sandbox_light/src/libraries/util/MultiType.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/MultiType.h	(revision 5788)
@@ -0,0 +1,561 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Declaration of the MultiType and some helper constructs.
+
+    The MultiType can hold a value of one of the following types:
+     - all primitives
+     - all pointers
+     - string
+     - Vector2, Vector3, Vector4
+     - Quaternion
+     - ColourValue
+     - Radian, Degree
+
+    The MultiType has a "type" determined by the first assigned value, either through
+     - the constructor,
+     - the assignment operator= or
+     - setValue(value).
+    If you assign another value of another type, the MultiType keeps "it's" type and
+    converts the new value to this type.
+
+    If you want to change the type, there are three possibilities:
+     - convert<T>() set's the type to T and converts the currently assigned value
+     - setType<T>() set's the type to T and resets the value
+     - setValue<T>(value) assigns a new value and changes the type to T.
+
+    @example
+    MultiType a = 10;;         // a has now the type int and the value 10
+    a.setValue("3.14");        // a has still the type int and "3.14" gets converted, therefore the value is now 3
+    a.setValue<float>("3.14"); // a has now the type float and "3.14" gets converted to 3.14
+    a.convert<bool>();         // converts 3.14 to bool, which is true
+    a = false;                 // assigns false, this is equivalent to a.setValue(false)
+
+    @note
+    Whenever a value gets converted, there is a boolean return value telling you whether it was
+    successful or not. If it wasn't a zero value is assigned with the help of zeroise<T>().
+*/
+
+#ifndef _MultiType_H__
+#define _MultiType_H__
+
+#include "UtilPrereqs.h"
+
+#include <cassert>
+#include <string>
+#include <OgreVector2.h>
+#include <OgreVector3.h>
+#include <OgreVector4.h>
+#include <OgreQuaternion.h>
+#include <OgreColourValue.h>
+
+#include "TypeTraits.h"
+
+namespace orxonox
+{
+    /**
+        @brief Enum of all possible types of a MultiType.
+    */
+    namespace MT_Type
+    {
+        enum Value
+        {
+            Null,
+            Char,
+            UnsignedChar,
+            Short,
+            UnsignedShort,
+            Int,
+            UnsignedInt,
+            Long,
+            UnsignedLong,
+            LongLong,
+            UnsignedLongLong,
+            Float,
+            Double,
+            LongDouble,
+            Bool,
+            VoidPointer,
+            String,
+            Vector2,
+            Vector3,
+            Vector4,
+            ColourValue,
+            Quaternion,
+            Radian,
+            Degree
+        };
+    }
+
+    /**
+        @brief The MultiType can hold a value of many possible types and convert them to other types.
+
+        The following types are supported by the MultiType:
+         - all primitves
+         - all pointers
+         - string
+         - Vector2, Vector3, Vector4
+         - Quaternion
+         - ColourValue
+         - Radian, Degree
+
+        The internal type of a MultiType is determined by the first assigned value, but can be
+        changed by using setType<T>(), convert<T>() or setValue<T>(value). If a value gets assigned
+        the normal way (operator=, setValue(value)), the value gets converted to the current internal
+        type of the MultiType.
+    */
+    class _UtilExport MultiType
+    {
+        _UtilExport friend std::ostream& operator<<(std::ostream& outstream, const MultiType& mt);
+        template <typename T> friend class MT_Value;
+
+    public:
+        /**
+            @brief MT_ValueBase is an almost pure virtual baseclass of MT_Value<T>, which holds the value of the MultiType.
+            This class is only used within the MultiType.
+        */
+        class _UtilExport MT_ValueBase
+        {
+        public:
+            MT_ValueBase(MT_Type::Value type) : type_(type), bHasDefaultValue_(false) {}
+            virtual ~MT_ValueBase() {}
+
+            virtual MT_ValueBase* clone() const = 0;
+
+            virtual void reset() = 0;
+            virtual bool assimilate(const MultiType& other) = 0;
+
+            /** @brief Returns the type of the current value. */
+            const MT_Type::Value& getType() const { return this->type_; }
+
+            /** @brief Checks whether the value is a default one. */
+            bool hasDefaultValue()   const { return this->bHasDefaultValue_; }
+
+            virtual bool setValue(const char& value)                 = 0;
+            virtual bool setValue(const unsigned char& value)        = 0;
+            virtual bool setValue(const short& value)                = 0;
+            virtual bool setValue(const unsigned short& value)       = 0;
+            virtual bool setValue(const int& value)                  = 0;
+            virtual bool setValue(const unsigned int& value)         = 0;
+            virtual bool setValue(const long& value)                 = 0;
+            virtual bool setValue(const unsigned long& value)        = 0;
+            virtual bool setValue(const long long& value)            = 0;
+            virtual bool setValue(const unsigned long long& value)   = 0;
+            virtual bool setValue(const float& value)                = 0;
+            virtual bool setValue(const double& value)               = 0;
+            virtual bool setValue(const long double& value)          = 0;
+            virtual bool setValue(const bool& value)                 = 0;
+            virtual bool setValue(      void* const& value)          = 0;
+            virtual bool setValue(const std::string& value)          = 0;
+            virtual bool setValue(const orxonox::Vector2& value)     = 0;
+            virtual bool setValue(const orxonox::Vector3& value)     = 0;
+            virtual bool setValue(const orxonox::Vector4& value)     = 0;
+            virtual bool setValue(const orxonox::ColourValue& value) = 0;
+            virtual bool setValue(const orxonox::Quaternion& value)  = 0;
+            virtual bool setValue(const orxonox::Radian& value)      = 0;
+            virtual bool setValue(const orxonox::Degree& value)      = 0;
+
+            virtual bool getValue(char*                 value) const = 0;
+            virtual bool getValue(unsigned char*        value) const = 0;
+            virtual bool getValue(short*                value) const = 0;
+            virtual bool getValue(unsigned short*       value) const = 0;
+            virtual bool getValue(int*                  value) const = 0;
+            virtual bool getValue(unsigned int*         value) const = 0;
+            virtual bool getValue(long*                 value) const = 0;
+            virtual bool getValue(unsigned long*        value) const = 0;
+            virtual bool getValue(long long*            value) const = 0;
+            virtual bool getValue(unsigned long long*   value) const = 0;
+            virtual bool getValue(float*                value) const = 0;
+            virtual bool getValue(double*               value) const = 0;
+            virtual bool getValue(long double*          value) const = 0;
+            virtual bool getValue(bool*                 value) const = 0;
+            virtual bool getValue(void**                value) const = 0;
+            virtual bool getValue(std::string*          value) const = 0;
+            virtual bool getValue(orxonox::Vector2*     value) const = 0;
+            virtual bool getValue(orxonox::Vector3*     value) const = 0;
+            virtual bool getValue(orxonox::Vector4*     value) const = 0;
+            virtual bool getValue(orxonox::ColourValue* value) const = 0;
+            virtual bool getValue(orxonox::Quaternion*  value) const = 0;
+            virtual bool getValue(orxonox::Radian*      value) const = 0;
+            virtual bool getValue(orxonox::Degree*      value) const = 0;
+
+            virtual operator char()                 const = 0;
+            virtual operator unsigned char()        const = 0;
+            virtual operator short()                const = 0;
+            virtual operator unsigned short()       const = 0;
+            virtual operator int()                  const = 0;
+            virtual operator unsigned int()         const = 0;
+            virtual operator long()                 const = 0;
+            virtual operator unsigned long()        const = 0;
+            virtual operator long long()            const = 0;
+            virtual operator unsigned long long()   const = 0;
+            virtual operator float()                const = 0;
+            virtual operator double()               const = 0;
+            virtual operator long double()          const = 0;
+            virtual operator bool()                 const = 0;
+            virtual operator void*()                const = 0;
+            virtual operator std::string()          const = 0;
+            virtual operator orxonox::Vector2()     const = 0;
+            virtual operator orxonox::Vector3()     const = 0;
+            virtual operator orxonox::Vector4()     const = 0;
+            virtual operator orxonox::ColourValue() const = 0;
+            virtual operator orxonox::Quaternion()  const = 0;
+            virtual operator orxonox::Radian()      const = 0;
+            virtual operator orxonox::Degree()      const = 0;
+
+            virtual void toString(std::ostream& outstream) const = 0;
+            
+            virtual void importData( uint8_t*& mem )=0;
+            virtual void exportData( uint8_t*& mem ) const=0;
+            virtual uint8_t getSize() const=0;
+
+            MT_Type::Value type_;   //!< The type of the current value
+            bool bHasDefaultValue_; //!< True if the last conversion wasn't successful
+        };
+
+        public:
+            inline MultiType()                                  : value_(0) {}                                      /** @brief Default constructor: Assigns no value and no type. The type will be determined by the first assignment of a value. */
+            inline MultiType(const char& value)                 : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const unsigned char& value)        : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const short& value)                : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const unsigned short& value)       : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const int& value)                  : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const unsigned int& value)         : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const long& value)                 : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const unsigned long& value)        : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const long long& value)            : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const unsigned long long& value)   : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const float& value)                : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const double& value)               : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const long double& value)          : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const bool& value)                 : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(      void* const& value)          : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const std::string& value)          : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Vector2& value)     : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Vector3& value)     : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Vector4& value)     : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::ColourValue& value) : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Quaternion& value)  : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Radian& value)      : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const orxonox::Degree& value)      : value_(0) { this->assignValue(value); }           /** @brief Constructor: Assigns the given value and sets the type. */
+            inline MultiType(const char* value)                 : value_(0) { this->setValue(std::string(value)); } /** @brief Constructor: Converts the char array to a std::string, assigns the value and sets the type. */
+            inline MultiType(const MultiType& other)            : value_(0) { this->setValue(other); }              /** @brief Copyconstructor: Assigns value and type of the other MultiType. */
+            inline MultiType(MT_Type::Value type)               : value_(0) { this->setType(type); }                /** @brief Constructor: Sets the type, the next assignment will determine the value. */
+
+            /** @brief Destructor: Deletes the MT_Value. */
+            inline ~MultiType() { if (this->value_) { delete this->value_; } }
+
+            template <typename V> inline const MultiType& operator=(const V& value)         { this->setValue(value); return (*this); } /** @brief Assigns a new value. The value will be converted to the current type of the MultiType. */
+            template <typename V> inline const MultiType& operator=(V* value)               { this->setValue(value); return (*this); } /** @brief Assigns a pointer. */
+            inline                       const MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } /** @brief Assigns the value of the other MultiType and converts it to the current type of the MultiType. */
+            inline                       const MultiType& operator=(MT_Type::Value type)    { this->setType(type);   return (*this); } /** @brief Resets the value and changes the type. */
+
+            inline bool                                   setValue(const char& value);
+            inline bool                                   setValue(const unsigned char& value);
+            inline bool                                   setValue(const short& value);
+            inline bool                                   setValue(const unsigned short& value);
+            inline bool                                   setValue(const int& value);
+            inline bool                                   setValue(const unsigned int& value);
+            inline bool                                   setValue(const long& value);
+            inline bool                                   setValue(const unsigned long& value);
+            inline bool                                   setValue(const long long& value);
+            inline bool                                   setValue(const unsigned long long& value);
+            inline bool                                   setValue(const float& value);
+            inline bool                                   setValue(const double& value);
+            inline bool                                   setValue(const long double& value);
+            inline bool                                   setValue(const bool& value);
+            inline bool                                   setValue(      void* const& value);
+            inline bool                                   setValue(const std::string& value);
+            inline bool                                   setValue(const orxonox::Vector2& value);
+            inline bool                                   setValue(const orxonox::Vector3& value);
+            inline bool                                   setValue(const orxonox::Vector4& value);
+            inline bool                                   setValue(const orxonox::ColourValue& value);
+            inline bool                                   setValue(const orxonox::Quaternion& value);
+            inline bool                                   setValue(const orxonox::Radian& value);
+            inline bool                                   setValue(const orxonox::Degree& value);
+            inline bool                                   setValue(const char* value);
+            /** @brief Assigns a pointer. */
+            template <typename V> inline bool setValue(V* value)
+            {
+                if (this->value_)
+                    return this->value_->setValue(static_cast<void*>(const_cast<typename Loki::TypeTraits<V>::UnqualifiedType*>(value)));
+                else
+                    return this->assignValue     (static_cast<void*>(const_cast<typename Loki::TypeTraits<V>::UnqualifiedType*>(value)));
+            }
+            /** @brief Assigns the value of the other MultiType and converts it to the current type. */
+            bool                                          setValue(const MultiType& other) { if (this->value_) { return this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } return true; } }
+            /** @brief Changes the type to T and assigns the new value (which might be of another type than T - it gets converted). */
+            template <typename T, typename V> inline bool setValue(const V& value) { this->setType<T>(); return this->setValue(value); }
+
+
+            /** @brief Copies the other MultiType by assigning value and type. */
+            inline void                       copy(const MultiType& other)    { if (this == &other) { return; } if (this->value_) { delete this->value_; } this->value_ = (other.value_) ? other.value_->clone() : 0; }
+
+            template <typename T> inline bool convert()                       { return this->setValue<T>((T)(*this));  } /** @brief Converts the current value to type T. */
+            inline bool                       convert(const MultiType& other) { return this->convert(other.getType()); } /** @brief Converts the current value to the type of the other MultiType. */
+            bool                              convert(MT_Type::Value type);
+
+            /** @brief Current content gets deleted. New type is MT_Type::Null */
+            inline void                       reset()                         { if (this->value_) delete this->value_; this->value_ = 0; }
+            /** @brief Current content gets overridden with default zero value */
+            inline void                       resetValue()                    { if (this->value_) this->value_->reset(); }
+
+            template <typename T> inline void setType()                       { this->assignValue(typename Loki::TypeTraits<T>::UnqualifiedReferredType()); } /** @brief Resets the value and changes the internal type to T. */
+            inline void                       setType(const MultiType& other) { this->setType(other.getType());                                             } /** @brief Resets the value and changes the internal type to the type of the other MultiType. */
+            inline void                       setType(MT_Type::Value type)    { this->reset(); this->convert(type); this->resetValue();                     } /** @brief Resets the value and changes the internal type to the given type. */
+
+            /** @brief Returns the current type. */
+            inline MT_Type::Value             getType()                   const { return (this->value_) ? this->value_->type_ : MT_Type::Null; }
+            /** @brief Returns true if the current type equals the given type. */
+            inline bool                       isType(MT_Type::Value type) const { return (this->value_) ? (this->value_->type_ == type) : (type == MT_Type::Null); }
+            /** @brief Returns true if the current type is T. */
+            template <typename T> inline bool isType()                    const { return false; } // Only works for specialized values - see below
+            std::string                       getTypename()               const;
+            
+            /** @brief Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT */
+            inline void                       exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *static_cast<uint8_t*>(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }
+            /** @brief Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT */
+            inline void                       importData(uint8_t*& mem) { assert(sizeof(MT_Type::Value)<=8); this->setType(static_cast<MT_Type::Value>(*static_cast<uint8_t*>(mem))); mem+=sizeof(uint8_t); this->value_->importData(mem); }
+            /** @brief Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT */
+            inline uint8_t*&                  operator << (uint8_t*& mem) { importData(mem); return mem; }
+            /** @brief Loads the value of the MT to a bytestream and increases pointer to bytestream by size of MT */
+            inline void                       operator >> (uint8_t*& mem) const { exportData(mem); }
+            inline uint32_t                   getNetworkSize() const { assert(this->value_); return this->value_->getSize() + sizeof(uint8_t); }
+
+            /** @brief Checks whether the value is a default one. */
+            bool                              hasDefaultValue()         const { return this->value_->hasDefaultValue(); }
+
+            operator char()                  const;
+            operator unsigned char()         const;
+            operator short()                 const;
+            operator unsigned short()        const;
+            operator int()                   const;
+            operator unsigned int()          const;
+            operator long()                  const;
+            operator unsigned long()         const;
+            operator long long()             const;
+            operator unsigned long long()    const;
+            operator float()                 const;
+            operator double()                const;
+            operator long double()           const;
+            operator bool()                  const;
+            operator void*()                 const;
+            operator std::string()           const;
+            operator orxonox::Vector2()      const;
+            operator orxonox::Vector3()      const;
+            operator orxonox::Vector4()      const;
+            operator orxonox::ColourValue()  const;
+            operator orxonox::Quaternion()   const;
+            operator orxonox::Radian()       const;
+            operator orxonox::Degree()       const;
+            /** @brief Returns the current value, converted to a T* pointer. */
+            template <class T> operator T*() const { return (static_cast<T*>(this->operator void*())); }
+
+            inline bool getValue(char*                 value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(unsigned char*        value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(short*                value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(unsigned short*       value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(int*                  value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(unsigned int*         value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(long*                 value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(unsigned long*        value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(long long*            value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(unsigned long long*   value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(float*                value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(double*               value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(long double*          value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(bool*                 value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(void**                value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(std::string*          value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Vector2*     value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Vector3*     value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Vector4*     value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::ColourValue* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Quaternion*  value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Radian*      value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+            inline bool getValue(orxonox::Degree*      value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+
+            inline char                     getChar()             const { return this->operator char();                 } /** @brief Returns the current value, converted to the requested type. */
+            inline unsigned char            getUnsignedChar()     const { return this->operator unsigned char();        } /** @brief Returns the current value, converted to the requested type. */
+            inline short                    getShort()            const { return this->operator short();                } /** @brief Returns the current value, converted to the requested type. */
+            inline unsigned short           getUnsignedShort()    const { return this->operator unsigned short();       } /** @brief Returns the current value, converted to the requested type. */
+            inline int                      getInt()              const { return this->operator int();                  } /** @brief Returns the current value, converted to the requested type. */
+            inline unsigned int             getUnsignedInt()      const { return this->operator unsigned int();         } /** @brief Returns the current value, converted to the requested type. */
+            inline long                     getLong()             const { return this->operator long();                 } /** @brief Returns the current value, converted to the requested type. */
+            inline unsigned long            getUnsignedLong()     const { return this->operator unsigned long();        } /** @brief Returns the current value, converted to the requested type. */
+            inline long long                getLongLong()         const { return this->operator long long();            } /** @brief Returns the current value, converted to the requested type. */
+            inline unsigned long long       getUnsignedLongLong() const { return this->operator unsigned long long();   } /** @brief Returns the current value, converted to the requested type. */
+            inline float                    getFloat()            const { return this->operator float();                } /** @brief Returns the current value, converted to the requested type. */
+            inline double                   getDouble()           const { return this->operator double();               } /** @brief Returns the current value, converted to the requested type. */
+            inline long double              getLongDouble()       const { return this->operator long double();          } /** @brief Returns the current value, converted to the requested type. */
+            inline bool                     getBool()             const { return this->operator bool();                 } /** @brief Returns the current value, converted to the requested type. */
+            inline void*                    getVoid()             const { return this->operator void*();                } /** @brief Returns the current value, converted to the requested type. */
+            inline std::string              getString()           const { return this->operator std::string();          } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Vector2         getVector2()          const { return this->operator orxonox::Vector2();     } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Vector3         getVector3()          const { return this->operator orxonox::Vector3();     } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Vector4         getVector4()          const { return this->operator orxonox::Vector4();     } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::ColourValue     getColourValue()      const { return this->operator orxonox::ColourValue(); } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Quaternion      getQuaternion()       const { return this->operator orxonox::Quaternion();  } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Radian          getRadian()           const { return this->operator orxonox::Radian();      } /** @brief Returns the current value, converted to the requested type. */
+            inline orxonox::Degree          getDegree()           const { return this->operator orxonox::Degree();      } /** @brief Returns the current value, converted to the requested type. */
+            template <typename T> inline T* getPointer()          const { return static_cast<T*>(this->getVoid());      } /** @brief Returns the current value, converted to a T* pointer. */
+
+        private:
+            inline bool assignValue(const char& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Char)             { return this->value_->setValue(value); } else { this->changeValueContainer<char>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned char& value)        { if (this->value_ && this->value_->type_ == MT_Type::UnsignedChar)     { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);        return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const short& value)                { if (this->value_ && this->value_->type_ == MT_Type::Short)            { return this->value_->setValue(value); } else { this->changeValueContainer<short>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned short& value)       { if (this->value_ && this->value_->type_ == MT_Type::UnsignedShort)    { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);       return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const int& value)                  { if (this->value_ && this->value_->type_ == MT_Type::Int)              { return this->value_->setValue(value); } else { this->changeValueContainer<int>(value);                  return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned int& value)         { if (this->value_ && this->value_->type_ == MT_Type::UnsignedInt)      { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);         return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const long& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Long)             { return this->value_->setValue(value); } else { this->changeValueContainer<long>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned long& value)        { if (this->value_ && this->value_->type_ == MT_Type::UnsignedLong)     { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);        return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const long long& value)            { if (this->value_ && this->value_->type_ == MT_Type::LongLong)         { return this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);            return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned long long& value)   { if (this->value_ && this->value_->type_ == MT_Type::UnsignedLongLong) { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);   return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const float& value)                { if (this->value_ && this->value_->type_ == MT_Type::Float)            { return this->value_->setValue(value); } else { this->changeValueContainer<float>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const double& value)               { if (this->value_ && this->value_->type_ == MT_Type::Double)           { return this->value_->setValue(value); } else { this->changeValueContainer<double>(value);               return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const long double& value)          { if (this->value_ && this->value_->type_ == MT_Type::LongDouble)       { return this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);          return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const bool& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Bool)             { return this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(      void* const& value)          { if (this->value_ && this->value_->type_ == MT_Type::VoidPointer)      { return this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const std::string& value)          { if (this->value_ && this->value_->type_ == MT_Type::String)           { return this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);          return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Vector2& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector2)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Vector3& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector3)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Vector4& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector4)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_Type::ColourValue)      { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Quaternion& value)  { if (this->value_ && this->value_->type_ == MT_Type::Quaternion)       { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);  return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Radian& value)      { if (this->value_ && this->value_->type_ == MT_Type::Radian)           { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);      return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Degree& value)      { if (this->value_ && this->value_->type_ == MT_Type::Degree)           { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);      return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+
+            /** @brief Changes the value container. */
+            template <typename T> inline void changeValueContainer(const T& value) { if (this->value_) { delete this->value_; } this->createNewValueContainer<T>(value); }
+            /** @brief Creates a new value container (works only with specialized types). */
+            template <typename T>        void createNewValueContainer(const T& value) { /* STATIC ASSERT */ *****value; return false; }
+
+            MT_ValueBase* value_; //!< A pointer to the value container
+    };
+
+    /** @brief Puts the MultiType on a stream by using the native << operator of the current type. */
+    _UtilExport inline std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; }
+
+    template <> inline bool MultiType::isType<char>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Char);             } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned char>()        const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedChar);     } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<short>()                const { return (this->value_ && this->value_->type_ == MT_Type::Short);            } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned short>()       const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedShort);    } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<int>()                  const { return (this->value_ && this->value_->type_ == MT_Type::Int);              } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned int>()         const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedInt);      } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<long>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Long);             } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned long>()        const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedLong);     } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<long long>()            const { return (this->value_ && this->value_->type_ == MT_Type::LongLong);         } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned long long>()   const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedLongLong); } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<float>()                const { return (this->value_ && this->value_->type_ == MT_Type::Float);            } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<double>()               const { return (this->value_ && this->value_->type_ == MT_Type::Double);           } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<long double>()          const { return (this->value_ && this->value_->type_ == MT_Type::LongDouble);       } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<bool>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Bool);             } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<void*>()                const { return (this->value_ && this->value_->type_ == MT_Type::VoidPointer);      } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<std::string>()          const { return (this->value_ && this->value_->type_ == MT_Type::String);           } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Vector2>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector2);          } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Vector3>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector3);          } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Vector4>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector4);          } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->value_ && this->value_->type_ == MT_Type::ColourValue);      } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Quaternion>()  const { return (this->value_ && this->value_->type_ == MT_Type::Quaternion);       } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Radian>()      const { return (this->value_ && this->value_->type_ == MT_Type::Radian);           } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Degree>()      const { return (this->value_ && this->value_->type_ == MT_Type::Degree);           } /** @brief Returns true if the current type equals the given type. */
+
+    // Specialization to avoid ambiguities with the conversion operator
+    template <> inline bool MultiType::convert<std::string>()          { return this->setValue<std::string>         (this->operator std::string());          } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Vector2>()     { return this->setValue<orxonox::Vector2>    (this->operator orxonox::Vector2());     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Vector3>()     { return this->setValue<orxonox::Vector3>    (this->operator orxonox::Vector3());     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Vector4>()     { return this->setValue<orxonox::Vector4>    (this->operator orxonox::Vector4());     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::ColourValue>() { return this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Quaternion>()  { return this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion());  } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Radian>()      { return this->setValue<orxonox::Radian>     (this->operator orxonox::Radian());      } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<orxonox::Degree>()      { return this->setValue<orxonox::Degree>     (this->operator orxonox::Degree());      } /** @brief Converts the current value to the given type. */
+
+    // Specialization to avoid ambiguities with the conversion operator
+    template <> inline bool MultiType::convert<const std::string&>()          { return this->convert<std::string>();          } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Vector2&>()     { return this->convert<orxonox::Vector2>();     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Vector3&>()     { return this->convert<orxonox::Vector3>();     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Vector4&>()     { return this->convert<orxonox::Vector4>();     } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::ColourValue&>() { return this->convert<orxonox::ColourValue>(); } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Quaternion&>()  { return this->convert<orxonox::Quaternion>();  } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Radian&>()      { return this->convert<orxonox::Radian>();      } /** @brief Converts the current value to the given type. */
+    template <> inline bool MultiType::convert<const orxonox::Degree&>()      { return this->convert<orxonox::Degree>();      } /** @brief Converts the current value to the given type. */
+
+    template <> void MultiType::createNewValueContainer(const char& value);
+    template <> void MultiType::createNewValueContainer(const unsigned char& value);
+    template <> void MultiType::createNewValueContainer(const short& value);
+    template <> void MultiType::createNewValueContainer(const unsigned short& value);
+    template <> void MultiType::createNewValueContainer(const int& value);
+    template <> void MultiType::createNewValueContainer(const unsigned int& value);
+    template <> void MultiType::createNewValueContainer(const long& value);
+    template <> void MultiType::createNewValueContainer(const unsigned long& value);
+    template <> void MultiType::createNewValueContainer(const long long& value);
+    template <> void MultiType::createNewValueContainer(const unsigned long long& value);
+    template <> void MultiType::createNewValueContainer(const float& value);
+    template <> void MultiType::createNewValueContainer(const double& value);
+    template <> void MultiType::createNewValueContainer(const bool& value);
+    template <> void MultiType::createNewValueContainer(const long double& value);
+    template <> void MultiType::createNewValueContainer(      void* const& value);
+    template <> void MultiType::createNewValueContainer(const std::string& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector2& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector3& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector4& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::ColourValue& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Quaternion& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Radian& value);
+    template <> void MultiType::createNewValueContainer(const orxonox::Degree& value);
+
+    inline bool MultiType::setValue(const char& value)                  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const unsigned char& value)         { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const short& value)                 { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const unsigned short& value)        { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const int& value)                   { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const unsigned int& value)          { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const long& value)                  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const unsigned long& value)         { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const long long& value)             { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const unsigned long long& value)    { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const float& value)                 { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const double& value)                { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const long double& value)           { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const bool& value)                  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(      void* const& value)           { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const std::string& value)           { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Vector2& value)      { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Vector3& value)      { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Vector4& value)      { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::ColourValue& value)  { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Quaternion& value)   { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Radian& value)       { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+    inline bool MultiType::setValue(const orxonox::Degree& value)       { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } /** @brief Assigns the given value and converts it to the current type. */
+
+    inline bool MultiType::setValue(const char* value)                  { if (this->value_) { return this->value_->setValue(std::string(value)); } else { return this->assignValue(std::string(value)); } }  /** @brief Assigns the given value and converts it to the current type. */
+}
+
+#endif /* _MultiType_H__ */
Index: /sandbox_light/src/libraries/util/MultiTypeValue.h
===================================================================
--- /sandbox_light/src/libraries/util/MultiTypeValue.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/MultiTypeValue.h	(revision 5788)
@@ -0,0 +1,267 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Declaration and Implementation of the MT_Value<T> class.
+
+    The MT_Value<T> class is used to hold a value of type T within a MultiType.
+*/
+
+#ifndef _MultiTypeValue_H__
+#define _MultiTypeValue_H__
+
+#include "UtilPrereqs.h"
+
+#include <cassert>
+#include "MathConvert.h"
+#include "MultiType.h"
+#include "Serialise.h"
+
+namespace orxonox
+{
+    /**
+        @brief The MT_Value<T> class is used to hold a value of type T within a MultiType.
+    */
+    template <typename T>
+    class MT_Value : public MultiType::MT_ValueBase
+    {
+    public:
+        /** @brief Constructor: Assigns the value and the type identifier. */
+        MT_Value(const T& value, MT_Type::Value type) : MT_ValueBase(type), value_(value) {}
+
+        /** @brief Creates a copy of itself. */
+        inline MT_ValueBase* clone() const { return new MT_Value<T>(this->value_, this->type_); }
+
+        /** @brief Resets the current value to the default. */
+        inline void reset() { this->value_ = zeroise<T>(); bHasDefaultValue_ = true; }
+
+        /** @brief Assigns the value of the other MultiType, converted to T. @param other The other MultiType */
+        inline bool assimilate(const MultiType& other)
+        {
+            if (other.value_)
+            {
+                return !(bHasDefaultValue_ = !other.value_->getValue(&value_));
+            }
+            else
+            {
+                this->value_ = zeroise<T>();
+                return !(bHasDefaultValue_ = true);
+            }
+        }
+
+        inline bool getValue(char*                 value) const { return convertValue<T, char                >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned char*        value) const { return convertValue<T, unsigned char       >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(short*                value) const { return convertValue<T, short               >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned short*       value) const { return convertValue<T, unsigned short      >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(int*                  value) const { return convertValue<T, int                 >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned int*         value) const { return convertValue<T, unsigned int        >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(long*                 value) const { return convertValue<T, long                >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned long*        value) const { return convertValue<T, unsigned long       >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(long long*            value) const { return convertValue<T, long long           >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(unsigned long long*   value) const { return convertValue<T, unsigned long long  >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(float*                value) const { return convertValue<T, float               >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(double*               value) const { return convertValue<T, double              >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(long double*          value) const { return convertValue<T, long double         >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(bool*                 value) const { return convertValue<T, bool                >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(void**                value) const { return convertValue<T, void*               >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(std::string*          value) const { return convertValue<T, std::string         >(value, value_, zeroise<std::string>         ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Vector2*     value) const { return convertValue<T, orxonox::Vector2    >(value, value_, zeroise<orxonox::Vector2>    ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Vector3*     value) const { return convertValue<T, orxonox::Vector3    >(value, value_, zeroise<orxonox::Vector3>    ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Vector4*     value) const { return convertValue<T, orxonox::Vector4    >(value, value_, zeroise<orxonox::Vector4>    ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::ColourValue* value) const { return convertValue<T, orxonox::ColourValue>(value, value_, zeroise<orxonox::ColourValue>()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Quaternion*  value) const { return convertValue<T, orxonox::Quaternion >(value, value_, zeroise<orxonox::Quaternion> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Radian*      value) const { return convertValue<T, orxonox::Radian     >(value, value_, zeroise<orxonox::Radian>     ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+        inline bool getValue(orxonox::Degree*      value) const { return convertValue<T, orxonox::Degree     >(value, value_, zeroise<orxonox::Degree>     ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
+
+        inline bool setValue(const char& value)                 { return !(bHasDefaultValue_ = !convertValue<char                , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const unsigned char& value)        { return !(bHasDefaultValue_ = !convertValue<unsigned char       , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const short& value)                { return !(bHasDefaultValue_ = !convertValue<short               , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const unsigned short& value)       { return !(bHasDefaultValue_ = !convertValue<unsigned short      , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const int& value)                  { return !(bHasDefaultValue_ = !convertValue<int                 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const unsigned int& value)         { return !(bHasDefaultValue_ = !convertValue<unsigned int        , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const long& value)                 { return !(bHasDefaultValue_ = !convertValue<long                , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const unsigned long& value)        { return !(bHasDefaultValue_ = !convertValue<unsigned long       , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const long long& value)            { return !(bHasDefaultValue_ = !convertValue<long long           , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const unsigned long long& value)   { return !(bHasDefaultValue_ = !convertValue<unsigned long long  , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const float& value)                { return !(bHasDefaultValue_ = !convertValue<float               , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const double& value)               { return !(bHasDefaultValue_ = !convertValue<double              , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const long double& value)          { return !(bHasDefaultValue_ = !convertValue<long double         , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const bool& value)                 { return !(bHasDefaultValue_ = !convertValue<bool                , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(      void* const& value)          { return !(bHasDefaultValue_ = !convertValue<void*               , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const std::string& value)          { return !(bHasDefaultValue_ = !convertValue<std::string         , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Vector2& value)     { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector2    , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Vector3& value)     { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector3    , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Vector4& value)     { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector4    , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::ColourValue& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::ColourValue, T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Quaternion& value)  { return !(bHasDefaultValue_ = !convertValue<orxonox::Quaternion , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Radian& value)      { return !(bHasDefaultValue_ = !convertValue<orxonox::Radian     , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+        inline bool setValue(const orxonox::Degree& value)      { return !(bHasDefaultValue_ = !convertValue<orxonox::Degree     , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */
+
+        inline operator char()                 const { return getConvertedValue<T, char>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator unsigned char()        const { return getConvertedValue<T, unsigned char>       (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator short()                const { return getConvertedValue<T, short>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator unsigned short()       const { return getConvertedValue<T, unsigned short>      (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator int()                  const { return getConvertedValue<T, int>                 (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator unsigned int()         const { return getConvertedValue<T, unsigned int>        (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator long()                 const { return getConvertedValue<T, long>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator unsigned long()        const { return getConvertedValue<T, unsigned long>       (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator long long()            const { return getConvertedValue<T, long long>           (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator unsigned long long()   const { return getConvertedValue<T, unsigned long long>  (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator float()                const { return getConvertedValue<T, float>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator double()               const { return getConvertedValue<T, double>              (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator long double()          const { return getConvertedValue<T, long double>         (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator bool()                 const { return getConvertedValue<T, bool>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator void*()                const { return getConvertedValue<T, void*>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
+        inline operator std::string()          const { return getConvertedValue<T, std::string>         (this->value_, NilValue<std::string         >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Vector2()     const { return getConvertedValue<T, orxonox::Vector2>    (this->value_, NilValue<orxonox::Vector2    >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Vector3()     const { return getConvertedValue<T, orxonox::Vector3>    (this->value_, NilValue<orxonox::Vector3    >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Vector4()     const { return getConvertedValue<T, orxonox::Vector4>    (this->value_, NilValue<orxonox::Vector4    >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::ColourValue() const { return getConvertedValue<T, orxonox::ColourValue>(this->value_, NilValue<orxonox::ColourValue>()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Quaternion()  const { return getConvertedValue<T, orxonox::Quaternion> (this->value_, NilValue<orxonox::Quaternion >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Radian()      const { return getConvertedValue<T, orxonox::Radian>     (this->value_, NilValue<orxonox::Radian     >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Degree()      const { return getConvertedValue<T, orxonox::Degree>     (this->value_, NilValue<orxonox::Degree     >()); } /** @brief Returns the current value, converted to the requested type. */
+
+        /** @brief Puts the current value on the stream */
+        inline void toString(std::ostream& outstream) const { outstream << this->value_; }
+        
+        /** @brief loads data from the bytestream (mem) into the MT and increases the bytestream pointer by the size of the data */
+        inline void importData( uint8_t*& mem )         { loadAndIncrease( /*(const T&)*/this->value_, mem ); }
+        /** @brief saves data from the MT into the bytestream (mem) and increases the bytestream pointer by the size of the data */
+        inline void exportData( uint8_t*& mem ) const   { saveAndIncrease( /*(const T&)*/this->value_, mem ); }
+        /** @brief returns the size of the data that would be saved by exportData */
+        inline uint8_t getSize() const { return returnSize( this->value_ ); }
+
+        T value_; //!< The stored value
+    };
+    
+    // Import / Export specialisation
+    // ColourValue
+    template <> inline void MT_Value<ColourValue>::importData( uint8_t*& mem )
+    {
+        loadAndIncrease( this->value_.r, mem );
+        loadAndIncrease( this->value_.g, mem );
+        loadAndIncrease( this->value_.b, mem );
+        loadAndIncrease( this->value_.a, mem );
+    }
+    template <> inline void MT_Value<ColourValue>::exportData( uint8_t*& mem ) const
+    {
+        saveAndIncrease( this->value_.r, mem );
+        saveAndIncrease( this->value_.g, mem );
+        saveAndIncrease( this->value_.b, mem );
+        saveAndIncrease( this->value_.a, mem );
+    }
+    template <> inline uint8_t MT_Value<ColourValue>::getSize() const
+    {
+        return 4*returnSize(this->value_.r);
+    }
+    // Ogre::Quaternion
+    template <> inline void MT_Value<Ogre::Quaternion>::importData( uint8_t*& mem )
+    {
+        loadAndIncrease( this->value_.x, mem );
+        loadAndIncrease( this->value_.y, mem );
+        loadAndIncrease( this->value_.z, mem );
+        loadAndIncrease( this->value_.w, mem );
+    }
+    template <> inline void MT_Value<Ogre::Quaternion>::exportData( uint8_t*& mem ) const
+    {
+        saveAndIncrease( this->value_.x, mem );
+        saveAndIncrease( this->value_.y, mem );
+        saveAndIncrease( this->value_.z, mem );
+        saveAndIncrease( this->value_.w, mem );
+    }
+    template <> inline uint8_t MT_Value<Ogre::Quaternion>::getSize() const
+    {
+        return 4*returnSize(this->value_.x);
+    }
+    // Ogre::Vector2
+    template <> inline void MT_Value<Ogre::Vector2>::importData( uint8_t*& mem )
+    {
+        loadAndIncrease( this->value_.x, mem );
+        loadAndIncrease( this->value_.y, mem );
+    }
+    template <> inline void MT_Value<Ogre::Vector2>::exportData( uint8_t*& mem ) const
+    {
+        saveAndIncrease( this->value_.x, mem );
+        saveAndIncrease( this->value_.y, mem );
+    }
+    template <> inline uint8_t MT_Value<Ogre::Vector2>::getSize() const
+    {
+        return 2*returnSize(this->value_.x);
+    }
+    // Ogre::Vector3
+    template <> inline void MT_Value<Ogre::Vector3>::importData( uint8_t*& mem )
+    {
+        loadAndIncrease( this->value_.x, mem );
+        loadAndIncrease( this->value_.y, mem );
+        loadAndIncrease( this->value_.z, mem );
+    }
+    template <> inline void MT_Value<Ogre::Vector3>::exportData( uint8_t*& mem ) const
+    {
+        saveAndIncrease( this->value_.x, mem );
+        saveAndIncrease( this->value_.y, mem );
+        saveAndIncrease( this->value_.z, mem );
+    }
+    template <> inline uint8_t MT_Value<Ogre::Vector3>::getSize() const
+    {
+        return 3*returnSize(this->value_.x);
+    }
+    // Ogre::Vector4
+    template <> inline void MT_Value<Ogre::Vector4>::importData( uint8_t*& mem )
+    {
+        loadAndIncrease( this->value_.x, mem );
+        loadAndIncrease( this->value_.y, mem );
+        loadAndIncrease( this->value_.z, mem );
+        loadAndIncrease( this->value_.w, mem );
+    }
+    template <> inline void MT_Value<Ogre::Vector4>::exportData( uint8_t*& mem ) const
+    {
+        saveAndIncrease( this->value_.x, mem );
+        saveAndIncrease( this->value_.y, mem );
+        saveAndIncrease( this->value_.z, mem );
+        saveAndIncrease( this->value_.w, mem );
+    }
+    template <> inline uint8_t MT_Value<Ogre::Vector4>::getSize() const
+    {
+        return 4*returnSize(this->value_.x);
+    }
+    template <> inline void MT_Value<void*>::importData( uint8_t*& mem )
+    {
+        assert(0);
+    }
+    template <> inline void MT_Value<void*>::exportData( uint8_t*& mem ) const
+    {
+        assert(0);
+    }
+    template <> inline uint8_t MT_Value<void*>::getSize() const
+    {
+        assert(0); return 0;
+    }
+}
+
+#endif /* _MultiTypeValue_H__ */
Index: /sandbox_light/src/libraries/util/OrxAssert.h
===================================================================
--- /sandbox_light/src/libraries/util/OrxAssert.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/OrxAssert.h	(revision 5788)
@@ -0,0 +1,52 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Declaration of custom assertion facilities
+*/
+
+#ifndef _OrxAssert_H__
+#define _OrxAssert_H__
+
+#include "UtilPrereqs.h"
+
+#include <cassert>
+#include "OutputHandler.h"
+
+// define an assert macro that can display a message
+#ifndef NDEBUG
+#define OrxAssert(Assertion, ErrorMessage) \
+    Assertion ? ((void)0) : (void)(orxonox::OutputHandler::getOutStream().setOutputLevel(1) << ErrorMessage << std::endl); \
+    assert(Assertion)
+#else
+#define OrxAssert(condition, errorMessage)  ((void)0)
+#endif
+
+#endif /* _OrxAssert_H__ */
Index: /sandbox_light/src/libraries/util/OrxEnum.h
===================================================================
--- /sandbox_light/src/libraries/util/OrxEnum.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/OrxEnum.h	(revision 5788)
@@ -0,0 +1,67 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Declaration of the OrxEnum class.
+*/
+
+#ifndef _OrxEnum_H__
+#define _OrxEnum_H__
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    template <class T>
+    struct OrxEnum
+    {
+        public:
+            OrxEnum() { }
+            OrxEnum(int type)                  { type_ = type; }
+            OrxEnum(const T& instance)   { type_ = instance.type_; }
+
+            operator int()                     { return type_; }
+            T& operator =(int type)      { type_ = type; return *this; }
+            bool operator <(const T& right) const { return (type_ < right.type_); }
+            bool operator >(const T& right) const { return (type_ > right.type_); }
+
+        private:
+            OrxEnum(const OrxEnum& instance);
+            int type_;
+    };
+}
+
+#define OrxEnumConstructors(enumName)                        \
+enumName() { }                                               \
+enumName(int type) : OrxEnum<enumName>(type)             { } \
+enumName(const enumName& inst) : OrxEnum<enumName>(inst) { } \
+void dummyFunction()
+
+#endif /* _OrxEnum_H__ */
Index: /sandbox_light/src/libraries/util/OutputBuffer.cc
===================================================================
--- /sandbox_light/src/libraries/util/OutputBuffer.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/OutputBuffer.cc	(revision 5788)
@@ -0,0 +1,127 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the OutputBuffer.
+*/
+
+#include "OutputBuffer.h"
+
+namespace orxonox
+{
+    /**
+        @brief Adds a new listener to the list.
+        @param listener The new listener
+    */
+    void OutputBuffer::registerListener(OutputBufferListener* listener)
+    {
+        this->listeners_.push_back(listener);
+    }
+
+    /**
+        @brief Removes a listener from the list.
+        @param listener The listener
+    */
+    void OutputBuffer::unregisterListener(OutputBufferListener* listener)
+    {
+        for (std::vector<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); )
+        {
+            if ((*it) == listener)
+                it = this->listeners_.erase(it);
+            else
+                ++it;
+        }
+    }
+
+    /**
+        @brief Puts a stream manipulator to the stream.
+        @param manipulator The manipulator
+    */
+    OutputBuffer& OutputBuffer::operator<<(std::ostream& (*manipulator)(std::ostream&))
+    {
+        this->stream_ << manipulator;
+        this->callListeners();
+        return *this;
+    }
+
+    /**
+        @brief Puts a stream manipulator to the stream.
+        @param manipulator The manipulator
+    */
+    OutputBuffer& OutputBuffer::operator<<(std::ios& (*manipulator)(std::ios&))
+    {
+        this->stream_ << manipulator;
+        this->callListeners();
+        return *this;
+    }
+
+    /**
+        @brief Puts a stream manipulator to the stream.
+        @param manipulator The manipulator
+    */
+    OutputBuffer& OutputBuffer::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
+    {
+        this->stream_ << manipulator;
+        this->callListeners();
+        return *this;
+    }
+
+    /**
+        @brief Removes the first line from the stream and assigns it to a given string object.
+        @param output The string object to assign the first line
+        @return True if there was at least one line in the stream and this line was successfully assigned
+
+        It's important to know the returned line will be removed from the stream. If there are more than one
+        listener, they have to cooperate to avoid conflicts.
+    */
+    bool OutputBuffer::getLine(std::string* output)
+    {
+        std::getline(this->stream_, *output);
+
+        bool eof = this->stream_.eof();
+        bool fail = this->stream_.fail();
+
+        if (eof)
+            this->stream_.flush();
+
+        if (eof || fail)
+            this->stream_.clear();
+
+        return (!eof && !fail);
+    }
+
+    /**
+        @brief Calls the outputChanged() function of all registered listeners.
+    */
+    void OutputBuffer::callListeners()
+    {
+        for (std::vector<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+            (*it)->outputChanged();
+    }
+}
Index: /sandbox_light/src/libraries/util/OutputBuffer.h
===================================================================
--- /sandbox_light/src/libraries/util/OutputBuffer.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/OutputBuffer.h	(revision 5788)
@@ -0,0 +1,173 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Declaration of the OutputBuffer class.
+
+    The OutputBuffer acts almost like std::ostream. You can put text and other values to the
+    OutputBuffer by using the << operator. The OutputBuffer stores the text and calls registerd
+    listeners if new text gets assigned.
+    The listeners are then able to retrieve the text line by line.
+
+    It's important to know that getLine actually removes the line from the OutputBuffer, so it's
+    better to only have one "active" listener.
+*/
+
+#ifndef _OutputBuffer_H__
+#define _OutputBuffer_H__
+
+#include "UtilPrereqs.h"
+
+#include <vector>
+#include <sstream>
+
+namespace orxonox
+{
+    /**
+        @brief A pure virtual baseclass for classes that want to register as listener to an OutputBuffer.
+
+        This class is pure virtual, so an inheriting class has to implement the function on it's own.
+        The function get's called, if an instance of the inheriting class registers as a listener at
+        an OutputBuffer and this buffer changes.
+    */
+    class OutputBufferListener
+    {
+        friend class OutputBuffer;
+
+        public:
+            virtual ~OutputBufferListener() {}
+
+        private:
+            virtual void outputChanged() = 0;
+    };
+
+    /**
+        @brief The OutputBuffer acts almost like std::ostream and stores the assigned text.
+
+        If text gets assigned by using the << operator or another function, the OutputBuffer
+        calls it's listeners, allowing them to retrieve the text line by line.
+
+        It's important to know that getLine actually removes the line from the OutputBuffer, so it's
+        better to only have one "active" listener.
+    */
+    class _UtilExport OutputBuffer
+    {
+        public:
+            OutputBuffer() {}
+            ~OutputBuffer() {}
+
+            /**
+                @brief Puts some object/value to the OutputBuffer. The text gets assigned and the OutputBuffer calls it's listeners.
+                @param object The object/value to assign
+            */
+            template <class T>
+            inline OutputBuffer& operator<<(T object)
+            {
+                this->stream_ << object;
+                this->callListeners();
+                return *this;
+            }
+
+            /**
+                @brief Reads the stored text of the other OutputBuffer and calls the listeners.
+                @param object The other OutputBuffer
+            */
+            template <const OutputBuffer&>
+            inline OutputBuffer& operator<<(const OutputBuffer& object)
+            {
+                this->stream_ << object.stream_.rdbuf();
+                this->callListeners();
+                return *this;
+            }
+
+            OutputBuffer& operator<<(std::ostream& (*manipulator)(std::ostream&));
+            OutputBuffer& operator<<(std::ios& (*manipulator)(std::ios&));
+            OutputBuffer& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
+
+            /**
+                @brief Does the same like operator<<: Assigns the object to the stream and calls the listeners.
+                @param object The object/value
+            */
+            template <class T>
+            inline void add(T object)
+            {
+                this->stream_ << object;
+                this->callListeners();
+            }
+
+            /**
+                @brief Assigns an object/value and adds std::endl.
+                @param object The object/value
+            */
+            template <class T>
+            inline void addLine(T object)
+            {
+                this->stream_ << object << std::endl;
+                this->callListeners();
+            }
+
+            /**
+                @brief Puts std::endl to the stream and calls the listeners.
+            */
+            inline void newline()
+            {
+                this->stream_ << std::endl;
+                this->callListeners();
+            }
+
+            /**
+                @brief Flushes the stored text (~empties the OutputBuffer).
+            */
+            inline void flush()
+            {
+                this->stream_.flush();
+            }
+
+            bool getLine(std::string* output);
+
+            void registerListener(OutputBufferListener* listener);
+            void unregisterListener(OutputBufferListener* listener);
+
+            /**
+                @brief Returns the internal stringstream object.
+            */
+            inline std::stringstream& getStream()
+            {
+                return this->stream_;
+            }
+
+        private:
+            void callListeners();
+
+            std::stringstream stream_;                     //!< The stringstream that stores the assigned text
+            std::vector<OutputBufferListener*> listeners_; //!< A list of all listeners
+    };
+}
+
+#endif /* _OutputBuffer_H__ */
Index: /sandbox_light/src/libraries/util/OutputHandler.cc
===================================================================
--- /sandbox_light/src/libraries/util/OutputHandler.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/OutputHandler.cc	(revision 5788)
@@ -0,0 +1,231 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the OutputHandler class.
+*/
+
+#include "OutputHandler.h"
+
+#include <ctime>
+#include <cstdlib>
+
+namespace orxonox
+{
+    /**
+        @brief Constructor: Opens the logfile and writes the first line.
+        @param logfilename The name of the logfile
+    */
+    OutputHandler::OutputHandler()
+    {
+#ifdef ORXONOX_PLATFORM_WINDOWS
+        char* pTempDir = getenv("TEMP");
+        this->logfilename_ = std::string(pTempDir) + "/orxonox.log";
+#else
+        this->logfilename_ = "/tmp/orxonox.log";
+#endif
+#ifdef NDEBUG
+        this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 2;
+        this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 1;
+#else
+        this->softDebugLevel_[LD_All] = this->softDebugLevel_[LD_Logfile] = 3;
+        this->softDebugLevel_[LD_Console] = this->softDebugLevel_[LD_Shell] = 2;
+#endif
+
+        this->outputBuffer_ = &this->fallbackBuffer_;
+        this->logfile_.open(this->logfilename_.c_str(), std::fstream::out);
+
+        time_t rawtime;
+        struct tm* timeinfo;
+        time(&rawtime);
+        timeinfo = localtime(&rawtime);
+
+        this->logfile_ << "Started log on " << asctime(timeinfo) << std::endl;
+        this->logfile_.flush();
+    }
+
+    /**
+        @brief Destructor: Writes the last line to the logfile and closes it.
+    */
+    OutputHandler::~OutputHandler()
+    {
+        this->logfile_ << "Closed log" << std::endl;
+        this->logfile_.close();
+    }
+
+    /**
+        @brief Returns a reference to the only existing instance of the OutputHandler class.
+        @return The instance
+    */
+    OutputHandler& OutputHandler::getOutStream()
+    {
+        static OutputHandler orxout;
+        return orxout;
+    }
+
+    /**
+        @brief Sets the soft debug level for a given output device.
+        @param device The output device
+        @param level The debug level
+    */
+    void OutputHandler::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
+    {
+        OutputHandler::getOutStream().softDebugLevel_[static_cast<unsigned int>(device)] = level;
+    }
+
+    /**
+        @brief Returns the soft debug level for a given output device.
+        @param device The output device
+        @return The debug level
+    */
+    int OutputHandler::getSoftDebugLevel(OutputHandler::OutputDevice device)
+    {
+        return OutputHandler::getOutStream().softDebugLevel_[static_cast<unsigned int>(device)];
+    }
+
+    /**
+        @brief Sets the OutputBuffer, representing the third output stream.
+        @param buffer The OutputBuffer
+    */
+    void OutputHandler::setOutputBuffer(OutputBuffer* buffer)
+    {
+        if (buffer == NULL)
+            this->outputBuffer_ = &this->fallbackBuffer_;
+        else
+        {
+            buffer->getStream() >> this->outputBuffer_->getStream().rdbuf();
+            this->outputBuffer_ = buffer;
+        }
+    }
+
+    /**
+        @brief Sets the path where to create orxonox.log
+        @param Path string with trailing slash
+    */
+    void OutputHandler::setLogPath(const std::string& path)
+    {
+        OutputHandler::getOutStream().logfile_.close();
+        // store old content
+        std::ifstream old;
+        old.open(OutputHandler::getOutStream().logfilename_.c_str());
+        OutputHandler::getOutStream().logfilename_ = path + "orxonox.log";
+        OutputHandler::getOutStream().logfile_.open(OutputHandler::getOutStream().logfilename_.c_str(), std::fstream::out);
+        OutputHandler::getOutStream().logfile_ << old.rdbuf();
+        old.close();
+        OutputHandler::getOutStream().logfile_.flush();
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console and the logfile.
+        @param sb The streambuffer that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::streambuf* sb)
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            std::cout << sb;
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            this->logfile_ << sb;
+            this->logfile_.flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << sb;
+
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console, the logfile and the ingame shell.
+        @param manipulator A function, manipulating the outstream.
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::ostream& (*manipulator)(std::ostream&))
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            manipulator(std::cout);
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            manipulator(this->logfile_);
+            this->logfile_.flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << manipulator;
+
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console, the logfile and the ingame shell.
+        @param manipulator A function, manipulating the outstream.
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::ios& (*manipulator)(std::ios&))
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            manipulator(std::cout);
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            manipulator(this->logfile_);
+            this->logfile_.flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << manipulator;
+
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console, the logfile and the ingame shell.
+        @param manipulator A function, manipulating the outstream.
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            manipulator(std::cout);
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            manipulator(this->logfile_);
+            this->logfile_.flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << manipulator;
+
+        return *this;
+    }
+}
Index: /sandbox_light/src/libraries/util/OutputHandler.h
===================================================================
--- /sandbox_light/src/libraries/util/OutputHandler.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/OutputHandler.h	(revision 5788)
@@ -0,0 +1,206 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Definition of the OutputHandler class.
+
+    The OutputHandler acts like std::cout, but output isn't only shown in the console,
+    but also written to the logfile and the ingame shell.
+*/
+
+#ifndef _OutputHandler_H__
+#define _OutputHandler_H__
+
+#include "UtilPrereqs.h"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#include "OutputBuffer.h"
+
+namespace orxonox
+{
+    //! The OutputHandler acts like std::cout, but redirects output to the console, the logfile and the ingame shell.
+    class _UtilExport OutputHandler
+    {
+        public:
+            enum OutputDevice
+            {
+                LD_All = 0,
+                LD_Console = 1,
+                LD_Logfile = 2,
+                LD_Shell = 3
+            };
+
+            static OutputHandler& getOutStream();
+
+            /** @brief Puts some text on the outstream. @param text The text */
+            static inline const std::string& log(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(0); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts an error on the outstream. @param text The text */
+            static inline const std::string& error(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(1); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts a warning on the outstream. @param text The text */
+            static inline const std::string& warning(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(2); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts an info on the outstream. @param text The text */
+            static inline const std::string& info(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(3); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts some debug output on the outstream. @param text The text */
+            static inline const std::string& debug(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(4); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Returns a reference to the logfile. @return The logfile */
+            inline std::ofstream& getLogfile()
+                { return this->logfile_; }
+
+            /** @brief Returns a pointer to the OutputBuffer. @return The OutputBuffer */
+            inline OutputBuffer* getOutputBuffer()
+                { return this->outputBuffer_; }
+
+            /** @brief Sets the level of the incoming output. @param level The level of the incoming output @return The OutputHandler itself */
+            inline OutputHandler& setOutputLevel(int level)
+                { this->outputLevel_ = level; return *this; }
+
+            /** @brief Returns the level of the incoming output. @return The level */
+            inline int getOutputLevel() const
+                { return this->outputLevel_; }
+
+            static void setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
+            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
+
+            static void setLogPath(const std::string& path);
+
+            void setOutputBuffer(OutputBuffer* buffer);
+
+            template <class T>
+            OutputHandler& output(const T& output);
+
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned char val)      { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(short val)              { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned short val)     { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(int val)                { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned int val)       { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(long val)               { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned long val)      { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(long long val)          { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned long long val) { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(float val)              { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(double val)             { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(long double val)        { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(const void* val)        { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(bool val)               { return this->output(val); }
+
+            OutputHandler& operator<<(std::streambuf* sb);
+
+            OutputHandler& operator<<(std::ostream& (*manipulator)(std::ostream&));
+            OutputHandler& operator<<(std::ios& (*manipulator)(std::ios&));
+            OutputHandler& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
+
+        private:
+            explicit OutputHandler();
+            OutputHandler(const OutputHandler& oh);
+            virtual ~OutputHandler();
+
+            std::ofstream logfile_;              //!< The logfile where the output is logged
+            std::string logfilename_;            //!< The name of the logfile
+            OutputBuffer fallbackBuffer_;        //!< The OutputBuffer that gets used if there is no other OutputBuffer
+            OutputBuffer* outputBuffer_;         //!< The OutputBuffer to put output in (usually used by the Shell)
+            int outputLevel_;                    //!< The level of the incoming output
+            int softDebugLevel_[4];              //!< The soft debug level for each OutputDevice - the configurable maximal output level
+    };
+
+    /**
+        @brief Redirects the output to the console and the logfile.
+        @param output The value that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    template<class T>
+    OutputHandler& OutputHandler::output(const T& output)
+    {
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            std::cout << output;
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            this->logfile_ << output;
+            this->logfile_.flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << output;
+
+        return *this;
+    }
+
+    /**
+        @brief Overloading of the non-member << operator to redirect the output of classes with self defined '<< to std::ostream' operators to the console and the logfile.
+        @param out The OutputHandler itself
+        @param output The class that should be shown in the console
+        @return The OutputHandler itself
+    */
+    template<class T>
+    OutputHandler& operator<<(OutputHandler& out, const T& output)
+    {
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Console) >= out.getOutputLevel())
+            std::cout << output;
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Logfile) >= out.getOutputLevel())
+        {
+            out.getLogfile() << output;
+            out.getLogfile().flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= out.getOutputLevel())
+            (*out.getOutputBuffer()) << output;
+
+        return out;
+    }
+}
+
+#endif /* _OutputHandler_H__ */
Index: /sandbox_light/src/libraries/util/RefToValue.h
===================================================================
--- /sandbox_light/src/libraries/util/RefToValue.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/RefToValue.h	(revision 5788)
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2006 Richard Sposato
+// Copyright (c) 2006 Peter Kümmel
+// Permission to use, copy, modify, distribute and sell this software for any 
+//     purpose is hereby granted without fee, provided that the above copyright 
+//     notice appear in all copies and that both that copyright notice and this 
+//     permission notice appear in supporting documentation.
+// The authors make no representations about the 
+//     suitability of this software for any purpose. It is provided "as is" 
+//     without express or implied warranty.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_REFTOVALUE_INC_
+#define LOKI_REFTOVALUE_INC_
+
+// $Id: RefToValue.h 751 2006-10-17 19:50:37Z syntheticpp $
+
+
+namespace Loki
+{
+
+    ////////////////////////////////////////////////////////////////////////////////
+    ///  \class RefToValue
+    ///
+    ///  \ingroup SmartPointerGroup 
+    ///  Transports a reference as a value
+    ///  Serves to implement the Colvin/Gibbons trick for SmartPtr/ScopeGuard
+    ////////////////////////////////////////////////////////////////////////////////
+
+    template <class T>
+    class RefToValue
+    {   
+    public:
+    
+        RefToValue(T& ref) : ref_(ref) 
+        {}
+
+        RefToValue(const RefToValue& rhs) : ref_(rhs.ref_)
+        {}
+
+        operator T& () const 
+        {
+            return ref_;
+        }
+
+    private:
+        // Disable - not implemented
+        RefToValue();
+        RefToValue& operator=(const RefToValue&);
+        
+        T& ref_;
+    };
+
+
+    ////////////////////////////////////////////////////////////////////////////////
+    ///  \ingroup ExceptionGroup 
+    ///  RefToValue creator.
+    ////////////////////////////////////////////////////////////////////////////////
+
+    template <class T>
+    inline RefToValue<T> ByRef(T& t)
+    {
+        return RefToValue<T>(t);
+    }    
+    
+}
+
+
+#endif // end file guardian
+
Index: /sandbox_light/src/libraries/util/Scope.cc
===================================================================
--- /sandbox_light/src/libraries/util/Scope.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/Scope.cc	(revision 5788)
@@ -0,0 +1,35 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Scope.h"
+
+namespace orxonox
+{
+    std::map<ScopeID::Value, int> ScopeManager::instanceCounts_s;
+    std::map<ScopeID::Value, std::set<ScopeListener*> > ScopeManager::listeners_s;
+}
Index: /sandbox_light/src/libraries/util/Scope.h
===================================================================
--- /sandbox_light/src/libraries/util/Scope.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/Scope.h	(revision 5788)
@@ -0,0 +1,141 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef __Util_Scope_H__
+#define __Util_Scope_H__
+
+#include "UtilPrereqs.h"
+#include <cassert>
+#include <set>
+#include <map>
+#include "Debug.h"
+
+namespace orxonox
+{
+    namespace ScopeID
+    {
+        /**
+            @brief A list of available scopes for the Scope template.
+        */
+        enum Value
+        {
+            GSRoot,
+            GSGraphics,
+            GSLevel
+        };
+    }
+
+    class ScopeListener; // Forward declaration
+
+    /**
+        @brief The ScopeManager stores the variables of the scope templates in a statically linked context.
+    */
+    class _UtilExport ScopeManager
+    {
+        template <ScopeID::Value scope>
+        friend class Scope;
+        friend class ScopeListener;
+
+        private:
+            static std::map<ScopeID::Value, int> instanceCounts_s;                  //!< Counts the number of active instances (>0 means active) for a scope
+            static std::map<ScopeID::Value, std::set<ScopeListener*> > listeners_s; //!< Stores all listeners for a scope
+    };
+
+    /**
+        @brief ScopeListeners register themselves in the corresponding scope and wait for notifications.
+    */
+    class _UtilExport ScopeListener
+    {
+        template <ScopeID::Value scope>
+        friend class Scope;
+
+        protected:
+            //! Constructor: Registers the instance.
+            ScopeListener(ScopeID::Value scope) : scope_(scope)
+                { ScopeManager::listeners_s[this->scope_].insert(this); }
+            //! Destructor: Unregisters the instance.
+            virtual ~ScopeListener()
+                { ScopeManager::listeners_s[this->scope_].erase(this); }
+
+            //! Gets called if the scope is activated
+            virtual void activated() = 0;
+            //! Gets called if the scope is deactivated
+            virtual void deactivated() = 0;
+
+        private:
+            ScopeID::Value scope_; //!< Store the scope to unregister on destruction
+    };
+
+    /**
+        @brief A scope for a given template argument is either active or not.
+
+        Objects inheriting from a ScopeListener are registered in a list (different for each scope).
+        If the scope gets activated or deactivated, all objects in this list are notified.
+    */
+    template <ScopeID::Value scope>
+    class Scope
+    {
+        public:
+            //! Constructor: Increases the instance counter and activates the scope if the count went from 0 to 1. Counts >1 don't change anything.
+            Scope()
+            {
+                ScopeManager::instanceCounts_s[scope]++;
+                assert(ScopeManager::instanceCounts_s[scope] > 0);
+                if (ScopeManager::instanceCounts_s[scope] == 1)
+                {
+                    for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); )
+                        (*(it++))->activated();
+                }
+            }
+
+            //! Destructor: Decreases the instance counter and deactivates the scope if the count went from 1 to 0. Counts >0 don't change anything.
+            ~Scope()
+            {
+                ScopeManager::instanceCounts_s[scope]--;
+
+                // This shouldn't happen but just to be sure: check if the count is positive
+                assert(ScopeManager::instanceCounts_s[scope] >= 0);
+                if (ScopeManager::instanceCounts_s[scope] < 0)
+                    ScopeManager::instanceCounts_s[scope] = 0;
+
+                if (ScopeManager::instanceCounts_s[scope] == 0)
+                {
+                    for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); )
+                        (*(it++))->deactivated();
+                }
+            }
+
+            //! Returns true if the scope is active.
+            static bool isActive()
+            {
+                return (ScopeManager::instanceCounts_s[scope] > 0);
+            }
+    };
+}
+
+#endif /* __Util_Scope_H__ */
Index: /sandbox_light/src/libraries/util/ScopeGuard.h
===================================================================
--- /sandbox_light/src/libraries/util/ScopeGuard.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/ScopeGuard.h	(revision 5788)
@@ -0,0 +1,666 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2000 Andrei Alexandrescu
+// Copyright (c) 2000 Petru Marginean
+// Copyright (c) 2005 Joshua Lehrer
+//
+// Permission to use, copy, modify, distribute and sell this software for any 
+//     purpose is hereby granted without fee, provided that the above copyright 
+//     notice appear in all copies and that both that copyright notice and this 
+//     permission notice appear in supporting documentation.
+// The author makes no representations about the 
+//     suitability of this software for any purpose. It is provided "as is" 
+//     without express or implied warranty.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_SCOPEGUARD_INC_
+#define LOKI_SCOPEGUARD_INC_
+
+// $Id: ScopeGuard.h 799 2006-12-20 00:37:13Z rich_sposato $
+
+
+#include "RefToValue.h"
+
+/// \defgroup ExceptionGroup Exception-safe code
+
+namespace Loki
+{
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImplBase
+    /// \ingroup ExceptionGroup
+    ///
+    /// Base class used by all ScopeGuard implementations.  All commonly used
+    /// functions are in this class (e.g. - Dismiss and SafeExecute).
+    ///
+    /// See Andrei's and Petru Marginean's CUJ article
+    /// http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/alexandr.htm
+    ///
+    /// Changes to the original code by Joshua Lehrer:
+    /// http://www.lehrerfamily.com/scopeguard.html
+    ////////////////////////////////////////////////////////////////
+
+    class ScopeGuardImplBase
+    {
+        /// Copy-assignment operator is not implemented and private.
+        ScopeGuardImplBase& operator =(const ScopeGuardImplBase&);
+
+    protected:
+
+        ~ScopeGuardImplBase()
+        {}
+
+        /// Copy-constructor takes over responsibility from other ScopeGuard.
+        ScopeGuardImplBase(const ScopeGuardImplBase& other) throw() 
+            : dismissed_(other.dismissed_)
+        {
+            other.Dismiss();
+        }
+
+        template <typename J>
+        static void SafeExecute(J& j) throw() 
+        {
+            if (!j.dismissed_)
+                try
+                {
+                    j.Execute();
+                }
+                catch(...)
+                {}
+        }
+        
+        mutable bool dismissed_;
+
+    public:
+        ScopeGuardImplBase() throw() : dismissed_(false) 
+        {}
+
+        void Dismiss() const throw() 
+        {
+            dismissed_ = true;
+        }
+    };
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \typedef typedef const ScopeGuardImplBase& ScopeGuard
+    /// \ingroup ExceptionGroup
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    typedef const ScopeGuardImplBase& ScopeGuard;
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl0
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with no parameters.  ScopeGuard ignores any value returned from the
+    /// call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F>
+    class ScopeGuardImpl0 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl0<F> MakeGuard(F fun)
+        {
+            return ScopeGuardImpl0<F>(fun);
+        }
+
+        ~ScopeGuardImpl0() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            fun_();
+        }
+
+        ScopeGuardImpl0(F fun) : fun_(fun) 
+        {}
+
+    protected:
+        F fun_;
+    };
+
+    template <typename F> 
+    inline ScopeGuardImpl0<F> MakeGuard(F fun)
+    {
+        return ScopeGuardImpl0<F>::MakeGuard(fun);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl1
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with one parameter.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F, typename P1>
+    class ScopeGuardImpl1 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
+        {
+            return ScopeGuardImpl1<F, P1>(fun, p1);
+        }
+
+        ~ScopeGuardImpl1() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute()
+        {
+            fun_(p1_);
+        }
+
+        ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1) 
+        {}
+
+    protected:
+        F fun_;
+        const P1 p1_;
+    };
+
+    template <typename F, typename P1> 
+    inline ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
+    {
+        return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl2
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with two parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F, typename P1, typename P2>
+    class ScopeGuardImpl2: public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
+        {
+            return ScopeGuardImpl2<F, P1, P2>(fun, p1, p2);
+        }
+
+        ~ScopeGuardImpl2() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute()
+        {
+            fun_(p1_, p2_);
+        }
+
+        ScopeGuardImpl2(F fun, P1 p1, P2 p2) : fun_(fun), p1_(p1), p2_(p2) 
+        {}
+
+    protected:
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+    };
+
+    template <typename F, typename P1, typename P2>
+    inline ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
+    {
+        return ScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl3
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with three parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F, typename P1, typename P2, typename P3>
+    class ScopeGuardImpl3 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
+        {
+            return ScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3);
+        }
+
+        ~ScopeGuardImpl3() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute()
+        {
+            fun_(p1_, p2_, p3_);
+        }
+
+        ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) : fun_(fun), p1_(p1), p2_(p2), p3_(p3) 
+        {}
+
+    protected:
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+    };
+
+    template <typename F, typename P1, typename P2, typename P3>
+    inline ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
+    {
+        return ScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl4
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with four parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4 >
+    class ScopeGuardImpl4 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard(
+            F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
+        {
+            return ScopeGuardImpl4< F, P1, P2, P3, P4 >( fun, p1, p2, p3, p4 );
+        }
+
+        ~ScopeGuardImpl4() throw() 
+        {
+            SafeExecute( *this );
+        }
+
+        void Execute()
+        {
+            fun_( p1_, p2_, p3_, p4_ );
+        }
+
+        ScopeGuardImpl4( F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) :
+             fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 )
+        {}
+
+    protected:
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+        const P4 p4_;
+    };
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4 >
+    inline ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
+    {
+        return ScopeGuardImpl4< F, P1, P2, P3, P4 >::MakeGuard( fun, p1, p2, p3, p4 );
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl5
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with five parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 >
+    class ScopeGuardImpl5 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard(
+            F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
+        {
+            return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >( fun, p1, p2, p3, p4, p5 );
+        }
+
+        ~ScopeGuardImpl5() throw() 
+        {
+            SafeExecute( *this );
+        }
+
+        void Execute()
+        {
+            fun_( p1_, p2_, p3_, p4_, p5_ );
+        }
+
+        ScopeGuardImpl5( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) :
+             fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ), p5_( p5 )
+        {}
+
+    protected:
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+        const P4 p4_;
+        const P5 p5_;
+    };
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 >
+    inline ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
+    {
+        return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >::MakeGuard( fun, p1, p2, p3, p4, p5 );
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl0
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with no
+    /// parameters.  ScopeGuard ignores any value returned from the call within
+    /// the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <class Obj, typename MemFun>
+    class ObjScopeGuardImpl0 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
+        {
+            return ObjScopeGuardImpl0<Obj, MemFun>(obj, memFun);
+        }
+
+        ~ObjScopeGuardImpl0() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            (obj_.*memFun_)();
+        }
+
+        ObjScopeGuardImpl0(Obj& obj, MemFun memFun) : obj_(obj), memFun_(memFun) 
+        {}
+
+    protected:
+        Obj& obj_;
+        MemFun memFun_;
+    };
+
+    template <class Obj, typename MemFun>
+    inline ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
+    {
+        return ObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun);
+    }
+
+    template <typename Ret, class Obj1, class Obj2>
+    inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 &obj) 
+    {
+      return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(obj,memFun);
+    }
+
+    template <typename Ret, class Obj1, class Obj2>
+    inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 *obj) 
+    {
+      return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(*obj,memFun);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl1
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with one
+    /// parameter.  The parameter is copied by value - use ::Loki::ByRef if you
+    /// must use a reference instead.  ScopeGuard ignores any value returned
+    /// from the call within the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <class Obj, typename MemFun, typename P1>
+    class ObjScopeGuardImpl1 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
+        {
+            return ObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1);
+        }
+
+        ~ObjScopeGuardImpl1() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            (obj_.*memFun_)(p1_);
+        }
+
+        ObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) : obj_(obj), memFun_(memFun), p1_(p1) 
+        {}
+        
+    protected:
+        Obj& obj_;
+        MemFun memFun_;
+        const P1 p1_;
+    };
+
+    template <class Obj, typename MemFun, typename P1>
+    inline ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
+    {
+        return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
+    inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 &obj, P1b p1) 
+    {
+      return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(obj,memFun,p1);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
+    inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 *obj, P1b p1) 
+    {
+      return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(*obj,memFun,p1);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl2
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with two
+    /// parameters.  Each parameter is copied by value - use ::Loki::ByRef if you
+    /// must use a reference instead.  ScopeGuard ignores any value returned
+    /// from the call within the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <class Obj, typename MemFun, typename P1, typename P2>
+    class ObjScopeGuardImpl2 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+        {
+            return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2);
+        }
+
+        ~ObjScopeGuardImpl2() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            (obj_.*memFun_)(p1_, p2_);
+        }
+
+        ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2) 
+        {}
+
+    protected:
+        Obj& obj_;
+        MemFun memFun_;
+        const P1 p1_;
+        const P2 p2_;
+    };
+
+    template <class Obj, typename MemFun, typename P1, typename P2>
+    inline ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+    {
+        return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>::MakeObjGuard(obj, memFun, p1, p2);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
+    inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 &obj, P1b p1, P2b p2) 
+    {
+      return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(obj,memFun,p1,p2);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
+    inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 *obj, P1b p1, P2b p2) 
+    {
+      return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(*obj,memFun,p1,p2);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl3
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with three
+    /// parameters.  Each parameter is copied by value - use ::Loki::ByRef if you
+    /// must use a reference instead.  ScopeGuard ignores any value returned
+    /// from the call within the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template < class Obj, typename MemFun, typename P1, typename P2, typename P3 >
+    class ObjScopeGuardImpl3 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(
+            Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
+        {
+            return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >( obj, memFun, p1, p2, p3 );
+        }
+
+        ~ObjScopeGuardImpl3() throw() 
+        {
+            SafeExecute( *this );
+        }
+
+        void Execute() 
+        {
+            ( obj_.*memFun_ )( p1_, p2_, p3_ );
+        }
+
+        ObjScopeGuardImpl3( Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) :
+             obj_( obj ), memFun_( memFun ), p1_( p1 ), p2_( p2 ), p3_( p3 )
+        {}
+
+    protected:
+        Obj& obj_;
+        MemFun memFun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+    };
+
+    template < class Obj, typename MemFun, typename P1, typename P2, typename P3 >
+    inline ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(
+        Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
+    {
+        return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >::MakeObjGuard(
+            obj, memFun, p1, p2, p3 );
+    }
+
+    template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b,
+        typename P2a, typename P2b, typename P3a, typename P3b >
+    inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+        MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 & obj, P1b p1, P2b p2, P3b p3 )
+    {
+      return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+          ::MakeObjGuard( obj, memFun, p1, p2, p3 );
+    }
+
+    template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b,
+        typename P2a, typename P2b, typename P3a, typename P3b >
+    inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+        MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 * obj, P1b p1, P2b p2, P3b p3 )
+    {
+      return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+          ::MakeObjGuard( *obj, memFun, p1, p2, p3 );
+    }
+
+} // namespace Loki
+
+#define LOKI_CONCATENATE_DIRECT(s1, s2)  s1##s2
+#define LOKI_CONCATENATE(s1, s2)         LOKI_CONCATENATE_DIRECT(s1, s2)
+#define LOKI_ANONYMOUS_VARIABLE(str)     LOKI_CONCATENATE(str, __LINE__)
+
+#define LOKI_ON_BLOCK_EXIT      ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeGuard
+#define LOKI_ON_BLOCK_EXIT_OBJ  ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeObjGuard
+
+#endif // end file guardian
+
Index: /sandbox_light/src/libraries/util/ScopedSingleton.h
===================================================================
--- /sandbox_light/src/libraries/util/ScopedSingleton.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/ScopedSingleton.h	(revision 5788)
@@ -0,0 +1,102 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef __Util_ScopedSingleton_H__
+#define __Util_ScopedSingleton_H__
+
+#include "UtilPrereqs.h"
+#include <cassert>
+
+#include "Scope.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Base for scoped singleton classes.
+        A Scoped singleton creates itself if the scope is active and getInstance() is called.
+        Destroys itself if the scope is deactivated.
+
+        Usage:
+        Inherit publicly from ScopedSingleton<MyClass, scope> and provide access to
+        MyClass::singletonPtr_s.
+        This can easily be done with a friend declaration.
+
+        See @ref UtilPrereqs.h for a list of scopes (ScopeID::Value).
+    */
+    template <class T, ScopeID::Value scope>
+    class ScopedSingleton : public ScopeListener
+    {
+        public:
+            //! Returns a reference to the singleton instance
+            static T& getInstance()
+            {
+                assert(Scope<scope>::isActive());
+
+                if (!T::singletonPtr_s && Scope<scope>::isActive())
+                    T::singletonPtr_s = new T();
+
+                return *T::singletonPtr_s;
+            }
+
+        protected:
+            //! Constructor sets the singleton instance pointer
+            ScopedSingleton() : ScopeListener(scope)
+            {
+                assert(T::singletonPtr_s == 0);
+                T::singletonPtr_s = static_cast<T*>(this);
+            }
+
+            //! Constructor resets the singleton instance pointer
+            ~ScopedSingleton()
+            {
+                assert(T::singletonPtr_s != 0);
+                T::singletonPtr_s = 0;
+            }
+
+        private:
+            //! Called if the Scope of this Singleton gets active (no instance should be active then)
+            void activated()
+            {
+                // The ScopedSingleton shouldn't be active bevor the scope is activated -> always assertion failed
+                assert(T::singletonPtr_s == 0 && false);
+            }
+
+            //! Called if the Scope of this Singleton gets deactivated (destroys the instance)
+            void deactivated()
+            {
+                if (T::singletonPtr_s)
+                {
+                    delete T::singletonPtr_s;
+                    T::singletonPtr_s = 0;
+                }
+            }
+    };
+}
+
+#endif /* __Util_ScopedSingleton_H__ */
Index: /sandbox_light/src/libraries/util/Serialise.h
===================================================================
--- /sandbox_light/src/libraries/util/Serialise.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/Serialise.h	(revision 5788)
@@ -0,0 +1,478 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Functions to serialise most of the types/classed used in Orxonox
+*/
+
+#ifndef _Serialise_H__
+#define _Serialise_H__
+
+#include <cstring>
+#include "util/Math.h"
+
+namespace orxonox{
+    
+// general template declaration
+    
+    /** @brief returns the size of the variable in a datastream */
+    template <class T> inline uint32_t returnSize( const T& );
+    /** @brief loads the value of a variable out of the bytestream and increases the mem pointer */
+    template <class T> inline void loadAndIncrease( const T&, uint8_t*& );
+    /** @brief saves the value of a variable into the bytestream and increases the mem pointer */
+    template <class T> inline void saveAndIncrease( const T&, uint8_t*& );
+    /** @brief checks whether the variable of type T is the same as in the bytestream */
+    template <class T> inline  bool checkEquality( const T&, uint8_t* );
+
+// =================== Template specialisation stuff =============
+
+// =========== bool
+
+    template <> inline uint32_t returnSize( const bool& variable )
+    {
+        return sizeof(uint8_t);
+    }
+
+    template <> inline void loadAndIncrease( const bool& variable, uint8_t*& mem )
+    {
+        *(uint8_t*)( &variable ) = *static_cast<uint8_t*>(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const bool& variable, uint8_t*& mem )
+    {
+        *static_cast<uint8_t*>(mem) = *(uint8_t*)( &variable );
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const bool& variable, uint8_t* mem )
+    {
+        return *static_cast<uint8_t*>(mem) == *(uint8_t*)( &variable );
+    }
+
+// =========== char
+
+    template <> inline uint32_t returnSize( const char& variable )
+    {
+        return sizeof(uint8_t);
+    }
+
+    template <> inline void loadAndIncrease( const char& variable, uint8_t*& mem )
+    {
+        *(uint8_t*)( &variable ) = *static_cast<uint8_t*>(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const char& variable, uint8_t*& mem )
+    {
+        *static_cast<uint8_t*>(mem) = *(uint8_t*)( &variable );
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const char& variable, uint8_t* mem )
+    {
+        return *static_cast<uint8_t*>(mem) == *(uint8_t*)( &variable );
+    }
+
+// =========== unsigned char
+
+    template <> inline uint32_t returnSize( const unsigned char& variable )
+    {
+        return sizeof(uint8_t);
+    }
+
+    template <> inline void loadAndIncrease( const unsigned char& variable, uint8_t*& mem )
+    {
+        *(uint8_t*)( &variable ) = *static_cast<uint8_t*>(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const unsigned char& variable, uint8_t*& mem )
+    {
+        *static_cast<uint8_t*>(mem) = *(uint8_t*)( &variable );
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const unsigned char& variable, uint8_t* mem )
+    {
+        return *static_cast<uint8_t*>(mem) == *(uint8_t*)( &variable );
+    }
+
+// =========== short
+
+    template <> inline uint32_t returnSize( const short& variable )
+    {
+        return sizeof(int16_t);
+    }
+
+    template <> inline void loadAndIncrease( const short& variable, uint8_t*& mem )
+    {
+        *(short*)( &variable ) = *(int16_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const short& variable, uint8_t*& mem )
+    {
+        *(int16_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const short& variable, uint8_t* mem )
+    {
+        return *(int16_t*)(mem) == static_cast<int16_t>(variable);
+    }
+
+// =========== unsigned short
+
+    template <> inline uint32_t returnSize( const unsigned short& variable )
+    {
+        return sizeof(uint16_t);
+    }
+
+    template <> inline void loadAndIncrease( const unsigned short& variable, uint8_t*& mem )
+    {
+        *(unsigned short*)( &variable ) = *(uint16_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const unsigned short& variable, uint8_t*& mem )
+    {
+        *(uint16_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const unsigned short& variable, uint8_t* mem )
+    {
+        return *(uint16_t*)(mem) == variable;
+    }
+
+// =========== int
+
+    template <> inline uint32_t returnSize( const int& variable )
+    {
+        return sizeof(int32_t);
+    }
+
+    template <> inline void loadAndIncrease( const int& variable, uint8_t*& mem )
+    {
+        *(int *)( &variable ) = *(int32_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const int& variable, uint8_t*& mem )
+    {
+        *(int32_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const int& variable, uint8_t* mem )
+    {
+        return *(int32_t*)(mem) == variable;
+    }
+
+// =========== unsigned int
+
+    template <> inline uint32_t returnSize( const unsigned int& variable )
+    {
+        return sizeof(uint32_t);
+    }
+    
+    template <> inline void loadAndIncrease( const unsigned int& variable, uint8_t*& mem )
+    {
+        *(unsigned int*)( &variable ) = *(uint32_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const unsigned int& variable, uint8_t*& mem )
+    {
+        *(uint32_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const unsigned int& variable, uint8_t* mem )
+    {
+        return *(uint32_t*)(mem) == variable;
+    }
+
+// =========== long
+
+    template <> inline uint32_t returnSize( const long& variable )
+    {
+        return sizeof(int32_t);
+    }
+
+    template <> inline void loadAndIncrease( const long& variable, uint8_t*& mem )
+    {
+        *(long*)( &variable ) = *(int32_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const long& variable, uint8_t*& mem )
+    {
+        *(int32_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const long& variable, uint8_t* mem )
+    {
+        return *(int32_t*)(mem) == variable;
+    }
+
+// =========== unsigned long
+
+    template <> inline uint32_t returnSize( const unsigned long& variable )
+    {
+        return sizeof(uint32_t);
+    }
+
+    template <> inline void loadAndIncrease( const unsigned long& variable, uint8_t*& mem )
+    {
+        *(unsigned long*)( &variable ) = *(uint32_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const unsigned long& variable, uint8_t*& mem )
+    {
+        *(uint32_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const unsigned long& variable, uint8_t* mem )
+    {
+        return *(uint32_t*)(mem) == variable;
+    }
+
+// =========== long long
+
+    template <> inline uint32_t returnSize( const long long& variable )
+    {
+        return sizeof(int64_t);
+    }
+
+    template <> inline void loadAndIncrease( const long long& variable, uint8_t*& mem )
+    {
+        *(long long*)( &variable ) = *(int64_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const long long& variable, uint8_t*& mem )
+    {
+        *(int64_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const long long& variable, uint8_t* mem )
+    {
+        return *(int64_t*)(mem) == variable;
+    }
+
+// =========== unsigned long long
+
+    template <> inline uint32_t returnSize( const unsigned long long& variable )
+    {
+        return sizeof(uint64_t);
+    }
+
+    template <> inline void loadAndIncrease( const unsigned long long& variable, uint8_t*& mem )
+    {
+        *(unsigned long long*)( &variable ) = *(uint64_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const unsigned long long& variable, uint8_t*& mem )
+    {
+        *(uint64_t*)(mem) = variable;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const unsigned long long& variable, uint8_t* mem )
+    {
+        return *(uint64_t*)(mem) == variable;
+    }
+
+// =========== float
+
+    template <> inline uint32_t returnSize( const float& variable )
+    {
+        return sizeof(uint32_t);
+    }
+
+    template <> inline void loadAndIncrease( const float& variable, uint8_t*& mem )
+    {
+        *(uint32_t*)( &variable ) = *(uint32_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const float& variable, uint8_t*& mem )
+    {
+        *(uint32_t*)(mem) = *(uint32_t*)( &variable );
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const float& variable, uint8_t* mem )
+    {
+        return *(uint32_t*)(mem) == *(uint32_t*)( &variable );
+    }
+
+// =========== double
+
+    template <> inline uint32_t returnSize( const double& variable )
+    {
+        return sizeof(uint64_t);
+    }
+
+    template <> inline void loadAndIncrease( const double& variable, uint8_t*& mem )
+    {
+        *(uint64_t*)( &variable ) = *(uint64_t*)(mem);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const double& variable, uint8_t*& mem )
+    {
+        *(uint64_t*)(mem) = *(uint64_t*)( &variable );
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const double& variable, uint8_t* mem )
+    {
+        return *(uint64_t*)(mem) == *(uint64_t*)( &variable );
+    }
+
+// =========== long double
+
+    template <> inline uint32_t returnSize( const long double& variable )
+    {
+        return sizeof(uint64_t);
+    }
+
+    template <> inline void loadAndIncrease( const long double& variable, uint8_t*& mem )
+    {
+        double temp;
+        memcpy(&temp, mem, sizeof(uint64_t));
+        *(long double*)( &variable ) = static_cast<const long double>(temp);
+        mem += returnSize( variable );
+    }
+
+    template <> inline void saveAndIncrease( const long double& variable, uint8_t*& mem )
+    {
+        double temp = static_cast<double>(variable);
+        memcpy(mem, &temp, sizeof(uint64_t));
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const long double& variable, uint8_t* mem )
+    {
+        double temp = static_cast<double>(variable);
+        return memcmp(&temp, mem, sizeof(uint64_t))==0;
+    }
+
+// =========== string
+
+    template <> inline uint32_t returnSize( const std::string& variable )
+    {
+        return variable.length()+1;
+    }
+
+    template <> inline void saveAndIncrease( const std::string& variable, uint8_t*& mem )
+    {
+        memcpy(mem, variable.c_str(), variable.length()+1);
+        mem += variable.length()+1;
+    }
+
+    template <> inline void loadAndIncrease( const std::string& variable, uint8_t*& mem )
+    {
+        *(std::string*)( &variable ) = (const char *)mem;
+        mem += variable.length()+1;
+    }
+
+    template <> inline bool checkEquality( const std::string& variable, uint8_t* mem )
+    {
+        //return std::string((const char*)mem)==variable;
+        return (const char*)mem==variable;
+    }
+
+// =========== Degree
+
+    template <> inline uint32_t returnSize( const Degree& variable )
+    {
+        return sizeof(Ogre::Real);
+    }
+
+    template <> inline void saveAndIncrease( const Degree& variable, uint8_t*& mem )
+    {
+        Ogre::Real r = variable.valueDegrees();
+        memcpy(mem, &r, returnSize( variable ));
+        mem += returnSize( variable );
+    }
+
+    template <> inline void loadAndIncrease( const Degree& variable, uint8_t*& mem )
+    {
+        Ogre::Real* r = (Ogre::Real*)mem;
+        (Degree&)variable = *r;
+        mem += returnSize( variable );
+    }
+
+     template <> inline bool checkEquality( const Degree& variable, uint8_t* mem )
+    {
+        Ogre::Real* r = (Ogre::Real*)mem;
+        return variable==Degree(*r);
+    }
+
+// =========== Radian
+
+    template <> inline uint32_t returnSize( const Radian& variable )
+    {
+        return sizeof(Ogre::Real);
+    }
+
+    template <> inline void saveAndIncrease( const Radian& variable, uint8_t*& mem )
+    {
+        Ogre::Real r = variable.valueRadians();
+        memcpy(mem, &r, returnSize( variable ));
+        mem += returnSize( variable );
+    }
+
+    template <> inline void loadAndIncrease( const Radian& variable, uint8_t*& mem )
+    {
+        Ogre::Real* r = (Ogre::Real*)mem;
+        (Radian&)variable = *r;
+        mem += returnSize( variable );
+    }
+
+    template <> inline bool checkEquality( const Radian& variable, uint8_t* mem )
+    {
+        Ogre::Real* r = (Ogre::Real*)mem;
+        return variable==Degree(*r);
+    }
+    
+    
+}
+
+
+#endif
Index: /sandbox_light/src/libraries/util/SignalHandler.cc
===================================================================
--- /sandbox_light/src/libraries/util/SignalHandler.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/SignalHandler.cc	(revision 5788)
@@ -0,0 +1,330 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Christoph Renner
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the SignalHandler class.
+*/
+
+#include "SignalHandler.h"
+
+#include <iostream>
+#include <cstdlib>
+#include <cstring>
+#include "Debug.h"
+
+namespace orxonox
+{
+    SignalHandler* SignalHandler::singletonPtr_s = NULL;
+}
+
+#ifdef ORXONOX_PLATFORM_LINUX
+
+#include <wait.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+
+namespace orxonox
+{
+    /**
+     * register signal handlers for SIGSEGV and SIGABRT
+     * @param appName path to executable eg argv[0]
+     * @param filename filename to append backtrace to
+     */
+    void SignalHandler::doCatch( const std::string & appName, const std::string & filename )
+    {
+      this->appName = appName;
+      this->filename = filename;
+
+      // make sure doCatch is only called once without calling dontCatch
+      assert( sigRecList.size() == 0 );
+
+      catchSignal( SIGSEGV );
+      catchSignal( SIGABRT );
+      catchSignal( SIGILL );
+    }
+
+    /**
+     * restore previous signal handlers
+     */
+    void SignalHandler::dontCatch()
+    {
+      for ( SignalRecList::iterator it = sigRecList.begin(); it != sigRecList.end(); it++ )
+      {
+        signal( it->signal, it->handler );
+      }
+
+      sigRecList.clear();
+    }
+
+    /**
+     * catch signal sig
+     * @param sig signal to catch
+     */
+    void SignalHandler::catchSignal( int sig )
+    {
+      sig_t handler = signal( sig, SignalHandler::sigHandler );
+
+      assert( handler != SIG_ERR );
+
+      SignalRec rec;
+      rec.signal = sig;
+      rec.handler = handler;
+
+      sigRecList.push_front( rec );
+    }
+
+    /**
+     * sigHandler is called when receiving signals
+     * @param sig
+     */
+    void SignalHandler::sigHandler( int sig )
+    {
+      std::string sigName = "UNKNOWN";
+
+      switch ( sig )
+      {
+        case SIGSEGV:
+          sigName = "SIGSEGV";
+          break;
+        case SIGABRT:
+          sigName = "SIGABRT";
+          break;
+        case SIGILL:
+          sigName = "SIGILL";
+          break;
+      }
+      // if the signalhandler has already been destroyed then don't do anything
+      if( SignalHandler::singletonPtr_s == 0 )
+      {
+        COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "can't write backtrace because SignalHandler already destroyed" << std::endl;
+        exit(EXIT_FAILURE);
+      }
+
+      for ( SignalCallbackList::iterator it = SignalHandler::getInstance().callbackList.begin(); it != SignalHandler::getInstance().callbackList.end(); it++  )
+      {
+        (*(it->cb))( it->someData );
+      }
+
+
+      COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox_crash.log" << std::endl;
+
+      int sigPipe[2];
+      if ( pipe(sigPipe) == -1 )
+      {
+        perror("pipe failed!\n");
+        exit(EXIT_FAILURE);
+      }
+
+      int sigPid = fork();
+
+      if ( sigPid == -1 )
+      {
+        perror("fork failed!\n");
+        exit(EXIT_FAILURE);
+      }
+
+      // gdb will be attached to this process
+      if ( sigPid == 0 )
+      {
+        getInstance().dontCatch();
+        // wait for message from parent when it has attached gdb
+        int someData;
+
+        read( sigPipe[0], &someData, sizeof(someData) );
+
+        if ( someData != 0x12345678 )
+        {
+          COUT(0) << "something went wrong :(" << std::endl;
+        }
+
+        return;
+      }
+
+      int gdbIn[2];
+      int gdbOut[2];
+      int gdbErr[2];
+
+      if ( pipe(gdbIn) == -1 || pipe(gdbOut) == -1 || pipe(gdbErr) == -1 )
+      {
+        perror("pipe failed!\n");
+        kill( sigPid, SIGTERM );
+        waitpid( sigPid, NULL, 0 );
+        exit(EXIT_FAILURE);
+      }
+
+      int gdbPid = fork();
+      // this process will run gdb
+
+      if ( gdbPid == -1 )
+      {
+        perror("fork failed\n");
+        kill( sigPid, SIGTERM );
+        waitpid( sigPid, NULL, 0 );
+        exit(EXIT_FAILURE);
+      }
+
+      if ( gdbPid == 0 )
+      {
+        // start gdb
+
+        close(gdbIn[1]);
+        close(gdbOut[0]);
+        close(gdbErr[0]);
+
+        dup2( gdbIn[0], STDIN_FILENO );
+        dup2( gdbOut[1], STDOUT_FILENO );
+        dup2( gdbErr[1], STDERR_FILENO );
+
+        execlp( "sh", "sh", "-c", "gdb", static_cast<void*>(NULL));
+      }
+
+      char cmd[256];
+      snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance().appName.c_str(), sigPid );
+      write( gdbIn[1], cmd, strlen(cmd) );
+
+      int charsFound = 0;
+      int promptFound = 0;
+      char byte;
+      while ( read( gdbOut[0], &byte, 1 ) == 1 )
+      {
+        if (
+          (charsFound == 0 && byte == '(') ||
+          (charsFound == 1 && byte == 'g') ||
+          (charsFound == 2 && byte == 'd') ||
+          (charsFound == 3 && byte == 'b') ||
+          (charsFound == 4 && byte == ')') ||
+          (charsFound == 5 && byte == ' ')
+            )
+              charsFound++;
+        else
+          charsFound = 0;
+
+        if ( charsFound == 6 )
+        {
+          promptFound++;
+          charsFound = 0;
+        }
+
+        if ( promptFound == 3 )
+        {
+          break;
+        }
+      }
+
+      int someData = 0x12345678;
+      write( sigPipe[1], &someData, sizeof(someData) );
+
+      write( gdbIn[1], "bt\nk\nq\n", 7 );
+
+
+      charsFound = 0;
+      promptFound = 0;
+      std::string bt;
+      while ( read( gdbOut[0], &byte, 1 ) == 1 )
+      {
+        bt += std::string( &byte, 1 );
+
+        if (
+          (charsFound == 0 && byte == '(') ||
+          (charsFound == 1 && byte == 'g') ||
+          (charsFound == 2 && byte == 'd') ||
+          (charsFound == 3 && byte == 'b') ||
+          (charsFound == 4 && byte == ')') ||
+          (charsFound == 5 && byte == ' ')
+            )
+              charsFound++;
+        else
+          charsFound = 0;
+
+        if ( charsFound == 6 )
+        {
+          promptFound++;
+          charsFound = 0;
+          bt += "\n";
+        }
+
+        if ( promptFound == 3 )
+        {
+          break;
+        }
+      }
+
+
+      waitpid( sigPid, NULL, 0 );
+      waitpid( gdbPid, NULL, 0 );
+
+      int wsRemoved = 0;
+
+      while ( wsRemoved < 2 && bt.length() > 0 )
+      {
+        if ( bt[1] == '\n' )
+          wsRemoved++;
+        bt.erase(0, 1);
+      }
+
+      if ( bt.length() > 0 )
+        bt.erase(0, 1);
+
+      time_t now = time(NULL);
+
+      std::string timeString =
+                         "=======================================================\n"
+                         "= time: " + std::string(ctime(&now)) +
+                         "=======================================================\n";
+      bt.insert(0, timeString);
+
+      FILE * f = fopen( getInstance().filename.c_str(), "w" );
+
+      if ( !f )
+      {
+        perror( ( std::string( "could not append to " ) + getInstance().filename ).c_str() );
+        exit(EXIT_FAILURE);
+      }
+
+      if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
+      {
+        COUT(0) << "could not write " << bt.length() << " byte to " << getInstance().filename << std::endl;
+        exit(EXIT_FAILURE);
+      }
+
+      exit(EXIT_FAILURE);
+    }
+
+    void SignalHandler::registerCallback( SignalCallback cb, void * someData )
+    {
+      SignalCallbackRec rec;
+      rec.cb = cb;
+      rec.someData = someData;
+
+      callbackList.push_back(rec);
+    }
+}
+
+#endif /* ORXONOX_PLATFORM_LINUX */
Index: /sandbox_light/src/libraries/util/SignalHandler.h
===================================================================
--- /sandbox_light/src/libraries/util/SignalHandler.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/SignalHandler.h	(revision 5788)
@@ -0,0 +1,118 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Christoph Renner
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Declaration of the SignalHandler class.
+*/
+
+#ifndef _SignalHandler_H__
+#define _SignalHandler_H__
+
+#include "UtilPrereqs.h"
+
+#include <cassert>
+#include <list>
+#include <string>
+#include "Singleton.h"
+
+namespace orxonox
+{
+    typedef int (*SignalCallback)( void * someData );
+}
+
+#ifdef ORXONOX_PLATFORM_LINUX
+#include <signal.h>
+
+namespace orxonox
+{
+    struct SignalRec
+    {
+        int signal;
+        sig_t handler;
+    };
+
+    struct SignalCallbackRec
+    {
+        SignalCallback cb;
+        void * someData;
+    };
+
+
+    typedef std::list<SignalRec> SignalRecList;
+    typedef std::list<SignalCallbackRec> SignalCallbackList;
+
+    class SignalHandler : public Singleton<SignalHandler>
+    {
+        friend class Singleton<SignalHandler>;
+    public:
+        SignalHandler()  { }
+        ~SignalHandler() { }
+
+        void registerCallback( SignalCallback cb, void * someData );
+
+        void doCatch( const std::string & appName, const std::string & filename );
+        void dontCatch();
+
+    private:
+        static void sigHandler( int sig );
+
+        void catchSignal( int sig );
+        SignalRecList sigRecList;
+
+        SignalCallbackList callbackList;
+
+        static SignalHandler* singletonPtr_s;
+
+        std::string appName;
+        std::string filename;
+    };
+}
+
+#else /* ORXONOX_PLATFORM_LINUX */
+
+namespace orxonox
+{
+    class _UtilExport SignalHandler : public Singleton<SignalHandler>
+    {
+        friend class Singleton<SignalHandler>;
+    public:
+        SignalHandler()  { }
+        ~SignalHandler() { }
+        void doCatch( const std::string & appName, const std::string & filename ) {}
+        void dontCatch() {}
+        void registerCallback( SignalCallback cb, void * someData ) {}
+
+    private:
+        static SignalHandler* singletonPtr_s;
+    };
+}
+
+#endif /* ORXONOX_PLATFORM_LINUX */
+
+#endif /* _SignalHandler_H__ */
Index: /sandbox_light/src/libraries/util/Singleton.h
===================================================================
--- /sandbox_light/src/libraries/util/Singleton.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/Singleton.h	(revision 5788)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef __Util_Singleton_H__
+#define __Util_Singleton_H__
+
+#include "UtilPrereqs.h"
+#include <cassert>
+
+namespace orxonox
+{
+    /**
+    @brief
+        Base for singleton classes.
+
+        Usage:
+        Inherit publicly from Singleton<MyClass> and provide access to
+        MyClass::singletonPtr_s.
+        This can easily be done with a friend declaration.
+    */
+    template <class T>
+    class Singleton
+    {
+    public:
+        //! Returns a reference to the singleton instance
+        static T& getInstance()
+        {
+            assert(T::singletonPtr_s != 0);
+            return *T::singletonPtr_s;
+        }
+
+    protected:
+        //! Constructor sets the singleton instance pointer
+        Singleton()
+        {
+            assert(T::singletonPtr_s == 0);
+            T::singletonPtr_s = static_cast<T*>(this);
+        }
+
+        //! Constructor resets the singleton instance pointer
+        ~Singleton()
+        {
+            assert(T::singletonPtr_s != 0);
+            T::singletonPtr_s = 0;
+        }
+
+    private:
+        Singleton(const Singleton& rhs); //!< Don't use (undefined)
+    };
+}
+
+#endif /* __Util_Singleton_H__ */
Index: /sandbox_light/src/libraries/util/Sleep.cc
===================================================================
--- /sandbox_light/src/libraries/util/Sleep.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/Sleep.cc	(revision 5788)
@@ -0,0 +1,85 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Implementation of three sleep functions. Avoids including windows.h
+*/
+
+#include "Sleep.h"
+#include "Debug.h"
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#undef min
+#undef max
+
+namespace orxonox
+{
+    void usleep(unsigned long microseconds)
+    {
+        //if (microseconds < 1000)
+        //    COUT(2) << "Warning: Windows cannot sleep less than 1ms, ignoring" << std::endl;
+        Sleep(microseconds / 1000);
+    }
+
+    void msleep(unsigned long milliseconds)
+    {
+        Sleep(milliseconds);
+    }
+
+    void sleep(unsigned long seconds)
+    {
+        Sleep(seconds * 1000);
+    }
+}
+
+#else /* Linux/Apple */
+#include <unistd.h>
+
+namespace orxonox
+{
+    void usleep(unsigned long usec)
+    {
+        ::usleep(usec);
+    }
+    void msleep(unsigned long msec)
+    {
+        ::usleep(msec * 1000);
+    }
+    void sleep(unsigned long sec)
+    {
+        ::usleep(sec * 1000000);
+    }
+}
+
+#endif
Index: /sandbox_light/src/libraries/util/Sleep.h
===================================================================
--- /sandbox_light/src/libraries/util/Sleep.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/Sleep.h	(revision 5788)
@@ -0,0 +1,50 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Functions declarations to make the current thread sleep.
+ */
+
+#ifndef _Sleep_H__
+#define _Sleep_H__
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    //! Makes the thread sleep for a few @a microseconds
+    _UtilExport void usleep(unsigned long microseconds);
+    //! Makes the thread sleep for a few @a milliseconds
+    _UtilExport void msleep(unsigned long milliseconds);
+    //! Makes the thread sleep for a few @a seconds
+    _UtilExport void sleep (unsigned long seconds);
+}
+
+#endif /* _Sleep_H__ */
Index: /sandbox_light/src/libraries/util/StringUtils.cc
===================================================================
--- /sandbox_light/src/libraries/util/StringUtils.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/StringUtils.cc	(revision 5788)
@@ -0,0 +1,513 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Benjamin Grauer
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of several string manipulation functions.
+*/
+
+#include "StringUtils.h"
+
+#include <cctype>
+#include "Convert.h"
+#include "Math.h"
+
+namespace orxonox
+{
+    std::string BLANKSTRING("");
+
+    std::string getUniqueNumberString()
+    {
+        return multi_cast<std::string>(getUniqueNumber());
+    }
+
+    /**
+        @brief Removes all whitespaces from a string.
+        @param str The string to strip
+    */
+    void strip(std::string* str)
+    {
+        size_t pos;
+        while ((pos = (*str).find(" ")) < (*str).length())
+            (*str).erase(pos, 1);
+        while ((pos = (*str).find("\t")) < (*str).length())
+            (*str).erase(pos, 1);
+        while ((pos = (*str).find("\n")) < (*str).length())
+            (*str).erase(pos, 1);
+    }
+
+    /**
+        @brief Returns a copy of a string without whitespaces.
+        @param str The string to strip
+        @return The stripped line
+    */
+    std::string getStripped(const std::string& str)
+    {
+        std::string output = std::string(str);
+        strip(&output);
+        return output;
+    }
+
+    /**
+        @brief Returns a copy of a string without trailing whitespaces.
+        @param str The string
+        @return The modified copy
+    */
+    std::string removeTrailingWhitespaces(const std::string& str)
+    {
+        size_t pos1 = 0;
+        int pos2 = static_cast<int>(str.size() - 1);
+        for (; pos1 < str.size() && (str[pos1] == ' ' || str[pos1] == '\t' || str[pos1] == '\n'); pos1++);
+        for (; pos2 > 0         && (str[pos2] == ' ' || str[pos2] == '\t' || str[pos2] == '\n'); pos2--);
+        return str.substr(pos1, pos2 - pos1 + 1);
+    }
+
+    /**
+        @brief Returns the position of the next quote in the string, starting with start.
+        @param str The string
+        @param start The startposition
+        @return The position of the next quote (std::string::npos if there is no next quote)
+    */
+    size_t getNextQuote(const std::string& str, size_t start)
+    {
+        size_t quote = start - 1;
+
+        while ((quote = str.find('\"', quote + 1)) != std::string::npos)
+        {
+            size_t backslash = quote;
+            size_t numbackslashes = 0;
+            for (; backslash > 0; backslash--, numbackslashes++)
+                if (str[backslash - 1] != '\\')
+                    break;
+
+            if (numbackslashes % 2 == 0)
+                break;
+        }
+
+        return quote;
+    }
+
+    /**
+        @brief Returns true if pos is between two quotes.
+        @param str The string
+        @param pos The position to check
+        @return True if pos is between two quotes
+    */
+    bool isBetweenQuotes(const std::string& str, size_t pos)
+    {
+        if (pos == std::string::npos)
+            return false;
+
+        size_t quotecount = 0;
+        size_t quote = static_cast<size_t>(-1);
+        while ((quote = getNextQuote(str, quote + 1)) < pos)
+        {
+            if (quote == pos)
+                return false;
+            quotecount++;
+        }
+
+        if (quote == std::string::npos)
+            return false;
+
+        return ((quotecount % 2) == 1);
+    }
+
+    /**
+        @brief Returns true if the string contains something like '..."between quotes"...'.
+        @param The string
+        @return True if there is something between quotes
+    */
+    bool hasStringBetweenQuotes(const std::string& str)
+    {
+        size_t pos1 = getNextQuote(str, 0);
+        size_t pos2 = getNextQuote(str, pos1 + 1);
+        return (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1);
+    }
+
+    /**
+        @brief If the string contains something like '..."between quotes"...' then 'between quotes' gets returned (without quotes).
+        @param The string
+        @param The string between the quotes
+    */
+    std::string getStringBetweenQuotes(const std::string& str)
+    {
+        size_t pos1 = getNextQuote(str, 0);
+        size_t pos2 = getNextQuote(str, pos1 + 1);
+        if (pos1 != std::string::npos && pos2 != std::string::npos)
+            return str.substr(pos1, pos2 - pos1 + 1);
+        else
+            return "";
+    }
+
+    /**
+        @brief Removes enclosing quotes if available (including whitespaces at the outside of the quotes).
+        @brief str The string to strip
+        @return The string with removed quotes
+    */
+    std::string stripEnclosingQuotes(const std::string& str)
+    {
+        size_t start = std::string::npos;
+        size_t end = 0;
+
+        for (size_t pos = 0; (pos < str.size()) && (pos < std::string::npos); pos++)
+        {
+            if (str[pos] == '"')
+            {
+                start = pos;
+                break;
+            }
+
+            if ((str[pos] != ' ') && (str[pos] != '\t') && (str[pos] != '\n'))
+                return str;
+        }
+
+        for (size_t pos = str.size() - 1; pos < std::string::npos; pos--)
+        {
+            if (str[pos] == '"')
+            {
+                end = pos;
+                break;
+            }
+
+            if ((str[pos] != ' ') && (str[pos] != '\t') && (str[pos] != '\n'))
+                return str;
+        }
+
+        if ((start != std::string::npos) && (end != 0))
+            return str.substr(start + 1, end - start - 1);
+        else
+            return str;
+    }
+
+    /**
+        @brief Removes enclosing {braces} (braces must be exactly on the beginning and the end of the string).
+        @param str The string to strip
+        @return The striped string
+    */
+    std::string stripEnclosingBraces(const std::string& str)
+    {
+        std::string output = str;
+
+        while (output.size() >= 2 && output[0] == '{' && output[output.size() - 1] == '}')
+            output = output.substr(1, output.size() - 2);
+
+        return output;
+    }
+
+    /**
+        @brief Determines if a string is a comment (starts with a comment-symbol).
+        @param str The string to check
+        @return True = it's a comment
+
+        A comment is defined by a leading '#', '%', ';' or '//'.
+    */
+    bool isComment(const std::string& str)
+    {
+        // Strip the line, whitespaces are disturbing
+        std::string teststring = getStripped(str);
+
+        // There are four possible comment-symbols:
+        //  1) #comment in script-language style
+        //  2) %comment in matlab style
+        //  3) ;comment in unreal tournament config-file style
+        //  4) //comment in code style
+        if (teststring.size() >= 2)
+        {
+            if (teststring[0] == '#' || teststring[0] == '%' || teststring[0] == ';' || (teststring[0] == '/' && teststring[1] == '/'))
+                return true;
+        }
+        else if (teststring.size() == 1)
+        {
+            if (teststring[0] == '#' || teststring[0] == '%' || teststring[0] == ';')
+                return true;
+        }
+
+        return false;
+    }
+
+    /**
+        @brief Determines if a string is empty (contains only whitespaces).
+        @param str The string to check
+        @return True = it's empty
+    */
+    bool isEmpty(const std::string& str)
+    {
+        std::string temp = getStripped(str);
+        return ((temp == "") || (temp.size() == 0));
+    }
+
+    /**
+        @brief Determines if a string contains only numbers and maximal one '.'.
+        @param str The string to check
+        @return True = it's a number
+    */
+    bool isNumeric(const std::string& str)
+    {
+        bool foundPoint = false;
+
+        for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)
+        {
+            if (((*it) < '0' || (*it) > '9'))
+            {
+                if ((*it) != '.' && !foundPoint)
+                    foundPoint = true;
+                else
+                    return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+        @brief Adds backslashes to the given string which makes special chars visible. Existing slashes will be doubled.
+        @param str The string to manipulate
+        @return The string with added slashes
+    */
+    std::string addSlashes(const std::string& str)
+    {
+        std::string output = str;
+
+        for (size_t pos = 0; (pos = output.find('\\', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\\"); }
+        for (size_t pos = 0; (pos = output.find('\n', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\n"); }
+        for (size_t pos = 0; (pos = output.find('\t', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\t"); }
+        for (size_t pos = 0; (pos = output.find('\v', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\v"); }
+        for (size_t pos = 0; (pos = output.find('\b', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\b"); }
+        for (size_t pos = 0; (pos = output.find('\r', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\r"); }
+        for (size_t pos = 0; (pos = output.find('\f', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\f"); }
+        for (size_t pos = 0; (pos = output.find('\a', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\a"); }
+        for (size_t pos = 0; (pos = output.find('"', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\""); }
+        for (size_t pos = 0; (pos = output.find('\0', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\0"); }
+
+        return output;
+    }
+
+    /**
+        @brief Removes backslashes from the given string. Double backslashes are interpreted as one backslash.
+        @param str The string to manipulate
+        @return The string with removed slashes
+    */
+    std::string removeSlashes(const std::string& str)
+    {
+        if (str.size() <= 1)
+            return str;
+
+        std::string output = "";
+        for (size_t pos = 0; pos < str.size() - 1; )
+        {
+            if (str[pos] == '\\')
+            {
+                if (str[pos + 1] == '\\') { output += '\\'; pos += 2; continue; }
+                else if (str[pos + 1] == 'n') { output += '\n'; pos += 2; continue; }
+                else if (str[pos + 1] == 't') { output += '\t'; pos += 2; continue; }
+                else if (str[pos + 1] == 'v') { output += '\v'; pos += 2; continue; }
+                else if (str[pos + 1] == 'b') { output += '\b'; pos += 2; continue; }
+                else if (str[pos + 1] == 'r') { output += '\r'; pos += 2; continue; }
+                else if (str[pos + 1] == 'f') { output += '\f'; pos += 2; continue; }
+                else if (str[pos + 1] == 'a') { output += '\a'; pos += 2; continue; }
+                else if (str[pos + 1] == '"') { output += '"'; pos += 2; continue; }
+                else if (str[pos + 1] == '0') { output += '\0'; pos += 2; continue; }
+            }
+            output += str[pos];
+            pos++;
+            if (pos == str.size() - 1)
+                output += str[pos];
+        }
+
+        return output;
+    }
+
+    /**
+        @brief Replaces each char between A and Z with its lowercase equivalent.
+        @param str The string to convert
+    */
+    void lowercase(std::string* str)
+    {
+        for (size_t i = 0; i < str->size(); ++i)
+        {
+            (*str)[i] = static_cast<char>(tolower((*str)[i]));
+        }
+    }
+
+    /**
+        @brief Returns a copy of the given string without uppercase chars.
+        @param str The string
+        @return The copy
+    */
+    std::string getLowercase(const std::string& str)
+    {
+        std::string output = std::string(str);
+        lowercase(&output);
+        return output;
+    }
+
+    /**
+        @brief Replaces each char between a and z with its uppercase equivalent.
+        @param str The string to convert
+    */
+    void uppercase(std::string* str)
+    {
+        for (size_t i = 0; i < str->size(); ++i)
+        {
+            (*str)[i] = static_cast<char>(toupper((*str)[i]));
+        }
+    }
+
+    /**
+        @brief Returns a copy of the given string without lowercase chars.
+        @param str The string
+        @return The copy
+    */
+    std::string getUppercase(const std::string& str)
+    {
+        std::string output = std::string(str);
+        uppercase(&output);
+        return output;
+    }
+
+    /**
+        @brief Compares two strings ignoring different casing.
+        @param s1 First string
+        @param s2 Second string
+    */
+    int nocaseCmp(const std::string& s1, const std::string& s2)
+    {
+        std::string::const_iterator it1=s1.begin();
+        std::string::const_iterator it2=s2.begin();
+
+        //stop when either string's end has been reached
+        while ( (it1!=s1.end()) && (it2!=s2.end()) )
+        {
+            if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
+                // return -1 to indicate smaller than, 1 otherwise
+                return (::toupper(*it1)  < ::toupper(*it2)) ? -1 : 1;
+            //proceed to the next character in each string
+            ++it1;
+            ++it2;
+        }
+        size_t size1=s1.size(), size2=s2.size();// cache lengths
+        //return -1,0 or 1 according to strings' lengths
+        if (size1==size2)
+            return 0;
+        return (size1<size2) ? -1 : 1;
+    }
+
+
+    /**
+        @brief Compares the first 'len' chars of two strings ignoring different casing.
+        @param s1 First string
+        @param s2 Second string
+        @param len Maximal number of chars to compare
+    */
+    int nocaseCmp(const std::string& s1, const std::string& s2, size_t len)
+    {
+        if (len == 0)
+            return 0;
+        std::string::const_iterator it1=s1.begin();
+        std::string::const_iterator it2=s2.begin();
+
+        //stop when either string's end has been reached
+        while ( (it1!=s1.end()) && (it2!=s2.end()) && len-- > 0)
+        {
+            if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
+                // return -1 to indicate smaller than, 1 otherwise
+                return (::toupper(*it1)  < ::toupper(*it2)) ? -1 : 1;
+            //proceed to the next character in each string
+            ++it1;
+            ++it2;
+        }
+        return 0;
+    }
+
+    /**
+        @brief Returns true if the string contains a comment, introduced by #, %, ; or //.
+        @param str The string
+        @return True if the string contains a comment
+    */
+    bool hasComment(const std::string& str)
+    {
+        return (getCommentPosition(str) != std::string::npos);
+    }
+
+    /**
+        @brief If the string contains a comment, the comment gets returned (including the comment symbol), an empty string otherwise.
+        @param str The string
+        @return The comment
+    */
+    std::string getComment(const std::string& str)
+    {
+        return str.substr(getCommentPosition(str));
+    }
+
+    /**
+        @brief If the string contains a comment, the position of the comment-symbol gets returned, std::string::npos otherwise.
+        @param str The string
+        @return The position
+    */
+    size_t getCommentPosition(const std::string& str)
+    {
+        return getNextCommentPosition(str, 0);
+    }
+
+    /**
+        @brief Returns the position of the next comment-symbol, starting with start.
+        @param str The string
+        @param start The startposition
+        @return The position
+    */
+    size_t getNextCommentPosition(const std::string& str, size_t start)
+    {
+        for (size_t i = start; i < str.size(); i++)
+            if (isComment(str.substr(i)))
+                return i;
+
+        return std::string::npos;
+    }
+
+    /**
+        @brief Replaces individual charaters
+        @param str String to be manipulated
+        @param target Character to be replaced
+        @param replacement Replacement character
+        @return Number of replacements
+    */
+    _UtilExport size_t replaceCharacters(std::string& str, char target, char replacement)
+    {
+        size_t j = 0;
+        for (size_t i = 0; i < str.size(); ++i)
+        {
+            if (str[i] == target)
+            {
+                str[i] = replacement;
+                ++j;
+            }
+        }
+        return j;
+    }
+}
Index: /sandbox_light/src/libraries/util/StringUtils.h
===================================================================
--- /sandbox_light/src/libraries/util/StringUtils.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/StringUtils.h	(revision 5788)
@@ -0,0 +1,83 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Declaration of several string manipulation functions, used in many parts of the game.
+*/
+
+#ifndef _StringUtils_H__
+#define _StringUtils_H__
+
+#include "UtilPrereqs.h"
+#include <string>
+
+namespace orxonox
+{
+    extern _UtilExport std::string BLANKSTRING;
+    _UtilExport std::string getUniqueNumberString();
+
+    _UtilExport void        strip(std::string* str);
+    _UtilExport std::string getStripped(const std::string& str);
+
+    _UtilExport std::string removeTrailingWhitespaces(const std::string& str);
+
+    _UtilExport size_t      getNextQuote(const std::string& str, size_t start);
+    _UtilExport bool        isBetweenQuotes(const std::string& str, size_t pos);
+
+    _UtilExport bool        hasStringBetweenQuotes(const std::string& str);
+    _UtilExport std::string getStringBetweenQuotes(const std::string& str);
+
+    _UtilExport std::string stripEnclosingQuotes(const std::string& str);
+    _UtilExport std::string stripEnclosingBraces(const std::string& str);
+
+    _UtilExport bool        isEmpty(const std::string& str);
+    _UtilExport bool        isComment(const std::string& str);
+    _UtilExport bool        isNumeric(const std::string& str);
+
+    _UtilExport std::string addSlashes(const std::string& str);
+    _UtilExport std::string removeSlashes(const std::string& str);
+
+    _UtilExport void        lowercase(std::string* str);
+    _UtilExport std::string getLowercase(const std::string& str);
+
+    _UtilExport void        uppercase(std::string* str);
+    _UtilExport std::string getUppercase(const std::string& str);
+
+    _UtilExport int         nocaseCmp(const std::string& s1, const std::string& s2);
+    _UtilExport int         nocaseCmp(const std::string& s1, const std::string& s2, size_t len);
+
+    _UtilExport bool        hasComment(const std::string& str);
+    _UtilExport std::string getComment(const std::string& str);
+    _UtilExport size_t      getCommentPosition(const std::string& str);
+    _UtilExport size_t      getNextCommentPosition(const std::string& str, size_t start = 0);
+
+    _UtilExport size_t      replaceCharacters(std::string& str, char target, char replacement);
+}
+
+#endif /* _StringUtils_H__ */
Index: /sandbox_light/src/libraries/util/SubString.cc
===================================================================
--- /sandbox_light/src/libraries/util/SubString.cc	(revision 5788)
+++ /sandbox_light/src/libraries/util/SubString.cc	(revision 5788)
@@ -0,0 +1,564 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Christian Meyer
+ *   Co-authors:
+ *      Benjamin Grauer
+ *
+
+//
+//  splitLine
+//  STL string tokenizer
+//
+//  Created by Clemens Wacha.
+//  Version 1.0
+//  Copyright (c) 2005 Clemens Wacha. All rights reserved.
+//
+
+ *   Extended by Fabian 'x3n' Landau by the SL_PARENTHESES mode.
+ */
+
+#include "SubString.h"
+#include <cstdio>
+
+namespace orxonox
+{
+    /**
+     * @brief default constructor
+     */
+    SubString::SubString()
+    {}
+
+
+    /**
+     * @brief create a SubString from
+     * @param string the String to Split
+     * @param delimiter the Character at which to split string (delimiter)
+     */
+    SubString::SubString(const std::string& string, char delimiter)
+    {
+        this->split(string, delimiter);
+    }
+
+
+    /**
+     * @brief Splits a String into multiple splitters.
+     * @param string the String to split
+     * @param delimiters multiple set of characters at what to split. (delimiters)
+     * @param delimiterNeighbours neighbours of the delimiters, that will be erased only when near a delimiter.
+     * @param emptyEntries If empty entries should be allewed or removed.
+     * @param escapeChar The Escape Character that overrides splitters commends and so on...
+     * @param safemode_char within these characters splitting won't happen
+     * @param comment_char the Comment character.
+     */
+    SubString::SubString(const std::string& string,
+                         const std::string& delimiters, const std::string& delimiterNeighbours, bool emptyEntries,
+                         char escapeChar, bool removeEscapeChar, char safemode_char, bool removeSafemodeChar,
+                         char openparenthesis_char, char closeparenthesis_char, bool removeParenthesisChars, char comment_char)
+    {
+        SubString::splitLine(this->strings, this->bInSafemode, string, delimiters, delimiterNeighbours, emptyEntries, escapeChar, removeEscapeChar, safemode_char, removeSafemodeChar, openparenthesis_char, closeparenthesis_char, removeParenthesisChars, comment_char);
+    }
+
+    /**
+     * @brief creates a SubSet of a SubString.
+     * @param subString the SubString to take a set from.
+     * @param subSetBegin the beginning to the end
+     */
+    SubString::SubString(const SubString& subString, unsigned int subSetBegin)
+    {
+        for (unsigned int i = subSetBegin; i < subString.size(); i++)
+        {
+            this->strings.push_back(subString[i]);
+            this->bInSafemode.push_back(subString.isInSafemode(i));
+        }
+    }
+
+
+    /**
+     * @brief creates a SubSet of a SubString.
+     * @param subString the SubString to take a Set from
+     * @param subSetBegin the beginning to the end
+     * @param subSetEnd the end of the SubSet (max subString.size() will be checked internaly)
+     */
+    SubString::SubString(const SubString& subString, unsigned int subSetBegin, unsigned int subSetEnd)
+    {
+        for (unsigned int i = subSetBegin; i < subString.size() && i < subSetEnd; i++)
+        {
+            this->strings.push_back(subString[i]);
+            this->bInSafemode.push_back(subString.isInSafemode(i));
+        }
+    }
+
+    /**
+     * @brief creates a Substring from a count and values set.
+     * @param argc: the Arguments Count.
+     * @param argv: Argument Values.
+     */
+    SubString::SubString(unsigned int argc, const char** argv)
+    {
+        for(unsigned int i = 0; i < argc; ++i)
+        {
+            this->strings.push_back(std::string(argv[i]));
+            this->bInSafemode.push_back(false);
+        }
+    }
+
+    /**
+     * @brief removes the object from memory
+     */
+    SubString::~SubString()
+    { }
+
+    /** @brief An empty String */
+    // const std::string SubString::emptyString = "";
+    /** @brief Helper that gets you a String consisting of all White Spaces */
+    const std::string SubString::WhiteSpaces = " \n\t";
+    /** @brief Helper that gets you a String consisting of all WhiteSpaces and the Comma */
+    const std::string SubString::WhiteSpacesWithComma = " \n\t,";
+    /** An Empty SubString */
+    const SubString SubString::NullSubString = SubString();
+
+    /**
+     * @brief stores the Value of subString in this SubString
+     * @param subString will be copied into this String.
+     * @returns this SubString.
+     */
+    SubString& SubString::operator=(const SubString& subString)
+    {
+        this->strings = subString.strings;
+        this->bInSafemode = subString.bInSafemode;
+        return *this;
+    }
+
+
+    /**
+     * @brief comparator.
+     * @param subString the SubString to compare against this one.
+     * @returns true if the Stored Strings match
+     */
+    bool SubString::operator==(const SubString& subString) const
+    {
+        return ((this->strings == subString.strings) && (this->bInSafemode == subString.bInSafemode));
+    }
+
+    /**
+     * @brief comparator.
+     * @param subString the SubString to compare against this one.
+     * @returns true if the Stored Strings match
+     */
+    bool SubString::compare(const SubString& subString) const
+    {
+        return (*this == subString);
+    }
+
+    /**
+     * @brief comparator.
+     * @param subString the SubString to compare against this one.
+     * @param length how many entries to compare. (from 0 to length)
+     * @returns true if the Stored Strings match
+     */
+    bool SubString::compare(const SubString& subString, unsigned int length) const
+    {
+        if (length > this->size() || length > subString.size())
+            return false;
+
+        for (unsigned int i = 0; i < length; i++)
+            if ((this->strings[i] != subString.strings[i]) || (this->bInSafemode[i] != subString.bInSafemode[i]))
+                return false;
+        return true;
+    }
+
+
+    /**
+     * @brief append operator
+     * @param subString the String to append.
+     * @returns a SubString where this and subString are appended.
+     */
+    SubString SubString::operator+(const SubString& subString) const
+    {
+        return SubString(*this) += subString;
+    }
+
+
+    /**
+     * @brief append operator.
+     * @param subString append subString to this SubString.
+     * @returns this substring appended with subString
+     */
+    SubString& SubString::operator+=(const SubString& subString)
+    {
+        for (unsigned int i = 0; i < subString.size(); i++)
+        {
+            this->strings.push_back(subString[i]);
+            this->bInSafemode.push_back(subString.isInSafemode(i));
+        }
+        return *this;
+    }
+
+
+    /**
+     * @brief Split the String at
+     * @param string where to split
+     * @param splitter delimiter.
+     */
+    unsigned int SubString::split(const std::string& string, char splitter)
+    {
+        this->strings.clear();
+        this->bInSafemode.clear();
+        char split[2];
+        split[0] = splitter;
+        split[1] = '\0';
+        SubString::splitLine(this->strings, this->bInSafemode, string, split);
+        return strings.size();
+    }
+
+
+    /**
+     * @brief Splits a String into multiple splitters.
+     * @param string the String to split
+     * @param delimiters multiple set of characters at what to split. (delimiters)
+     * @param delimiterNeighbours: Neighbours to the Delimiters that will be erased too.
+     * @param emptyEntries: If empty entries are added to the List of SubStrings
+     * @param escapeChar The Escape Character that overrides splitters commends and so on...
+     * @param safemode_char within these characters splitting won't happen
+     * @param comment_char the Comment character.
+     */
+    unsigned int SubString::split(const std::string& string,
+                                  const std::string& delimiters, const std::string& delimiterNeighbours, bool emptyEntries,
+                                  char escapeChar, bool removeExcapeChar, char safemode_char, bool removeSafemodeChar,
+                                  char openparenthesis_char, char closeparenthesis_char, bool removeParenthesisChars, char comment_char)
+    {
+        this->strings.clear();
+        this->bInSafemode.clear();
+        SubString::splitLine(this->strings, this->bInSafemode, string, delimiters, delimiterNeighbours, emptyEntries, escapeChar, removeExcapeChar, safemode_char, removeSafemodeChar, openparenthesis_char, closeparenthesis_char, removeParenthesisChars, comment_char);
+        return this->strings.size();
+    }
+
+
+    /**
+     * @brief joins together all Strings of this Substring.
+     * @param delimiter the String between the subStrings.
+     * @returns the joined String.
+     */
+    std::string SubString::join(const std::string& delimiter) const
+    {
+        if (!this->strings.empty())
+        {
+            std::string retVal = this->strings[0];
+            for (unsigned int i = 1; i < this->strings.size(); i++)
+                retVal += delimiter + this->strings[i];
+            return retVal;
+        }
+        else
+        {
+            static std::string empty;
+            return empty;
+        }
+    }
+
+
+    /**
+     * @brief creates a SubSet of a SubString.
+     * @param subSetBegin the beginning to the end
+     * @returns the SubSet
+     *
+     * This function is added for your convenience, and does the same as
+     * SubString::SubString(const SubString& subString, unsigned int subSetBegin)
+     */
+    SubString SubString::subSet(unsigned int subSetBegin) const
+    {
+        return SubString(*this, subSetBegin);
+    }
+
+
+    /**
+     * @brief creates a SubSet of a SubString.
+     * @param subSetBegin the beginning to
+     * @param subSetEnd the end of the SubSet to select (if bigger than subString.size() it will be downset.)
+     * @returns the SubSet
+     *
+     * This function is added for your convenience, and does the same as
+     * SubString::SubString(const SubString& subString, unsigned int subSetBegin)
+     */
+    SubString SubString::subSet(unsigned int subSetBegin, unsigned int subSetEnd) const
+    {
+        return SubString(*this, subSetBegin, subSetEnd);
+    }
+
+
+    /**
+     * @brief splits line into tokens and stores them in ret.
+     * @param ret the Array, where the Splitted strings will be stored in
+     * to the beginning of the current token is stored
+     * @param line the inputLine to split
+     * @param delimiters a String of Delimiters (here the input will be splitted)
+     * @param delimiterNeighbours Naighbours to the Delimitter, that will be removed if they are to the left or the right of a Delimiter.
+     * @param emptyEntries: if empty Strings are added to the List of Strings.
+     * @param escape_char: Escape carater (escapes splitters)
+     * @param safemode_char: the beginning of the safemode is marked with this
+     * @param removeSafemodeChar removes the safemode_char from the beginning and the ending of a token
+     * @param openparenthesis_char the beginning of a safemode is marked with this
+     * @param closeparenthesis_char the ending of a safemode is marked with this
+     * @param removeParenthesisChars removes the parenthesis from the beginning and the ending of a token
+     * @param comment_char: the beginning of a comment is marked with this: (until the end of a Line)
+     * @param start_state: the Initial state on how to parse the String.
+     * @return SPLIT_LINE_STATE the parser was in when returning
+     *
+     * This is the Actual Splitting Algorithm from Clemens Wacha
+     * Supports delimiters, escape characters,
+     * ignores special  characters between safemode_char and between comment_char and linend '\n'.
+     */
+    SubString::SPLIT_LINE_STATE
+    SubString::splitLine(std::vector<std::string>& ret,
+                         std::vector<bool>& bInSafemode,
+                         const std::string& line,
+                         const std::string& delimiters,
+                         const std::string& delimiterNeighbours,
+                         bool emptyEntries,
+                         char escape_char,
+                         bool removeExcapeChar,
+                         char safemode_char,
+                         bool removeSafemodeChar,
+                         char openparenthesis_char,
+                         char closeparenthesis_char,
+                         bool removeParenthesisChars,
+                         char comment_char,
+                         SPLIT_LINE_STATE start_state)
+    {
+        SPLIT_LINE_STATE state = start_state;
+        unsigned int i = 0;
+        unsigned int fallBackNeighbours = 0;
+
+        std::string token;
+        bool inSafemode = false;
+
+        if(start_state != SL_NORMAL && ret.size() > 0)
+        {
+            token = ret[ret.size()-1];
+            ret.pop_back();
+        }
+        if(start_state != SL_NORMAL && bInSafemode.size() > 0)
+        {
+            inSafemode = bInSafemode[bInSafemode.size()-1];
+            bInSafemode.pop_back();
+        }
+
+        while(i < line.size())
+        {
+            switch(state)
+            {
+            case SL_NORMAL:
+                if(line[i] == escape_char)
+                {
+                    state = SL_ESCAPE;
+                    if (!removeExcapeChar)
+                        token += line[i];
+                }
+                else if(line[i] == safemode_char)
+                {
+                    state = SL_SAFEMODE;
+                    inSafemode = true;
+                    if (!removeSafemodeChar)
+                        token += line[i];
+                }
+                else if(line[i] == openparenthesis_char)
+                {
+                    state = SL_PARENTHESES;
+                    inSafemode = true;
+                    if (!removeParenthesisChars)
+                        token += line[i];
+                }
+                else if(line[i] == comment_char)
+                {
+                    if (fallBackNeighbours > 0)
+                        token = token.substr(0, token.size() - fallBackNeighbours);
+                    /// FINISH
+                    if(emptyEntries || token.size() > 0)
+                    {
+                        ret.push_back(token);
+                        token.clear();
+                        bInSafemode.push_back(inSafemode);
+                        inSafemode = false;
+                    }
+                    token += line[i];       // EAT
+                    state = SL_COMMENT;
+                }
+                else if(delimiters.find(line[i]) != std::string::npos)
+                {
+                    // line[i] is a delimiter
+                    if (fallBackNeighbours > 0)
+                        token = token.substr(0, token.size() - fallBackNeighbours);
+                    /// FINISH
+                    if(emptyEntries || token.size() > 0)
+                    {
+                        ret.push_back(token);
+                        token.clear();
+                        bInSafemode.push_back(inSafemode);
+                        inSafemode = false;
+                    }
+                    state = SL_NORMAL;
+                }
+                else
+                {
+                    if (delimiterNeighbours.find(line[i]) != std::string::npos)
+                    {
+                        if (token.size() > 0)
+                            ++fallBackNeighbours;
+                        else
+                        {
+                            i++;
+                            continue;
+                        }
+                    }
+                    else
+                        fallBackNeighbours = 0;
+                    token += line[i];       // EAT
+                }
+                break;
+            case SL_ESCAPE:
+                if (!removeSafemodeChar)
+                    token += line[i];
+                else
+                {
+                    if(line[i] == 'n') token += '\n';
+                    else if(line[i] == 't') token += '\t';
+                    else if(line[i] == 'v') token += '\v';
+                    else if(line[i] == 'b') token += '\b';
+                    else if(line[i] == 'r') token += '\r';
+                    else if(line[i] == 'f') token += '\f';
+                    else if(line[i] == 'a') token += '\a';
+                    else if(line[i] == '?') token += '\?';
+                    else token += line[i];  // EAT
+                }
+                state = SL_NORMAL;
+                break;
+            case SL_SAFEMODE:
+                if(line[i] == safemode_char)
+                {
+                    state = SL_NORMAL;
+                    if (!removeSafemodeChar)
+                        token += line[i];
+                }
+                else if(line[i] == escape_char)
+                {
+                    state = SL_SAFEESCAPE;
+                }
+                else
+                {
+                    token += line[i];       // EAT
+                }
+                break;
+
+            case SL_SAFEESCAPE:
+                if(line[i] == 'n') token += '\n';
+                else if(line[i] == 't') token += '\t';
+                else if(line[i] == 'v') token += '\v';
+                else if(line[i] == 'b') token += '\b';
+                else if(line[i] == 'r') token += '\r';
+                else if(line[i] == 'f') token += '\f';
+                else if(line[i] == 'a') token += '\a';
+                else if(line[i] == '?') token += '\?';
+                else token += line[i];  // EAT
+                state = SL_SAFEMODE;
+                break;
+
+            case SL_PARENTHESES:
+                if(line[i] == closeparenthesis_char)
+                {
+                    state = SL_NORMAL;
+                    if (!removeParenthesisChars)
+                        token += line[i];
+                }
+                else if(line[i] == escape_char)
+                {
+                    state = SL_PARENTHESESESCAPE;
+                }
+                else
+                {
+                    token += line[i];       // EAT
+                }
+                break;
+
+            case SL_PARENTHESESESCAPE:
+                if(line[i] == 'n') token += '\n';
+                else if(line[i] == 't') token += '\t';
+                else if(line[i] == 'v') token += '\v';
+                else if(line[i] == 'b') token += '\b';
+                else if(line[i] == 'r') token += '\r';
+                else if(line[i] == 'f') token += '\f';
+                else if(line[i] == 'a') token += '\a';
+                else if(line[i] == '?') token += '\?';
+                else token += line[i];  // EAT
+                state = SL_PARENTHESES;
+                break;
+
+            case SL_COMMENT:
+                if(line[i] == '\n')
+                {
+                    /// FINISH
+                    if(token.size() > 0)
+                    {
+                        ret.push_back(token);
+                        token.clear();
+                        bInSafemode.push_back(inSafemode);
+                        inSafemode = false;
+                    }
+                    state = SL_NORMAL;
+                }
+                else
+                {
+                    token += line[i];       // EAT
+                }
+                break;
+
+            default:
+                // nothing
+                break;
+            }
+            i++;
+        }
+
+        /// FINISH
+        if (fallBackNeighbours > 0)
+            token = token.substr(0, token.size() - fallBackNeighbours);
+        if(emptyEntries || token.size() > 0)
+        {
+            ret.push_back(token);
+            token.clear();
+            bInSafemode.push_back(inSafemode);
+            inSafemode = false;
+        }
+        return(state);
+    }
+
+
+    /**
+     * @brief Some nice debug information about this SubString
+     */
+    void SubString::debug() const
+    {
+        printf("Substring-information::count=%d ::", this->strings.size());
+        for (unsigned int i = 0; i < this->strings.size(); i++)
+            printf("s%d='%s'::", i, this->strings[i].c_str());
+        printf("\n");
+    }
+}
Index: /sandbox_light/src/libraries/util/SubString.h
===================================================================
--- /sandbox_light/src/libraries/util/SubString.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/SubString.h	(revision 5788)
@@ -0,0 +1,176 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Christian Meyer
+ *   Co-authors:
+ *      Benjamin Grauer
+ *      Fabian 'x3n' Landau
+ *
+
+//  splitLine
+//  STL string tokenizer
+//
+//  Created by Clemens Wacha.
+//  Version 1.0
+//  Copyright (c) 2005 Clemens Wacha. All rights reserved.
+
+ *   Extended by Fabian 'x3n' Landau by the SL_PARENTHESES mode.
+ */
+
+ /*!
+ * @file
+ * @brief a small class to get the parts of a string separated by commas
+ *
+ * This class is also identified as a Tokenizer. It splits up one long
+ * String into multiple small ones by a designated Delimiter.
+ *
+ * Substring is Advanced, and it is possible, to split a string by ','
+ * but also removing leading and trailing spaces around the comma.
+ *
+ * @example
+ * Split the String std::string st = "1345, The new empire   , is , orxonox"
+ * is splitted with:
+ * SubString(st, ',', " \n\t")
+ * into
+ * "1345", "The new empire", "is", "orxonox"
+ * As you can see, the useless spaces around ',' were removed.
+ */
+
+#ifndef __SubString_H__
+#define __SubString_H__
+
+#include "UtilPrereqs.h"
+
+#include <vector>
+#include <string>
+
+namespace orxonox
+{
+    //! A class that can load one string and split it in multipe ones
+    /**
+     * SubString is a very Powerfull way to create a SubSet from a String
+     * It can be used, to Split strings append them and join them again.
+     */
+    class _UtilExport SubString
+    {
+    public:
+        //! An enumerator for the State the Parser is in
+        typedef enum {
+            SL_NORMAL,            //!< Normal state
+            SL_ESCAPE,            //!< After an escape character
+            SL_SAFEMODE,          //!< In safe mode (between "" mostly).
+            SL_SAFEESCAPE,        //!< In safe mode with the internal escape character, that escapes even the savemode character.
+            SL_COMMENT,           //!< In Comment mode.
+            SL_PARENTHESES,       //!< Between parentheses (usually '(' and ')')
+            SL_PARENTHESESESCAPE, //!< Between parentheses with the internal escape character, that escapes even the closing paranthesis character.
+        } SPLIT_LINE_STATE;
+
+
+    public:
+        SubString();
+        SubString(const std::string& string, char delimiter = ',');
+        SubString(const std::string& string,
+                  const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries=false,
+                  char escapeChar ='\\', bool removeEscapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true,
+                  char openparenthesis_char = '(', char closeparenthesis_char = ')',  bool removeParenthesisChars = true, char comment_char = '\0');
+        SubString(unsigned int argc, const char** argv);
+        /** @brief create a Substring as a copy of another one. @param subString the SubString to copy. */
+        SubString(const SubString& subString) { *this = subString; };
+        SubString(const SubString& subString, unsigned int subSetBegin);
+        SubString(const SubString& subString, unsigned int subSetBegin, unsigned int subSetEnd);
+        ~SubString();
+
+        // operate on the SubString
+        SubString& operator=(const SubString& subString);
+        bool operator==(const SubString& subString) const;
+        bool compare(const SubString& subString) const;
+        bool compare(const SubString& subString, unsigned int length) const;
+        SubString operator+(const SubString& subString) const;
+        SubString& operator+=(const SubString& subString);
+        /** @param subString the String to append @returns appended String. @brief added for convenience */
+        SubString& append(const SubString subString) { return (*this += subString); };
+
+        /////////////////////////////////////////
+        // Split and Join the any String. ///////
+        unsigned int split(const std::string& string = "", char delimiter = ',');
+        unsigned int split(const std::string& string,
+                           const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries = false,
+                           char escapeChar ='\\', bool removeExcapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true,
+                           char openparenthesis_char = '(', char closeparenthesis_char = ')',  bool removeParenthesisChars = true, char comment_char = '\0');
+        std::string join(const std::string& delimiter = " ") const;
+        ////////////////////////////////////////
+
+        // retrieve a SubSet from the String
+        SubString subSet(unsigned int subSetBegin) const;
+        SubString subSet(unsigned int subSetBegin, unsigned int subSetEnd) const;
+
+        // retrieve Information from within
+        /** @brief Returns true if the SubString is empty */
+        inline bool empty() const { return this->strings.empty(); };
+        /** @brief Returns the count of Strings stored in this substring */
+        inline unsigned int size() const { return this->strings.size(); };
+        /** @brief Returns the i'th string from the subset of Strings @param i the i'th String */
+        inline const std::string& operator[](unsigned int i) const { return this->strings[i]; };
+        /** @brief Returns the i'th string from the subset of Strings @param i the i'th String */
+        inline const std::string& getString(unsigned int i) const { return (*this)[i]; };
+        /** @brief Returns all Strings as std::vector */
+        inline const std::vector<std::string>& getAllStrings() const { return this->strings; }
+        /** @brief Returns true if the token is in safemode. @param i the i'th token */
+        inline bool isInSafemode(unsigned int i) const { return this->bInSafemode[i]; }
+        /** @brief Returns the front of the StringList. */
+        inline const std::string& front() const { return this->strings.front(); };
+        /** @brief Returns the back of the StringList. */
+        inline const std::string& back() const { return this->strings.back(); };
+        /** @brief removes the back of the strings list. */
+        inline void pop_back() { this->strings.pop_back(); this->bInSafemode.pop_back(); };
+
+        // the almighty algorithm.
+        static SPLIT_LINE_STATE splitLine(std::vector<std::string>& ret,
+                                          std::vector<bool>& bInSafemode,
+                                          const std::string& line,
+                                          const std::string& delimiters = SubString::WhiteSpaces,
+                                          const std::string& delimiterNeighbours = "",
+                                          bool emptyEntries = false,
+                                          char escape_char = '\\',
+                                          bool removeExcapeChar = true,
+                                          char safemode_char = '"',
+                                          bool removeSafemodeChar = true,
+                                          char openparenthesis_char = '(',
+                                          char closeparenthesis_char = ')',
+                                          bool removeParenthesisChars = true,
+                                          char comment_char = '\0',
+                                          SPLIT_LINE_STATE start_state = SL_NORMAL);
+        // debugging.
+        void debug() const;
+
+    public:
+        static const std::string WhiteSpaces;
+        static const std::string WhiteSpacesWithComma;
+        static const SubString   NullSubString;
+
+    private:
+        std::vector<std::string>  strings;                      //!< strings produced from a single string splitted in multiple strings
+        std::vector<bool>         bInSafemode;
+    };
+}
+
+#endif /* __SubString_H__ */
Index: /sandbox_light/src/libraries/util/TemplateUtils.h
===================================================================
--- /sandbox_light/src/libraries/util/TemplateUtils.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/TemplateUtils.h	(revision 5788)
@@ -0,0 +1,88 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Declaration of various helper templates.
+*/
+
+#ifndef _TemplateUtils_H__
+#define _TemplateUtils_H__
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    ///////////////////////////////////////////////////
+    // Static detection of implicit type conversions //
+    ///////////////////////////////////////////////////
+
+// disable warnings about possible loss of data
+#ifdef ORXONOX_COMPILER_MSVC
+#  pragma warning(push)
+#  pragma warning(disable:4244)
+#endif
+// GCC generates warnings when implicitely casting from float to int for instance.
+#ifdef ORXONOX_COMPILER_GCC
+#  pragma GCC system_header
+#endif
+
+    /**
+    @brief
+        Detects whether you can implicitely cast FromType to ToType.
+
+        Usage: ImplicitConversion<FromType, ToType>::exists
+        This gives you a compile time constant boolean in the form of an enum value.
+    @note
+        The idea to use the sizeof() operator on return values to determine function existance
+        is described in 'Modern C++ design' by Alexandrescu (2001).
+    */
+    template <class FromType, class ToType>
+    class ImplicitConversion
+    {
+    private:
+        ImplicitConversion(); ImplicitConversion(const ImplicitConversion&); ~ImplicitConversion();
+        // Gets chosen only if there is an implicit conversion from FromType to ToType.
+        static char test(ToType);
+        // Accepts any argument. Why do we not use a template? The reason is that with templates,
+        // the function above is only taken iff it is an exact type match. But since we want to
+        // check for implicit conversion, we have to use the ellipsis.
+        static long long test(...);
+        static FromType object; // helper object to handle private c'tor and d'tor
+    public:
+        // test(object) only has 'long long' return type iff the compiler doesn't choose test(...)
+        enum { exists = (sizeof(test(object)) == sizeof(char)) };
+    };
+
+#ifdef ORXONOX_COMPILER_MSVC
+#  pragma warning(pop)
+#endif
+
+}
+
+#endif /* _TemplateUtils_H__ */
Index: /sandbox_light/src/libraries/util/TypeTraits.h
===================================================================
--- /sandbox_light/src/libraries/util/TypeTraits.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/TypeTraits.h	(revision 5788)
@@ -0,0 +1,285 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2001 by Andrei Alexandrescu
+// This code accompanies the book:
+// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design 
+//     Patterns Applied". Copyright (c) 2001. Addison-Wesley.
+// Permission to use, copy, modify, distribute and sell this software for any 
+//     purpose is hereby granted without fee, provided that the above copyright 
+//     notice appear in all copies and that both that copyright notice and this 
+//     permission notice appear in supporting documentation.
+// The author or Addison-Wesley Longman make no representations about the 
+//     suitability of this software for any purpose. It is provided "as is" 
+//     without express or implied warranty.
+//
+// Changes by Orxonox (Reto)
+//     Removed all stdInt, etc. type traits and function pointer traits
+//     and added UnqualifiedReferredType.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_TYPETRAITS_INC_
+#define LOKI_TYPETRAITS_INC_
+
+// $Id: TypeTraits.h 835 2007-08-02 19:39:02Z syntheticpp $
+
+
+#if (defined _MSC_VER) && (_MSC_VER < 1400)
+#include <string>
+#endif
+
+
+#ifdef _MSC_VER
+#pragma warning( push ) 
+#pragma warning( disable : 4180 ) //qualifier applied to function type has no meaning; ignored
+#endif
+
+namespace Loki
+{
+////////////////////////////////////////////////////////////////////////////////
+// class NullType
+// Used as a placeholder for "no type here"
+// Useful as an end marker in typelists 
+////////////////////////////////////////////////////////////////////////////////
+
+    class NullType {};
+
+////////////////////////////////////////////////////////////////////////////////
+// class template IsCustomUnsignedInt
+// Offers a means to integrate nonstandard built-in unsigned integral types
+// (such as unsigned __int64 or unsigned long long int) with the TypeTraits 
+//     class template defined below.
+// Invocation: IsCustomUnsignedInt<T> where T is any type
+// Defines 'value', an enum that is 1 iff T is a custom built-in unsigned
+//     integral type
+// Specialize this class template for nonstandard unsigned integral types
+//     and define value = 1 in those specializations
+////////////////////////////////////////////////////////////////////////////////
+
+    template <typename T>
+    struct IsCustomUnsignedInt
+    {
+        enum { value = 0 };
+    };        
+
+////////////////////////////////////////////////////////////////////////////////
+// class template IsCustomSignedInt
+// Offers a means to integrate nonstandard built-in unsigned integral types
+// (such as unsigned __int64 or unsigned long long int) with the TypeTraits 
+//     class template defined below.
+// Invocation: IsCustomSignedInt<T> where T is any type
+// Defines 'value', an enum that is 1 iff T is a custom built-in signed
+//     integral type
+// Specialize this class template for nonstandard unsigned integral types
+//     and define value = 1 in those specializations
+////////////////////////////////////////////////////////////////////////////////
+
+    template <typename T>
+    struct IsCustomSignedInt
+    {
+        enum { value = 0 };
+    };        
+
+////////////////////////////////////////////////////////////////////////////////
+// class template IsCustomFloat
+// Offers a means to integrate nonstandard floating point types with the
+//     TypeTraits class template defined below.
+// Invocation: IsCustomFloat<T> where T is any type
+// Defines 'value', an enum that is 1 iff T is a custom built-in
+//     floating point type
+// Specialize this class template for nonstandard unsigned integral types
+//     and define value = 1 in those specializations
+////////////////////////////////////////////////////////////////////////////////
+
+    template <typename T>
+    struct IsCustomFloat
+    {
+        enum { value = 0 };
+    };        
+
+////////////////////////////////////////////////////////////////////////////////
+// Helper types for class template TypeTraits defined below
+////////////////////////////////////////////////////////////////////////////////
+
+    namespace Private
+    {
+        template <typename U> struct AddPointer
+        {
+            typedef U* Result;
+        };
+
+        template <typename U> struct AddPointer<U&>
+        {
+            typedef U* Result;
+        };
+
+        template <class U> struct AddReference
+        {
+            typedef U & Result;
+        };
+
+        template <class U> struct AddReference<U &>
+        {
+            typedef U & Result;
+        };
+
+        template <> struct AddReference<void>
+        {
+            typedef NullType Result;
+        };
+
+        template <class U> struct AddParameterType
+        {
+            typedef const U & Result;
+        };
+
+        template <class U> struct AddParameterType<U &>
+        {
+            typedef U & Result;
+        };
+
+        template <> struct AddParameterType<void>
+        {
+            typedef NullType Result;
+        };
+    }// namespace Private
+        
+////////////////////////////////////////////////////////////////////////////////
+// class template TypeTraits
+//
+// Figures out at compile time various properties of any given type
+// Invocations (T is a type, TypeTraits<T>::Property):
+//
+// - isPointer       : returns true if T is a pointer type
+// - PointeeType     : returns the type to which T points if T is a pointer 
+//                     type, NullType otherwise
+// - isReference     : returns true if T is a reference type
+// - ReferredType    : returns the type to which T refers if T is a reference 
+//                     type, NullType otherwise
+// - ParameterType   : returns the optimal type to be used as a parameter for 
+//                     functions that take Ts
+// - isConst         : returns true if T is a const-qualified type
+// - NonConstType    : Type with removed 'const' qualifier from T, if any
+// - isVolatile      : returns true if T is a volatile-qualified type
+// - NonVolatileType : Type with removed 'volatile' qualifier from T, if any
+// - UnqualifiedType : Type with removed 'const' and 'volatile' qualifiers from 
+//                     T, if any
+// - ParameterType   : returns the optimal type to be used as a parameter 
+//                       for functions that take 'const T's
+//
+////////////////////////////////////////////////////////////////////////////////
+
+    template <typename T>
+    class TypeTraits
+    {
+    private:
+    
+        template <class U> struct ReferenceTraits
+        {
+            enum { result = false };
+            typedef U ReferredType;
+        };
+        
+        template <class U> struct ReferenceTraits<U&>
+        {
+            enum { result = true };
+            typedef U ReferredType;
+        };
+               
+        template <class U> struct PointerTraits
+        {
+            enum { result = false };
+            typedef NullType PointeeType;
+        };
+        
+        template <class U> struct PointerTraits<U*>
+        {
+            enum { result = true };
+            typedef U PointeeType;
+        };
+        
+        template <class U> struct PointerTraits<U*&>
+        {
+            enum { result = true };
+            typedef U PointeeType;
+        };
+          
+        template <class U> struct PToMTraits
+        {
+            enum { result = false };
+        };
+        
+        template <class U, class V> struct PToMTraits<U V::*>
+        {
+            enum { result = true };
+        };
+        
+        template <class U, class V> struct PToMTraits<U V::*&>
+        {
+            enum { result = true };
+        };
+        
+        template <class U> struct UnConst
+        {
+            typedef U Result;
+            enum { isConst = 0 };
+        };
+        
+        template <class U> struct UnConst<const U>
+        {
+            typedef U Result;
+            enum { isConst = 1 };
+        };
+
+        template <class U> struct UnConst<const U&>
+        {
+            typedef U& Result;
+            enum { isConst = 1 };
+        };
+  
+        template <class U> struct UnVolatile
+        {
+            typedef U Result;
+            enum { isVolatile = 0 };
+        };
+       
+        template <class U> struct UnVolatile<volatile U>
+        {
+            typedef U Result;
+            enum { isVolatile = 1 };
+        };
+
+        template <class U> struct UnVolatile<volatile U&>
+        {
+            typedef U& Result;
+            enum { isVolatile = 1 };
+        };
+        
+    public:
+        typedef typename UnConst<T>::Result 
+            NonConstType;
+        typedef typename UnVolatile<T>::Result 
+            NonVolatileType;
+        typedef typename UnVolatile<typename UnConst<T>::Result>::Result 
+            UnqualifiedType;
+        typedef typename PointerTraits<UnqualifiedType>::PointeeType 
+            PointeeType;
+        typedef typename ReferenceTraits<T>::ReferredType 
+            ReferredType;
+        typedef typename ReferenceTraits<typename UnVolatile<typename UnConst<T>::Result>::Result>::ReferredType
+            UnqualifiedReferredType;
+
+        enum { isConst          = UnConst<T>::isConst };
+        enum { isVolatile       = UnVolatile<T>::isVolatile };
+        enum { isReference      = ReferenceTraits<UnqualifiedType>::result };
+        enum { isPointer        = PointerTraits<
+                                        typename ReferenceTraits<UnqualifiedType>::ReferredType >::result};
+                
+    };
+}
+
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif // _MSC_VER
+
+
+#endif // end file guardian
+
Index: /sandbox_light/src/libraries/util/UtilPrereqs.h
===================================================================
--- /sandbox_light/src/libraries/util/UtilPrereqs.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/UtilPrereqs.h	(revision 5788)
@@ -0,0 +1,108 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      Fabian 'x3n' Landau
+ *
+ */
+
+/**
+  @file
+  @brief Contains all the necessary forward declarations for all classes and structs.
+*/
+
+#ifndef _UtilPrereqs_H__
+#define _UtilPrereqs_H__
+
+#include "OrxonoxConfig.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( UTIL_STATIC_BUILD )
+#  ifdef UTIL_SHARED_BUILD
+#    define _UtilExport __declspec(dllexport)
+#  else
+#    if defined( __MINGW32__ )
+#      define _UtilExport
+#    else
+#      define _UtilExport __declspec(dllimport)
+#    endif
+#  endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+#  define _UtilExport  __attribute__ ((visibility("default")))
+#else
+#  define _UtilExport
+#endif
+
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    class Exception;
+    class ExprParser;
+    class IntVector2;
+    class IntVector3;
+    class MultiType;
+    class OutputBuffer;
+    class OutputBufferListener;
+    class OutputHandler;
+    class SignalHandler;
+    class SubString;
+}
+
+namespace Ogre
+{
+    class Radian;
+    class Degree;
+    class Vector2;
+    class Vector3;
+    class Vector4;
+    class Matrix3;
+    class Matrix4;
+    class Quaternion;
+    class ColourValue;
+}
+namespace orxonox
+{
+    using Ogre::Radian;
+    using Ogre::Degree;
+    using Ogre::Vector2;
+    using Ogre::Vector3;
+    using Ogre::Vector4;
+    using Ogre::Matrix3;
+    using Ogre::Matrix4;
+    using Ogre::Quaternion;
+    using Ogre::ColourValue;
+}
+
+namespace Loki
+{
+    class ScopeGuardImplBase;
+    typedef const ScopeGuardImplBase& ScopeGuard;
+}
+
+#endif /* _UtilPrereqs_H__ */
Index: /sandbox_light/src/libraries/util/mbool.h
===================================================================
--- /sandbox_light/src/libraries/util/mbool.h	(revision 5788)
+++ /sandbox_light/src/libraries/util/mbool.h	(revision 5788)
@@ -0,0 +1,81 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _mbool_H__
+#define _mbool_H__
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    struct _UtilExport mbool
+    {
+        public:
+            inline mbool(bool value = false)
+                { this->value_.memory_ = 0; this->value_.bool_ = value; }
+            inline mbool(const mbool& value)
+                { this->value_.memory_ = value.value_.memory_; }
+
+            inline const mbool& operator=(bool value)
+                { if (value != this->value_.bool_) { ++this->value_.memory_; } return (*this); }
+            inline const mbool& operator=(const mbool& value)
+                { this->value_.memory_ = value.value_.memory_; return (*this); }
+
+            inline mbool& operator++()
+                { ++this->value_.memory_; return (*this); }
+            inline mbool operator++(int i)
+                { mbool temp = (*this); ++this->value_.memory_; return temp; }
+
+            inline operator bool() const
+                { return this->value_.bool_; }
+
+            inline bool operator==(bool other) const
+                { return this->value_.bool_ == other; }
+            inline bool operator!=(bool other) const
+                { return this->value_.bool_ != other; }
+
+            inline bool operator==(const mbool& other) const
+                { return this->value_.memory_ == other.value_.memory_; }
+            inline bool operator!=(const mbool& other) const
+                { return this->value_.memory_ != other.value_.memory_; }
+
+            inline bool operator!() const
+                { return (!this->value_.bool_); }
+            
+            inline unsigned char& getMemory(){ return value_.memory_; }
+
+        private:
+            union
+            {
+                bool bool_ : 1;
+                unsigned char memory_;
+            } value_;
+    };
+}
+
+#endif /* _mbool_H__ */
Index: /sandbox_light/src/modules/CMakeLists.txt
===================================================================
--- /sandbox_light/src/modules/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/src/modules/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,27 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+
+INCLUDE_DIRECTORIES(
+  ${CMAKE_SOURCE_DIR}/src/external
+  ${CMAKE_SOURCE_DIR}/src/libraries
+  ${CMAKE_SOURCE_DIR}/src/orxonox
+  ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+################ Sub Directories ################
Index: /sandbox_light/src/orxonox-main.vcproj.user.in
===================================================================
--- /sandbox_light/src/orxonox-main.vcproj.user.in	(revision 5788)
+++ /sandbox_light/src/orxonox-main.vcproj.user.in	(revision 5788)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+	ProjectType="Visual C++"
+	Version="${VISUAL_STUDIO_VERSION_SIMPLE}.00"
+	ShowAllFiles="false"
+	>
+	<Configurations>
+		<Configuration
+			Name="Debug|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+		<Configuration
+			Name="MinSizeRel|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+		<Configuration
+			Name="RelWithDebInfo|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+	</Configurations>
+</VisualStudioUserFile>
Index: /sandbox_light/src/orxonox/CMakeLists.txt
===================================================================
--- /sandbox_light/src/orxonox/CMakeLists.txt	(revision 5788)
+++ /sandbox_light/src/orxonox/CMakeLists.txt	(revision 5788)
@@ -0,0 +1,40 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
+
+INCLUDE_DIRECTORIES(
+  ${CMAKE_SOURCE_DIR}/src/external
+  ${CMAKE_SOURCE_DIR}/src/libraries
+  ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+SET_SOURCE_FILES(ORXONOX_SRC_FILES
+  Main.cc
+  GSRoot.cc
+)
+
+ORXONOX_ADD_LIBRARY(orxonox
+  FIND_HEADER_FILES
+  DEFINE_SYMBOL
+    "ORXONOX_SHARED_BUILD"
+  LINK_LIBRARIES
+    tolua++_orxonox
+    util
+    core
+  SOURCE_FILES ${ORXONOX_SRC_FILES}
+)
Index: /sandbox_light/src/orxonox/GSRoot.cc
===================================================================
--- /sandbox_light/src/orxonox/GSRoot.cc	(revision 5788)
+++ /sandbox_light/src/orxonox/GSRoot.cc	(revision 5788)
@@ -0,0 +1,58 @@
+/*
+ *   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 "GSRoot.h"
+
+#include "core/Clock.h"
+#include "core/Game.h"
+
+namespace orxonox
+{
+    DeclareGameState(GSRoot, "root", false, false);
+
+    GSRoot::GSRoot(const GameStateInfo& info)
+        : GameState(info)
+    {
+    }
+
+    GSRoot::~GSRoot()
+    {
+    }
+
+    void GSRoot::activate()
+    {
+    }
+
+    void GSRoot::deactivate()
+    {
+    }
+
+    void GSRoot::update(const Clock& time)
+    {
+    }
+}
Index: /sandbox_light/src/orxonox/GSRoot.h
===================================================================
--- /sandbox_light/src/orxonox/GSRoot.h	(revision 5788)
+++ /sandbox_light/src/orxonox/GSRoot.h	(revision 5788)
@@ -0,0 +1,51 @@
+/*
+ *   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 _GSRoot_H__
+#define _GSRoot_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/GameState.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport GSRoot : public GameState
+    {
+    public:
+        GSRoot(const GameStateInfo& info);
+        ~GSRoot();
+
+        void activate();
+        void deactivate();
+        void update(const Clock& time);
+
+    private:
+    };
+}
+
+#endif /* _GSRoot_H__ */
Index: /sandbox_light/src/orxonox/Main.cc
===================================================================
--- /sandbox_light/src/orxonox/Main.cc	(revision 5788)
+++ /sandbox_light/src/orxonox/Main.cc	(revision 5788)
@@ -0,0 +1,66 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    The main function of Orxonox.
+*/
+
+#include "OrxonoxPrereqs.h"
+#include "SpecialConfig.h"
+
+#include "util/Exception.h"
+#include "core/CommandLine.h"
+#include "core/Game.h"
+#include "core/LuaState.h"
+#include "Main.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Main method. Game starts here (except for static initialisations).
+    */
+    int main(const std::string& strCmdLine)
+    {
+        Game* game = new Game(strCmdLine);
+
+        game->setStateHierarchy(
+        "root"
+        );
+
+        game->requestState("root");
+
+        game->run();
+        delete game;
+
+        return 0;
+    }
+}
Index: /sandbox_light/src/orxonox/Main.h
===================================================================
--- /sandbox_light/src/orxonox/Main.h	(revision 5788)
+++ /sandbox_light/src/orxonox/Main.h	(revision 5788)
@@ -0,0 +1,40 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Main_H__
+#define _Main_H__
+
+#include "OrxonoxPrereqs.h"
+
+namespace orxonox
+{
+    _OrxonoxExport int main(const std::string& strCmdLine);
+}
+
+#endif /* _Main_H__ */
Index: /sandbox_light/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- /sandbox_light/src/orxonox/OrxonoxPrereqs.h	(revision 5788)
+++ /sandbox_light/src/orxonox/OrxonoxPrereqs.h	(revision 5788)
@@ -0,0 +1,221 @@
+/*
+ *   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 Contains all the necessary forward declarations for all classes and structs.
+*/
+
+#ifndef _OrxonoxPrereqs_H__
+#define _OrxonoxPrereqs_H__
+
+#include "OrxonoxConfig.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
+#  ifdef ORXONOX_SHARED_BUILD
+#    define _OrxonoxExport __declspec(dllexport)
+#  else
+#    if defined( __MINGW32__ )
+#      define _OrxonoxExport
+#    else
+#      define _OrxonoxExport __declspec(dllimport)
+#    endif
+#  endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+#  define _OrxonoxExport  __attribute__ ((visibility("default")))
+#else
+#  define _OrxonoxExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    class CameraManager;
+    class LevelManager;
+    class PawnManager;
+    class PlayerManager;
+
+    class Level;
+    class Scene;
+    class Tickable;
+
+    // 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 BaseItem;
+    class DroppedItem;
+    class EquipmentItem;
+    class ModifierPickup;
+    class PassiveItem;
+    class PickupCollection;
+    class PickupInventory;
+    class PickupSpawner;
+    class UsableItem;
+
+    class Jump;
+    class HealthUsable;
+    class PassiveItem;
+
+    // items
+    class Item;
+    class Engine;
+    class MultiStateEngine;
+    class RotatingEngine;
+
+    // weaponsystem
+    class WeaponSystem;
+    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;
+}
+
+// Bullet Physics Engine
+class btTransform;
+class btVector3;
+
+class btRigidBody;
+class btCollisionObject;
+class btGhostObject;
+class btManifoldPoint;
+
+class btCollisionShape;
+class btSphereShape;
+class btCompoundShape;
+class btStaticPlaneShape;
+
+class btDiscreteDynamicsWorld;
+class bt32BitAxisSweep3;
+class btDefaultCollisionConfiguration;
+class btCollisionDispatcher;
+class btSequentialImpulseConstraintSolver;
+
+// ALUT
+typedef struct ALCcontext_struct ALCcontext;
+typedef struct ALCdevice_struct ALCdevice;
+typedef unsigned int ALuint;
+typedef int ALint;
+
+#endif /* _OrxonoxPrereqs_H__ */
