Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/controllers/ActionpointController.cc

    r11052 r11071  
    339339            inLoop = this->bInLoop_;
    340340
    341             Action::Value value;
     341            Action value;
    342342           
    343343            if ( actionName == "FIGHT" )
     
    371371            return this->actionpoints_[index];
    372372        else
    373             return 0;
     373            return nullptr;
    374374    }
    375375    //XML method
    376     Action::Value ActionpointController::getAction ()
     376    Action ActionpointController::getAction ()
    377377    {
    378378        return this->action_;
     
    401401    }
    402402    //XML method
    403     void ActionpointController::setAction (Action::Value action)
     403    void ActionpointController::setAction (Action action)
    404404    {
    405405        this->action_ = action;
    406406    }
    407407    //set action and target/protect
    408     void ActionpointController::setAction (Action::Value action, ControllableEntity* target)
     408    void ActionpointController::setAction (Action action, ControllableEntity* target)
    409409    {
    410410        if (!this || !this->getControllableEntity())
     
    423423    }
    424424    //set action and target position
    425     void ActionpointController::setAction (Action::Value action, const Vector3& target)
     425    void ActionpointController::setAction (Action action, const Vector3& target)
    426426    {
    427427        if (!this || !this->getControllableEntity())
     
    434434    }
    435435    //set action and target position and orientation
    436     void ActionpointController::setAction (Action::Value action, const Vector3& target,  const Quaternion& orient )
     436    void ActionpointController::setAction (Action action, const Vector3& target,  const Quaternion& orient )
    437437    {
    438438        if (!this || !this->getControllableEntity())
     
    476476                return;
    477477
    478             this->setTarget(0);
     478            this->setTarget(nullptr);
    479479            this->setTargetPosition(this->getControllableEntity()->getWorldPosition());
    480480            this->action_ = Action::NONE;
     
    506506                if (targetName == "")
    507507                    break;
    508                 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
    509                 {
    510                     if (!this || !this->getControllableEntity())
    511                         return;
    512                     if (CommonController::getName(*itP) == targetName)
     508                for (Pawn* pawn : ObjectList<Pawn>())
     509                {
     510                    if (!this || !this->getControllableEntity())
     511                        return;
     512                    if (CommonController::getName(pawn) == targetName)
    513513                    {
    514                         this->setTarget (static_cast<ControllableEntity*>(*itP));
     514                        this->setTarget (static_cast<ControllableEntity*>(pawn));
    515515                    }
    516516                }
     
    541541                if (protectName == "reservedKeyword:human")
    542542                {
    543                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     543                    for (Pawn* pawn : ObjectList<Pawn>())
    544544                    {
    545                         if (orxonox_cast<ControllableEntity*>(*itP) && ((*itP)->getController()) && ((*itP)->getController()->getIdentifier()->getName() == "NewHumanController"))
     545                        if (orxonox_cast<ControllableEntity*>(pawn) && (pawn->getController()) && (pawn->getController()->getIdentifier()->getName() == "NewHumanController"))
    546546                        {
    547                             this->setProtect (static_cast<ControllableEntity*>(*itP));
     547                            this->setProtect (static_cast<ControllableEntity*>(pawn));
    548548                        }
    549549                    }
     
    551551                else
    552552                {
    553                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     553                    for (Pawn* pawn : ObjectList<Pawn>())
    554554                    {
    555                         if (CommonController::getName(*itP) == protectName)
     555                        if (CommonController::getName(pawn) == protectName)
    556556                        {
    557                             this->setProtect (static_cast<ControllableEntity*>(*itP));
     557                            this->setProtect (static_cast<ControllableEntity*>(pawn));
    558558                        }
    559559                    }                           
     
    578578                std::string targetName = p.name;
    579579
    580                 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
    581                 {
    582                     if (CommonController::getName(*itP) == targetName)
     580                for (Pawn* pawn : ObjectList<Pawn>())
     581                {
     582                    if (CommonController::getName(pawn) == targetName)
    583583                    {
    584584                        if (!this || !this->getControllableEntity())
    585585                            return;
    586                         this->setTarget (static_cast<ControllableEntity*>(*itP));
     586                        this->setTarget (static_cast<ControllableEntity*>(pawn));
    587587                    }
    588588                }
     
    702702    {
    703703        if (!this || !this->getControllableEntity())
    704             return 0;
    705 
    706         Pawn* closestTarget = 0;
     704            return nullptr;
     705
     706        Pawn* closestTarget = nullptr;
    707707        float minDistance =  std::numeric_limits<float>::infinity();
    708708        Gametype* gt = this->getGametype();
    709         for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     709        for (Pawn* pawn : ObjectList<Pawn>())
    710710        {
    711711            if (!this || !this->getControllableEntity())
    712                 return 0;
    713             if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
     712                return nullptr;
     713            if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), gt) )
    714714                continue;
    715715
    716             float distance = CommonController::distance (*itP, this->getControllableEntity());
     716            float distance = CommonController::distance (pawn, this->getControllableEntity());
    717717            if (distance < minDistance)
    718718            {
    719                 closestTarget = *itP;
     719                closestTarget = pawn;
    720720                minDistance = distance;
    721721            }
     
    725725           return closestTarget;
    726726        }
    727         return 0; 
     727        return nullptr;
    728728    }
    729729    //push action FIGHT to the stack and set target to the closest enemy
Note: See TracChangeset for help on using the changeset viewer.