Index: /code/branches/AI_HS15/data/levels/AITest.oxw
===================================================================
--- /code/branches/AI_HS15/data/levels/AITest.oxw	(revision 10718)
+++ /code/branches/AI_HS15/data/levels/AITest.oxw	(revision 10719)
@@ -63,13 +63,11 @@
   </!-->
     
-    <SpaceShip position = "-1000, -1000, -1000">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
+    <StaticEntity position = "-1000, -1000, -1000">
+ 
       <controller>
         <FleetController accuracy=10 team=1 >
         </FleetController>
       </controller>
-    </SpaceShip>
+    </StaticEntity>
     
     <SpaceShip position="1000, 1000, -1500 ?>" lookat="0,0,0">
@@ -96,6 +94,6 @@
       </templates>
       <controller>
-        <LeaderController team=1>
-        </LeaderController>
+        <SectionController team=1>
+        </SectionController>
       </controller>
     </SpaceShip>
@@ -109,5 +107,4 @@
       </controller>
     </SpaceShip>
-    <!-->    
     <!-->
     <?lua
Index: /code/branches/AI_HS15/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/CMakeLists.txt	(revision 10718)
+++ /code/branches/AI_HS15/src/orxonox/controllers/CMakeLists.txt	(revision 10719)
@@ -15,3 +15,5 @@
   LeaderController.cc
   WingmanController.cc
+  SectionController.cc
+  CommonController.cc
 )
Index: /code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	(revision 10719)
+++ /code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	(revision 10719)
@@ -0,0 +1,59 @@
+/*
+ *   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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Dominik Solenicki
+ *
+ */
+#include "controllers/CommonController.h"
+
+namespace orxonox
+{
+
+    RegisterClass(CommonController);
+
+    
+    bool CommonController::setWingman (CommonController* wingman)
+    {
+        return false;
+    }
+    bool CommonController::isLeader ()
+    {
+        return false;
+    }
+    CommonController::CommonController(Context* context) : Controller(context)
+    {
+
+        RegisterObject(CommonController);
+
+        //this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&LeaderController::action, this)));
+    }
+
+
+    CommonController::~CommonController()
+    {
+    }
+
+ 
+
+}
Index: /code/branches/AI_HS15/src/orxonox/controllers/CommonController.h
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	(revision 10719)
+++ /code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	(revision 10719)
@@ -0,0 +1,59 @@
+/*
+ *   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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _CommonController_H__
+#define _CommonController_H__
+
+
+#include "controllers/Controller.h"
+#include "worldentities/ControllableEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport CommonController : public Controller
+    {
+        public:
+           
+            CommonController(Context* context);
+            virtual ~CommonController();
+            virtual bool isLeader();
+            virtual bool setWingman(CommonController* wingman);
+
+
+        protected:
+
+            //void defaultBehaviour(float maxrand); //<! Helper function for code reusage. Some concrete commands for a bot.    
+         
+        private:
+            
+            //Timer actionTimer_; //<! Regularly calls action().
+               
+    };
+}
+
+#endif /* _CommonController_H__ */
Index: /code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc	(revision 10718)
+++ /code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc	(revision 10719)
@@ -64,10 +64,10 @@
         }
     }
-    /*void DivisionController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    void DivisionController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
         SUPER(DivisionController, XMLPort, xmlelement, mode);
 
         //XMLPortParam(DivisionController, "target_", setTarget, getTarget, xmlelement, mode).defaultValues(100.0f);
-    }*/
+    }
 
     
Index: /code/branches/AI_HS15/src/orxonox/controllers/DivisionController.h
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/DivisionController.h	(revision 10718)
+++ /code/branches/AI_HS15/src/orxonox/controllers/DivisionController.h	(revision 10719)
@@ -39,5 +39,5 @@
 namespace orxonox
 {
-    class _OrxonoxExport DivisionController : public LeaderController
+    class _OrxonoxExport DivisionController : public LeaderController, public Tickable
       {
         public:
@@ -45,5 +45,5 @@
         	virtual ~DivisionController();
 
-        	//virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+        	virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
         	//Using british military aircraft formations
@@ -53,4 +53,17 @@
            		{ return this->formationMode_; }
 			virtual bool setFollower(LeaderController* myFollower);
+			virtual bool setWingman(CommonController* wingman)
+            {
+                if (!this->myWingman_)
+                {
+                    this->myWingman_ = wingman;
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+            };
+            virtual void tick(float dt); //<! Carrying out the targets set in action().
 
 			
@@ -66,5 +79,5 @@
 			FormationMode formationMode_;
 			
-			
+			CommonController* myWingman_;
       		LeaderController* myFollower_;
 	        
Index: /code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc	(revision 10718)
+++ /code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc	(revision 10719)
@@ -35,5 +35,5 @@
     RegisterClass(FleetController);
 
-    FleetController::FleetController(Context* context) : FormationController(context)
+    FleetController::FleetController(Context* context) : Controller(context)
     {
         RegisterObject(FleetController);
Index: /code/branches/AI_HS15/src/orxonox/controllers/FleetController.h
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/FleetController.h	(revision 10718)
+++ /code/branches/AI_HS15/src/orxonox/controllers/FleetController.h	(revision 10719)
@@ -29,5 +29,4 @@
 #ifndef _FleetController_H__
 #define _FleetController_H__
-#include "controllers/FormationController.h"
 
 #include "controllers/Controller.h"
@@ -58,5 +57,5 @@
 {   
 
-    class _OrxonoxExport FleetController : public FormationController, public Tickable
+    class _OrxonoxExport FleetController : public Controller, public Tickable
     {
         public:
Index: /code/branches/AI_HS15/src/orxonox/controllers/FormationController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/FormationController.cc	(revision 10718)
+++ /code/branches/AI_HS15/src/orxonox/controllers/FormationController.cc	(revision 10719)
@@ -277,5 +277,5 @@
         }
 
-        Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
+        Vector2 coord = get2DViewCoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
         float distance = (target - this->getControllableEntity()->getPosition()).length();
         float rotateX = clamp(coord.x * 10, -1.0f, 1.0f);
@@ -1069,5 +1069,5 @@
             return;
 
-        Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
+        Vector2 coord = get2DViewCoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
         float distance = (target - this->getControllableEntity()->getPosition()).length();
 
Index: /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.cc	(revision 10718)
+++ /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.cc	(revision 10719)
@@ -41,5 +41,4 @@
     RegisterClass(LeaderController);
 
-    static const int RADIUS_TO_SEARCH_FOR_LEADER = 3000;
 
     LeaderController::LeaderController(Context* context) : CommonController(context)
@@ -47,5 +46,4 @@
 
         RegisterObject(LeaderController);
-        bIsDivisionLeader_ = false;
 
         //this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&LeaderController::action, this)));
@@ -57,126 +55,5 @@
     }
 
-    LeaderController* LeaderController::findNewDivisionLeader()
-    {
-
-        if (!this->getControllableEntity())
-            return NULL;
-
-        
-        //go through all pawns
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
-        {
-
-            //same team?
-            if (!(this->getControllableEntity()->getTeam() != static_cast<ControllableEntity*>(*it)->getTeam()))
-                continue;
-
-            //Does it have a Controller?
-            Controller* controller = 0;
-
-            if (it->getController())
-                controller = it->getController();
-            else if (it->getXMLController())
-                controller = it->getXMLController();
-
-            if (!controller)
-                continue;
-
-            //is equal to this?
-            if (orxonox_cast<ControllableEntity*>(*it) == this->getControllableEntity())
-                continue;
-
-
-            LeaderController* newLeader = orxonox_cast<LeaderController*>(controller);
-
-            //nullptr or not DivisionController?
-            if (!newLeader || !newLeader->bIsDivisionLeader_)
-                continue;
-
-            float distance = (it->getPosition() - this->getControllableEntity()->getPosition()).length();
-
-            // is pawn in range?
-            if (distance < RADIUS_TO_SEARCH_FOR_LEADER)
-            {
-
-                if (newLeader->setFollower(this))
-                    return newLeader;
-            }
-        }
-                return NULL;
-
-    }
-    void LeaderController::action()
-    {
-        //this->target_ = this->sectionTarget_;        
-        if (!myDivisionLeader_)
-        {
-            LeaderController* newDivisionLeader = findNewDivisionLeader();
-            myDivisionLeader_ = newDivisionLeader;
-            orxout(internal_error) << "new DivisionLeader set" << endl;
-        }
-    }
-    /*
-    Wingmen and Leaders attack target_, which is a member variable of their classes.
-    Wingmen's target_ is set to sectionTarget_, which is a member variable of SectionController class, unless
-    Wingman covers Leader's rear.
-    Leader's target_ must always equal sectionTarget_.
-    if section has a target, its Leader shoots at it, but doesn't follow.
-    Every section is a part of division. Division consisting of one Section is still a division.
-    Division's leader's target_ must always equal divisionTarget_, which is a member variable of DivisionController.
-    Division leader ONLY can follow target_ while in formation flight.
-    If Division doesn't have a target, Division Leader stays in place, unless it has a waypoint.
-    Division Leader's sectionTarget_ must equal divisionTarget_,
-    but the other section, that is not a leading section, can attack any target that is near divisonTarget_
-
-    */
-    void LeaderController::tick(float dt)
-    {/*
-        if (!this->isActive())
-            return;
-        
-        //--------------------------Stay in division--------------------------
-        this->keepDivisionTick();*/
-        /*keepDivisionTick(){
-            if (this->divisionLeader_ && this->divisionLeader_->getControllableEntity() && desiredRelativePosition_){
-                Vector3 desiredAbsolutePosition = ((this->divisionLeader_->getControllableEntity()->getWorldPosition()) + 
-                    (this->divisionLeader_->getControllableEntity()->getWorldOrientation()* (*desiredRelativePosition_)));
-                this->moveToPosition (desiredAbsolutePosition);
-            }
-        }
-        */
-        /*//If ordered to attack -> follow target and shoot
-        if (this->bAttackOrder_)
-        {
- 
-        } 
-        //If ordered to move -> move to a target Point
-        
-        //No orders -> Don't move, but shoot at whatever is close, unless Boss is shooting at it. 
-        //(Section shoots same target, Boss's section shoots another target) 
-        {
-
-        }*/
-
-        orxout(internal_error) << "my Wingman is " << this->myWingman_ << endl;
-        
-        SUPER(LeaderController, tick, dt);
-    }
-    bool LeaderController::setWingman(WingmanController* wingman)
-    {
-        if (!this->myWingman_)
-        {
-            this->myWingman_ = wingman;
-            return true;
-        }
-        else
-        {
-            return false;
-        }
-    }
-    bool LeaderController::isLeader()
-    {
-        return true;
-    }
+    
 //**********************************************NEW
    /* void LeaderController::defaultBehaviour(float maxrand)
Index: /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.h
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.h	(revision 10718)
+++ /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.h	(revision 10719)
@@ -35,27 +35,30 @@
 
 #include "util/Math.h"
-#include "tools/Timer.h"
-#include "tools/interfaces/Tickable.h"
+
 
 namespace orxonox
 {
-    class _OrxonoxExport LeaderController : public CommonController,  virtual public Tickable
+    class _OrxonoxExport LeaderController : public CommonController
     {
         public:
-           
+               static const int RADIUS_TO_SEARCH_FOR_LEADER = 3000;
+
             LeaderController(Context* context);
             virtual ~LeaderController();
-            virtual bool isLeader();
+            virtual bool isLeader()
+            {
+                return true;
+            }
+            bool bIsDivisionLeader_;
+            virtual bool setFollower(LeaderController* myFollower)
+            {
+                return false;
+            };
 
-            virtual bool setWingman(WingmanController* wingman);
-            virtual void tick(float dt); //<! Carrying out the targets set in action().
 
         protected:
            
-            LeaderController* findNewDivisionLeader();
 
-            bool bIsDivisionLeader_;
 
-            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets.
             //void defaultBehaviour(float maxrand); //<! Helper function for code reusage. Some concrete commands for a bot.    
          
@@ -64,6 +67,5 @@
             WeakPtr<Pawn> target_;
             
-            WingmanController* myWingman_;
-            LeaderController* myDivisionLeader_;
+            
             //Timer actionTimer_; //<! Regularly calls action().
                
Index: /code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc	(revision 10719)
+++ /code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc	(revision 10719)
@@ -0,0 +1,163 @@
+/*
+ *   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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Dominik Solenicki
+ *
+ */
+
+#include "SectionController.h"
+
+namespace orxonox
+{
+
+    RegisterClass(SectionController);
+    static const float ACTION_INTERVAL = 1.0f;
+
+    SectionController::SectionController(Context* context) : LeaderController(context)
+    {
+        RegisterObject(SectionController);
+        bIsDivisionLeader_ = false;
+        this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&SectionController::action, this)));
+
+
+    }
+   
+    SectionController::~SectionController()
+    {
+        if (this->isInitialized())
+        {
+           
+        }
+    }
+     LeaderController* SectionController::findNewDivisionLeader()
+    {
+
+        if (!this->getControllableEntity())
+            return NULL;
+
+        
+        //go through all pawns
+        for (ObjectList<LeaderController>::iterator it = ObjectList<LeaderController>::begin(); it; ++it)
+        {
+
+            //same team?
+            if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()))
+                continue;
+
+            //is equal to this?
+            if (orxonox_cast<ControllableEntity*>(*it) == this->getControllableEntity())
+                continue;
+
+
+            
+            //nullptr or not DivisionController?
+            if (!(it) || !(it)->bIsDivisionLeader_)
+                continue;
+
+            float distance = ((it)->getControllableEntity()->getPosition() - this->getControllableEntity()->getPosition()).length();
+
+            // is pawn in range?
+            if (distance < RADIUS_TO_SEARCH_FOR_LEADER)
+            {
+
+                if ((it)->setFollower(this))
+                    return (*it);
+            }
+        }
+                return NULL;
+
+    }
+
+    void SectionController::action()
+    {
+        //this->target_ = this->sectionTarget_;        
+        if (!myDivisionLeader_)
+        {
+            LeaderController* newDivisionLeader = findNewDivisionLeader();
+            myDivisionLeader_ = newDivisionLeader;
+           /* if (newDivisionLeader)
+                orxout(internal_error) << "new DivisionLeader set" << endl;
+            else
+                orxout(internal_error) << "null division leader" << endl;*/
+        }
+    }
+    /*
+    Wingmen and Leaders attack target_, which is a member variable of their classes.
+    Wingmen's target_ is set to sectionTarget_, which is a member variable of SectionController class, unless
+    Wingman covers Leader's rear.
+    Leader's target_ must always equal sectionTarget_.
+    if section has a target, its Leader shoots at it, but doesn't follow.
+    Every section is a part of division. Division consisting of one Section is still a division.
+    Division's leader's target_ must always equal divisionTarget_, which is a member variable of DivisionController.
+    Division leader ONLY can follow target_ while in formation flight.
+    If Division doesn't have a target, Division Leader stays in place, unless it has a waypoint.
+    Division Leader's sectionTarget_ must equal divisionTarget_,
+    but the other section, that is not a leading section, can attack any target that is near divisonTarget_
+
+    */
+    void SectionController::tick(float dt)
+    {/*
+        if (!this->isActive())
+            return;
+        
+        //--------------------------Stay in division--------------------------
+        this->keepDivisionTick();*/
+        /*keepDivisionTick(){
+            if (this->divisionLeader_ && this->divisionLeader_->getControllableEntity() && desiredRelativePosition_){
+                Vector3 desiredAbsolutePosition = ((this->divisionLeader_->getControllableEntity()->getWorldPosition()) + 
+                    (this->divisionLeader_->getControllableEntity()->getWorldOrientation()* (*desiredRelativePosition_)));
+                this->moveToPosition (desiredAbsolutePosition);
+            }
+        }
+        */
+        /*//If ordered to attack -> follow target and shoot
+        if (this->bAttackOrder_)
+        {
+ 
+        } 
+        //If ordered to move -> move to a target Point
+        
+        //No orders -> Don't move, but shoot at whatever is close, unless Boss is shooting at it. 
+        //(Section shoots same target, Boss's section shoots another target) 
+        {
+
+        }*/
+
+        //orxout(internal_error) << "my Wingman is " << this->myWingman_ << endl;
+        
+        SUPER(SectionController, tick, dt);
+    }
+    
+
+    void SectionController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(SectionController, XMLPort, xmlelement, mode);
+
+        //XMLPortParam(SectionController, "target_", setTarget, getTarget, xmlelement, mode).defaultValues(100.0f);
+    }
+
+    
+   
+
+}
Index: /code/branches/AI_HS15/src/orxonox/controllers/SectionController.h
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/SectionController.h	(revision 10719)
+++ /code/branches/AI_HS15/src/orxonox/controllers/SectionController.h	(revision 10719)
@@ -0,0 +1,85 @@
+/*
+ *   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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Dominik Solenicki
+ *
+ */
+
+#ifndef _SectionController_H__
+#define _SectionController_H__
+
+#include "controllers/LeaderController.h"
+
+#include "tools/Timer.h"
+#include "tools/interfaces/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport SectionController : public LeaderController, public Tickable
+    {
+        public:
+            SectionController(Context* context);
+            virtual ~SectionController();
+            virtual bool setWingman(CommonController* wingman)
+            {
+                if (!this->myWingman_)
+                {
+                    this->myWingman_ = wingman;
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+            };
+            virtual void tick(float dt); //<! Carrying out the targets set in action().
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            LeaderController* findNewDivisionLeader();
+ 
+
+
+        protected:
+
+            //A division is the biggest block of spaceships.
+            //In division one section is leading, the other one always stays on the same position
+            //relative to the Leader of the leading section.
+            //In section a Wingman always stays on same position relative to the Leader.
+            //That position is desiredRelativePosition_
+            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets.
+
+
+           
+
+        
+        private:
+            Timer actionTimer_; //<! Regularly calls action().
+            CommonController* myWingman_;
+            LeaderController* myDivisionLeader_;
+            Vector3* desiredRelativePosition_;
+
+    };
+}
+
+#endif /* _SectionController_H__ */
Index: /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc	(revision 10718)
+++ /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc	(revision 10719)
@@ -41,10 +41,10 @@
 
     RegisterClass(WingmanController);
-    static const int RADIUS_TO_SEARCH_FOR_LEADER = 3000;
-
+    static const int RADIUS_TO_SEARCH_FOR_LEADER = 7000;
+    static const float ACTION_INTERVAL = 1.0f;
     WingmanController::WingmanController(Context* context) : CommonController(context)
     {
         RegisterObject(WingmanController);
-        //this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&WingmanController::action, this)));
+        this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&WingmanController::action, this)));
     }
 
@@ -68,34 +68,20 @@
         
         //go through all pawns
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
-        {
-
+        for (ObjectList<CommonController>::iterator it = ObjectList<CommonController>::begin(); it; ++it)
+        {
             //same team?
-            if (!(this->getControllableEntity()->getTeam() != static_cast<ControllableEntity*>(*it)->getTeam()))
+            if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()))
                 continue;
-
-            //Does it have a Controller?
-            Controller* controller = 0;
-
-            if (it->getController())
-                controller = it->getController();
-            else if (it->getXMLController())
-                controller = it->getXMLController();
-
-            if (!controller)
+            //is equal to this?
+            if (it->getControllableEntity() == this->getControllableEntity())
                 continue;
 
-            //is equal to this?
-            if (orxonox_cast<ControllableEntity*>(*it) == this->getControllableEntity())
+
+
+            //nullptr?
+            if (!it || !it->isLeader())
                 continue;
 
-
-            CommonController* newLeader = orxonox_cast<CommonController*>(controller);
-
-            //nullptr?
-            if (!newLeader || !newLeader->isLeader())
-                continue;
-
-            float distance = (it->getPosition() - this->getControllableEntity()->getPosition()).length();
+            float distance = (it->getControllableEntity()->getPosition() - this->getControllableEntity()->getPosition()).length();
 
             // is pawn in range?
@@ -103,13 +89,9 @@
             {
 
-                if (newLeader->setWingman(this))
-                    return newLeader;
+                if (it->setWingman(this))
+                    return *it;
             }
         }
         return NULL;
-    }
-    bool WingmanController::isLeader()
-    {
-        return false;
     }
     void WingmanController::action()
@@ -120,12 +102,17 @@
             CommonController* newLeader = findNewLeader();
             myLeader_ = newLeader;
-            orxout(internal_error) << "new Leader set" << endl;
-        }
-    }
-
-    void WingmanController::tick(float dt)
-    {   
-        //-------------------------------------------------------
-            /*//collect data for AI behaviour
+           /* if (newLeader)
+                orxout(internal_error) << "new Leader set" << endl;
+            else
+                orxout(internal_error) << "null leader" << endl;
+*/
+        }
+        else
+        {
+            //orxout(internal_error) << "already have a Leader" << endl;
+
+        }
+    }
+ /*//collect data for AI behaviour
             Vector3* meanOfEnemiesPtr = new Vector3(0.0,0.0,0.0);
             Vector3* meanOfAlliesPtr  = new Vector3(0.0,0.0,0.0);
@@ -166,31 +153,6 @@
                 orxout(internal_error) << "mean of enemies_ is " << meanOfEnemies << ", with a size " << enemies_.size() << endl;
             }*/
-    /*
-        if (!this->isActive())
-            return;
-        //--------------------------Stay in formation--------------------------
-        if (bFollowLeader_)
-        {
-            this->keepSectionTick();*/
-            /*keepSectionTick(){
-                if (this->sectionLeader_ && this->sectionLeader_->getControllableEntity() && desiredRelativePosition_){
-                    Vector3 desiredAbsolutePosition = ((this->sectionLeader_->getControllableEntity()->getWorldPosition()) + 
-                        (this->sectionLeader_->getControllableEntity()->getWorldOrientation()* (*desiredRelativePosition_)));
-                    this->moveToPosition (desiredAbsolutePosition);
-                }
-            }
-            */
-          /*  
-            //--------------------------Attack same target as the Leader--------------------------
-
-            if (this->target_)
-            {
-                this->aimAtTarget();
-                this->doFire();
-            }
-        }*/
-         //orxout(internal_error) << "I am " << this << endl;
-
-       /* void FormationController::setDesiredPositionOfSlaves()
+
+      /*  void FormationController::setDesiredPositionOfSlaves()
     {
         if (this->state_ != MASTER)
@@ -218,7 +180,47 @@
        
     }*/
+    void WingmanController::tick(float dt)
+    {   
+        //-------------------------------------------------------
+           
+        /*
+        if (!this->isActive())
+            return;
+        //--------------------------Stay in formation--------------------------
+        if (bFollowLeader_)
+        {
+            this->keepSectionTick();
+            
+            keepSectionTick(){
+                if (this->sectionLeader_ && this->sectionLeader_->getControllableEntity() && desiredRelativePosition_){
+                    Vector3 desiredAbsolutePosition = ((this->sectionLeader_->getControllableEntity()->getWorldPosition()) + 
+                        (this->sectionLeader_->getControllableEntity()->getWorldOrientation()* (*desiredRelativePosition_)));
+                    this->moveToPosition (desiredAbsolutePosition);
+                }
+            }
+            
+            
+            //--------------------------Attack same target as the Leader--------------------------
+
+            if (this->target_)
+            {
+                this->aimAtTarget();
+                this->doFire();
+            }
+        }
+        */
+         //orxout(internal_error) << "I am " << this << endl;
+
         
         SUPER(WingmanController, tick, dt);
     }
+
+    void WingmanController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(WingmanController, XMLPort, xmlelement, mode);
+
+        //XMLPortParam(SectionController, "target_", setTarget, getTarget, xmlelement, mode).defaultValues(100.0f);
+    }
+
 //**********************************************NEW
     /*void WingmanController::defaultBehaviour(float maxrand)
Index: /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.h
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.h	(revision 10718)
+++ /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.h	(revision 10719)
@@ -46,10 +46,13 @@
             WingmanController(Context* context);
             virtual ~WingmanController();
-            virtual bool isLeader();
-          //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual bool isLeader()
+            {
+                return false;
+            };
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             virtual void tick(float dt); //<! Carrying out the targets set in action().
+            CommonController* findNewLeader();
 
         protected:
-            CommonController* findNewLeader();
 
             virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets.
@@ -65,5 +68,5 @@
             //LeaderController* leader_;
 
-            //Timer actionTimer_; //<! Regularly calls action().
+            Timer actionTimer_; //<! Regularly calls action().
            
     };
