Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 8:40:36 PM (9 years ago)
Author:
landauf
Message:

return collections directly instead of begin and end iterators.
this also fixes an issue in MultiStateEngine where two for-loops used begin() instead of end() in the loop condition.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.cc

    r11068 r11070  
    8686                // We have no ship, so the effects are not attached and won't be destroyed automatically
    8787                for (EffectContainer* container : this->effectContainers_)
    88                     for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsBegin(); ++it)
    89                         (*it)->destroy();
     88                    for (WorldEntity* effect : container->getEffects())
     89                        effect->destroy();
    9090                if (this->defEngineSndNormal_)
    9191                    this->defEngineSndNormal_->destroy();
     
    199199
    200200        for (EffectContainer* container : this->effectContainers_)
    201             for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsEnd(); ++it)
    202                 this->getShip()->attach(*it);
    203     }
    204 
    205     void MultiStateEngine::addEffectContainer(EffectContainer* effect)
    206     {
    207         if (effect == nullptr)
     201            for (WorldEntity* effect : container->getEffects())
     202                this->getShip()->attach(effect);
     203    }
     204
     205    void MultiStateEngine::addEffectContainer(EffectContainer* container)
     206    {
     207        if (container == nullptr)
    208208            return;
    209         effect->setLuaState(this->lua_, 'f' + multi_cast<std::string>(this->effectContainers_.size()));
    210         this->effectContainers_.push_back(effect);
     209        container->setLuaState(this->lua_, 'f' + multi_cast<std::string>(this->effectContainers_.size()));
     210        this->effectContainers_.push_back(container);
    211211        if (this->getShip())
    212212        {
    213             for (std::vector<WorldEntity*>::const_iterator it = effect->getEffectsBegin(); it != effect->getEffectsBegin(); ++it)
    214                 this->getShip()->attach(*it);
     213            for (WorldEntity* effect : container->getEffects())
     214                this->getShip()->attach(effect);
    215215        }
    216216    }
Note: See TracChangeset for help on using the changeset viewer.