Index: code/branches/gui/src/core/CorePrereqs.h
===================================================================
--- code/branches/gui/src/core/CorePrereqs.h	(revision 1686)
+++ code/branches/gui/src/core/CorePrereqs.h	(revision 1688)
@@ -163,4 +163,6 @@
   // game states
   class GameState;
+  template <class ParentType>
+  class GameStateTyped;
   class RootGameState;
 
Index: code/branches/gui/src/core/GameState.cc
===================================================================
--- code/branches/gui/src/core/GameState.cc	(revision 1686)
+++ code/branches/gui/src/core/GameState.cc	(revision 1688)
@@ -45,7 +45,7 @@
     GameState::GameState(const std::string& name)
         : name_(name)
-        , parent_(0)
+        //, parent_(0)
         , activeChild_(0)
-        //, bPauseParent_(false)
+        //, bPausegetParent()(false)
     {
         Operations temp = {false, false, false, false, false};
@@ -103,5 +103,5 @@
 
         // mark us as parent
-        state->parent_ = this;
+        state->setParent(this);
     }
 
@@ -178,6 +178,6 @@
         this->allChildren_[grandchild->getName()] = grandchild;
         this->grandchildrenToChildren_[grandchild] = child;
-        if (this->parent_)
-            this->parent_->grandchildAdded(this, grandchild);
+        if (this->getParent())
+            this->getParent()->grandchildAdded(this, grandchild);
     }
 
@@ -196,6 +196,6 @@
         this->allChildren_.erase(grandchild->getName());
         this->grandchildrenToChildren_.erase(grandchild);
-        if (this->parent_)
-            this->parent_->grandchildRemoved(grandchild);
+        if (this->getParent())
+            this->getParent()->grandchildRemoved(grandchild);
     }
 
@@ -208,6 +208,6 @@
     GameState* GameState::getState(const std::string& name)
     {
-        if (this->parent_)
-            return this->parent_->getState(name);
+        if (this->getParent())
+            return this->getParent()->getState(name);
         else
         {
@@ -227,6 +227,6 @@
     GameState* GameState::getRoot()
     {
-        if (this->parent_)
-            return this->parent_->getRoot();
+        if (this->getParent())
+            return this->getParent()->getRoot();
         else
             return this;
Index: code/branches/gui/src/core/GameState.h
===================================================================
--- code/branches/gui/src/core/GameState.h	(revision 1686)
+++ code/branches/gui/src/core/GameState.h	(revision 1688)
@@ -41,4 +41,5 @@
 #include <vector>
 #include <map>
+#include <cassert>
 #include "util/Integers.h"
 #include "Clock.h"
@@ -63,4 +64,6 @@
     {
         friend class RootGameState;
+        template <class ParentType>
+        friend class GameStateTyped;
 
     public:
@@ -79,5 +82,4 @@
 
     public:
-        GameState(const std::string& name);
         virtual ~GameState();
 
@@ -88,5 +90,4 @@
         GameState* getState(const std::string& name);
         GameState* getRoot();
-        GameState* getParent() const { return this->parent_; }
         //! Returns the currently active game state
         virtual GameState* getCurrentState();
@@ -107,5 +108,12 @@
         void tickChild(const Clock& time) { if (this->getActiveChild()) this->getActiveChild()->tick(time); }
 
+        virtual GameState* getParent() const = 0;
+        virtual void setParent(GameState* state) = 0;
+
     private:
+        // Making the constructor private ensures that game states
+        // are always derivates of GameStateTyped<T>. Note the friend declaration above.
+        GameState(const std::string& name);
+
         //! Performs a transition to 'destination'
         virtual void makeTransition(GameState* source, GameState* destination);
@@ -120,5 +128,4 @@
         const std::string                   name_;
         Operations                          operation_;
-        GameState*                          parent_;
         GameState*                          activeChild_;
         //bool                                bPauseParent_;
@@ -126,4 +133,25 @@
         std::map<GameState*, GameState*>    grandchildrenToChildren_;
     };
+
+    template <class ParentType>
+    class GameStateTyped : public GameState
+    {
+    public:
+        GameStateTyped(const std::string& name) : GameState(name) { }
+        virtual ~GameStateTyped() { }
+
+        ParentType* getParent() const
+            { return parent_; }
+
+    protected:
+        void setParent(GameState* state)
+        {
+            assert(dynamic_cast<ParentType*>(state) != 0);
+            this->parent_ = dynamic_cast<ParentType*>(state);
+        }
+
+    private:
+        ParentType* parent_;
+    };
 }
 
Index: code/branches/gui/src/core/RootGameState.cc
===================================================================
--- code/branches/gui/src/core/RootGameState.cc	(revision 1686)
+++ code/branches/gui/src/core/RootGameState.cc	(revision 1688)
@@ -39,5 +39,5 @@
 
     RootGameState::RootGameState(const std::string& name)
-        : GameState(name)
+        : GameStateTyped<GameState>(name)
         , stateRequest_("")
     {
Index: code/branches/gui/src/core/RootGameState.h
===================================================================
--- code/branches/gui/src/core/RootGameState.h	(revision 1686)
+++ code/branches/gui/src/core/RootGameState.h	(revision 1688)
@@ -35,5 +35,5 @@
 namespace orxonox
 {
-    class _CoreExport RootGameState : public GameState
+    class _CoreExport RootGameState : public GameStateTyped<GameState>
     {
     public:
