Index: code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc	(revision 10847)
+++ code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc	(revision 10848)
@@ -122,5 +122,5 @@
         return CommonController::getName (this->getProtect());
     }
-    std::string CommonController::getName(ControllableEntity* entity)
+    std::string CommonController::getName(Pawn* entity)
     {
         std::string name = entity->getName();
@@ -291,50 +291,58 @@
         Vector3 position;
         std::string targetName;
-        this->actionpoints_.push_back(actionpoint);
+
         if (static_cast<Actionpoint*> (actionpoint))
         {
             Actionpoint* ap = static_cast<Actionpoint*> (actionpoint);
+            
             actionName = ap->getActionXML();
-            targetName = ap->get
+            targetName = ap->getName();
+            position = ap->getWorldPosition();
+
             Action::Value value;
             
-            if ( valUpper == "FIGHT" )
+            if ( actionName == "FIGHT" )
             {
                 value = Action::FIGHT;
 
             }
-            else if ( valUpper == "FLY" )
+            else if ( actionName == "FLY" )
             {
                 value = Action::FLY;
 
             }
-            else if ( valUpper == "PROTECT" )
+            else if ( actionName == "PROTECT" )
             {
                 value = Action::PROTECT;
 
             }
-            else if ( valUpper == "NONE" )
+            else if ( actionName == "NONE" )
             {
                 value = Action::NONE;
 
             }
-            else if ( valUpper == "FIGHTALL" )
+            else if ( actionName == "FIGHTALL" )
             {
                 value = Action::FIGHTALL;
 
             }
-            else if ( valUpper == "ATTACK" )
+            else if ( actionName == "ATTACK" )
             {
                 value = Action::ATTACK;
+
 
             }
             else
                 ThrowException( ParseError, std::string( "Attempting to set an unknown Action: '" )+ val + "'." );
-            this->setAction( value );
-        }
-        else
-        {
-            actionName = "FLY";
-        }
+            //this->setAction( value );
+            parsedActionpoints_.push_back( std::make_tuple (value, targetName, position) );
+        }
+        else
+        {
+            parsedActionpoints_.push_back( 
+                std::make_tuple (Action::FLY, "", actionpoint->getWorldPosition()) );
+        }
+            this->actionpoints_.push_back(actionpoint);
+
         
     }
@@ -377,4 +385,94 @@
         return 0;  
     }
+    //POST: this starts doing what was asked by the last element of parsedActionpoints_,
+    //if last element was failed to be parsed, next element will be executed.
+    void CommonController::executeActionpoint()
+    {
+        if (!this->parsedActionpoints_.empty())
+        {
+            this->action_ = std::get<0>( this->parsedActionpoints_.back() );
+
+            switch ( this->action_ )
+            {
+                case Action::FIGHT:
+                {                
+                    break;
+                }
+                case Action::FLY:
+                {
+                    this->setTargetPosition(std::get<2>( this->parsedActionpoints_.back() ));
+                    if (this->squaredDistanceToTarget() <= this->squaredaccuracy_)
+                    {
+                        this->nextActionpoint();
+                        this->executeActionpoint();
+                    }
+                    break;
+                }
+                case Action::PROTECT:
+                {
+                    std::string protectName = std::get<1>( this->parsedActionpoints_.back() );
+
+                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                    {
+                        if (CommonController::getName(*itP) == protectName)
+                        {
+                            this->setProtect (static_cast<ControllableEntity*>(*itP));
+                        }
+                    }
+                    if (!this->getProtect())
+                    {
+                        this->nextActionpoint();
+                        this->executeActionpoint();
+                    }
+                    break;
+                }
+                case Action::NONE:
+                {
+                    break;
+                }
+                case Action::FIGHTALL:
+                {
+                    break;
+                }
+                case Action::ATTACK:
+                {
+                    std::string targetName = std::get<1>( this->parsedActionpoints_.back() );
+
+                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                    {
+                        if (CommonController::getName(*itP) == targetName)
+                        {
+                            this->setTarget (static_cast<ControllableEntity*>(*itP));
+                        }
+                    }
+                    if (!this->getTarget())
+                    {
+                        this->nextActionpoint();
+                        this->executeActionpoint();
+                    }
+                    break;
+                }
+                default:
+                    break;
+            }
+            
+
+        }
+        else
+        {
+            this->setTarget(0);
+            this->setTargetPosition(this->getControllableEntity()->getWorldPosition());
+            this->action_ = Action::NONE;
+        }
+    }
+    void CommonController::nextActionpoint()
+    {
+        if (!this->parsedActionpoints_.empty())
+        {
+            this->parsedActionpoints_.pop_back();
+        }
+        this->setAction(Action::NONE);
+    }
+
     void CommonController::maneuver() 
     {
