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/ArtificialController.cc

    r11052 r11071  
    5656        this->currentWaypoint_ = 0;
    5757        this->setAccuracy(5);
    58         this->defaultWaypoint_ = NULL;
     58        this->defaultWaypoint_ = nullptr;
    5959        this->mode_ = DEFAULT;//Vector-implementation: mode_.push_back(DEFAULT);
    6060    }
     
    177177            {
    178178                this->weaponModes_.clear(); // reset previous weapon information
    179                 WeaponSlot* wSlot = 0;
     179                WeaponSlot* wSlot = nullptr;
    180180                for(int l=0; (wSlot = pawn->getWeaponSlot(l)) ; l++)
    181181                {
    182                     WeaponMode* wMode = 0;
     182                    WeaponMode* wMode = nullptr;
    183183                    for(int i=0; (wMode = wSlot->getWeapon()->getWeaponmode(i)) ; i++)
    184184                    {
     
    207207    void ArtificialController::setAllBotLevel(float level)
    208208    {
    209         for (ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it != ObjectList<ArtificialController>::end(); ++it)
    210             it->setBotLevel(level);
     209        for (ArtificialController* controller : ObjectList<ArtificialController>())
     210            controller->setBotLevel(level);
    211211    }
    212212
     
    222222    {
    223223        SpaceShip* ship = orxonox_cast<SpaceShip*>(this->getControllableEntity());
    224         if(ship == NULL) return;
     224        if(ship == nullptr) return;
    225225        if(ship->getBoostPower()*1.5f > ship->getInitialBoostPower() ) //upper limit ->boost
    226226            this->getControllableEntity()->boost(true);
     
    231231    int ArtificialController::getFiremode(std::string name)
    232232    {
    233         for (std::map< std::string, int >::iterator it = this->weaponModes_.begin(); it != this->weaponModes_.end(); ++it)
    234         {
    235             if (it->first == name)
    236                 return it->second;
     233        for (const auto& mapEntry : this->weaponModes_)
     234        {
     235            if (mapEntry.first == name)
     236                return mapEntry.second;
    237237        }
    238238        return -1;
     
    249249            return this->waypoints_[index];
    250250        else
    251             return 0;
     251            return nullptr;
    252252    }
    253253
     
    258258    void ArtificialController::updatePointsOfInterest(std::string name, float searchDistance)
    259259    {
    260         WorldEntity* waypoint = NULL;
    261         for (ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)
    262         {
    263             if((*it)->getIdentifier() == ClassByString(name))
     260        WorldEntity* waypoint = nullptr;
     261        for (WorldEntity* we : ObjectList<WorldEntity>())
     262        {
     263            if(we->getIdentifier() == ClassByString(name))
    264264            {
    265265                ControllableEntity* controllable = this->getControllableEntity();
    266266                if(!controllable) continue;
    267                 float actualDistance = ( (*it)->getPosition() - controllable->getPosition() ).length();
     267                float actualDistance = ( we->getPosition() - controllable->getPosition() ).length();
    268268                if(actualDistance > searchDistance || actualDistance < 5.0f) continue;
    269269                    // TODO: PickupSpawner: adjust waypoint accuracy to PickupSpawner's triggerdistance
     
    271271                else
    272272                {
    273                     waypoint = *it;
     273                    waypoint = we;
    274274                    break;
    275275                }
Note: See TracChangeset for help on using the changeset viewer.