Index: code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc	(revision 10881)
+++ code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc	(revision 10883)
@@ -124,74 +124,84 @@
         else if (myDivisionLeader_)
         {
-            switch (myDivisionLeader_->getAction())
-            {
-                case Action::FIGHT:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->chooseTarget();
-                    }
-                    break;
-                }
-                case Action::FIGHTALL:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->chooseTarget();
-                    }
-                    break;
-                }
-                case Action::ATTACK:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->chooseTarget();
-                    }
-                    break;
-                }
-                default:
-                {
-                    //formation flight is executed in tick
-                    ControllableEntity* myEntity = this->getControllableEntity();
-            Vector3 myPosition = myEntity->getWorldPosition();
-            if (!this->myDivisionLeader_)
-            {
-                return;
-            }
-            ControllableEntity* leaderEntity = this->myDivisionLeader_->getControllableEntity();
-            Quaternion orient = leaderEntity->getWorldOrientation();
-            Vector3 leaderPosition = leaderEntity->getWorldPosition();
-
-            Vector3 targetRelativePosition = getFormationPosition();
-            if (!this->myDivisionLeader_)
-            {
-                return;
-            }
-            Vector3 targetAbsolutePosition = 
-                (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
-                 + (orient* (targetRelativePosition)));
-            //let ship finish rotating. also don't call copyOrientation to often as it is a slow function.
-            if (this->actionCounter_ % 9 == 0 && !this->bHasTargetOrientation_)
-                this->setAction (Action::FLY, targetAbsolutePosition, orient);
+            if (this->myDivisionLeader_->bKeepFormation_ || !(this->myDivisionLeader_->getAction() == Action::FIGHT 
+                || this->myDivisionLeader_->getAction() == Action::FIGHTALL
+                || this->myDivisionLeader_->getAction() == Action::ATTACK))
+            {
+                ControllableEntity* myEntity = this->getControllableEntity();
+                Vector3 myPosition = myEntity->getWorldPosition();
+                if (!this->myDivisionLeader_)
+                {
+                    return;
+                }
+                ControllableEntity* leaderEntity = this->myDivisionLeader_->getControllableEntity();
+                Quaternion orient = leaderEntity->getWorldOrientation();
+                Vector3 leaderPosition = leaderEntity->getWorldPosition();
+
+                Vector3 targetRelativePosition = getFormationPosition();
+                if (!this->myDivisionLeader_)
+                {
+                    return;
+                }
+                Vector3 targetAbsolutePosition = 
+                    (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
+                     + (orient* (targetRelativePosition)));
+                //let ship finish rotating. also don't call copyOrientation to often as it is a slow function.
+                if (this->actionCounter_ % 9 == 0 && !this->bHasTargetOrientation_)
+                    this->setAction (Action::FLY, targetAbsolutePosition, orient);
+                else
+                    this->setAction (Action::FLY, targetAbsolutePosition);
+
+                if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
+                {
+                    this->boostControl();
+                }
+                else
+                {
+                   this->getControllableEntity()->boost(false);
+                }
+            }
             else
-                this->setAction (Action::FLY, targetAbsolutePosition);
-
-            if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
-            {
-                this->boostControl();
-            }
-            else
-            {
-               this->getControllableEntity()->boost(false);
-            }
-                }
-            }
-            if (this->hasTarget())
-            {
-                //----choose where to go----
-                this->maneuver();
-                //----fire if you can----
-                this->bShooting_ = this->canFire();                
-            }
+            {
+                switch (myDivisionLeader_->getAction())
+                {
+                    case Action::FIGHT:
+                    {
+                        if (!this->hasTarget())
+                        {
+                            this->chooseTarget();
+                        }
+                        break;
+                    }
+                    case Action::FIGHTALL:
+                    {
+                        if (!this->hasTarget())
+                        {
+                            this->chooseTarget();
+                        }
+                        break;
+                    }
+                    case Action::ATTACK:
+                    {
+                        if (!this->hasTarget())
+                        {
+                            this->chooseTarget();
+                        }
+                        break;
+                    }
+                    default:
+                    {
+                        //formation flight is executed in tick 
+                    }
+                }
+                if (this->hasTarget())
+                {
+                    //----choose where to go----
+                    this->maneuver();
+                    //----fire if you can----
+                    this->bShooting_ = this->canFire();                
+                }
+            }
+            
+            
         }
         this->actionCounter_ += this->actionCounter_ < 100000 ? 1 : -this->actionCounter_ ;
@@ -263,4 +273,5 @@
     {
         this->setFormationMode( this->myDivisionLeader_->getFormationMode() );
+        this->spread_ = this->myDivisionLeader_->getSpread();
         Vector3* targetRelativePosition;
         switch (this->formationMode_){
