Index: code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.cc
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.cc	(revision 1989)
+++ code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.cc	(revision 1993)
@@ -42,4 +42,5 @@
 #include "objects/gametypes/Gametype.h"
 #include "objects/worldentities/ControllableEntity.h"
+#include "objects/controllers/HumanController.h"
 
 namespace orxonox
@@ -53,5 +54,4 @@
         this->ping_ = -1;
         this->clientID_ = network::CLIENTID_UNKNOWN;
-        this->bLocalPlayer_ = Core::isStandalone();
         this->bLocalPlayer_ = false;
         this->bHumanPlayer_ = false;
@@ -60,17 +60,25 @@
         this->pawn_ = 0;
         this->pawnID_ = network::OBJECTID_UNKNOWN;
+        this->controller_ = 0;
+        this->setDefaultController(Class(HumanController));
 
         this->setConfigValues();
         this->registerVariables();
-
-//COUT(0) << "created PlayerInfo (" << this->getObjectID() << ")" << std::endl;
     }
 
     PlayerInfo::~PlayerInfo()
     {
-        Gametype* gametype = Gametype::getCurrentGametype();
-        if (gametype)
-            gametype->removePlayer(this);
-//COUT(0) << "destroyed PlayerInfo (" << this->getObjectID() << ")" << std::endl;
+        if (this->isInitialized())
+        {
+            Gametype* gametype = Gametype::getCurrentGametype();
+            if (gametype)
+                gametype->removePlayer(this);
+
+            if (this->controller_)
+                delete this->controller_;
+
+            if (this->pawn_)
+                this->pawn_->removePlayer();
+        }
     }
 
@@ -82,5 +90,4 @@
     void PlayerInfo::checkNick()
     {
-//std::cout << "# PI(" << this->getObjectID() << "): checkName: " << this->bLocalPlayer_ << std::endl;
         if (this->bLocalPlayer_)
         {
@@ -94,5 +101,4 @@
     void PlayerInfo::changedName()
     {
-//std::cout << "# PI(" << this->getObjectID() << "): changedName to " << this->getName() << std::endl;
         Gametype* gametype = Gametype::getCurrentGametype();
         if (gametype)
@@ -113,5 +119,4 @@
     void PlayerInfo::clientChangedName()
     {
-//std::cout << "# PI(" << this->getObjectID() << "): clientChangedName() from " << this->getName() << " to " << this->playerName_ << std::endl;
         this->setName(this->playerName_);
     }
@@ -119,23 +124,14 @@
     void PlayerInfo::checkClientID()
     {
-//std::cout << "# PI(" << this->getObjectID() << "): checkClientID()" << std::endl;
         this->bHumanPlayer_ = true;
 
         if (this->clientID_ == network::Host::getPlayerID())
         {
-//std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): it's the client's ID" << std::endl;
-            this->bLocalPlayer_ = true;
-            this->playerName_ = this->nick_;
-//std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): name: " << this->getName() << std::endl;
+            this->takeLocalControl();
 
             if (Core::isClient())
-            {
-//std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): we're on a client: set object mode to bidirectional" << std::endl;
                 this->setObjectMode(network::direction::bidirectional);
-//std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): proposed name: " << this->playerName_ << std::endl;
-            }
             else
             {
-//std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): we're not on a client: finish setup" << std::endl;
                 this->clientChangedName();
                 this->bFinishedSetup_ = true;
@@ -147,20 +143,11 @@
     void PlayerInfo::finishedSetup()
     {
-//std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): " << this->bFinishedSetup_ << std::endl;
         if (Core::isClient())
-        {
-//std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): we're a client: finish setup" << std::endl;
             this->bFinishedSetup_ = true;
-        }
         else if (this->bFinishedSetup_)
         {
-//std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): we're a server: add player" << std::endl;
             Gametype* gametype = Gametype::getCurrentGametype();
             if (gametype)
                 gametype->addPlayer(this);
-        }
-        else
-        {
-//std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): we're a server: client not yet finished" << std::endl;
         }
     }
@@ -171,4 +158,7 @@
         this->pawn_ = pawn;
         this->pawnID_ = pawn->getObjectID();
+
+        if (this->controller_)
+            this->controller_->setPawn(this->pawn_);
     }
 
@@ -180,4 +170,17 @@
     }
 
+    void PlayerInfo::takeLocalControl()
+    {
+        this->bLocalPlayer_ = true;
+        this->playerName_ = this->nick_;
+        this->createController();
+    }
+
+    void PlayerInfo::createController()
+    {
+        this->controller_ = this->defaultController_.fabricate();
+        this->controller_->setPawn(this->pawn_);
+    }
+
     void PlayerInfo::updatePawn()
     {
Index: code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.h
===================================================================
--- code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.h	(revision 1989)
+++ code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.h	(revision 1993)
@@ -33,4 +33,6 @@
 
 #include "Info.h"
+#include "core/Identifier.h"
+#include "objects/controllers/Controller.h"
 
 namespace orxonox
@@ -58,11 +60,23 @@
                 { return this->bLocalPlayer_; }
 
-            void startControl(ControllableEntity* pawn);
-            void stopControl();
+            virtual void startControl(ControllableEntity* pawn);
+            virtual void stopControl();
 
             inline ControllableEntity* getPawn() const
                 { return this->pawn_; }
+/*
+            inline void setController(Controller* controller)
+                { this->controller_ = controller; }
+            inline Controller* getController() const
+                { return this->controller_; }
+*/
+        protected:
+            inline void setDefaultController(Identifier* identifier)
+                { this->defaultController_ = identifier; }
 
         private:
+            virtual void createController();
+            virtual void takeLocalControl();
+
             void checkClientID();
             void finishedSetup();
@@ -82,4 +96,6 @@
             ControllableEntity* pawn_;
             unsigned int pawnID_;
+            Controller* controller_;
+            SubclassIdentifier<Controller> defaultController_;
     };
 }
