Index: code/branches/campaignHS15/data/levels/AITest.oxw
===================================================================
--- code/branches/campaignHS15/data/levels/AITest.oxw	(revision 10883)
+++ code/branches/campaignHS15/data/levels/AITest.oxw	(revision 10885)
@@ -32,5 +32,5 @@
 
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
-    <TeamSpawnPoint team=0 position="-1000,-1000,-1000" lookat="1,1,-1" spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <TeamSpawnPoint team=0 position="-5000, 3000, -2000" lookat="1,1,-1" spawnclass=SpaceShip pawndesign=spaceshipassff />
     
 <!-- HERE STARTS DEMO FOR THE "WAYPOINTS" -->
@@ -127,5 +127,5 @@
 <!-- HERE ENDS DEMO FOR THE ACTIONPOINTS -->
 <!-- HERE STARTS DEMO FOR FIGHTING -->
-    <!-- 
+    
     <SpaceShip position="-4000, 1500, -1000" lookat="0,0,0" team=0 name="ss2">
       <templates>
@@ -134,7 +134,5 @@
       <controller>
         <DivisionController team=0 formationMode="WALL">
-          <actionpoints>
-            <Actionpoint position="0,0,0" action="ATTACK" attack="ss3" />
-          </actionpoints>
+
         </DivisionController>
       </controller>
@@ -167,6 +165,26 @@
       </controller>
     </SpaceShip>
-
-    <SpaceShip position="2000, -1500, 1000" lookat="0,0,0" team=1 name="ss3">
+    <SpaceShip position="-4000, 1500, -3000" lookat="0,0,0" team=0>
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <DivisionController team=0 formationMode="WALL">
+
+        </DivisionController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="-4000, 1900, -3000" lookat="0,0,0" team=0>
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <SectionController team=0>
+        </SectionController>
+      </controller>
+    </SpaceShip>
+
+
+    <SpaceShip position="2000, -1500, 1000" lookat="0,0,0" team=1 >
       <templates>
         <Template link=spaceshipassff />
@@ -174,7 +192,5 @@
       <controller>
         <DivisionController team=1 formationMode="WALL">
-          <actionpoints>
-            <Actionpoint position="0,0,0" action="ATTACk" attack="ss2" />
-          </actionpoints>
+
         </DivisionController>
       </controller>
@@ -207,8 +223,28 @@
       </controller>
     </SpaceShip> 
-     -->
+    <SpaceShip position="2000, -1500, 3000" lookat="0,0,0" team=1>
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <DivisionController team=1 formationMode="WALL">
+
+        </DivisionController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="2000, -1900, 3000" lookat="0,0,0" team=1>
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <SectionController team=1>
+        </SectionController>
+      </controller>
+    </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" />
@@ -259,8 +295,8 @@
       </controller>
     </SpaceShip> 
-   
+    -->
 <!-- HERE ENDS DEMO FOR FORMATIONS -->
     <!-- 
-    <SpaceShip position="2000, 2000, 2000" lookat="0,0,0" team=1 name="ss2">
+    <SpaceShip position="-2000, 3000, -2000" lookat="0,0,0" team=1 name="ss2">
       <templates>
         <Template link=spaceshipassff />
@@ -272,6 +308,6 @@
       </controller>
     </SpaceShip>
-   
  -->
+
   </Scene>
 </Level>
Index: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10885)
@@ -21,7 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
- *      Dominik Solenicki
+ *      ...
  *
  */
@@ -61,4 +61,11 @@
    	void ActionpointController::tick(float dt)
    	{
+        if (this->timeout_ > 0 && this->bFiredRocket_)
+        {
+            this->timeout_ -= dt;
+        }
+        if (timeout_ <= 0)
+            this->bFiredRocket_ = false;
+
    		if (this->bHasTargetPosition_)
         {
@@ -69,5 +76,5 @@
             this->lookAtTarget(dt);
         }
-        if (bShooting_)
+        if (this->bShooting_)
         {
             this->doFire();
@@ -537,5 +544,5 @@
 
     }
-    void ActionpointController::takeActionpoints (std::vector<Point > vector, std::vector<Point > loop, bool b)
+    void ActionpointController::takeActionpoints (const std::vector<Point>& vector, const std::vector<Point>& loop, bool b)
     {
       this->parsedActionpoints_ = vector;
Index: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h	(revision 10885)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
  *      ...
@@ -55,18 +55,18 @@
     {
         public:
-            //----[language demanded functions]----            
-                ActionpointController(Context* context);
-                virtual ~ActionpointController();
-            //----[language demanded functions]----            
-                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);          
+            ActionpointController(Context* context);
+            virtual ~ActionpointController();
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);          
                
-            virtual void tick(float dt); 
+            virtual void tick(float dt);
+
             void addActionpoint(WorldEntity* waypoint);
             WorldEntity* getActionpoint(unsigned int index) const;           
             virtual void stayNearProtect();
             virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
-            virtual void takeActionpoints (std::vector<Point > vector, std::vector<Point > loop, bool b);
-            Action::Value getAction ();
-            std::string getActionName();
+            virtual void takeActionpoints (const std::vector<Point>& vector, const std::vector<Point>& loop, bool b);
+
+            virtual Action::Value getAction ();
+            virtual std::string getActionName();
 
             void setAction (Action::Value action);
@@ -83,8 +83,10 @@
             virtual bool hasFollower()
                 { return true; }
-
+               
         protected:
-            void startAttackingEnemiesThatAreClose();
-
+                void startAttackingEnemiesThatAreClose();
+                WeakPtr<ActionpointController> myWingman_;
+                WeakPtr<ActionpointController> myFollower_;
+                WeakPtr<ActionpointController> myDivisionLeader_;
             //----[Actionpoint information]----
                 Action::Value action_;
@@ -103,5 +105,7 @@
                 ControllableEntity* getProtect (); 
                 WeakPtr<ControllableEntity> protect_;     
-
+                void fillLoop();
+                void fillLoopReversed();
+                void moveBackToTop();
                 void setClosestTarget();
                 Pawn* closestTarget();
@@ -109,7 +113,6 @@
                 void executeActionpoint();
                 void nextActionpoint();
-                void fillLoop();
-                void fillLoopReversed();
-                void moveBackToTop();
+                void pushAction(Point& p);
+                void popAction();
             //----[Actionpoint methods]----          
                 bool bFirstTick_; 
Index: code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc	(revision 10885)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
  *      Dominik Solenicki
@@ -52,8 +52,5 @@
     float CommonController::randomInRange( float a, float b )
     {
-        float random = rnd( 1.0f );
-        float diff = b - a;
-        float r = random * diff;
-        return a + r;
+        return a + rnd(1.0f) * (b - a);
     }
     float CommonController::distance (ControllableEntity* entity1, ControllableEntity* entity2)
@@ -193,5 +190,3 @@
         return name;
     }
-  
-
 }
Index: code/branches/campaignHS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/CommonController.h	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/CommonController.h	(revision 10885)
@@ -21,7 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
- *      ...
+ *      Dominik Solenicki
  *
  */
Index: code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc	(revision 10885)
@@ -21,7 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
- *      Dominik Solenicki
+ *      ...
  *
  */
@@ -96,11 +96,11 @@
     }
     
-    bool DivisionController::setWingman(ActionpointController* wingman)
+    bool DivisionController::setWingman(ActionpointController* newWingman)
     {
-
-        WingmanController* newWingman = orxonox_cast<WingmanController*>(wingman);
         if (!this->myWingman_)
         {
             this->myWingman_ = newWingman;
+            if (!this->hasFollower())
+                newWingman->takeActionpoints (this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
             return true;
         }
@@ -110,7 +110,6 @@
         }
     }
-    bool DivisionController::setFollower(ActionpointController* myFollower)
+    bool DivisionController::setFollower(ActionpointController* newFollower)
     {
-        LeaderController* newFollower = orxonox_cast<LeaderController*> (myFollower);
         if (!this->myFollower_)
         {
@@ -120,4 +119,7 @@
                 this->myWingman_->takeActionpoints (std::vector<Point>(), std::vector<Point>(), false);
             }
+
+            newFollower->takeActionpoints (this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
+            
             return true;
         }
Index: code/branches/campaignHS15/src/orxonox/controllers/DivisionController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/DivisionController.h	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/DivisionController.h	(revision 10885)
@@ -21,7 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
- *      Dominik Solenicki
+ *      ...
  *
  */
@@ -52,6 +52,6 @@
 
             //----[own functions]----
-                virtual bool setFollower(ActionpointController* myFollower);
-                virtual bool setWingman(ActionpointController* wingman);
+                virtual bool setFollower(ActionpointController* newFollower);
+                virtual bool setWingman(ActionpointController* newWingman);
                 virtual bool hasWingman();
                 virtual bool hasFollower();
Index: code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc	(revision 10885)
@@ -21,7 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
- *      Dominik Solenicki
+ *      Fabian 'x3n' Landau, Dominik Solenicki
  *
  */
@@ -31,4 +31,11 @@
 
 
+#include "worldentities/pawns/SpaceShip.h"
+
+#include "weaponsystem/WeaponMode.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/Weapon.h"
+#include "weaponsystem/WeaponSlot.h"
+#include "weaponsystem/WeaponSlot.h"
 namespace orxonox
 {
@@ -38,7 +45,8 @@
     FightingController::FightingController( Context* context ): FlyingController( context )
     {
-    	this->attackRange_ = 2000;
+    	this->attackRange_ = 3000;
         this->stopLookingAtTarget();
-
+        this->bSetupWorked = false;
+        this->timeout_ = 0;
         RegisterObject( FightingController );
     }
@@ -78,5 +86,5 @@
         this->bLookAtTarget_ = true;
     }
-    bool FightingController::hasTarget() 
+    bool FightingController::hasTarget() const
     {
         if ( this->target_ )
@@ -106,25 +114,17 @@
     void FightingController::maneuver() 
     {
+        if ( !this->target_ || !this->getControllableEntity())
+            return;
         maneuverCounter_++;
         if (maneuverCounter_ > 5)
             maneuverCounter_ = 0;
 
-        if ( !this->target_ || !this->getControllableEntity())
-            return;
-        
         Vector3 thisPosition = this->getControllableEntity()->getWorldPosition();
-        this->setPositionOfTarget( getPredictedPosition( 
-            thisPosition, 
-            hardcoded_projectile_speed, 
-            this->target_->getWorldPosition() , 
-            this->target_->getVelocity()  
-            )  );
-        this->setOrientationOfTarget( this->target_->getOrientation() );
-
+        this->setPositionOfTarget(this->target_->getWorldPosition());
+        //this->setOrientationOfTarget(this->target_->getOrientation());
         Vector3 diffVector = this->positionOfTarget_ - thisPosition;
         float diffLength = diffVector.length();
         Vector3 diffUnit = diffVector/diffLength;
-
-        bool bTargetIsLookingAtThis = CommonController::isLooking ( this->target_, getControllableEntity(), math::pi/20.0f );
+        bool bTargetIsLookingAtThis = CommonController::isLooking (this->target_, this->getControllableEntity(), math::pi/20.0f);
         
         //too far? well, come closer then
@@ -135,13 +135,13 @@
             this->bKeepFormation_ = true;
             
-            this->setTargetPosition( this->positionOfTarget_ );
+            this->setTargetPosition(this->positionOfTarget_ - diffUnit * 200.0f);
         }
         //too close? How do u expect to dodge anything? Just attack!
-        else if ( diffLength < 500 )
+        else if (diffLength < 500)
         {   
             this->bKeepFormation_ = false;
 
             //at this point, just look and shoot
-            if ( diffLength < 250 )
+            if (diffLength < 250)
             {
                 this->stopMoving();
@@ -150,12 +150,12 @@
             else
             {
-                this->setTargetPosition( this->positionOfTarget_ );
+                this->setTargetPosition(this->positionOfTarget_ - diffUnit * 200.0f);
             }
         }
         //Good distance? Check if target looks at us. It doesn't? Go hunt!
-        else if ( !bTargetIsLookingAtThis )
+        else if (!bTargetIsLookingAtThis)
         {
             this->bKeepFormation_ = false;
-            this->setTargetPosition( this->positionOfTarget_ );
+            this->setTargetPosition(this->positionOfTarget_ - diffUnit * 200.0f);
         }
         //That's unfortunate, he is looking and probably shooting... try to dodge what we can...  
@@ -165,91 +165,62 @@
             if (maneuverCounter_ == 0)
             {
-                this->setTargetPosition( this->positionOfTarget_ );   
+                this->setTargetPosition(this->positionOfTarget_ - diffUnit * 200.0f);   
                 return;
             }
-            dodge( thisPosition, diffUnit );
+            dodge(thisPosition, diffUnit);
         }
     }
     
-    void FightingController::dodge(Vector3& thisPosition, Vector3& diffUnit)
-    {
-        float factorX = 0, factorY = 0, factorZ = 0;
-        float rand = CommonController::randomInRange (0, 1);
-    
-        if (rand <= 0.5)
-        { factorX = 1; }
+    void FightingController::dodge(const Vector3& thisPosition, Vector3& diffUnit)
+    {
+        //d.x*x + d.y*y + d.z*z == 0
+        //z = 1/d.z * (-d.y*y - d.x * x)
+        float x = CommonController::randomInRange (1000, 10000) * (CommonController::randomInRange(0,1) <= 0.5 ? 1 : -1);
+        float y = CommonController::randomInRange (1000, 10000) * (CommonController::randomInRange(0,1) <= 0.5 ? 1 : -1);
+        float z = (1/diffUnit.z) * (-x * diffUnit.x - y * diffUnit.y);
+        this->setTargetPosition(thisPosition + Vector3(x,y,z) + diffUnit * 1000.0f);
+        this->boostControl();
+
+    }
+    bool FightingController::canFire() 
+    {
+        //no target? why fire?
+        if (!this->target_)
+            return false;
+        Vector3 newPositionOfTarget = getPredictedPosition(this->getControllableEntity()->getWorldPosition(), 
+                                                           hardcoded_projectile_speed, this->target_->getWorldPosition(), 
+                                                           this->target_->getVelocity());
+        if (!newPositionOfTarget.isNaN())
+        {
+            this->setPositionOfTarget(newPositionOfTarget);
+        }
+        return squaredDistanceToTarget() < this->attackRange_*this->attackRange_ && this->isLookingAtTarget(math::pi / 20.0f);
+    }
+    // void FightingController::doFire() 
+    // {
+    //     if ( !this->target_ || !this->getControllableEntity() )
+    //     {
+    //         return;
+    //     }
+      
+    //     Pawn* pawn = orxonox_cast<Pawn*>( this->getControllableEntity() );
+
+    //     if ( pawn )
+    //         pawn->setAimPosition( this->positionOfTarget_ );
+    //     float distance = CommonController::distance (this->getControllableEntity(), this->target_);
+    //     this->getControllableEntity() ->fire(distance < 1500 ? (distance < 1000 && distance > 700 ? 3 : 0) : (1));
+    // }
+
+
+    float FightingController::squaredDistanceToTarget()  const
+    {
+        if (!this->getControllableEntity())
+            return 0;
+        if (!this->target_ || !this->getControllableEntity())
+            return (this->getControllableEntity()->getPosition().squaredDistance(this->targetPosition_));
         else
-        { factorX = -1; }
-        rand = CommonController::randomInRange (0, 1);
-        if (rand <= 0.5)
-        { factorY = 1; }
-        else
-        { factorY = -1; }
-        rand = CommonController::randomInRange (0, 1);
-        if (rand <= 0.5)
-        { factorZ = 1; }
-        else
-        { factorZ = -1; }
-
-        Vector3 target = ( diffUnit )* 8000.0f;
-        Vector3* randVector = new Vector3( 
-            factorX * CommonController::randomInRange( 10000, 40000 ), 
-            factorY * CommonController::randomInRange( 10000, 40000 ), 
-            factorZ * CommonController::randomInRange( 10000, 40000 ) 
-        );
-        Vector3 projection = randVector->dotProduct( diffUnit )* diffUnit;
-        Vector3 randV = *randVector;
-        delete randVector;
-        randV -= projection;
-        target += randV;
-        this->setTargetPosition( thisPosition + target );
-    }
-    bool FightingController::canFire() 
-    {
-        //no target? why fire?
-        if ( !this->target_ )
-            return false;
-
-        Vector3 newPositionOfTarget = getPredictedPosition( this->getControllableEntity() ->getWorldPosition() , 
-            hardcoded_projectile_speed, this->target_->getWorldPosition() , this->target_->getVelocity() );
-        if ( newPositionOfTarget != Vector3::ZERO )
-        {
-            this->setPositionOfTarget( newPositionOfTarget );
-        }
-
-        float squaredDistance = squaredDistanceToTarget();
-
-        if ( squaredDistance < this->attackRange_*this->attackRange_ && this->isLookingAtTarget( math::pi / 20.0f)) 
-        {
-            return true;
-        }
-        else
-        {
-            return false;
-        }
-    }
-    void FightingController::doFire() 
-    {
-        if ( !this->target_ || !this->getControllableEntity() )
-        {
-            return;
-        }
-      
-        Pawn* pawn = orxonox_cast<Pawn*>( this->getControllableEntity() );
-
-        if ( pawn )
-            pawn->setAimPosition( this->positionOfTarget_ );
-        this->getControllableEntity() ->fire( 0 );
-    }
-    float FightingController::squaredDistanceToTarget()  const
-    {
-        if ( !this->getControllableEntity()  )
-            return 0;
-        if ( !this->target_ || !this->getControllableEntity() )
-            return ( this->getControllableEntity() ->getPosition() .squaredDistance( this->targetPosition_ ) );
-        else
-            return ( this->getControllableEntity() ->getPosition() .squaredDistance( this->positionOfTarget_ ) );
-    }
-    bool FightingController::isLookingAtTarget( float angle )
+            return (this->getControllableEntity()->getPosition().squaredDistance(this->positionOfTarget_));
+    }
+    bool FightingController::isLookingAtTarget( float angle ) const
     {
         if ( !this->getControllableEntity()  || !this->target_ )
@@ -257,10 +228,10 @@
         return CommonController::isLooking(this->getControllableEntity(), this->getTarget(), angle);
     }
-        void FightingController::setClosestTarget()
+    void FightingController::setClosestTarget()
     {
         this->setTarget (static_cast<ControllableEntity*>( closestTarget() ) ); 
     }
     
-    Pawn* FightingController::closestTarget()
+    Pawn* FightingController::closestTarget() const
     {
         if (!this->getControllableEntity())
@@ -288,3 +259,114 @@
         return 0;  
     }
+    //I checked it out, rockets DO NOT cause any problems! this->getControllableEntity() is always a SpaceShip
+    void FightingController::doFire()
+    {
+        if (!this->bSetupWorked)
+        {
+            this->setupWeapons();
+        }
+        if (!this->target_ || !this->getControllableEntity())
+        {
+            return;
+        }
+        Pawn* pawn = orxonox_cast<Pawn*> (this->getControllableEntity());
+        if (pawn)
+            pawn->setAimPosition (this->positionOfTarget_);
+
+        int firemode;
+        float distance = CommonController::distance (this->getControllableEntity(), this->target_);
+
+        // firemode = distance < 1500 ? (distance > 800 && distance < 1200 ? 
+        //                             (this->rocketsLeft_ > 0 && !this->bFiredRocket_ ? getFiremode("RocketFire") : getFiremode ("HsW01"))
+        //                                                      : getFiremode("HsW01")) : 
+        //                                                      (distance < 2500 ? getFiremode("LightningGun") : getFiremode("HsW01"));
+        if (distance < 800)
+        {
+            if (this->rocketsLeft_ > 0)
+            {
+                firemode = getFiremode ("SimpleRocketFire");
+            }
+            else
+            {
+                if (distance > 450)
+                    firemode = getFiremode ("LightningGun");
+                else
+                    firemode = getFiremode ("HsW01");
+            }
+
+        } 
+        else if (distance < 1200)
+        {
+            if (this->rocketsLeft_ > 0 && !this->bFiredRocket_)
+            {
+                firemode = getFiremode ("RocketFire");
+            }
+            else
+            {
+                firemode = getFiremode ("HsW01");
+            }
+        }
+        else if (distance < 1500)
+        {
+            firemode = getFiremode ("LightningGun");
+        }
+        else
+        {
+            firemode = getFiremode ("HsW01");
+        }
+        if (firemode < 0)
+        {
+            firemode = getFiremode ("HsW01");
+        }
+        if (firemode == getFiremode("RocketFire"))
+        {
+            this->timeout_ = 1.0f;
+            this->rocketsLeft_--;
+            this->bFiredRocket_ = true;
+        }
+        if (firemode == getFiremode("SimpleRocketFire"))
+        {
+            this->rocketsLeft_--;
+        }
+              
+        this->getControllableEntity()->fire(firemode);
+        
+    }
+    void FightingController::setupWeapons() //TODO: Make this function generic!! (at the moment is is based on conventions)
+    {
+        this->bSetupWorked = false;
+        if(this->getControllableEntity())
+        {
+            Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity());
+            if(pawn && pawn->isA(Class(SpaceShip))) //fix for First Person Mode: check for SpaceShip
+            {
+                this->weaponModes_.clear(); // reset previous weapon information
+                WeaponSlot* wSlot = 0;
+                for(int l=0; (wSlot = pawn->getWeaponSlot(l)) ; l++)
+                {
+                    WeaponMode* wMode = 0;
+                    for(int i=0; (wMode = wSlot->getWeapon()->getWeaponmode(i)) ; i++)
+                    {
+                        std::string wName = wMode->getIdentifier()->getName();
+                        if (wName == "RocketFire")
+                            this->rocketsLeft_ = 10;
+                        if(this->getFiremode(wName) == -1) //only add a weapon, if it is "new"
+                            weaponModes_[wName] = wMode->getMode();
+                    }
+                }
+                if(weaponModes_.size())//at least one weapon detected
+                    this->bSetupWorked = true;
+            }//pawn->weaponSystem_->getMunition(SubclassIdentifier< Munition > *identifier)->getNumMunition (WeaponMode *user);
+        }
+    }
+
+    int FightingController::getFiremode(std::string name)
+    {
+        for (std::map< std::string, int >::iterator it = this->weaponModes_.begin(); it != this->weaponModes_.end(); ++it)
+        {
+            if (it->first == name)
+                return it->second;
+        }
+        return -1;
+    }
 }
Index: code/branches/campaignHS15/src/orxonox/controllers/FightingController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FightingController.h	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/FightingController.h	(revision 10885)
@@ -21,7 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
- *      ...
+ *      Fabian 'x3n' Landau, Dominik Solenicki
  *
  */
@@ -45,7 +45,7 @@
        
             float squaredDistanceToTarget() const;
-            bool isLookingAtTarget(float angle);
-            bool hasTarget();
-            ControllableEntity* getTarget()
+            bool isLookingAtTarget(float angle) const;
+            bool hasTarget() const;
+            ControllableEntity* getTarget() const
                 { return this->target_; }
             bool bKeepFormation_;
@@ -61,5 +61,5 @@
 
             void maneuver();
-            void dodge(Vector3& thisPosition, Vector3& diffUnit);
+            void dodge(const Vector3& thisPosition, Vector3& diffUnit);
             bool canFire();
             void doFire();
@@ -71,10 +71,21 @@
             bool bHasOrientationOfTarget_;
             Quaternion orientationOfTarget_;
-            Pawn* closestTarget();
+            Pawn* closestTarget() const;
 
             int attackRange_;
             bool bShooting_;
             int maneuverCounter_;   
-            bool bLookAtTarget_;           
+            bool bLookAtTarget_; 
+
+            //WEAPONSYSTEM DATA
+            int rocketsLeft_;
+            float timeout_;
+            bool bFiredRocket_;
+            std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode - managed by setupWeapons()
+            //std::vector<int> projectiles_; //<! Displays amount of projectiles of each weapon. - managed by setupWeapons()
+            void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed.
+            bool bSetupWorked; //<! If false, setupWeapons() is called.
+            int getFiremode(std::string name);
+          
     };
 }
Index: code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc	(revision 10885)
@@ -21,5 +21,6 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
+
  *   Co-authors:
  *      Dominik Solenicki
@@ -31,14 +32,15 @@
 #include "util/Math.h"
 #include <OgreMatrix3.h>
+
 namespace orxonox
 {    
     RegisterClass (FlyingController);
     
-    FlyingController::FlyingController( Context* context ): CommonController( context )
-    {
+    FlyingController::FlyingController(Context* context): CommonController(context)
+    {
+        RegisterObject(FlyingController);        
         this->rotationProgress_ = 0;
         this->spread_ = 200;
-        this->tolerance_ = 60;
-        RegisterObject( FlyingController );
+        this->tolerance_ = 100;
     }
     FlyingController::~FlyingController() 
@@ -47,14 +49,14 @@
     }
 
-    void FlyingController::XMLPort( Element& xmlelement, XMLPort::Mode mode )
-    {
-        XMLPortParam( FlyingController, "spread", setSpread, getSpread,  xmlelement, mode );
-        XMLPortParam( FlyingController, "formationMode", setFormationModeXML, getFormationModeXML,  xmlelement, mode );
-        SUPER( FlyingController, XMLPort, xmlelement, mode );
+    void FlyingController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        XMLPortParam(FlyingController, "spread", setSpread, getSpread,  xmlelement, mode);
+        XMLPortParam(FlyingController, "formationMode", setFormationModeXML, getFormationModeXML,  xmlelement, mode);
+        SUPER(FlyingController, XMLPort, xmlelement, mode);
     }
    
-    void FlyingController::setFormationModeXML( std::string val )
-    {
-        const std::string valUpper = getUppercase( val );
+    void FlyingController::setFormationModeXML(std::string val)
+    {
+        const std::string valUpper = getUppercase(val);
         FormationMode::Value value;
         
@@ -66,8 +68,8 @@
             value = FormationMode::DIAMOND;
         else
-            ThrowException( ParseError, std::string( "Attempting to set an unknown FormationMode: '" )+ val + "'." );
-        this->setFormationMode( value );
-    }
-    std::string FlyingController::getFormationModeXML() 
+            ThrowException(ParseError, std::string( "Attempting to set an unknown FormationMode: '" )+ val + "'.");
+        this->setFormationMode(value);
+    }
+    std::string FlyingController::getFormationModeXML() const
     {
         switch ( this->formationMode_ )
@@ -83,18 +85,13 @@
         }
     }
-
-    
-
     void FlyingController::stopMoving()
     {
         this->bHasTargetPosition_ = false;
     }
-
-    void FlyingController::moveToPosition( const Vector3& target, float dt )
+    void FlyingController::moveToPosition(const Vector3& target, float dt)
     {
         ControllableEntity* entity = this->getControllableEntity();
 
-        float distance = ( target - this->getControllableEntity() ->getPosition() ).length();
-
+        float distance = ( target - entity->getPosition() ).length();
 
         if ( distance >= this->tolerance_ )
@@ -107,10 +104,10 @@
             float rotateX = -clamp( coord.x * 10, -1.0f, 1.0f );
             float rotateY = clamp( coord.y * 10, -1.0f, 1.0f );
-            this->getControllableEntity() ->rotateYaw( ROTATEFACTOR * rotateX * dt );
-            this->getControllableEntity() ->rotatePitch( ROTATEFACTOR * rotateY * dt );
-
+            entity->rotateYaw( ROTATEFACTOR * rotateX * dt );
+            entity->rotatePitch( ROTATEFACTOR * rotateY * dt );
           
             if (distance > this->tolerance_*1.5f || (rotateX > -0.01 && rotateX < 0.01 && rotateY > -0.01 && rotateY < 0.01))
-                this->getControllableEntity() ->moveFrontBack( SPEED * dt );
+                entity->moveFrontBack( SPEED * dt );
+                copyTargetOrientation(dt);
         }
         else
@@ -118,5 +115,4 @@
             bHasTargetPosition_ = false;
         }
-        copyTargetOrientation(dt);
     }
     
@@ -125,5 +121,5 @@
         this->moveToPosition (this->targetPosition_, dt);
     }
-    void FlyingController::copyOrientation( const Quaternion& orient, float dt )
+    void FlyingController::copyOrientation(const Quaternion& orient, float dt)
     {
         //inspired by
@@ -167,13 +163,13 @@
     }
     //change log: increased precision, increased rotation speed
-    void FlyingController::copyTargetOrientation( float dt )
-    {
-        if ( bHasTargetOrientation_ )
+    void FlyingController::copyTargetOrientation(float dt)
+    {
+        if (bHasTargetOrientation_)
         {   
-            copyOrientation( targetOrientation_, dt );
+            copyOrientation(targetOrientation_, dt);
         }
     }
     
-    void FlyingController::setTargetPosition( const Vector3& target )
+    void FlyingController::setTargetPosition(const Vector3& target)
     {
         this->targetPosition_ = target;
@@ -181,5 +177,5 @@
     }
 
-    void FlyingController::setTargetOrientation( const Quaternion& orient )
+    void FlyingController::setTargetOrientation(const Quaternion& orient)
     {
         this->targetOrientation_=orient;
@@ -187,8 +183,8 @@
     }
 
-    void FlyingController::setTargetOrientation( ControllableEntity* target )
-    {
-        if ( target )
-            setTargetOrientation( target->getOrientation() );
+    void FlyingController::setTargetOrientation(ControllableEntity* target)
+    {
+        if (target)
+            setTargetOrientation(target->getOrientation());
     }
     void FlyingController::boostControl()
@@ -198,5 +194,4 @@
         if(ship->getBoostPower()*1.5f > ship->getInitialBoostPower() ) //upper limit ->boost
         {
-
             this->getControllableEntity()->boost(true);
         }
@@ -206,4 +201,3 @@
         }
     }
-    
 }
Index: code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h	(revision 10885)
@@ -56,9 +56,9 @@
             void setSpread (int spread)
                 { this->spread_ = spread; }
-            int getSpread ()
+            int getSpread () const
                 { return this->spread_; }
 
             void setFormationModeXML(std::string val);
-            std::string getFormationModeXML();
+            std::string getFormationModeXML() const;
 
             void setFormationMode(FormationMode::Value val)
Index: code/branches/campaignHS15/src/orxonox/controllers/LeaderController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/LeaderController.cc	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/LeaderController.cc	(revision 10885)
@@ -21,7 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
- *      Dominik Solenicki
+ *      ...
  *
  */
Index: code/branches/campaignHS15/src/orxonox/controllers/LeaderController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/LeaderController.h	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/LeaderController.h	(revision 10885)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
  *      ...
@@ -31,5 +31,4 @@
 
 #include "controllers/ActionpointController.h"
-#include "controllers/WingmanController.h"
 
 
@@ -51,7 +50,5 @@
         protected:
             //----private variables-----
-                WeakPtr<WingmanController> myWingman_;
-                WeakPtr<LeaderController> myFollower_;
-                WeakPtr<LeaderController> myDivisionLeader_;
+
 
             
Index: code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc	(revision 10885)
@@ -21,7 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
- *      Dominik Solenicki
+ *      ...
  *
  */
@@ -96,10 +96,10 @@
         if (!myDivisionLeader_)
         {
-            LeaderController* newDivisionLeader = findNewDivisionLeader();
+            ActionpointController* newDivisionLeader = findNewDivisionLeader();
             this->myDivisionLeader_ = newDivisionLeader;
             //spread copyOrientation called equally among the division
             if (this->myDivisionLeader_)
             {
-                this->actionCounter_ = 8;
+                this->actionCounter_ = 5;
             }
         }
@@ -147,5 +147,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_)
+                if (this->actionCounter_ % 6 == 0 && !this->bHasTargetOrientation_)
                     this->setAction (Action::FLY, targetAbsolutePosition, orient);
                 else
@@ -300,5 +300,5 @@
     
 
-    LeaderController* SectionController::findNewDivisionLeader()
+    ActionpointController* SectionController::findNewDivisionLeader()
     {
 
@@ -306,8 +306,8 @@
             return 0;
 
-        LeaderController* closestLeader = 0;
+        ActionpointController* closestLeader = 0;
         float minDistance =  std::numeric_limits<float>::infinity();
         //go through all pawns
-        for (ObjectList<LeaderController>::iterator it = ObjectList<LeaderController>::begin(); it; ++it)
+        for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
         {
             //0ptr or not DivisionController?
@@ -338,11 +338,11 @@
         return 0;
     }
-    bool SectionController::setWingman(ActionpointController* wingman)
-    {
-        WingmanController* newWingman = orxonox_cast<WingmanController*>(wingman);
+    bool SectionController::setWingman(ActionpointController* newWingman)
+    {
 
         if (!this->myWingman_)
         {
             this->myWingman_ = newWingman;
+            newWingman->takeActionpoints (this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
             return true;
         }
Index: code/branches/campaignHS15/src/orxonox/controllers/SectionController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/SectionController.h	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/SectionController.h	(revision 10885)
@@ -21,7 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
- *      Dominik Solenicki
+ *      ...
  *
  */
@@ -51,9 +51,10 @@
             
             //----[own functions]----
-                LeaderController* findNewDivisionLeader();
+                ActionpointController* findNewDivisionLeader();
 
-                virtual bool setWingman(ActionpointController* wingman);
+                virtual bool setWingman(ActionpointController* newWingman);
                 virtual bool hasWingman();
-
+                virtual bool hasFollower()
+                    { return false; }
                 void chooseTarget();
             //----[/own functions]----
Index: code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc	(revision 10885)
@@ -21,7 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
- *      Dominik Solenicki
+ *      ...
  *
  */
@@ -89,7 +89,7 @@
                 //spread copyOrientation called equally among the division
                 if (this->myLeader_->getIdentifier()->getName() == "SectionController")
-                    this->actionCounter_ = 2;
+                    this->actionCounter_ = 1;
                 else
-                    this->actionCounter_ = 5;
+                    this->actionCounter_ = 4;
             }
         }
@@ -126,5 +126,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_)
+                if (this->actionCounter_ % 6 == 0 && !this->bHasTargetOrientation_)
                     this->setAction (Action::FLY, targetAbsolutePosition, orient);
                 else
Index: code/branches/campaignHS15/src/orxonox/controllers/WingmanController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/WingmanController.h	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/controllers/WingmanController.h	(revision 10885)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
  *      ...
@@ -49,4 +49,8 @@
 
                 virtual void tick(float dt); 
+                virtual bool hasWingman()
+                    { return false; }
+                virtual bool hasFollower()
+                    { return false; }
             //----[/orxonox demanded functions]----
 
Index: code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.cc	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.cc	(revision 10885)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
  *      ...
Index: code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.h	(revision 10883)
+++ code/branches/campaignHS15/src/orxonox/worldentities/Actionpoint.h	(revision 10885)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Gani Aliguzhinov
  *   Co-authors:
  *      ...
