Index: /code/branches/core5/src/libraries/core/BaseObject.h
===================================================================
--- /code/branches/core5/src/libraries/core/BaseObject.h	(revision 5805)
+++ /code/branches/core5/src/libraries/core/BaseObject.h	(revision 5806)
@@ -138,5 +138,5 @@
             inline const SmartPtr<Scene>& getScene() const { return this->scene_; }
 
-            inline void setGametype(Gametype* gametype)
+            inline void setGametype(const SmartPtr<Gametype>& gametype)
             {
                 if (gametype != this->gametype_)
@@ -147,5 +147,5 @@
                 }
             }
-            inline Gametype* getGametype() const { return this->gametype_; }
+            inline const SmartPtr<Gametype>& getGametype() const { return this->gametype_; }
             inline Gametype* getOldGametype() const { return this->oldGametype_; }
             virtual void changedGametype() {}
@@ -196,5 +196,5 @@
             BaseObject*            creator_;
             SmartPtr<Scene>        scene_;
-            Gametype*              gametype_;
+            SmartPtr<Gametype>     gametype_;
             Gametype*              oldGametype_;
             std::set<Template*>    templates_;
Index: /code/branches/core5/src/modules/gamestates/GSLevel.cc
===================================================================
--- /code/branches/core5/src/modules/gamestates/GSLevel.cc	(revision 5805)
+++ /code/branches/core5/src/modules/gamestates/GSLevel.cc	(revision 5806)
@@ -52,4 +52,5 @@
 #include "LevelManager.h"
 #include "PlayerManager.h"
+#include "infos/HumanPlayer.h"
 
 namespace orxonox
@@ -242,4 +243,7 @@
     void GSLevel::unloadLevel()
     {
+        for (ObjectList<HumanPlayer>::iterator it = ObjectList<HumanPlayer>::begin(); it; ++it)
+            it->setGametype(0);
+        
         Loader::unload(startFile_s);
 
Index: /code/branches/core5/src/modules/objects/triggers/CheckPoint.cc
===================================================================
--- /code/branches/core5/src/modules/objects/triggers/CheckPoint.cc	(revision 5805)
+++ /code/branches/core5/src/modules/objects/triggers/CheckPoint.cc	(revision 5806)
@@ -85,5 +85,5 @@
         DistanceTrigger::triggered(bIsTriggered);
 
-        Asteroids* gametype = orxonox_cast<Asteroids*>(this->getGametype());
+        Asteroids* gametype = orxonox_cast<Asteroids*>(this->getGametype().get());
         if (gametype)
         {
Index: /code/branches/core5/src/modules/overlays/hud/TeamBaseMatchScore.cc
===================================================================
--- /code/branches/core5/src/modules/overlays/hud/TeamBaseMatchScore.cc	(revision 5805)
+++ /code/branches/core5/src/modules/overlays/hud/TeamBaseMatchScore.cc	(revision 5806)
@@ -118,5 +118,5 @@
 
         if (this->getOwner() && this->getOwner()->getGametype())
-            this->owner_ = orxonox_cast<TeamBaseMatch*>(this->getOwner()->getGametype());
+            this->owner_ = orxonox_cast<TeamBaseMatch*>(this->getOwner()->getGametype().get());
         else
             this->owner_ = 0;
Index: /code/branches/core5/src/modules/overlays/hud/UnderAttackHealthBar.cc
===================================================================
--- /code/branches/core5/src/modules/overlays/hud/UnderAttackHealthBar.cc	(revision 5805)
+++ /code/branches/core5/src/modules/overlays/hud/UnderAttackHealthBar.cc	(revision 5806)
@@ -78,5 +78,5 @@
             this->owner_ = player;
 
-            UnderAttack* ua = orxonox_cast<UnderAttack*>(player->getGametype());
+            UnderAttack* ua = orxonox_cast<UnderAttack*>(player->getGametype().get());
             if (ua)
             {
Index: /code/branches/core5/src/modules/pong/Pong.cc
===================================================================
--- /code/branches/core5/src/modules/pong/Pong.cc	(revision 5805)
+++ /code/branches/core5/src/modules/pong/Pong.cc	(revision 5806)
@@ -158,5 +158,5 @@
 
             if (player)
-                this->gtinfo_.sendAnnounceMessage(player->getName() + " scored");
+                this->gtinfo_->sendAnnounceMessage(player->getName() + " scored");
         }
 
Index: /code/branches/core5/src/modules/pong/PongCenterpoint.cc
===================================================================
--- /code/branches/core5/src/modules/pong/PongCenterpoint.cc	(revision 5805)
+++ /code/branches/core5/src/modules/pong/PongCenterpoint.cc	(revision 5806)
@@ -73,5 +73,5 @@
         if (this->getGametype() && this->getGametype()->isA(Class(Pong)))
         {
-            Pong* pong_gametype = orxonox_cast<Pong*>(this->getGametype());
+            Pong* pong_gametype = orxonox_cast<Pong*>(this->getGametype().get());
             pong_gametype->setCenterpoint(this);
         }
Index: /code/branches/core5/src/modules/pong/PongScore.cc
===================================================================
--- /code/branches/core5/src/modules/pong/PongScore.cc	(revision 5805)
+++ /code/branches/core5/src/modules/pong/PongScore.cc	(revision 5806)
@@ -133,5 +133,5 @@
 
         if (this->getOwner() && this->getOwner()->getGametype())
-            this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype());
+            this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype().get());
         else
             this->owner_ = 0;
Index: /code/branches/core5/src/orxonox/gametypes/Asteroids.cc
===================================================================
--- /code/branches/core5/src/orxonox/gametypes/Asteroids.cc	(revision 5805)
+++ /code/branches/core5/src/orxonox/gametypes/Asteroids.cc	(revision 5806)
@@ -54,5 +54,5 @@
         if (this->time_ < 0 && !this->hasEnded() && this->timerIsActive_)
         {
-            this->gtinfo_.sendAnnounceMessage("Time's up - you have lost the match!");
+            this->gtinfo_->sendAnnounceMessage("Time's up - you have lost the match!");
             this->end();
         }
@@ -63,5 +63,5 @@
         if (victim && victim->getPlayer())
         {
-            this->gtinfo_.sendAnnounceMessage("You're dead - you have lost the match!");
+            this->gtinfo_->sendAnnounceMessage("You're dead - you have lost the match!");
             this->end();
         }
Index: /code/branches/core5/src/orxonox/gametypes/Gametype.cc
===================================================================
--- /code/branches/core5/src/orxonox/gametypes/Gametype.cc	(revision 5805)
+++ /code/branches/core5/src/orxonox/gametypes/Gametype.cc	(revision 5806)
@@ -47,9 +47,11 @@
     CreateUnloadableFactory(Gametype);
 
-    Gametype::Gametype(BaseObject* creator) : BaseObject(creator), gtinfo_(creator)
+    Gametype::Gametype(BaseObject* creator) : BaseObject(creator)
     {
         RegisterObject(Gametype);
-
-        this->setGametype(this);
+        
+        this->gtinfo_ = new GametypeInfo(creator);
+
+        this->setGametype(SmartPtr<Gametype>(this, false));
 
         this->defaultControllableEntity_ = Class(Spectator);
@@ -76,4 +78,10 @@
         else
             this->scoreboard_ = 0;
+    }
+    
+    Gametype::~Gametype()
+    {
+        if (this->isInitialized())
+            this->gtinfo_->destroy();
     }
 
@@ -100,10 +108,10 @@
         }
 
-        if (this->gtinfo_.bStartCountdownRunning_ && !this->gtinfo_.bStarted_)
-            this->gtinfo_.startCountdown_ -= dt;
-
-        if (!this->gtinfo_.bStarted_)
+        if (this->gtinfo_->bStartCountdownRunning_ && !this->gtinfo_->bStarted_)
+            this->gtinfo_->startCountdown_ -= dt;
+
+        if (!this->gtinfo_->bStarted_)
             this->checkStart();
-        else if (!this->gtinfo_.bEnded_)
+        else if (!this->gtinfo_->bEnded_)
             this->spawnDeadPlayersIfRequested();
 
@@ -115,5 +123,5 @@
         this->addBots(this->numberOfBots_);
 
-        this->gtinfo_.bStarted_ = true;
+        this->gtinfo_->bStarted_ = true;
 
         this->spawnPlayersIfRequested();
@@ -122,5 +130,5 @@
     void Gametype::end()
     {
-        this->gtinfo_.bEnded_ = true;
+        this->gtinfo_->bEnded_ = true;
 
         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
@@ -243,7 +251,7 @@
 
                         if (killer->getPlayer()->getClientID() != CLIENTID_UNKNOWN)
-                            this->gtinfo_.sendKillMessage("You killed " + victim->getPlayer()->getName(), killer->getPlayer()->getClientID());
+                            this->gtinfo_->sendKillMessage("You killed " + victim->getPlayer()->getName(), killer->getPlayer()->getClientID());
                         if (victim->getPlayer()->getClientID() != CLIENTID_UNKNOWN)
-                            this->gtinfo_.sendDeathMessage("You were killed by " + killer->getPlayer()->getName(), victim->getPlayer()->getClientID());
+                            this->gtinfo_->sendDeathMessage("You were killed by " + killer->getPlayer()->getName(), victim->getPlayer()->getClientID());
                     }
                 }
@@ -308,5 +316,5 @@
                 it->second.state_ = PlayerState::Dead;
 
-                if (!it->first->isReadyToSpawn() || !this->gtinfo_.bStarted_)
+                if (!it->first->isReadyToSpawn() || !this->gtinfo_->bStarted_)
                 {
                     this->spawnPlayerAsDefaultPawn(it->first);
@@ -319,12 +327,12 @@
     void Gametype::checkStart()
     {
-        if (!this->gtinfo_.bStarted_)
-        {
-            if (this->gtinfo_.bStartCountdownRunning_)
-            {
-                if (this->gtinfo_.startCountdown_ <= 0)
-                {
-                    this->gtinfo_.bStartCountdownRunning_ = false;
-                    this->gtinfo_.startCountdown_ = 0;
+        if (!this->gtinfo_->bStarted_)
+        {
+            if (this->gtinfo_->bStartCountdownRunning_)
+            {
+                if (this->gtinfo_->startCountdown_ <= 0)
+                {
+                    this->gtinfo_->bStartCountdownRunning_ = false;
+                    this->gtinfo_->startCountdown_ = 0;
                     this->start();
                 }
@@ -349,6 +357,6 @@
                     if (allplayersready && hashumanplayers)
                     {
-                        this->gtinfo_.startCountdown_ = this->initialStartCountdown_;
-                        this->gtinfo_.bStartCountdownRunning_ = true;
+                        this->gtinfo_->startCountdown_ = this->initialStartCountdown_;
+                        this->gtinfo_->bStartCountdownRunning_ = true;
                     }
                 }
Index: /code/branches/core5/src/orxonox/gametypes/Gametype.h
===================================================================
--- /code/branches/core5/src/orxonox/gametypes/Gametype.h	(revision 5805)
+++ /code/branches/core5/src/orxonox/gametypes/Gametype.h	(revision 5806)
@@ -68,5 +68,5 @@
         public:
             Gametype(BaseObject* creator);
-            virtual ~Gametype() {}
+            virtual ~Gametype();
 
             void setConfigValues();
@@ -75,10 +75,10 @@
 
             inline const GametypeInfo* getGametypeInfo() const
-                { return &this->gtinfo_; }
+                { return this->gtinfo_; }
 
             inline bool hasStarted() const
-                { return this->gtinfo_.bStarted_; }
+                { return this->gtinfo_->bStarted_; }
             inline bool hasEnded() const
-                { return this->gtinfo_.bEnded_; }
+                { return this->gtinfo_->bEnded_; }
 
             virtual void start();
@@ -114,12 +114,12 @@
 
             inline bool isStartCountdownRunning() const
-                { return this->gtinfo_.bStartCountdownRunning_; }
+                { return this->gtinfo_->bStartCountdownRunning_; }
             inline float getStartCountdown() const
-                { return this->gtinfo_.startCountdown_; }
+                { return this->gtinfo_->startCountdown_; }
 
             inline void setHUDTemplate(const std::string& name)
-                { this->gtinfo_.hudtemplate_ = name; }
+                { this->gtinfo_->hudtemplate_ = name; }
             inline const std::string& getHUDTemplate() const
-                { return this->gtinfo_.hudtemplate_; }
+                { return this->gtinfo_->hudtemplate_; }
 
             void addBots(unsigned int amount);
@@ -163,5 +163,5 @@
             virtual void spawnDeadPlayersIfRequested();
 
-            GametypeInfo gtinfo_;
+            SmartPtr<GametypeInfo> gtinfo_;
 
             bool bAutoStart_;
Index: /code/branches/core5/src/orxonox/gametypes/TeamBaseMatch.cc
===================================================================
--- /code/branches/core5/src/orxonox/gametypes/TeamBaseMatch.cc	(revision 5805)
+++ /code/branches/core5/src/orxonox/gametypes/TeamBaseMatch.cc	(revision 5806)
@@ -67,10 +67,10 @@
                 {
                     base->setState(BaseState::ControlTeam1);
-                    this->gtinfo_.sendAnnounceMessage("The red team captured a base");
+                    this->gtinfo_->sendAnnounceMessage("The red team captured a base");
                 }
                 if (teamnr == 1)
                 {
                     base->setState(BaseState::ControlTeam2);
-                    this->gtinfo_.sendAnnounceMessage("The blue team captured a base");
+                    this->gtinfo_->sendAnnounceMessage("The blue team captured a base");
                 }
             }
@@ -194,7 +194,7 @@
 
                 if (it->second == winningteam)
-                    this->gtinfo_.sendAnnounceMessage("You have won the match!", it->first->getClientID());
+                    this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
                 else
-                    this->gtinfo_.sendAnnounceMessage("You have lost the match!", it->first->getClientID());
+                    this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
             }
 
Index: /code/branches/core5/src/orxonox/gametypes/UnderAttack.cc
===================================================================
--- /code/branches/core5/src/orxonox/gametypes/UnderAttack.cc	(revision 5805)
+++ /code/branches/core5/src/orxonox/gametypes/UnderAttack.cc	(revision 5806)
@@ -81,7 +81,7 @@
 
                 if (it->second == 0)
-                    this->gtinfo_.sendAnnounceMessage("You have won the match!", it->first->getClientID());
+                    this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
                 else
-                    this->gtinfo_.sendAnnounceMessage("You have lost the match!", it->first->getClientID());
+                    this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
             }
         }
@@ -164,7 +164,7 @@
 
                     if (it->second == 1)
-                        this->gtinfo_.sendAnnounceMessage("You have won the match!", it->first->getClientID());
+                        this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
                     else
-                        this->gtinfo_.sendAnnounceMessage("You have lost the match!", it->first->getClientID());
+                        this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
                 }
             }
@@ -178,5 +178,5 @@
                 Host::Broadcast(message);
 */
-                this->gtinfo_.sendAnnounceMessage(message);
+                this->gtinfo_->sendAnnounceMessage(message);
 
                 if (timesequence_ >= 30 && timesequence_ <= 60)
Index: /code/branches/core5/src/orxonox/infos/HumanPlayer.cc
===================================================================
--- /code/branches/core5/src/orxonox/infos/HumanPlayer.cc	(revision 5805)
+++ /code/branches/core5/src/orxonox/infos/HumanPlayer.cc	(revision 5806)
@@ -162,6 +162,10 @@
 
         if (this->isInitialized() && this->isLocalPlayer())
-            if (this->getGametype()->getHUDTemplate() != "")
+        {
+            if (this->getGametype() && this->getGametype()->getHUDTemplate() != "")
                 this->setGametypeHUDTemplate(this->getGametype()->getHUDTemplate());
+            else
+                this->setGametypeHUDTemplate("");
+        }
     }
 
Index: /code/branches/core5/src/orxonox/worldentities/pawns/Destroyer.cc
===================================================================
--- /code/branches/core5/src/orxonox/worldentities/pawns/Destroyer.cc	(revision 5805)
+++ /code/branches/core5/src/orxonox/worldentities/pawns/Destroyer.cc	(revision 5806)
@@ -40,5 +40,5 @@
         RegisterObject(Destroyer);
 
-        UnderAttack* gametype = orxonox_cast<UnderAttack*>(this->getGametype());
+        UnderAttack* gametype = orxonox_cast<UnderAttack*>(this->getGametype().get());
         if (gametype)
         {
Index: /code/branches/core5/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc
===================================================================
--- /code/branches/core5/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc	(revision 5805)
+++ /code/branches/core5/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc	(revision 5806)
@@ -45,5 +45,5 @@
         this->state_ = BaseState::Uncontrolled;
 
-        TeamBaseMatch* gametype = orxonox_cast<TeamBaseMatch*>(this->getGametype());
+        TeamBaseMatch* gametype = orxonox_cast<TeamBaseMatch*>(this->getGametype().get());
         if (gametype)
         {
@@ -58,5 +58,5 @@
         this->fireEvent();
 
-        TeamDeathmatch* gametype = orxonox_cast<TeamDeathmatch*>(this->getGametype());
+        TeamDeathmatch* gametype = orxonox_cast<TeamDeathmatch*>(this->getGametype().get());
         if (!gametype)
             return;
