Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2015, 11:22:03 PM (9 years ago)
Author:
landauf
Message:

use actual types instead of 'auto'. only exception is for complicated template types, e.g. when iterating over a map

Location:
code/branches/cpp11_v2/src/orxonox/controllers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/orxonox/controllers/ArtificialController.cc

    r10768 r10916  
    231231    int ArtificialController::getFiremode(std::string name)
    232232    {
    233         for (auto firemode : this->weaponModes_)
    234         {
    235             if (firemode.first == name)
    236                 return firemode.second;
     233        for (auto& mapEntry : this->weaponModes_)
     234        {
     235            if (mapEntry.first == name)
     236                return mapEntry.second;
    237237        }
    238238        return -1;
  • code/branches/cpp11_v2/src/orxonox/controllers/FormationController.cc

    r10821 r10916  
    440440                if(newMaster->slaves_.size() > this->maxFormationSize_) continue;
    441441
    442                 for(auto & elem : this->slaves_)
     442                for(FormationController* slave : this->slaves_)
    443443                {
    444                     (elem)->myMaster_ = newMaster;
    445                     newMaster->slaves_.push_back(elem);
     444                    slave->myMaster_ = newMaster;
     445                    newMaster->slaves_.push_back(slave);
    446446                }
    447447                this->slaves_.clear();
     
    486486            int i = 1;
    487487
    488             for(auto & elem : slaves_)
     488            for(FormationController* slave : slaves_)
    489489            {
    490490                pos = Vector3::ZERO;
     
    497497                    dest+=FORMATION_LENGTH*(orient*WorldEntity::BACK);
    498498                }
    499                 (elem)->setTargetOrientation(orient);
    500                 (elem)->setTargetPosition(pos);
     499                slave->setTargetOrientation(orient);
     500                slave->setTargetPosition(pos);
    501501                left=!left;
    502502            }
     
    569569        if(this->state_ != MASTER) return;
    570570
    571         for(auto & elem : slaves_)
    572         {
    573             (elem)->state_ = FREE;
    574             (elem)->myMaster_ = nullptr;
     571        for(FormationController* slave : slaves_)
     572        {
     573            slave->state_ = FREE;
     574            slave->myMaster_ = nullptr;
    575575        }
    576576        this->slaves_.clear();
     
    584584        if(this->state_ != MASTER) return;
    585585
    586         for(auto & elem : slaves_)
    587         {
    588             (elem)->state_ = FREE;
    589             (elem)->forceFreedom();
    590             (elem)->targetPosition_ = this->targetPosition_;
    591             (elem)->bShooting_ = true;
     586        for(FormationController* slave : slaves_)
     587        {
     588            slave->state_ = FREE;
     589            slave->forceFreedom();
     590            slave->targetPosition_ = this->targetPosition_;
     591            slave->bShooting_ = true;
    592592//             (*it)->getControllableEntity()->fire(0);// fire once for fun
    593593        }
     
    650650            this->slaves_.push_back(this->myMaster_);
    651651            //set this as new master
    652             for(auto & elem : slaves_)
    653             {
    654                  (elem)->myMaster_=this;
     652            for(FormationController* slave : slaves_)
     653            {
     654                 slave->myMaster_=this;
    655655            }
    656656            this->myMaster_=nullptr;
     
    694694        if (this->state_ == MASTER)
    695695        {
    696             for(auto & elem : slaves_)
    697             {
    698                  (elem)->formationMode_ = val;
     696            for(FormationController* slave : slaves_)
     697            {
     698                 slave->formationMode_ = val;
    699699                 if (val == ATTACK)
    700                      (elem)->forgetTarget();
     700                     slave->forgetTarget();
    701701            }
    702702        }
  • code/branches/cpp11_v2/src/orxonox/controllers/WaypointController.cc

    r10821 r10916  
    4444    WaypointController::~WaypointController()
    4545    {
    46         for (auto & elem : this->waypoints_)
     46        for (WorldEntity* waypoint : this->waypoints_)
    4747        {
    48             if(elem)
    49                 elem->destroy();
     48            if(waypoint)
     49                waypoint->destroy();
    5050        }
    5151    }
Note: See TracChangeset for help on using the changeset viewer.