Index: code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc	(revision 9135)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc	(revision 9136)
@@ -60,100 +60,128 @@
 #include "worldentities/pawns/SpaceShip.h"
 
+/* Part of a temporary hack to allow the player to add towers */
+#include "core/command/ConsoleCommand.h"
+
 namespace orxonox
 {
     CreateUnloadableFactory(TowerDefense);
-
-    TowerDefense::TowerDefense(BaseObject* creator) : Deathmatch(creator)
+	
+	TowerDefense::TowerDefense(BaseObject* creator) : Deathmatch(creator)
     {
         RegisterObject(TowerDefense);
-
+		
+		/* Temporary hack to allow the player to add towers */
+		this->dedicatedAddTower_ = createConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) );
+		
     }
-
+	
+    TowerDefense::~TowerDefense()
+    {
+        if (this->isInitialized())
+        {
+            if( this->dedicatedAddTower_ )
+                delete this->dedicatedAddTower_;
+        }
+    }
+	
+	void TowerDefense::setCenterpoint(TowerDefenseCenterpoint *centerpoint)
+	{
+		orxout() << "got a centerpoint..." << endl;
+		
+		this->center_ = centerpoint;
+	}
+	
     void TowerDefense::start()
     {
         Deathmatch::start();
         orxout()<< "This is a way to display output on the terminal." <<endl;
-        //Tipp: Fenster-Modus über die Grafikeinstellungen einstellen.
-        //(dazu den Bulletpoint 'Fullscreen' entfernen, eine kleine Auflösung auswählen und auf 'Apply' klicken.)
     }
-    /*
-    void TowerDefense::end()
-    {
-        Deathmatch::end();
-
-        std::string message("The match has ended.");
-        ChatManager::message(message);
-    }
-    */
-
-
+	
+	/*
+	 void TowerDefense::end()
+	 {
+	 Deathmatch::end();
+	 
+	 std::string message("The match has ended.");
+	 ChatManager::message(message);
+	 }
+	 */
+	
+	void TowerDefense::addTower(int x, int y)
+	{
+		orxout()<< "Should add tower at (" << x << "," << y << ")" << endl;
+		
+		if (x > 16 || y > 16)
+		{
+			orxout() << "x and y should be between 1 and 16" << endl;
+			return;
+		}
+		
+		
+		
+		// TODO: create Tower mesh
+		// TODO: load Tower mesh
+	}
+	
 	void TowerDefense::tick(float dt)
     {
         SUPER(TowerDefense, tick, dt);
-
+		
         static bool test = false;
         if (!test)
         {
 			orxout()<< "First tick." <<endl;
-            spawnEnemy();
         }
         test = true;
     }
-
-	void TowerDefense::spawnEnemy()
-	{
-		//SpawnPoint *sp = *this->spawnpoints_.begin();
-
-		//Pawn* p = sp->spawn();
-	}
-
-/*
-    void TowerDefense::playerEntered(PlayerInfo* player)
-    {
-        Deathmatch::playerEntered(player);
-
-        const std::string& message = player->getName() + " entered the game";
-        ChatManager::message(message);
-    }
-
-    bool TowerDefense::playerLeft(PlayerInfo* player)
-    {
-        bool valid_player = Deathmatch::playerLeft(player);
-
-        if (valid_player)
-        {
-            const std::string& message = player->getName() + " left the game";
-            ChatManager::message(message);
-        }
-
-        return valid_player;
-    }
-
-
-    void TowerDefense::pawnKilled(Pawn* victim, Pawn* killer)
-    {
-        if (victim && victim->getPlayer())
-        {
-            std::string message;
-            if (killer)
-            {
-                if (killer->getPlayer())
-                    message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName();
-                else
-                    message = victim->getPlayer()->getName() + " was killed";
-            }
-            else
-                message = victim->getPlayer()->getName() + " died";
-
-            ChatManager::message(message);
-        }
-
-        Deathmatch::pawnKilled(victim, killer);
-    }
-
-    void TowerDefense::playerScored(PlayerInfo* player)
-    {
-        Gametype::playerScored(player);
-
-    }*/
+	
+	/*
+	 void TowerDefense::playerEntered(PlayerInfo* player)
+	 {
+	 Deathmatch::playerEntered(player);
+	 
+	 const std::string& message = player->getName() + " entered the game";
+	 ChatManager::message(message);
+	 }
+	 
+	 bool TowerDefense::playerLeft(PlayerInfo* player)
+	 {
+	 bool valid_player = Deathmatch::playerLeft(player);
+	 
+	 if (valid_player)
+	 {
+	 const std::string& message = player->getName() + " left the game";
+	 ChatManager::message(message);
+	 }
+	 
+	 return valid_player;
+	 }
+	 
+	 
+	 void TowerDefense::pawnKilled(Pawn* victim, Pawn* killer)
+	 {
+	 if (victim && victim->getPlayer())
+	 {
+	 std::string message;
+	 if (killer)
+	 {
+	 if (killer->getPlayer())
+	 message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName();
+	 else
+	 message = victim->getPlayer()->getName() + " was killed";
+	 }
+	 else
+	 message = victim->getPlayer()->getName() + " died";
+	 
+	 ChatManager::message(message);
+	 }
+	 
+	 Deathmatch::pawnKilled(victim, killer);
+	 }
+	 
+	 void TowerDefense::playerScored(PlayerInfo* player)
+	 {
+	 Gametype::playerScored(player);
+	 
+	 }*/
 }
Index: code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.h
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.h	(revision 9135)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.h	(revision 9136)
@@ -37,18 +37,26 @@
     class _OrxonoxExport TowerDefense : public Deathmatch
     {
-        public:
-            TowerDefense(BaseObject* creator);
-            virtual ~TowerDefense() {}
-
-            virtual void start(); //<! The function is called when the gametype starts
-            //virtual void end();
-            virtual void tick(float dt);
-            //virtual void playerEntered(PlayerInfo* player);
-            //virtual bool playerLeft(PlayerInfo* player);
-
-            //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
-            //virtual void playerScored(PlayerInfo* player);
-		private:
-				void spawnEnemy();
+	public:
+		TowerDefense(BaseObject* creator);
+		virtual ~TowerDefense();
+		
+		virtual void start(); //<! The function is called when the gametype starts
+		//virtual void end();
+		virtual void tick(float dt);
+		//virtual void playerEntered(PlayerInfo* player);
+		//virtual bool playerLeft(PlayerInfo* player);
+		
+		//virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
+		//virtual void playerScored(PlayerInfo* player);
+		
+		void setCenterpoint(TowerDefenseCenterpoint *centerpoint);
+		
+		/* Part of a temporary hack to allow the player to add towers */
+		void addTower(int x, int y);
+		ConsoleCommand* dedicatedAddTower_;
+		
+	private:
+//		WeakPtr<TowerDefenseCenterpoint> center_;
+		TowerDefenseCenterpoint *center_;
     };
 }
Index: code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc	(revision 9135)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc	(revision 9136)
@@ -51,4 +51,6 @@
         RegisterObject(TowerDefenseCenterpoint);
 
+		
+		
         this->width_ = 10;
         this->height_ = 11;
@@ -89,8 +91,9 @@
     void TowerDefenseCenterpoint::checkGametype()
     {
-        if (this->getGametype() != NULL && this->getGametype()->isA(Class(TowerDefense)))
+		if (this->getGametype() != NULL && this->getGametype()->isA(Class(TowerDefense)))
         {
-            //TowerDefense* TowerDefenseGametype = orxonox_cast<TowerDefense*>(this->getGametype().get());
-            //TowerDefenseGametype->setCenterpoint(this);
+			// Sets the centerpoint of the gametype. The gametype uses this to later spawn in towers, he needs the tower template stored in the center point
+            TowerDefense* towerDefenseGametype = orxonox_cast<TowerDefense*>(this->getGametype().get());
+            towerDefenseGametype->setCenterpoint(this);
         }
     }
