Index: code/branches/presentationHS15/data/levels/AITest.oxw
===================================================================
--- code/branches/presentationHS15/data/levels/AITest.oxw	(revision 10971)
+++ code/branches/presentationHS15/data/levels/AITest.oxw	(revision 10974)
@@ -162,5 +162,5 @@
 <!-- HERE ENDS DEMO FOR THE ACTIONPOINTS -->
 <!-- HERE STARTS DEMO FOR FIGHTING -->
-    <!-- 
+    
 
     <SpaceShip position="-4000, 1500, -1000" lookat="0,0,0" team=0 name="d1sd1">
@@ -238,9 +238,9 @@
         </WingmanController>
       </controller>
-    </SpaceShip>  -->
+    </SpaceShip> 
 
 <!-- HERE ENDS DEMO FOR FIGHTING -->
 <!-- HERE STARTS DEMO FOR FORMATIONS -->
-    
+    <!-- 
     <Model mesh="cube.mesh" scale=8 position="   0,2000,    0" />
     <Model mesh="cube.mesh" scale=8 position="   0,2000,-2000" />
@@ -291,5 +291,5 @@
       </controller>
     </SpaceShip> 
-   
+    -->
 <!-- HERE ENDS DEMO FOR FORMATIONS -->
     <!-- 1 division is roughly equal to 6 AIControllers--!>
Index: code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10974)
@@ -53,5 +53,4 @@
         this->bDefaultPatrol_ = true;
         this->bDefaultFightAll_ = true;
-        this->stop_ = false;
         RegisterObject(ActionpointController);
 
@@ -75,5 +74,5 @@
     void ActionpointController::tick(float dt)
     {
-        if (!this || !this->getControllableEntity() || !this->isActive() || this->stop_)
+        if (!this || !this->getControllableEntity() || !this->isActive())
             return;
 
@@ -733,33 +732,29 @@
         if (!this || !this->getControllableEntity())
             return;
-
-        //if (this->action_ != Action::FIGHT && this->action_ != Action::FIGHTALL)
-        {
-            if (!this->target_ || (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_))
-            {
-                if (!this || !this->getControllableEntity())
-                    return;
-                Pawn* newTarget = this->closestTarget();
-                if ( newTarget && 
-                    CommonController::distance (this->getControllableEntity(), static_cast<ControllableEntity*>(newTarget))
-                        <= this->attackRange_ )
-                {
-                    if (!this || !this->getControllableEntity())
-                        return;
-                    this->setTarget(newTarget);
-                    if (this->bLoop_ && !this->bPatrolling_)
-                    {
-                        Point p = { Action::FIGHT, "", Vector3::ZERO, true };
-                        this->loopActionpoints_.push_back(p);
-                    }
-                    else if (!this->bPatrolling_)
-                    {
-                        //orxout (internal_error) << "found new target " << CommonController::getName(newTarget) <<endl;
-                        Point p = { Action::FIGHT, "", Vector3::ZERO, false };
-                        this->parsedActionpoints_.push_back(p);
-                    }
-                    this->bPatrolling_ = true;
-                    this->executeActionpoint();
-                }
+        
+        if (!this->target_ || (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_))
+        {
+            if (!this || !this->getControllableEntity())
+                return;
+            Pawn* newTarget = this->closestTarget();
+            if ( newTarget && 
+                CommonController::distance (this->getControllableEntity(), static_cast<ControllableEntity*>(newTarget))
+                    <= this->attackRange_ )
+            {
+                if (!this || !this->getControllableEntity())
+                    return;
+                this->setTarget(newTarget);
+                if (this->bLoop_ && !this->bPatrolling_)
+                {
+                    Point p = { Action::FIGHT, "", Vector3::ZERO, true };
+                    this->loopActionpoints_.push_back(p);
+                }
+                else if (!this->bPatrolling_)
+                {
+                    Point p = { Action::FIGHT, "", Vector3::ZERO, false };
+                    this->parsedActionpoints_.push_back(p);
+                }
+                this->bPatrolling_ = true;
+                this->executeActionpoint();
             }
         }
Index: code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.h	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.h	(revision 10974)
@@ -63,4 +63,5 @@
     @note
         ActionpointController will not work, if there is no MasterController in the level!
+        All the demos are in a file called AITest.oxw. In the menu look for New AI Testing Level.
     */
     namespace Action
@@ -216,7 +217,7 @@
                 std::vector<Point > parsedActionpoints_;//<! actionpoints as they are stored here after being parsed from XML
                 std::vector<Point > loopActionpoints_;  //<! actionpoints that are to be looped
-                bool bInLoop_;
+                bool bInLoop_;                          //<! variable for addActionpoint method
                 bool bLoop_;                            //<! is state machine looping?
-                bool bEndLoop_;                    
+                bool bEndLoop_;                         //<! variable for addActionpoint method
                 bool bTakenOver_;                       //<! are actionpoints taken over from the leader when he died? if yes, top actionpoint 
                                                         //<! is to be executed for the state machine to start working
@@ -250,11 +251,9 @@
             //----[Actionpoint methods]----          
 
-                bool bDefaultFightAll_;
-
-                bool bPatrolling_;
-                bool bDefaultPatrol_;
-                bool stop_;
+                bool bDefaultFightAll_;     //<! if true, when no action set, this will fight all
+
+                bool bPatrolling_;        //<! true if current action_ is FIGHT because this found enemies that are close, need this to correctly go back to looping if was looping
+                bool bDefaultPatrol_;       //<! if true, this will look out for enemies that are close if this is just flying or doing nothing
                 unsigned int ticks_;     //<! local tick counter            
-
     };
 }
Index: code/branches/presentationHS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/CommonController.cc	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/CommonController.cc	(revision 10974)
@@ -23,5 +23,5 @@
  *      Gani Aliguzhinov
  *   Co-authors:
- *      Dominik Solenicki
+ *      ...
  *
  */
@@ -73,8 +73,5 @@
     bool CommonController::sameTeam (ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype)
     {
-        //uncomment following code if functions stops working due to being a hack
-        /*if (!entity1 || !entity2)
-            return false;
-        return entity1->getTeam() == entity2->getTeam();*/
+        
         if (!entity1 || !entity2)
             return false;
Index: code/branches/presentationHS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/CommonController.h	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/CommonController.h	(revision 10974)
@@ -23,5 +23,5 @@
  *      Gani Aliguzhinov
  *   Co-authors:
- *      Dominik Solenicki
+ *      ...
  *
  */
@@ -49,9 +49,9 @@
             CommonController(Context* context);
             virtual ~CommonController();
-            static float randomInRange(float a, float b);
-            static float distance(const ControllableEntity* entity1, const ControllableEntity* entity2);
+            static float randomInRange(float a, float b);   //<! returns random number from a to b
+            static float distance(const ControllableEntity* entity1, const ControllableEntity* entity2);    //<! returns distance between arguments
             static bool sameTeam (ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gt);
-            static bool isLooking(const ControllableEntity* entityThatLooks, const ControllableEntity* entityBeingLookedAt, float angle ) ;
-            static std::string getName(const Pawn* entity ) ;           
+            static bool isLooking(const ControllableEntity* entityThatLooks, const ControllableEntity* entityBeingLookedAt, float angle) ;
+            static std::string getName(const Pawn* entity) ;           
     };
 }
Index: code/branches/presentationHS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/DivisionController.cc	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/DivisionController.cc	(revision 10974)
@@ -79,4 +79,5 @@
         if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
         {
+            //when this dies, its follower will execute all its actionpoints, if follower dies before this, wingman will do this
             if (this->myFollower_)
             {
Index: code/branches/presentationHS15/src/orxonox/controllers/DivisionController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/DivisionController.h	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/DivisionController.h	(revision 10974)
@@ -39,4 +39,5 @@
         @note
         ActionpointController will not work, if there is no MasterController in the level!
+        All the demos are in a file called AITest.oxw. In the menu look for New AI Testing Level.
     */
     class _OrxonoxExport DivisionController : public ActionpointController
Index: code/branches/presentationHS15/src/orxonox/controllers/FightingController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/FightingController.cc	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/FightingController.cc	(revision 10974)
@@ -151,5 +151,4 @@
             if (!this->bDodge_)
             {
-                // orxout(internal_error) << "attacking" << endl;
                 this->bStartedDodging_ = false;
 
@@ -159,5 +158,4 @@
             else if (bTargetIsLookingAtThis || diffLength < 700.0f)
             {
-                // orxout(internal_error) << "dodging" << endl;
                 if (!this->bStartedDodging_)
                 {
@@ -170,5 +168,4 @@
                 if (diffLength < 1000)
                 {
-                // orxout(internal_error) << "looking" << endl;                    
                     this->stopMoving();
                     this->startLookingAtTarget();
@@ -177,5 +174,4 @@
                 else
                 {
-                // orxout(internal_error) << "closing up" << endl;                    
                     this->setTargetPosition(this->positionOfTarget_ - diffUnit * 300.0f);
                 }
@@ -354,5 +350,4 @@
                         if (wName == "RocketFire")
                             this->rocketsLeft_ = 10;
-                            // this->rocketsLeft_ = orxonox_cast<Pawn*>(this->getControllableEntity())->getWeaponSystem()->getMunition(&munition)->getNumMunitionInCurrentMagazine(wMode);
                         if(this->getFiremode(wName) == -1) //only add a weapon, if it is "new"
                             weaponModes_[wName] = wMode->getMode();
@@ -361,5 +356,5 @@
                 if(weaponModes_.size())//at least one weapon detected
                     this->bSetupWorked = true;
-            }//pawn->weaponSystem_->getMunition(SubclassIdentifier< Munition > *identifier)->getNumMunition (WeaponMode *user);
+            }
         }
 
Index: code/branches/presentationHS15/src/orxonox/controllers/MasterController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/MasterController.cc	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/MasterController.cc	(revision 10974)
@@ -38,6 +38,4 @@
     {
         RegisterObject(MasterController);
-        // orxout(internal_error) << "MasterController was created" << endl;
-
         this->controllers_.clear();
         this->numberOfTicksPassedSinceLastActionCall_ = 0;
@@ -50,4 +48,6 @@
         this->controllers_.clear();
     } 
+    /*HACK*/
+    //the whole idea is a hack
     void MasterController::tick(float dt)
     {   
@@ -55,5 +55,4 @@
             return;  
         ++this->ticks_;
-        //orxout(internal_error) << "Tick = " << this->ticks_ << endl;
         if (this->ticks_ == 1)
         {
@@ -66,9 +65,7 @@
                 this->controllers_.push_back(*it);
             }
-            //orxout(internal_error) << "I got " << this->controllers_.size() << " controllers" << endl;
         }
         else
         {
-
             if (this->controllers_.empty())
                 return;
@@ -87,7 +84,7 @@
             if (this->numberOfTicksPassedSinceLastActionCall_ > 0)
             {
-                //call maneuver for current index
                 if (this->numberOfTicksPassedSinceLastActionCall_ == 3)
                 {
+                    //check if 0ptr
                     if (!this->controllers_.at(this->indexOfCurrentController_))
                     {
@@ -95,10 +92,10 @@
                         return;
                     }
-                    //orxout (internal_error) << "Executing maneuver of Controller # " << this->indexOfCurrentController_ << endl;
+                    //call maneuver for current index
                     this->controllers_.at(this->indexOfCurrentController_)->maneuver();
                 }
                 else if (this->numberOfTicksPassedSinceLastActionCall_ == 6)
                 {
-                    //call canFire for current index
+                    //check if 0ptr
                     if (!this->controllers_.at(this->indexOfCurrentController_))
                     {
@@ -106,5 +103,5 @@
                         return;
                     }
-                    //orxout (internal_error) << "Executing maneuver of Controller # " << this->indexOfCurrentController_ << endl;
+                    //call canFire for current index
                     this->controllers_.at(this->indexOfCurrentController_)->bShooting_ = this->controllers_.at(this->indexOfCurrentController_)->canFire();   
                 }
@@ -113,5 +110,5 @@
             else
             {
-                //call action for current index
+                //check if 0ptr
                 if (!this->controllers_.at(this->indexOfCurrentController_))
                 {
@@ -119,6 +116,7 @@
                     return;
                 }
-                //orxout (internal_error) << "Executing action of Controller # " << this->indexOfCurrentController_ << endl;
-                this->controllers_.at(this->indexOfCurrentController_)->action();    
+                //call action for current index
+                this->controllers_.at(this->indexOfCurrentController_)->action();   
+                 
                 //bCopyOrientation makes ship oscillate like crazy if set to true all the time.s
                 this->controllers_.at(this->indexOfCurrentController_)->bCopyOrientation_ = this->ticks_ % 3 == 0;
Index: code/branches/presentationHS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/SectionController.cc	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/SectionController.cc	(revision 10974)
@@ -84,6 +84,4 @@
 
             this->myDivisionLeader_ = newDivisionLeader;
-            //spread copyOrientation called equally among the division
-
         }
         //----If have leader----
@@ -111,6 +109,4 @@
             {
                 this->keepFormation();
-                //orxout (internal_error) << "Keeping formation" << endl;
-
             }
             else if (!this->myDivisionLeader_->bKeepFormation_)
@@ -162,5 +158,4 @@
                             foundTarget = true;
                             target =  (*itP);
-                            //orxout(internal_error) << "Found target" << endl;
                             break; 
                         }
Index: code/branches/presentationHS15/src/orxonox/controllers/SectionController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/SectionController.h	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/SectionController.h	(revision 10974)
@@ -38,4 +38,5 @@
         @note
         ActionpointController will not work, if there is no MasterController in the level!
+        All the demos are in a file called AITest.oxw. In the menu look for New AI Testing Level.
     */
     class _OrxonoxExport SectionController : public ActionpointController
@@ -66,5 +67,5 @@
         protected:       
             //----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 by MasterController managing the bot's behaviour.
                 Vector3 getFormationPosition ();
                 void keepFormation();
Index: code/branches/presentationHS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/WingmanController.cc	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/WingmanController.cc	(revision 10974)
@@ -99,5 +99,6 @@
         else if (this->myLeader_)
         {
-            if (this->myLeader_->bKeepFormation_ || !(this->myLeader_->getAction() == Action::FIGHT || this->myLeader_->getAction() == Action::FIGHTALL
+            if (this->myLeader_->bKeepFormation_ || !(this->myLeader_->getAction() == Action::FIGHT 
+                || this->myLeader_->getAction() == Action::FIGHTALL
                 || this->myLeader_->getAction() == Action::ATTACK))
             {
@@ -148,5 +149,4 @@
         else
         {
-
             switch (this->formationMode_){
                 case FormationMode::WALL:
@@ -215,14 +215,8 @@
         {
             //----Racing conditions----
+            /*TODO: racing condition check is wrong and redundant, as there is no multithreading here, ticks get called one after another,
+            so it can be simplified to a check of whether leader got a wingman*/
             if (closestLeader->setWingman(orxonox_cast<ActionpointController*>(this)))
             {
-                if (closestLeader->getIdentifier()->getName() == "SectionController")
-                {
-                    this->actionTime_ = 1.6f;
-                }
-                else
-                {
-                    this->actionTime_ = 2.0f;
-                }
                 return closestLeader;
             }
Index: code/branches/presentationHS15/src/orxonox/controllers/WingmanController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/WingmanController.h	(revision 10971)
+++ code/branches/presentationHS15/src/orxonox/controllers/WingmanController.h	(revision 10974)
@@ -39,4 +39,5 @@
         @note
         ActionpointController will not work, if there is no MasterController in the level!
+        All the demos are in a file called AITest.oxw. In the menu look for New AI Testing Level.
     */
     class _OrxonoxExport WingmanController : public ActionpointController
@@ -73,5 +74,4 @@
                 WeakPtr<ActionpointController> myLeader_;
                 bool bFirstAction_;
-                float actionTime_;
 
 
