Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2015, 11:22:03 PM (10 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/worldentities/pawns
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/orxonox/worldentities/pawns/ModularSpaceShip.cc

    r10821 r10916  
    9999            }
    100100            // iterate through all attached parts
    101             for(auto & elem : this->partList_)
     101            for(ShipPart* part : this->partList_)
    102102            {
    103103                // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done).
    104                 if((elem->getName() == this->getAttachedObject(i)->getName()) && !elem->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
     104                if((part->getName() == this->getAttachedObject(i)->getName()) && !part->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
    105105                {
    106106                    // The Entity is added to the part's entityList_
    107                     elem->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
     107                    part->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
    108108                    // An entry in the partMap_ is created, assigning the part to the entity.
    109                     this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), elem);
     109                    this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), part);
    110110                }
    111111            }
     
    146146    ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const
    147147    {
    148         for (const auto & elem : this->partMap_)
    149         {
    150             if (elem.first == entity)
    151                 return elem.second;
     148        for (const auto& mapEntry : this->partMap_)
     149        {
     150            if (mapEntry.first == entity)
     151                return mapEntry.second;
    152152        }
    153153        return nullptr;
     
    242242    ShipPart* ModularSpaceShip::getShipPartByName(std::string name)
    243243    {
    244         for(auto & elem : this->partList_)
    245         {
    246             if(orxonox_cast<ShipPart*>(elem)->getName() == name)
    247             {
    248                 return orxonox_cast<ShipPart*>(elem);
     244        for(ShipPart* part : this->partList_)
     245        {
     246            if(orxonox_cast<ShipPart*>(part)->getName() == name)
     247            {
     248                return orxonox_cast<ShipPart*>(part);
    249249            }
    250250        }
     
    256256    @brief
    257257        Check whether the SpaceShip has a particular Engine.
    258     @param engine
     258    @param search
    259259        A pointer to the Engine to be checked.
    260260    */
    261     bool ModularSpaceShip::hasShipPart(ShipPart* part) const
    262     {
    263         for(auto & elem : this->partList_)
    264         {
    265             if(elem == part)
     261    bool ModularSpaceShip::hasShipPart(ShipPart* search) const
     262    {
     263        for(ShipPart* part : this->partList_)
     264        {
     265            if(part == search)
    266266                return true;
    267267        }
  • code/branches/cpp11_v2/src/orxonox/worldentities/pawns/SpaceShip.cc

    r10821 r10916  
    158158
    159159        // Run the engines
    160         for(auto & elem : this->engineList_)
    161             (elem)->run(dt);
     160        for(Engine* engine : this->engineList_)
     161            engine->run(dt);
    162162
    163163        if (this->hasLocalController())
     
    313313    @brief
    314314        Check whether the SpaceShip has a particular Engine.
    315     @param engine
     315    @param search
    316316        A pointer to the Engine to be checked.
    317317    */
    318     bool SpaceShip::hasEngine(Engine* engine) const
    319     {
    320         for(auto & elem : this->engineList_)
    321         {
    322             if(elem == engine)
     318    bool SpaceShip::hasEngine(Engine* search) const
     319    {
     320        for(Engine* engine : this->engineList_)
     321        {
     322            if(engine == search)
    323323                return true;
    324324        }
     
    350350    Engine* SpaceShip::getEngineByName(const std::string& name)
    351351    {
    352         for(auto & elem : this->engineList_)
    353             if(elem->getName() == name)
    354                 return elem;
     352        for(Engine* engine : this->engineList_)
     353            if(engine->getName() == name)
     354                return engine;
    355355
    356356        orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl;
     
    396396    void SpaceShip::addSpeedFactor(float factor)
    397397    {
    398         for(auto & elem : this->engineList_)
    399             elem->addSpeedMultiply(factor);
     398        for(Engine* engine : this->engineList_)
     399            engine->addSpeedMultiply(factor);
    400400    }
    401401
     
    408408    void SpaceShip::addSpeed(float speed)
    409409    {
    410         for(auto & elem : this->engineList_)
    411             elem->addSpeedAdd(speed);
     410        for(Engine* engine : this->engineList_)
     411            engine->addSpeedAdd(speed);
    412412    }
    413413
     
    436436    {
    437437        float speed=0;
    438         for(auto & elem : this->engineList_)
    439         {
    440             if(elem->getMaxSpeedFront() > speed)
    441                 speed = elem->getMaxSpeedFront();
     438        for(Engine* engine : this->engineList_)
     439        {
     440            if(engine->getMaxSpeedFront() > speed)
     441                speed = engine->getMaxSpeedFront();
    442442        }
    443443        return speed;
  • code/branches/cpp11_v2/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc

    r10821 r10916  
    8080
    8181        std::set<WorldEntity*> attachments = this->getAttachedObjects();
    82         for (const auto & attachment : attachments)
     82        for (WorldEntity* attachment : attachments)
    8383        {
    84             if ((attachment)->isA(Class(TeamColourable)))
     84            if (attachment->isA(Class(TeamColourable)))
    8585            {
    8686                TeamColourable* tc = orxonox_cast<TeamColourable*>(attachment);
Note: See TracChangeset for help on using the changeset viewer.