Index: /code/branches/AI_HS15/data/levels/AITest.oxw
===================================================================
--- /code/branches/AI_HS15/data/levels/AITest.oxw	(revision 10825)
+++ /code/branches/AI_HS15/data/levels/AITest.oxw	(revision 10826)
@@ -79,5 +79,5 @@
       </controller>
     </SpaceShip>
-    <SpaceShip position="6000, 1500, -2800" lookat="0,0,0">
+    <SpaceShip position="4000, 1500, -2800 " lookat="0,0,0">
       <templates>
         <Template link=spaceshipassff />
@@ -88,41 +88,4 @@
       </controller>
     </SpaceShip>
-    <SpaceShip position="6000, 1500, -1000" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <DivisionController team=1 formationMode="DIAMOND">
-        </DivisionController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="6000 ,1500, -1600 " lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=1>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="6000, 1500, -2200" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=1>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="6000, 1500, -2800" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <SectionController team=1>
-        </SectionController>
-      </controller>
-    </SpaceShip>
-  
     
     <SpaceShip position="-4000, 1500, -5000" lookat="0,0,0">
@@ -163,42 +126,4 @@
     </SpaceShip>
 
-       <SpaceShip position="-6000, 1500, -5000" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <DivisionController team=2 formationMode="FINGER4">
-        </DivisionController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="-6000 , 1500, -5600" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=2>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="-6000, 1500, -6200" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=2>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="-6000, 1500, -6800 " lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <SectionController team=2>
-        </SectionController>
-      </controller>
-    </SpaceShip>
-
-
     
    
Index: /code/branches/AI_HS15/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/CMakeLists.txt	(revision 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/CMakeLists.txt	(revision 10826)
@@ -11,5 +11,4 @@
   FormationController.cc
   ControllerDirector.cc
-  FleetController.cc
   DivisionController.cc
   LeaderController.cc
Index: /code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	(revision 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	(revision 10826)
@@ -46,6 +46,6 @@
 
     RegisterClass( CommonController );
-    float SPEED = 0.9f/0.02f;
-    float ROTATEFACTOR = 1.0f/0.02f;
+    const float SPEED = 0.9f/0.02f;
+    const float ROTATEFACTOR = 1.0f/0.02f;
 
     CommonController::CommonController( Context* context ): Controller( context )
@@ -53,9 +53,9 @@
         this->bSetupWorked = false;
 
-        this->executingManeuver_ = false;
+       
         this->executingMoveToPoint_ = false;
         this->action_ = Action::FLY;
         this->stopLookingAtTarget();
-        this->maneuverType_ = ManeuverType::NONE;
+       
         RegisterObject( CommonController );
     }
@@ -64,5 +64,5 @@
     CommonController::~CommonController() 
     {
-        orxout(internal_error) << "I died, my Rank is " << rank_ << endl;
+        //orxout(internal_error) << "I died, my Rank is " << rank_ << endl;
     }
 
@@ -77,7 +77,6 @@
         const std::string valUpper = getUppercase( val );
         FormationMode::Value value;
-        if ( valUpper == "VEE" )
-            value = FormationMode::VEE;
-        else if ( valUpper == "WALL" )
+        
+        if ( valUpper == "WALL" )
             value = FormationMode::WALL;
         else if ( valUpper == "FINGER4" )
@@ -94,9 +93,4 @@
         switch ( this->formationMode_ )
         {
-            case FormationMode::VEE:
-            {
-                return "VEE";
-                break;
-            }
             case FormationMode::WALL:
             {
@@ -246,9 +240,5 @@
             }
         }
-        if ( this->getControllableEntity()  && !this->target_ )
-        {
-
-            this->maneuverType_ = ManeuverType::NONE;
-        }
+        
         //orxout ( internal_error ) << "ManeuverType = " << this->maneuverType_ << endl;
     }
@@ -606,4 +596,16 @@
 
     }
+    float CommonController::distance (ControllableEntity* entity1, ControllableEntity* entity2)
+    {
+        if (!entity1 || !entity2)
+            return std::numeric_limits<float>::infinity();
+        return ( entity1->getPosition() - entity2->getPosition() ).length();
+    }
+    bool CommonController::sameTeam (ControllableEntity* entity1, ControllableEntity* entity2)
+    {
+        if (!entity1 || !entity2)
+            return false;
+        return entity1->getTeam() == entity2->getTeam();
+    }
     void CommonController::doFire() 
     {
Index: /code/branches/AI_HS15/src/orxonox/controllers/CommonController.h
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	(revision 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	(revision 10826)
@@ -34,5 +34,5 @@
 #include "worldentities/ControllableEntity.h"
 #include "worldentities/pawns/Pawn.h"
-#include "core/ClassTreeMask.h"
+#include <limits>
 
 
@@ -44,5 +44,5 @@
         enum Value
         {
-            VEE, FINGER4, DIAMOND, WALL
+            FINGER4, DIAMOND, WALL
         };
     }
@@ -55,15 +55,4 @@
 
     }
-    //none for a formation flight without attacking, neutral when opponent and this have no 
-    //advantage over each other, offensive when this spotted opponent first,
-    //defensive otherwise
-    namespace ManeuverType
-    {
-        enum Value 
-        { 
-            NONE, NEUTRAL, OFFENSIVE, DEFENCIVE 
-        };
-
-    }
     namespace Action
     {  
@@ -73,14 +62,5 @@
         };
     }
-    //none for a formation flight
-    namespace Maneuver
-    {
-        enum Value
-        {
-            NONE, GUNSD, SCISSORS, COMBATSPREAD, DEFENSIVESPLIT, BREAK, BARRELROLL, SWOOP, IMMELMANN, 
-            WINGOVER, LOWYOYO, HIGHYOYO, LAGDISPLACEMENTROLL
-        };
-    }
-
+ 
 
     class _OrxonoxExport CommonController : public Controller
@@ -118,5 +98,5 @@
             virtual bool setWingman(CommonController* wingman);
             virtual bool hasWingman();
-
+            static bool sameTeam (ControllableEntity* entity1, ControllableEntity* entity2);
             void setTarget(ControllableEntity* target);
             bool hasTarget();
@@ -147,4 +127,5 @@
             void copyTargetOrientation(float dt);
 
+            static float distance(ControllableEntity* entity1, ControllableEntity* entity2);
             float squaredDistanceToTarget() const;
             void doFire();
@@ -202,8 +183,5 @@
             FormationMode::Value formationMode_;
             Rank::Value rank_;
-            ManeuverType::Value maneuverType_;
-            Maneuver::Value maneuver_;
-
-            bool executingManeuver_;
+        
             bool executingMoveToPoint_;
          
Index: /code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc	(revision 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc	(revision 10826)
@@ -35,4 +35,5 @@
     RegisterClass(DivisionController);
 
+    //Leaders share the fact that they have Wingmans
     DivisionController::DivisionController(Context* context) : LeaderController(context)
     {
@@ -53,4 +54,11 @@
     } 
 
+    void DivisionController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(DivisionController, XMLPort, xmlelement, mode);
+
+        //XMLPortParam(DivisionController, "target_", setTarget, getTarget, xmlelement, mode).defaultValues(100.0f);
+    }
+
     
     void DivisionController::tick(float dt)
@@ -76,14 +84,15 @@
     void DivisionController::action()
     {
-        if (!this->target_)
+        //----find a target----
+        if ( !this->hasTarget() )
         {
             for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
             {
-                if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam())
+                if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP)) )
                     continue;           
 
                 
-                if (static_cast<ControllableEntity*>(*itP) != (this)->getControllableEntity() && !(this)->hasTarget()
-                    && ((*itP)->getWorldPosition() - (this)->getControllableEntity()->getWorldPosition()).length() < 10000)
+                if (static_cast<ControllableEntity*>(*itP) != (this)->getControllableEntity()
+                    && CommonController::distance (*itP, this->getControllableEntity())  < 10000)
                 {
                     (this)->setAction(Action::FIGHT, *itP);
@@ -94,13 +103,18 @@
         if (this->action_ == Action::FIGHT)
         {
+            //----choose where to go----
             this->maneuver();
+            //----fire if you can----
             this->bShooting_ = this->canFire();
+
             if (this->target_)
             {
                 if (this->myWingman_)
                 {
+                    //----wingmans shall support the fire of their leaders----
                     this->myWingman_->setAction (Action::FIGHT, this->target_);                    
                 }
                 
+                //----fly in formation if far enough----
                 Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
                 if (diffVector.length() > 3000)
@@ -141,8 +155,5 @@
                 break;
             }
-            case FormationMode::VEE: 
-            {
-                break;
-            }
+         
             case FormationMode::DIAMOND: 
             {
@@ -177,8 +188,5 @@
                 break;
             }
-            case FormationMode::VEE: 
-            {
-                break;
-            }
+            
             case FormationMode::DIAMOND: 
             {
@@ -239,11 +247,4 @@
 
 
-    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 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/DivisionController.h	(revision 10826)
@@ -42,27 +42,32 @@
       {
         public:
+            //----[language demanded functions]----            
+            	DivisionController(Context* context);
 
-        	DivisionController(Context* context);
-        	virtual ~DivisionController();
+            	virtual ~DivisionController();
+            //----[/language demanded functions]----            
 
-            virtual void tick(float dt); //<! Carrying out the targets set in action().
+            //----[orxonox demanded functions]----
+                virtual void tick(float dt); 
 
-     		
-			virtual bool setFollower(LeaderController* myFollower);
-			virtual bool setWingman(CommonController* cwingman);
-            virtual bool hasWingman();
-            virtual bool hasFollower();
+                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);          
+            //----[orxonox demanded functions]----
 
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);          
+            //----[own functions]----
+                virtual bool setFollower(LeaderController* myFollower);
+                virtual bool setWingman(CommonController* cwingman);
+                virtual bool hasWingman();
+                virtual bool hasFollower();
+
+                void setTargetPositionOfWingman();
+                void setTargetPositionOfFollower();
+            //----[/own functions]----
 
         protected:
-            
-            void setTargetPositionOfWingman();
-            void setTargetPositionOfFollower();
-
-            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets.
+            //----action must only be managed by this----
+            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
 	    
         private:
-
+            //----private variables-----
             Timer actionTimer_; //<! Regularly calls action().
 
Index: de/branches/AI_HS15/src/orxonox/controllers/FleetController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc	(revision 10825)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*
- *   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 "FleetController.h"
-
-
-namespace orxonox
-{
-
-    RegisterClass(FleetController);
-
-    FleetController::FleetController(Context* context) : Controller(context)
-    {
-        RegisterObject(FleetController);
-        
-        this->gameGoal_ = DOMINATE;
-        this->goalPosition_ = NULL;
-      /*  this->goalTarget_ = NULL;
-        this->goalProtect_ = NULL;*/
-        
-        this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&FleetController::action, this)));
-    }
-
-    FleetController::~FleetController()
-    {
-        if (this->isInitialized())
-        {
-           
-        }
-    }
-    void FleetController::action()
-    {
-        this->divisions_.clear();
-        
-        for (ObjectList<DivisionController>::iterator it = ObjectList<DivisionController>::begin(); it; ++it)
-        {
-            if ((this->getControllableEntity()->getTeam() == (it)->getControllableEntity()->getTeam()))
-            {
-                this->divisions_.push_back(*(it));
-            } 
-        }
-        /*for(std::vector<WeakPtr<DivisionController> >::iterator it2 = divisions_.begin(); it2 != divisions_.end(); ++it2) 
-        {
-            (*it2)->setTargetPosition(this->getControllableEntity()->getWorldPosition());   
-        }*/ 
-        /*for (ObjectList<Controller>::iterator it = ObjectList<Controller>::begin(); it; ++it)
-        {
-            if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()) && (it)->getControllableEntity()->getTeam() == 0)
-            {
-                for(std::vector<WeakPtr<DivisionController> >::iterator it2 = divisions_.begin(); it2 != divisions_.end(); ++it2) {
-                    (*it2)->setTarget(it->getControllableEntity());   
-                    (*it2)->setTargetPosition(it->getControllableEntity()->getWorldPosition());
-                }               
-                break;
-            } 
-        }*/
-        for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
-        {
-            if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam())
-                continue;           
-
-            for(std::vector<WeakPtr<DivisionController> >::iterator it = divisions_.begin(); it != divisions_.end(); ++it) 
-            {
-                if (static_cast<ControllableEntity*>(*itP) != (*it)->getControllableEntity() && !(*it)->hasTarget()
-                    && ((*itP)->getWorldPosition() - (*it)->getControllableEntity()->getWorldPosition()).length() < 10000)
-                {
-                    (*it)->setAction(Action::FIGHT, *itP);
-                }
-                
-            }   
-           
-        }
-        /*for(std::vector<WeakPtr<DivisionController> >::iterator it = divisions_.begin(); it != divisions_.end(); ++it) 
-        {
-            Vector3* target = new Vector3 (0, 0, 2000);
-            (*it)->setAction (Action::FLY, *target);           
-        }   
-*/
-    }
-    void FleetController::tick(float dt)
-    {
-
-        SUPER(FleetController, tick, dt);
-
-    }
-    void FleetController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(FleetController, XMLPort, xmlelement, mode);
-
-        //XMLPortObject(FleetController, GameGoal, "gameGoal", setGameGoal, getGameGoal, xmlelement, mode).defaultValues(DOMINATE);
-        //XMLPortParam(FleetController, "goalPosition", setGoalPosition, getGoalPosition, xmlelement, mode).defaultValues(NULL);
-        //XMLPortParam(FleetController, "goalTarget", setGoalTarget, getGoalTarget, xmlelement, mode).defaultValues(NULL);
-        //XMLPortParam(FleetController, "goalProtect", setGoalProtect, getGoalProtect, xmlelement, mode).defaultValues(NULL);
-
-    }
-
-    
-   
-
-}
Index: de/branches/AI_HS15/src/orxonox/controllers/FleetController.h
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/FleetController.h	(revision 10825)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- *   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 _FleetController_H__
-#define _FleetController_H__
-
-#include "controllers/Controller.h"
-#include "controllers/DivisionController.h"
-#include "controllers/LeaderController.h"
-#include "controllers/WingmanController.h"
-
-#include "OrxonoxPrereqs.h"
-#include "core/class/Super.h"
-#include "core/CoreIncludes.h"
-
-
-#include <vector>
-#include "util/Math.h"
-#include <climits>
-
-#include "tools/Timer.h"
-#include "tools/interfaces/Tickable.h"
-
-#include "worldentities/ControllableEntity.h"
-
-
-namespace orxonox
-{   
-
-    class _OrxonoxExport FleetController : public Controller, public Tickable
-    {
-        public:
-                      static const float ACTION_INTERVAL = 1.0f;
-
-          FleetController(Context* context);
-          virtual ~FleetController();
-
-          virtual void tick(float dt); //<! Carrying out the targets set in action().
-
-          virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
-          //gameGoal_ is to be set in XML
-          //DOMINATE is default, makes AI want to be the only team alive
-          //MOVE makes a fleet move to a set absolute position (set in variable goalPosition_)
-          //DESTROY makes a fleet destroy a target (set in variable goalTarget_)
-          //PROTECT makes a fleet protect a target (set in variable goalProtect_)
-          enum GameGoal {DOMINATE, MOVE, DESTROY, PROTECT};
-          
-          
-
-
-        protected:
-            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets.
-
-            
-            GameGoal gameGoal_;
-            Vector3* goalPosition_;
-            WeakPtr<Pawn> goalTarget_;
-            WeakPtr<Pawn> goalProtect_;
-
-        private:
-        
-            std::vector<WeakPtr<DivisionController> > divisions_;
-            Timer actionTimer_; //<! Regularly calls action().
-
-    };
-}
-
-#endif /* _FleetController_H__ */
Index: /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.cc	(revision 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.cc	(revision 10826)
@@ -41,5 +41,5 @@
     RegisterClass(LeaderController);
 
-
+    //CommonController contains all common functionality of AI Controllers
     LeaderController::LeaderController(Context* context) : CommonController(context)
     {
Index: /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.h
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.h	(revision 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/LeaderController.h	(revision 10826)
@@ -42,23 +42,23 @@
     {
         public:
+            //----[language demanded functions]----            
+                LeaderController(Context* context);
+                virtual ~LeaderController();
+            //----[language demanded functions]----            
 
-            LeaderController(Context* context);
-            virtual ~LeaderController();
-           
-            virtual bool setFollower(LeaderController* myFollower)
-                { return false; }
-           
-            virtual bool hasFollower()
-                { return true; }
-            
+            //----[pseudo virtual methods]----
+                virtual bool setFollower(LeaderController* myFollower)
+                    { return false; }
+                virtual bool hasFollower()
+                    { return true; }
+            //----[/pseudo virtual methods]----
 
 
 
         protected:
-         
-            WeakPtr<WingmanController> myWingman_;
-
-            WeakPtr<LeaderController> myFollower_;
-            WeakPtr<LeaderController> myDivisionLeader_;
+            //----private variables-----
+                WeakPtr<WingmanController> myWingman_;
+                WeakPtr<LeaderController> myFollower_;
+                WeakPtr<LeaderController> myDivisionLeader_;
 
             
Index: /code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc	(revision 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc	(revision 10826)
@@ -34,4 +34,5 @@
     RegisterClass(SectionController);
 
+    //Leaders share the fact that they have Wingmans
     SectionController::SectionController(Context* context) : LeaderController(context)
     {
@@ -44,5 +45,5 @@
         this->rank_ = Rank::SECTIONLEADER;
 
-        orxout(internal_error) << this << "Was created" << endl;
+        //orxout(internal_error) << this << "Was created" << endl;
 
     }
@@ -52,5 +53,12 @@
        
     }
-
+    void SectionController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(SectionController, XMLPort, xmlelement, mode);
+
+        //XMLPortParam(SectionController, "target_", setTarget, getTarget, xmlelement, mode).defaultValues(100.0f);
+    }
+
+    //----in tick, move (or look) and shoot----
     void SectionController::tick(float dt)
     {
@@ -75,92 +83,132 @@
     void SectionController::action()
     {
-        //this->target_ = this->sectionTarget_;        
+        //----If no leader, find one----  
         if (!myDivisionLeader_)
         {
             LeaderController* newDivisionLeader = findNewDivisionLeader();
             this->myDivisionLeader_ = newDivisionLeader;
+
             if (newDivisionLeader)
-                orxout(internal_error) << "new DivisionLeader set" << endl;
+            {
+                //orxout(internal_error) << "new DivisionLeader set" << endl;
+            }
+            //----If no leader found, attack someone----
+            //----TODO: find closest enemy----
             else
             {
-                for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
-                {
-                    if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam())
-                        continue;           
-
-                    if (!this->myDivisionLeader_)
+                if ( !this->hasTarget() || this->action_ != Action::FIGHT )
+                {
+                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
                     {
+                        if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP)) )
+                            continue;
+
                         this->setAction(Action::FIGHT, (*itP));
-                        break;
+                        break;   
+                    }    
+                }
+                
+            }
+
+        }
+        //----If have leader----
+        else
+        {
+            this->chooseTarget();
+        }
+
+        //----action was set to fight----
+        if (this->action_ == Action::FIGHT)
+        {
+            //----choose where to go----
+            this->maneuver();
+            //----fire if you can----
+            this->bShooting_ = this->canFire();
+
+            if (this->target_)
+            {
+                //----wingmans shall support the fire of their leaders----
+                if (this->myWingman_)
+                {
+                    this->myWingman_->setAction (Action::FIGHT, this->target_);                    
+                }
+                //----fly in formation if far enough----
+                Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
+                if (diffVector.length() > 3000)
+                {
+                    this->setTargetPositionOfWingman();
+                }   
+            }
+        }
+
+        //----action was set to fly----
+        else if (this->action_ == Action::FLY)
+        {
+            this->setTargetPositionOfWingman();
+        }
+
+        //----action was set to protect----
+        else if (this->action_ == Action::PROTECT)
+        {
+
+        }
+                
+
+    }
+    //PRE: myDivisionLeader_ != 0
+    //POST: this->target_ is set unless division leader doesn't have one
+    void SectionController::chooseTarget()
+    {
+        //----If division leader fights, cover him by fighting emenies close to his target----
+        if (this->myDivisionLeader_->getAction() == Action::FIGHT)
+        {
+            //----if he has a target----
+            if (this->myDivisionLeader_->hasTarget())
+            {
+                //----try to find a new target if division leader has wingman (doing fine) and no good target already set----
+                if ( this->myDivisionLeader_->hasWingman() && 
+                    !( this->hasTarget() && this->getTarget() != this->myDivisionLeader_->getTarget() ) )
+                {
+
+                    bool foundTarget = false;
+                    //----new target should be close to division's target----
+                    Vector3 divisionTargetPosition = this->myDivisionLeader_->getTarget()->getWorldPosition();
+                    
+                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                    {
+                        //----is enemy?----
+                        if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP)) )
+                            continue;           
+                        //----in range?----
+                        if (((*itP)->getWorldPosition() - divisionTargetPosition).length() < 3000 && 
+                            (*itP) != this->myDivisionLeader_->getTarget())
+                        {
+                            foundTarget = true;
+                            this->setAction(Action::FIGHT, (*itP));
+                            //orxout(internal_error) << "Found target" << endl;
+                            break; 
+                        }
                     }
-                   
-                }
-            }
-
-        }
-        else
-        {
-            if (this->myDivisionLeader_->getAction() == Action::FIGHT)
-            {
-                if (this->myDivisionLeader_->hasTarget())
-                {
-                    if (this->myDivisionLeader_->hasWingman() && (!this->hasTarget() || this->getTarget() == this->myDivisionLeader_->getTarget()))
+                    //----no target? then attack same target as division leader----
+                    if (!foundTarget)
                     {
-                        bool foundTarget = false;
-                        Vector3 divisionTargetPosition = this->myDivisionLeader_->getTarget()->getWorldPosition();
-                        for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
-                        {
-                            if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam())
-                                continue;           
-
-                            if (((*itP)->getWorldPosition() - divisionTargetPosition).length() < 3000 &&
-                                ((*itP)->getWorldPosition() - divisionTargetPosition).length() > 1000 && 
-                                (*itP) != this->myDivisionLeader_->getTarget())
-                            {
-                                foundTarget = true;
-                                this->setAction(Action::FIGHT, (*itP));
-                                orxout(internal_error) << "Found target" << endl;
-                                break; 
-                            }
-                        }
-                        if (!foundTarget)
-                        {
-                            this->setAction(Action::FIGHT, this->myDivisionLeader_->getTarget());
-                        }
-
+                        this->setAction(Action::FIGHT, this->myDivisionLeader_->getTarget());
                     }
                 }
-            }   
-        }
-        
-        if (this->action_ == Action::FIGHT)
-        {
-            this->maneuver();
-            this->bShooting_ = this->canFire();
-            if (this->target_)
-            {
-                if (this->myWingman_)
-                {
-                    this->myWingman_->setAction (Action::FIGHT, this->target_);                    
+                //----if division leader doesn't have a wingman, support his fire----
+                else
+                {
+                    this->setAction(Action::FIGHT, this->myDivisionLeader_->getTarget());
                 }
-                Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
-                if (diffVector.length() > 3000)
-                {
-                    this->setTargetPositionOfWingman();
-                }   
-            }
-        }
-        else if (this->action_ == Action::FLY)
-        {
-            this->setTargetPositionOfWingman();
-        }
-        else if (this->action_ == Action::PROTECT)
-        {
-
-        }
-                
-
-    }
-    
+            }
+            //----If he fights but doesn't have a target, wait for him to get one----
+            else
+            {
+
+            }
+        } 
+    }
+
+    //----stay in formation----
     void SectionController::setTargetPositionOfWingman()
     {
@@ -177,8 +225,4 @@
             {
                 targetRelativePositionOfWingman = new Vector3 (-400, 0, -200);  
-                break;
-            }
-            case FormationMode::VEE: 
-            {
                 break;
             }
@@ -197,4 +241,5 @@
        
     }
+
     LeaderController* SectionController::findNewDivisionLeader()
     {
@@ -219,6 +264,5 @@
                 continue;
 
-
-            float distance = ((it)->getControllableEntity()->getPosition() - this->getControllableEntity()->getPosition()).length();
+            float distance = CommonController::distance (it->getControllableEntity(), this->getControllableEntity());
             
             if (distance < minDistance && !(it->hasFollower()))
@@ -260,11 +304,5 @@
     }
 
-    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 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/SectionController.h	(revision 10826)
@@ -40,26 +40,33 @@
     {
         public:
+            //----[language demanded functions]----            
+                SectionController(Context* context);
 
-            SectionController(Context* context);
-            virtual ~SectionController();
+                virtual ~SectionController();
+            //----[/language demanded functions]----
             
-            virtual void tick(float dt); //<! Carrying out the targets set in action().
+            //----[orxonox demanded functions]----
+                virtual void tick(float dt); 
+                
+                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            //----[/orxonox demanded functions]----
             
+            //----[own functions]----
+                LeaderController* findNewDivisionLeader();
+                void setTargetPositionOfWingman();
 
-            LeaderController* findNewDivisionLeader();
-            virtual bool setWingman(CommonController* cwingman);
-            virtual bool hasWingman();
-            
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+                virtual bool setWingman(CommonController* cwingman);
+                virtual bool hasWingman();
 
-        protected:
+                void chooseTarget();
+            //----[/own functions]----
 
-            void setTargetPositionOfWingman();
-            
-            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets.
+        protected:       
+            //----action must only be managed by this----     
+                virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
 
         private:
-
-            Timer actionTimer_; //<! Regularly calls action().
+            //----private variables-----
+                Timer actionTimer_; //<! Regularly calls action().
             
 
Index: /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc	(revision 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc	(revision 10826)
@@ -35,5 +35,5 @@
     RegisterClass(WingmanController);
     
-
+    //CommonController contains all common functionality of AI Controllers
     WingmanController::WingmanController(Context* context) : CommonController(context)
     {
@@ -42,5 +42,4 @@
         this->myLeader_ = 0;
         this->rank_ = Rank::WINGMAN;
-
     }
 
@@ -49,64 +48,13 @@
 
     }
-    // void WingmanController::chooseManeuver()
-    // {
-    //     if (this->maneuverType_ == ManeuverType::NONE)
-    //     switch (this->maneuverType_ )
-    //     {
-    //         case ManeuverType::NONE:
-    //         {
+  
+    void WingmanController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(WingmanController, XMLPort, xmlelement, mode);
 
-    //             break;
-    //         }
-    //         case ManeuverType::NEUTRAL:
-    //         {
-
-    //             break;
-    //         }
-    //         case ManeuverType::OFFENSIVE:
-    //         {
-
-    //             break;
-    //         }
-    //         case ManeuverType::DEFENSIVE:
-    //         {
-
-    //             break;
-    //         }
-    //     }
-    //     if (!this->myWingman_)
-    //         return;
-    //     Vector3* targetRelativePositionOfWingman;
-    //     switch (this->formationMode_){
-    //         case FormationMode::WALL:
-    //         {
-    //             targetRelativePositionOfWingman = new Vector3 (-400, 0, 0);  
-    //             break;
-    //         }
-    //         case FormationMode::FINGER4: 
-    //         {
-    //             targetRelativePositionOfWingman = new Vector3 (-400, 0, -200);  
-    //             break;
-    //         }
-    //         case FormationMode::VEE: 
-    //         {
-    //             break;
-    //         }
-    //         case FormationMode::DIAMOND: 
-    //         {
-    //             targetRelativePositionOfWingman = new Vector3 (400, -200, 0);                  
-    //             break;
-    //         }
-    //     }
-    //     Quaternion orient = this->getControllableEntity()->getWorldOrientation();
-        
-    //     Vector3 targetAbsolutePositionOfWingman = ((this->getControllableEntity()->getWorldPosition()) + 
-    //     (this->getControllableEntity()->getWorldOrientation()* (*targetRelativePositionOfWingman)));
-        
-    //     myWingman_->setTargetOrientation(orient);
-    //     myWingman_->setTargetPosition(targetAbsolutePositionOfWingman);
-       
-    // }
-
+        //XMLPortParam(SectionController, "target_", setTarget, getTarget, xmlelement, mode).defaultValues(100.0f);
+    }
+    
+    //----in tick, move (or look) and shoot----
     void WingmanController::tick(float dt)
     {   
@@ -129,6 +77,8 @@
     }
     
+    //----action for hard calculations----
     void WingmanController::action()
     {
+        //----If no leader, find one----
         if (!this->myLeader_)
         {
@@ -136,11 +86,16 @@
             this->myLeader_ = newLeader;
             if (newLeader)
-                orxout(internal_error) << "new Leader set" << endl;
+            {
+                //orxout(internal_error) << "new Leader set" << endl;
+            }
+            //----If no leader found, attack someone----
+            //----TODO: find closest enemy----
             else
             {
-                if (!this->target_){
+                if ( !this->hasTarget() || this->action_ != Action::FIGHT )
+                {
                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
                     {
-                        if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam())
+                        if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP)) )
                             continue;   
                         this->setAction(Action::FIGHT, (*itP));
@@ -149,28 +104,26 @@
                 }
             }
-
         }
+        //----If have leader, he will deal with logic----
         else
         {
 
         }
-        
+
+
+        //----action was set to fight----
         if (this->action_ == Action::FIGHT)
         {
+            //----choose where to go----
             this->maneuver();
+            //----fire if you can----
             this->bShooting_ = this->canFire();
-            if (this->target_)
-            {
-                Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
-                if (diffVector.length() > 5000)
-                {
-                  
-                }   
-            }
         }
+        //----action was set to fly, leader handles the logic----
         else if (this->action_ == Action::FLY)
         {
 
         }
+        //----TODO: implement protect----
         else if (this->action_ == Action::PROTECT)
         {
@@ -182,5 +135,5 @@
    
     
-
+    //----POST: closest leader that is ready to take a new wingman is returned----
     CommonController* WingmanController::findNewLeader()
     {
@@ -189,4 +142,5 @@
             return 0;
 
+        //----vars for finding the closest leader----
         CommonController* closestLeader = 0;
         float minDistance =  std::numeric_limits<float>::infinity();
@@ -194,17 +148,16 @@
         for (ObjectList<CommonController>::iterator it = ObjectList<CommonController>::begin(); it; ++it)
         {
-            //0ptr?
+            //----0ptr or not a leader or dead?----
             if (!it || 
                 (it->getRank() != Rank::SECTIONLEADER && it->getRank() != Rank::DIVISIONLEADER) || 
                 !(it->getControllableEntity()))
                 continue;
-            //same team?
-            if (this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam())
+            
+            //----same team?----
+            if ( !CommonController::sameTeam (this->getControllableEntity(), (it)->getControllableEntity()) )
                 continue;
-            //is equal to this?
-            if (it->getControllableEntity() == this->getControllableEntity())
-                continue;
-
-            float distance = (it->getControllableEntity()->getPosition() - this->getControllableEntity()->getPosition()).length();
+            
+            //----check distance----
+            float distance = CommonController::distance (it->getControllableEntity(), this->getControllableEntity());
             if (distance < minDistance && !(it->hasWingman()))
             {
@@ -216,4 +169,5 @@
         if (closestLeader)
         {
+            //----Racing conditions----
             if (closestLeader->setWingman(this))
                 return closestLeader;
@@ -222,10 +176,4 @@
     }
 
-    void WingmanController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(WingmanController, XMLPort, xmlelement, mode);
-
-        //XMLPortParam(SectionController, "target_", setTarget, getTarget, xmlelement, mode).defaultValues(100.0f);
-    }
 
 
Index: /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.h
===================================================================
--- /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.h	(revision 10825)
+++ /code/branches/AI_HS15/src/orxonox/controllers/WingmanController.h	(revision 10826)
@@ -32,5 +32,4 @@
 
 #include "controllers/CommonController.h"
-#include <limits>
 
 
@@ -45,23 +44,29 @@
     {
         public:
-            WingmanController(Context* context);
-            virtual ~WingmanController();
-           
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            virtual void tick(float dt); //<! Carrying out the targets set in action().
-            CommonController* findNewLeader();
+            //----[language demanded functions]----
+                WingmanController(Context* context);
+                
+                virtual ~WingmanController();
+            //----[/language demanded functions]----
+            
+            //----[orxonox demanded functions]----
+                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+                virtual void tick(float dt); 
+            //----[/orxonox demanded functions]----
+
+            //----[own functions]----
+               CommonController* findNewLeader();
+            //----[/own functions]----
 
         protected:
-            WeakPtr<CommonController> myLeader_;
+            //----action must only be managed by this----
+                virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
 
-            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets.
-
-
-                     
         private:
-
-
-            Timer actionTimer_; //<! Regularly calls action().
-           
+            //----private variables-----
+                WeakPtr<CommonController> myLeader_;
+                Timer actionTimer_; //<! Regularly calls action().
+               
     };
 }
