Index: code/branches/campaignHS15/data/levels/AITest.oxw
===================================================================
--- code/branches/campaignHS15/data/levels/AITest.oxw	(revision 10875)
+++ code/branches/campaignHS15/data/levels/AITest.oxw	(revision 10877)
@@ -261,8 +261,17 @@
     -->
 <!-- HERE ENDS DEMO FOR FORMATIONS -->
-    
-    
+    <!-- 
+    <SpaceShip position="2000, 2000, 2000" lookat="0,0,0" team=1 name="ss2">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <DivisionController team=1 formationMode="finger4">
+          
+        </DivisionController>
+      </controller>
+    </SpaceShip>
    
-
+ -->
   </Scene>
 </Level>
Index: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10877)
@@ -31,4 +31,5 @@
 #include "core/XMLPort.h"
 #include <algorithm>
+#include "worldentities/Actionpoint.h"
 
 
@@ -38,8 +39,7 @@
     RegisterClass(ActionpointController);
 
-    //CommonController contains all common functionality of AI Controllers
     ActionpointController::ActionpointController(Context* context) : FightingController(context)
     {
-              this->bInLoop_ = false;
+        this->bInLoop_ = false;
         this->bLoop_ = false;
         this->bEndLoop_ = false;
@@ -48,5 +48,5 @@
         this->action_ = Action::NONE;
         this->squaredaccuracy_ = 2500;
-
+        this->bFirstTick_ = true;
 
         RegisterObject(ActionpointController);
@@ -559,13 +559,13 @@
         if (this->action_ != Action::FIGHT && this->action_ != Action::FIGHTALL)
         {
-            if ( (this->target_ && this->distance (this->getControllableEntity(), this->target_) > this->attackRange_) 
+            if ( (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_) 
                 || !this->target_ )
             {
                 Pawn* newTarget = this->closestTarget();
                 if ( newTarget && 
-                    this->distance (this->getControllableEntity(), static_cast<ControllableEntity*>(newTarget))
+                    CommonController::distance (this->getControllableEntity(), static_cast<ControllableEntity*>(newTarget))
                         <= this->attackRange_ )
                 {
-                    Point p = { Action::FIGHT, this->getName(newTarget), Vector3::ZERO, false };
+                    Point p = { Action::FIGHT, CommonController::getName(newTarget), Vector3::ZERO, false };
                     this->parsedActionpoints_.push_back(p);
                     this->executeActionpoint();
Index: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h	(revision 10877)
@@ -31,5 +31,6 @@
 
 #include "controllers/FightingController.h"
-
+#include "tools/Timer.h"
+#include "tools/interfaces/Tickable.h"
 
 namespace orxonox
@@ -51,5 +52,5 @@
     } ;
 
-    class _OrxonoxExport ActionpointController : public FightingController
+    class _OrxonoxExport ActionpointController : public FightingController, public Tickable
     {
         public:
@@ -74,6 +75,12 @@
             void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
 
-           
-
+            virtual bool setWingman(ActionpointController* wingman)
+                { return false; }
+            virtual bool hasWingman()
+                { return true; }
+            virtual bool setFollower(ActionpointController* myFollower)
+                { return false; }
+            virtual bool hasFollower()
+                { return true; }
 
         protected:
@@ -106,5 +113,6 @@
                 void moveBackToTop();
             //----[Actionpoint methods]----          
-            
+                bool bFirstTick_; 
+
         private:
             
Index: code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc	(revision 10877)
@@ -27,16 +27,12 @@
  */
 #include "controllers/CommonController.h"
-#include "core/XMLPort.h"
 
 //stuff for sameTeam function
+#include "gametypes/TeamDeathmatch.h"
+#include "gametypes/Gametype.h"
+#include "controllers/DroneController.h"
+#include "gametypes/Dynamicmatch.h"
+
 #include "worldentities/pawns/TeamBaseMatchBase.h"
-#include "gametypes/TeamDeathmatch.h"
-#include "gametypes/Dynamicmatch.h"
-#include "gametypes/Mission.h"
-#include "gametypes/Gametype.h"
-#include "controllers/WaypointPatrolController.h"
-#include "controllers/NewHumanController.h"
-#include "controllers/DroneController.h"
-#include "util/Math.h"
 
 namespace orxonox
@@ -44,14 +40,8 @@
 
     RegisterClass( CommonController );
-    const float SPEED = 0.9f/0.02f;
-    const float ROTATEFACTOR = 1.0f/0.02f;
 
-  
     CommonController::CommonController( Context* context ): Controller( context )
     {
-        this->bFirstTick_ = true;
-       
         RegisterObject( CommonController );
-
     }
     CommonController::~CommonController() 
@@ -59,21 +49,4 @@
         
     }
-    void CommonController::tick(float dt)
-    {
-        
-        SUPER(CommonController, tick, dt);
-    }
-
-      
-    void CommonController::XMLPort( Element& xmlelement, XMLPort::Mode mode )
-    {
-        SUPER( CommonController, XMLPort, xmlelement, mode );
-    }
- 
-    //"Virtual" methods
-    bool CommonController::setWingman ( CommonController* wingman )
-    { return false; }
-    bool CommonController::hasWingman() 
-    { return true; }
 
     float CommonController::randomInRange( float a, float b )
Index: code/branches/campaignHS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/CommonController.h	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/CommonController.h	(revision 10877)
@@ -32,45 +32,28 @@
 
 #include "controllers/Controller.h"
+#include <limits>
+
 #include "worldentities/ControllableEntity.h"
 #include "worldentities/pawns/Pawn.h"
 
-#include "tools/Timer.h"
-#include "tools/interfaces/Tickable.h"
-#include <limits>
-#include "worldentities/Actionpoint.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport CommonController : public Controller, public Tickable
+    class _OrxonoxExport CommonController : public Controller
     {
 
         public:
+            static const float ACTION_INTERVAL = 1.0f;
+
             static const float hardcoded_projectile_speed = 750;
-            static const float ACTION_INTERVAL = 1.0f;
 
             CommonController(Context* context);
             virtual ~CommonController();
 
-            virtual void tick(float dt); 
-
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-                
-
-
-            virtual bool setWingman(CommonController* wingman);
-            virtual bool hasWingman();        
-
-
-            float randomInRange(float a, float b);
+            static float randomInRange(float a, float b);
             static float distance(ControllableEntity* entity1, ControllableEntity* entity2);
             static bool sameTeam (ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gt);
             static bool isLooking( ControllableEntity* entityThatLooks, ControllableEntity* entityBeingLookedAt, float angle ) ;
-            static std::string getName( Pawn* entity ) ;
-
-        protected:
-           
-            bool bFirstTick_; 
-            
-           
+            static std::string getName( Pawn* entity ) ;           
     };
 }
Index: code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc	(revision 10877)
@@ -49,19 +49,4 @@
     DivisionController::~DivisionController()
     {
-        // if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
-        // {
-        //     if (this->myFollower_)
-        //     {
-        //         this->myFollower_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
-        //         if (this->myWingman_)
-        //         {
-        //             this->myWingman_->setAction(Action::FIGHTALL);
-        //         }
-        //     }
-        //     else if (this->myWingman_)
-        //     {
-        //         this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
-        //     }    
-        // }
         for (size_t i = 0; i < this->actionpoints_.size(); ++i)
         {
@@ -112,11 +97,11 @@
     }
     
-    bool DivisionController::setWingman(CommonController* cwingman)
+    bool DivisionController::setWingman(ActionpointController* wingman)
     {
 
-        WeakPtr<WingmanController> wingman = orxonox_cast<WingmanController*>(cwingman);
+        WingmanController* newWingman = orxonox_cast<WingmanController*>(wingman);
         if (!this->myWingman_)
         {
-            this->myWingman_ = wingman;
+            this->myWingman_ = newWingman;
             return true;
         }
@@ -126,9 +111,10 @@
         }
     }
-    bool DivisionController::setFollower(LeaderController* myFollower)
+    bool DivisionController::setFollower(ActionpointController* myFollower)
     {
-         if (!this->myFollower_)
+        LeaderController* newFollower = orxonox_cast<LeaderController*> (myFollower);
+        if (!this->myFollower_)
         {
-            this->myFollower_ = myFollower;
+            this->myFollower_ = newFollower;
             return true;
         }
Index: code/branches/campaignHS15/src/orxonox/controllers/DivisionController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/DivisionController.h	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/DivisionController.h	(revision 10877)
@@ -52,6 +52,6 @@
 
             //----[own functions]----
-                virtual bool setFollower(LeaderController* myFollower);
-                virtual bool setWingman(CommonController* cwingman);
+                virtual bool setFollower(ActionpointController* myFollower);
+                virtual bool setWingman(ActionpointController* wingman);
                 virtual bool hasWingman();
                 virtual bool hasFollower();
Index: code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc	(revision 10877)
@@ -126,5 +126,5 @@
         Vector3 diffUnit = diffVector/diffLength;
 
-        bool bTargetIsLookingAtThis = this->isLooking ( this->target_, getControllableEntity(), math::pi/10.0f );
+        bool bTargetIsLookingAtThis = CommonController::isLooking ( this->target_, getControllableEntity(), math::pi/10.0f );
         
         //too far? well, come closer then
@@ -167,5 +167,5 @@
     {
         float factorX = 0, factorY = 0, factorZ = 0;
-        float rand = randomInRange (0, 1);
+        float rand = CommonController::randomInRange (0, 1);
     
         if (rand <= 0.5)
@@ -173,10 +173,10 @@
         else
         { factorX = -1; }
-        rand = randomInRange (0, 1);
+        rand = CommonController::randomInRange (0, 1);
         if (rand <= 0.5)
         { factorY = 1; }
         else
         { factorY = -1; }
-        rand = randomInRange (0, 1);
+        rand = CommonController::randomInRange (0, 1);
         if (rand <= 0.5)
         { factorZ = 1; }
@@ -186,7 +186,7 @@
         Vector3 target = ( diffUnit )* 8000.0f;
         Vector3* randVector = new Vector3( 
-            factorX * randomInRange( 10000, 40000 ), 
-            factorY * randomInRange( 10000, 40000 ), 
-            factorZ * randomInRange( 10000, 40000 ) 
+            factorX * CommonController::randomInRange( 10000, 40000 ), 
+            factorY * CommonController::randomInRange( 10000, 40000 ), 
+            factorZ * CommonController::randomInRange( 10000, 40000 ) 
         );
         Vector3 projection = randVector->dotProduct( diffUnit )* diffUnit;
@@ -245,5 +245,5 @@
         if ( !this->getControllableEntity()  || !this->target_ )
             return false;
-        return this->isLooking(this->getControllableEntity(), this->getTarget(), angle);
+        return CommonController::isLooking(this->getControllableEntity(), this->getTarget(), angle);
     }
         void FightingController::setClosestTarget()
Index: code/branches/campaignHS15/src/orxonox/controllers/FightingController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FightingController.h	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/FightingController.h	(revision 10877)
@@ -35,7 +35,4 @@
 namespace orxonox
 {
-
-   
-
     class _OrxonoxExport FightingController : public FlyingController
     {
Index: code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc	(revision 10877)
@@ -45,4 +45,5 @@
 
     }
+
     void FlyingController::XMLPort( Element& xmlelement, XMLPort::Mode mode )
     {
Index: code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h	(revision 10877)
@@ -35,6 +35,4 @@
 namespace orxonox
 {   
-    const float SPEED = 0.9f/0.02f;
-    const float ROTATEFACTOR = 0.6f/0.02f;
     namespace FormationMode
     {
@@ -45,10 +43,11 @@
     }
 
-    
-
     class _OrxonoxExport FlyingController : public CommonController
     {
 
         public:
+            static const float SPEED = 0.9f/0.02f;
+            static const float ROTATEFACTOR = 0.6f/0.02f;
+ 
             FlyingController(Context* context);
             virtual ~FlyingController();
Index: code/branches/campaignHS15/src/orxonox/controllers/LeaderController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/LeaderController.h	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/LeaderController.h	(revision 10877)
@@ -47,10 +47,4 @@
                 virtual void tick(float dt); 
 
-            //----[pseudo virtual methods]----
-                virtual bool setFollower(LeaderController* myFollower)
-                    { return false; }
-                virtual bool hasFollower()
-                    { return true; }
-            //----[/pseudo virtual methods]----
 
 
Index: code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc	(revision 10877)
@@ -315,11 +315,11 @@
         return 0;
     }
-    bool SectionController::setWingman(CommonController* cwingman)
-    {
-        WeakPtr<WingmanController> wingman = orxonox_cast<WingmanController*>(cwingman);
+    bool SectionController::setWingman(ActionpointController* wingman)
+    {
+        WingmanController* newWingman = orxonox_cast<WingmanController*>(wingman);
 
         if (!this->myWingman_)
         {
-            this->myWingman_ = wingman;
+            this->myWingman_ = newWingman;
             return true;
         }
Index: code/branches/campaignHS15/src/orxonox/controllers/SectionController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/SectionController.h	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/SectionController.h	(revision 10877)
@@ -53,5 +53,5 @@
                 LeaderController* findNewDivisionLeader();
 
-                virtual bool setWingman(CommonController* cwingman);
+                virtual bool setWingman(ActionpointController* wingman);
                 virtual bool hasWingman();
 
Index: code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc	(revision 10877)
@@ -111,5 +111,5 @@
         if (!this->myLeader_)
         {
-            ActionpointController* newLeader = orxonox_cast<ActionpointController*> (findNewLeader());
+            ActionpointController* newLeader = (findNewLeader());
             this->myLeader_ = newLeader;
            
@@ -219,5 +219,5 @@
     }
     //----POST: closest leader that is ready to take a new wingman is returned----
-    CommonController* WingmanController::findNewLeader()
+    ActionpointController* WingmanController::findNewLeader()
     {
 
@@ -226,8 +226,9 @@
 
         //----vars for finding the closest leader----
-        CommonController* closestLeader = 0;
+        ActionpointController* closestLeader = 0;
         float minDistance =  std::numeric_limits<float>::infinity();
         Gametype* gt = this->getGametype();
-        for (ObjectList<CommonController>::iterator it = ObjectList<CommonController>::begin(); it; ++it)
+
+        for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
         {
             //----0ptr or not a leader or dead?----
@@ -253,7 +254,11 @@
         {
             //----Racing conditions----
-            if (closestLeader->setWingman(orxonox_cast<CommonController*>(this)))
+            if (closestLeader->setWingman(orxonox_cast<ActionpointController*>(this)))
+            {
                 return closestLeader;
-        }
+            }
+
+        }
+
         return 0;
     }
Index: code/branches/campaignHS15/src/orxonox/controllers/WingmanController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/WingmanController.h	(revision 10875)
+++ code/branches/campaignHS15/src/orxonox/controllers/WingmanController.h	(revision 10877)
@@ -52,5 +52,5 @@
 
             //----[own functions]----
-               CommonController* findNewLeader();
+               ActionpointController* findNewLeader();
             //----[/own functions]----
 
