Index: code/branches/presentation/src/modules/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/modules/CMakeLists.txt	(revision 8628)
+++ code/branches/presentation/src/modules/CMakeLists.txt	(revision 8631)
@@ -27,4 +27,5 @@
 
 ADD_SUBDIRECTORY(designtools)
+ADD_SUBDIRECTORY(gametypes)
 ADD_SUBDIRECTORY(notifications)
 ADD_SUBDIRECTORY(objects)
Index: code/branches/presentation/src/modules/gametypes/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/modules/gametypes/CMakeLists.txt	(revision 8631)
+++ code/branches/presentation/src/modules/gametypes/CMakeLists.txt	(revision 8631)
@@ -0,0 +1,16 @@
+SET_SOURCE_FILES(GAMETYPES_SRC_FILES
+  SpaceRace.cc
+  RaceCheckPoint.cc
+)
+
+ORXONOX_ADD_LIBRARY(gametypes
+  MODULE
+  FIND_HEADER_FILES
+  TOLUA_FILES
+  PCH_FILE
+    GametypesPrecompiledHeaders.h
+  LINK_LIBRARIES
+    orxonox
+    objects
+  SOURCE_FILES ${GAMETYPES_SRC_FILES}
+)
Index: code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h
===================================================================
--- code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h	(revision 8631)
+++ code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h	(revision 8631)
@@ -0,0 +1,53 @@
+/*
+ *   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 "OrxonoxConfig.h"
+
+///////////////////////////////////////////
+/////          Stable Headers         /////
+///////////////////////////////////////////
+
+#include <LinearMath/btTransform.h>
+
+///////////////////////////////////////////
+/////       All Rebuild Headers       /////
+///////////////////////////////////////////
+
+#include "core/BaseObject.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+
+// Just in case some header included windows.h
+#undef min
+#undef max
Index: code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h
===================================================================
--- code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h	(revision 8631)
+++ code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h	(revision 8631)
@@ -0,0 +1,70 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Shared library macros, enums, constants and forward declarations for the questsystem module
+*/
+
+#ifndef _GametypesPrereqs_H__
+#define _GametypesPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Gametypes_STATIC_BUILD)
+#  ifdef Gametypes_SHARED_BUILD
+#    define _GametypesExport __declspec(dllexport)
+#  else
+#    if defined( __MINGW32__ )
+#      define _GametypesExport
+#    else
+#      define _GametypesExport __declspec(dllimport)
+#    endif
+#  endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+#  define _GametypesExport  __attribute__ ((visibility("default")))
+#else
+#  define _GametypesExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    class SpaceRace;
+}
+
+#endif /* _GametypesPrereqs_H__ */
Index: code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc	(revision 8631)
+++ code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc	(revision 8631)
@@ -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:
+ *      Mauro Salomon
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "RaceCheckPoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "SpaceRace.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+    CreateFactory(RaceCheckPoint);
+    
+    RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
+    {
+        RegisterObject(RaceCheckPoint);
+
+        this->bCheckpointIndex_ = 0;
+        this->bIsLast_ = false;
+        this->bTimeLimit_ = 0;
+
+        this->setRadarObjectColour(ColourValue::Blue);
+        this->setRadarObjectShape(RadarViewable::Triangle);
+        this->setRadarVisibility(false);
+    }
+    
+    RaceCheckPoint::~RaceCheckPoint()
+    {
+    }
+    
+    void RaceCheckPoint::tick(float dt)
+    {
+        SUPER(RaceCheckPoint, tick, dt);
+
+        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+        if (this->getCheckpointIndex() == gametype->getCheckpointsReached())
+            this->setRadarVisibility(true);
+        else
+            this->setRadarVisibility(false);
+    }
+
+    
+    void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(RaceCheckPoint, XMLPort, xmlelement, mode);
+
+        XMLPortParam(RaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0);
+        XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
+        XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
+    }
+    
+    void RaceCheckPoint::triggered(bool bIsTriggered)
+    {
+        DistanceTrigger::triggered(bIsTriggered);
+
+        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+        if (gametype && this->getCheckpointIndex() == gametype->getCheckpointsReached() && bIsTriggered)
+        {
+            gametype->clock_.capture();
+            float time = gametype->clock_.getSecondsPrecise();
+            if (this->bTimeLimit_!=0 && time > this->bTimeLimit_)
+            {
+                gametype->timeIsUp();
+                gametype->end();
+            }
+            else if (this->getLast())
+                gametype->end();
+            else
+            {
+                gametype->newCheckpointReached();
+                this->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
+            }
+        }
+    }
+    
+    void RaceCheckPoint::setTimelimit(float timeLimit)
+    {
+        this->bTimeLimit_ = timeLimit;
+        if (this->bTimeLimit_ != 0)
+        {
+            SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+            if (gametype)
+            {
+                const std::string& message =  "You have " + multi_cast<std::string>(this->bTimeLimit_)
+                            + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1) + "\n";
+                COUT(3) << message;
+                const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
+            }
+        }
+    }
+    
+}
Index: code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h
===================================================================
--- code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h	(revision 8631)
+++ code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h	(revision 8631)
@@ -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:
+ *      Mauro Salomon
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _RaceCheckPoint_H__
+#define _RaceCheckPoint_H__
+
+#include "objects/ObjectsPrereqs.h"
+
+#include "objects/triggers/DistanceTrigger.h"
+#include "interfaces/RadarViewable.h"
+//#include <boost/concept_check.hpp>
+
+namespace orxonox
+{
+  /**
+  @brief
+    The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
+    !!! Don't forget to control the indexes of your check points and to set one last check point!!!
+  */
+    class _ObjectsExport RaceCheckPoint : public DistanceTrigger, public RadarViewable
+    {
+        public:
+            RaceCheckPoint(BaseObject* creator);
+            virtual ~RaceCheckPoint();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void tick(float dt);
+
+            protected:
+            virtual void triggered(bool bIsTriggered);
+            inline void setLast(bool isLast)
+                { this->bIsLast_ = isLast; }
+            inline bool getLast()
+                { return this->bIsLast_; }
+            inline void setCheckpointIndex(int checkpointIndex)
+                { this->bCheckpointIndex_ = checkpointIndex; }
+            inline int getCheckpointIndex()
+                { return this->bCheckpointIndex_; }
+            virtual void setTimelimit(float timeLimit);
+            inline float getTimeLimit()
+                { return this->bTimeLimit_;}
+            inline const WorldEntity* getWorldEntity() const
+                { return this; }
+
+        private:
+            int bCheckpointIndex_; //The index of this check point. This value will be compared with the number of check points reached in the level. The check points must be indexed in ascending order beginning from zero and without any jumps between the indexes.
+            bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
+            float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
+      
+    };
+}
+
+#endif /* _RaceCheckPoint_H__ */
Index: code/branches/presentation/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/branches/presentation/src/modules/gametypes/SpaceRace.cc	(revision 8631)
+++ code/branches/presentation/src/modules/gametypes/SpaceRace.cc	(revision 8631)
@@ -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:
+ *     Mauro Salomon
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "SpaceRace.h"
+
+#include "core/CoreIncludes.h"
+#include "network/Host.h"
+#include <util/Clock.h>
+#include <util/Math.h>
+#include "util/Convert.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(SpaceRace);
+    
+    SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator)
+    {
+        RegisterObject(SpaceRace);
+        this->bCheckpointsReached_ = 0;
+        this->bTimeIsUp_ = false;
+        this->numberOfBots_ = 0;
+    }
+    
+    void SpaceRace::end()
+    {
+        this->Gametype::end();
+          
+        if (this->bTimeIsUp_)
+        {
+            this->clock_.capture();
+            int s = this->clock_.getSeconds();
+            int ms = this->clock_.getMilliseconds()-1000*s;
+            const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
+                        + "You didn't reach the check point " + multi_cast<std::string>(this->bCheckpointsReached_+1)
+                        + " before the time limit. You lose!";
+            COUT(3) << message;
+            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+            Host::Broadcast(message);
+        }
+        else
+        {
+            this->clock_.capture();
+            int s = this->clock_.getSeconds();
+            int ms = this->clock_.getMilliseconds()-1000*s;
+            const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
+                        + "." + multi_cast<std::string>(ms) + " seconds.";
+            COUT(3) << message << std::endl;
+            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+            Host::Broadcast(message);
+            float time = this->clock_.getSecondsPrecise();
+            this->scores_.insert(time);
+            std::set<float>::iterator it;
+            for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
+            COUT(3) <<  multi_cast<std::string>(*it) << std::endl;
+        }
+    }
+
+    void SpaceRace::start()
+    {
+        Gametype::start();
+
+        std::string message("The match has started! Reach the check points as quickly as possible!");
+        COUT(3) << message << std::endl;
+        Host::Broadcast(message);
+    }
+    
+    void SpaceRace::newCheckpointReached()
+    {
+        this->bCheckpointsReached_++;
+        this->clock_.capture();
+        int s = this->clock_.getSeconds();
+        int ms = this->clock_.getMilliseconds()-1000*s;
+        const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
+                        + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
+                        + " seconds.\n";
+        COUT(3) << message;
+        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+        Host::Broadcast(message);
+    }
+
+}
Index: code/branches/presentation/src/modules/gametypes/SpaceRace.h
===================================================================
--- code/branches/presentation/src/modules/gametypes/SpaceRace.h	(revision 8631)
+++ code/branches/presentation/src/modules/gametypes/SpaceRace.h	(revision 8631)
@@ -0,0 +1,76 @@
+/*
+ *   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:
+ *      Mauro Salomon
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _SpaceRace_H__
+#define _SpaceRace_H__
+
+#include "gametypes/Gametype.h"
+#include "gametypes/GametypesPrereqs.h"
+#include "RaceCheckPoint.h"
+#include <boost/concept_check.hpp>
+#include <util/Clock.h>
+#include <string.h>
+#include <set>
+
+namespace orxonox
+{
+  /**
+  @brief
+    The SpaceRace class enables the creation of a space race level, where the player has to reach check points in a given order.
+  */
+    class _OrxonoxExport SpaceRace : public Gametype
+    {
+        friend class RaceCheckPoint;
+        
+        public:
+            SpaceRace(BaseObject* creator);
+            virtual ~SpaceRace() {}
+
+            virtual void start();
+                virtual void end();
+
+            virtual void newCheckpointReached();
+
+            inline void setCheckpointsReached(int n)
+            { this->bCheckpointsReached_ = n;}
+            inline int getCheckpointsReached()
+            { return this->bCheckpointsReached_; }
+            inline void timeIsUp()
+            { this->bTimeIsUp_ = true;}
+
+        protected:
+
+        private:
+            int bCheckpointsReached_; //The current number of check points reached by the player.
+            std::set<float> scores_; //The times of the players are saved in a set.
+            bool bTimeIsUp_; //True if one of the check points is reached too late.
+            Clock clock_; //The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
+    };
+}
+
+#endif /* _SpaceRace_H__ */
