Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10821


Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (8 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
Location:
code/branches/cpp11_v2/src
Files:
129 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/BaseObject.cc

    r10768 r10821  
    234234    {
    235235        unsigned int i = 0;
    236         for (std::set<Template*>::const_iterator it = this->templates_.begin(); it != this->templates_.end(); ++it)
     236        for (const auto & elem : this->templates_)
    237237        {
    238238            if (i == index)
    239                 return (*it);
     239                return (elem);
    240240            i++;
    241241        }
     
    269269    {
    270270        unsigned int i = 0;
    271         for (std::map<BaseObject*, std::string>::const_iterator it = this->eventSources_.begin(); it != this->eventSources_.end(); ++it)
    272         {
    273             if (it->second != state)
     271        for (const auto & elem : this->eventSources_)
     272        {
     273            if (elem.second != state)
    274274                continue;
    275275
    276276            if (i == index)
    277                 return it->first;
     277                return elem.first;
    278278            ++i;
    279279        }
     
    296296    {
    297297        unsigned int i = 0;
    298         for (std::set<BaseObject*>::const_iterator it = this->eventListenersXML_.begin(); it != this->eventListenersXML_.end(); ++it)
     298        for (const auto & elem : this->eventListenersXML_)
    299299        {
    300300            if (i == index)
    301                 return *it;
     301                return elem;
    302302            ++i;
    303303        }
     
    358358        Event event(activate, originator, name);
    359359
    360         for (std::set<BaseObject*>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
    361         {
    362             event.statename_ = (*it)->eventSources_[this];
    363             (*it)->processEvent(event);
     360        for (const auto & elem : this->eventListeners_)
     361        {
     362            event.statename_ = (elem)->eventSources_[this];
     363            (elem)->processEvent(event);
    364364        }
    365365    }
     
    370370    void BaseObject::fireEvent(Event& event)
    371371    {
    372         for (std::set<BaseObject*>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
    373             (*it)->processEvent(event);
     372        for (const auto & elem : this->eventListeners_)
     373            (elem)->processEvent(event);
    374374    }
    375375
     
    474474
    475475            // iterate through all states and get the event sources
    476             for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it)
     476            for (auto & statename : eventnames)
    477477            {
    478                 const std::string& statename = (*it);
     478               
    479479
    480480                // if the event state is already known, continue with the next state
  • code/branches/cpp11_v2/src/libraries/core/ClassTreeMask.cc

    r10768 r10821  
    293293        {
    294294            // No it's not: Search for classes inheriting from the given class and add the rules for them
    295             for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildren().begin(); it != subclass->getDirectChildren().end(); ++it)
    296                 if ((*it)->isA(this->root_->getClass()))
    297                     if (overwrite || (!this->nodeExists(*it))) // If we don't want to overwrite, only add nodes that don't already exist
    298                         this->add(this->root_, *it, bInclude, overwrite);
     295            for (const auto & elem : subclass->getDirectChildren())
     296                if ((elem)->isA(this->root_->getClass()))
     297                    if (overwrite || (!this->nodeExists(elem))) // If we don't want to overwrite, only add nodes that don't already exist
     298                        this->add(this->root_, elem, bInclude, overwrite);
    299299        }
    300300
     
    325325        {
    326326            // Search for an already existing node, containing the subclass we want to add
    327             for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
     327            for (auto & elem : node->subnodes_)
    328328            {
    329                 if (subclass->isA((*it)->getClass()))
     329                if (subclass->isA((elem)->getClass()))
    330330                {
    331331                    // We've found an existing node -> delegate the work with a recursive function-call and return
    332                     this->add(*it, subclass, bInclude, overwrite);
     332                    this->add(elem, subclass, bInclude, overwrite);
    333333                    return;
    334334                }
     
    392392        if (!subclass)
    393393            return;
    394         for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildren().begin(); it != subclass->getDirectChildren().end(); ++it)
    395             this->add(*it, this->isIncluded(*it), false, false);
     394        for (const auto & elem : subclass->getDirectChildren())
     395            this->add(elem, this->isIncluded(elem), false, false);
    396396
    397397        this->add(subclass, bInclude, false, clean);
     
    435435
    436436            // Go through the list of subnodes and look for a node containing the searched subclass and delegate the request by a recursive function-call.
    437             for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
    438                 if (subclass->isA((*it)->getClass()))
    439                     return isIncluded(*it, subclass);
     437            for (auto & elem : node->subnodes_)
     438                if (subclass->isA((elem)->getClass()))
     439                    return isIncluded(elem, subclass);
    440440
    441441            // There is no subnode containing our class -> the rule of the current node takes in effect
     
    957957            // The bool is "false", meaning they have no subnodes and therefore need no further checks
    958958            if (node->isIncluded())
    959                 for (std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it)
    960                     this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it, false));
     959                for (const auto & elem : directChildren)
     960                    this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(elem, false));
    961961        }
    962962    }
  • code/branches/cpp11_v2/src/libraries/core/Core.cc

    r10768 r10821  
    279279
    280280        const std::vector<std::string>& modulePaths = ApplicationPaths::getInstance().getModulePaths();
    281         for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it)
    282         {
    283             ModuleInstance* module = new ModuleInstance(*it);
     281        for (const auto & modulePath : modulePaths)
     282        {
     283            ModuleInstance* module = new ModuleInstance(modulePath);
    284284            this->loadModule(module);
    285285            this->modules_.push_back(module);
     
    309309    void Core::unloadModules()
    310310    {
    311         for (std::list<ModuleInstance*>::iterator it = this->modules_.begin(); it != this->modules_.end(); ++it)
    312         {
    313             ModuleInstance* module = (*it);
     311        for (auto module : this->modules_)
     312        {
     313           
    314314            this->unloadModule(module);
    315315            delete module;
  • code/branches/cpp11_v2/src/libraries/core/CoreStaticInitializationHandler.cc

    r10624 r10821  
    9999        std::set<Identifier*> identifiers;
    100100        const std::set<StaticallyInitializedInstance*>& instances = module->getInstances(StaticInitialization::IDENTIFIER);
    101         for (std::set<StaticallyInitializedInstance*>::const_iterator it = instances.begin(); it != instances.end(); ++it)
    102             identifiers.insert(&static_cast<StaticallyInitializedIdentifier*>(*it)->getIdentifier());
     101        for (const auto & instance : instances)
     102            identifiers.insert(&static_cast<StaticallyInitializedIdentifier*>(instance)->getIdentifier());
    103103
    104104        // destroy objects. some objects may survive this at first because they still have strong pointers pointing at them. this is
     
    106106        // that objects within one module may reference each other by strong pointers. but it is not allowed that objects from another
    107107        // module (which is not unloaded) uses strong pointers to point at objects inside the unloaded module. this will lead to a crash.
    108         for (std::set<Identifier*>::iterator it = identifiers.begin(); it != identifiers.end(); ++it)
    109             (*it)->destroyObjects();
     108        for (const auto & identifier : identifiers)
     109            (identifier)->destroyObjects();
    110110
    111111        // check if all objects were really destroyed. this is not the case if an object is referenced by a strong pointer from another
    112112        // module (or if two objects inside this module reference each other). this will lead to a crash and must be fixed (e.g. by
    113113        // changing object dependencies; or by changing the logic that allows modules to be unloaded).
    114         for (std::set<Identifier*>::iterator it = identifiers.begin(); it != identifiers.end(); ++it)
     114        for (const auto & identifier : identifiers)
    115115        {
    116             ObjectListBase* objectList = Context::getRootContext()->getObjectList(*it);
     116            ObjectListBase* objectList = Context::getRootContext()->getObjectList(identifier);
    117117            if (objectList->size() > 0)
    118118            {
    119                 orxout(internal_error) << "There are still " << objectList->size() << " objects of type " << (*it)->getName()
     119                orxout(internal_error) << "There are still " << objectList->size() << " objects of type " << (identifier)->getName()
    120120                    << " after unloading the Identifier. This may lead to a crash" << endl;
    121121            }
     
    123123
    124124        // destroy object-lists in all contexts
    125         for (std::set<Identifier*>::iterator it_identifier = identifiers.begin(); it_identifier != identifiers.end(); ++it_identifier)
     125        for (const auto & identifier : identifiers)
    126126        {
    127127            // only do this if the Identifier is not a Context itself; otherwise we delete the list we're iterating over
    128             if (!(*it_identifier)->isExactlyA(Class(Context)))
     128            if (!(identifier)->isExactlyA(Class(Context)))
    129129            {
    130130                // iterate over all contexts
    131131                for (ObjectList<Context>::iterator it_context = ObjectList<Context>::begin(); it_context != ObjectList<Context>::end(); ++it_context)
    132                     it_context->destroyObjectList((*it_identifier));
     132                    it_context->destroyObjectList((identifier));
    133133            }
    134134        }
  • code/branches/cpp11_v2/src/libraries/core/Game.cc

    r10772 r10821  
    612612        // Check if graphics is still required
    613613        bool graphicsRequired = false;
    614         for (unsigned i = 0; i < loadedStates_.size(); ++i)
    615             graphicsRequired |= loadedStates_[i]->getInfo().bGraphicsMode;
     614        for (auto & elem : loadedStates_)
     615            graphicsRequired |= elem->getInfo().bGraphicsMode;
    616616        if (!graphicsRequired)
    617617            this->unloadGraphics(!this->bAbort_); // if abort is false, that means the game is still running while unloading graphics. in this case we load a graphics manager without renderer (to keep all necessary ogre instances alive)
  • code/branches/cpp11_v2/src/libraries/core/Language.cc

    r10768 r10821  
    107107    Language::~Language()
    108108    {
    109         for (std::map<std::string, LanguageEntry*>::iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
    110             delete (it->second);
     109        for (auto & elem : this->languageEntries_)
     110            delete (elem.second);
    111111    }
    112112
     
    319319
    320320        // Iterate through the list an write the lines into the file
    321         for (std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
    322         {
    323             file << it->second->getLabel() << '=' << it->second->getDefault() << endl;
     321        for (const auto & elem : this->languageEntries_)
     322        {
     323            file << elem.second->getLabel() << '=' << elem.second->getDefault() << endl;
    324324        }
    325325
  • code/branches/cpp11_v2/src/libraries/core/Loader.cc

    r10777 r10821  
    165165                        std::ostringstream message;
    166166                        message << "Possible sources of error:" << endl;
    167                         for (std::vector<std::pair<std::string, size_t>>::iterator it = linesources.begin(); it != linesources.end(); ++it)
     167                        for (auto & linesource : linesources)
    168168                        {
    169                             message << it->first << ", Line " << it->second << endl;
     169                            message << linesource.first << ", Line " << linesource.second << endl;
    170170                        }
    171171                        orxout(user_error, context::loader) << message.str() << endl;
     
    261261        {
    262262            bool expectedValue = true;
    263             for (std::map<size_t, bool>::iterator it = luaTags.begin(); it != luaTags.end(); ++it)
    264             {
    265                 if (it->second == expectedValue)
     263            for (auto & luaTag : luaTags)
     264            {
     265                if (luaTag.second == expectedValue)
    266266                    expectedValue = !expectedValue;
    267267                else
  • code/branches/cpp11_v2/src/libraries/core/LuaState.cc

    r10817 r10821  
    326326    /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
    327327    {
    328         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    329         {
    330             if (it->first == name || it->second == function)
     328        for (const auto & interface : getToluaInterfaces())
     329        {
     330            if (interface.first == name || interface.second == function)
    331331            {
    332332                orxout(internal_warning, context::lua) << "Trying to add a Tolua interface with the same name or function." << endl;
     
    337337
    338338        // Open interface in all LuaStates
    339         for (std::vector<LuaState*>::const_iterator it = getInstances().begin(); it != getInstances().end(); ++it)
    340             (*function)((*it)->luaState_);
     339        for (const auto & state : getInstances())
     340            (*function)(state->luaState_);
    341341
    342342        // Return dummy bool
     
    354354
    355355        // Close interface in all LuaStates
    356         for (std::vector<LuaState*>::const_iterator itState = getInstances().begin(); itState != getInstances().end(); ++itState)
    357         {
    358             lua_pushnil((*itState)->luaState_);
    359             lua_setglobal((*itState)->luaState_, it->first.c_str());
     356        for (const auto & state : getInstances())
     357        {
     358            lua_pushnil(state->luaState_);
     359            lua_setglobal(state->luaState_, it->first.c_str());
    360360        }
    361361
     
    369369    /*static*/ void LuaState::openToluaInterfaces(lua_State* state)
    370370    {
    371         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    372             (*it->second)(state);
     371        for (const auto & interface : getToluaInterfaces())
     372            (interface.second)(state);
    373373    }
    374374
    375375    /*static*/ void LuaState::closeToluaInterfaces(lua_State* state)
    376376    {
    377         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
     377        for (const auto & interface : getToluaInterfaces())
    378378        {
    379379            lua_pushnil(state);
    380             lua_setglobal(state, it->first.c_str());
     380            lua_setglobal(state, interface.first.c_str());
    381381        }
    382382    }
  • code/branches/cpp11_v2/src/libraries/core/Namespace.cc

    r10768 r10821  
    5353    {
    5454        if (this->bRoot_)
    55             for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
    56                 delete (*it);
     55            for (auto & elem : this->representingNamespaces_)
     56                delete elem;
    5757    }
    5858
     
    8080            for (unsigned int i = 0; i < tokens.size(); i++)
    8181            {
    82                 for (std::set<NamespaceNode*>::iterator it = this->getNamespace()->representingNamespaces_.begin(); it != this->getNamespace()->representingNamespaces_.end(); ++it)
     82                for (auto & elem : this->getNamespace()->representingNamespaces_)
    8383                {
    84                     std::set<NamespaceNode*> temp = (*it)->getNodeRelative(tokens[i]);
     84                    std::set<NamespaceNode*> temp = elem->getNodeRelative(tokens[i]);
    8585                    this->representingNamespaces_.insert(temp.begin(), temp.end());
    8686                }
     
    9393        if (this->bAutogeneratedFileRootNamespace_)
    9494        {
    95             for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
     95            for (auto & elem : this->representingNamespaces_)
    9696            {
    97                 (*it)->setRoot(true);
    98                 (*it)->setHidden(true);
     97                elem->setRoot(true);
     98                elem->setHidden(true);
    9999            }
    100100        }
     
    114114    bool Namespace::includes(const Namespace* ns) const
    115115    {
    116         for (std::set<NamespaceNode*>::const_iterator it1 = this->representingNamespaces_.begin(); it1 != this->representingNamespaces_.end(); ++it1)
     116        for (const auto & elem1 : this->representingNamespaces_)
    117117        {
    118             for (std::set<NamespaceNode*>::const_iterator it2 = ns->representingNamespaces_.begin(); it2 != ns->representingNamespaces_.end(); ++it2)
     118            for (const auto & elem2 : ns->representingNamespaces_)
    119119            {
    120                 if ((*it1)->includes(*it2))
     120                if (elem1->includes(elem2))
    121121                {
    122122                    if (this->operator_ == "or")
     
    149149
    150150        int i = 0;
    151         for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
     151        for (const auto & elem : this->representingNamespaces_)
    152152        {
    153153            if (i > 0)
    154154                output += " / ";
    155155
    156             output += (*it)->toString();
     156            output += elem->toString();
     157            i++;
    157158        }
    158159
     
    165166
    166167        int i = 0;
    167         for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
     168        for (const auto & elem : this->representingNamespaces_)
    168169        {
    169170            if (i > 0)
    170171                output += '\n';
    171172
    172             output += (*it)->toString(indentation);
     173            output += elem->toString(indentation);
     174            i++;
    173175        }
    174176
  • code/branches/cpp11_v2/src/libraries/core/NamespaceNode.cc

    r8858 r10821  
    103103                bool bFoundMatchingNamespace = false;
    104104
    105                 for (std::map<std::string, NamespaceNode*>::iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
     105                for (auto & elem : this->subnodes_)
    106106                {
    107                     if (it->first.find(firstPart) == (it->first.size() - firstPart.size()))
     107                    if (elem.first.find(firstPart) == (elem.first.size() - firstPart.size()))
    108108                    {
    109                         std::set<NamespaceNode*> temp2 = it->second->getNodeRelative(secondPart);
     109                        std::set<NamespaceNode*> temp2 = elem.second->getNodeRelative(secondPart);
    110110                        nodes.insert(temp2.begin(), temp2.end());
    111111                        bFoundMatchingNamespace = true;
     
    132132        else
    133133        {
    134             for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
    135                 if (it->second->includes(ns))
     134            for (const auto & elem : this->subnodes_)
     135                if (elem.second->includes(ns))
    136136                    return true;
    137137        }
     
    167167        std::string output = (indentation + this->name_ + '\n');
    168168
    169         for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
    170             output += it->second->toString(indentation + "  ");
     169        for (const auto & elem : this->subnodes_)
     170            output += elem.second->toString(indentation + "  ");
    171171
    172172        return output;
  • code/branches/cpp11_v2/src/libraries/core/Resource.cc

    r10772 r10821  
    5858        DataStreamListPtr resources(new Ogre::DataStreamList());
    5959        const Ogre::StringVector& groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
    60         for (Ogre::StringVector::const_iterator it = groups.begin(); it != groups.end(); ++it)
     60        for (const auto & group : groups)
    6161        {
    62             DataStreamListPtr temp = Ogre::ResourceGroupManager::getSingleton().openResources(pattern, *it);
     62            DataStreamListPtr temp = Ogre::ResourceGroupManager::getSingleton().openResources(pattern, group);
    6363            resources->insert(resources->end(), temp->begin(), temp->end());
    6464        }
     
    121121        StringVectorPtr resourceNames(new Ogre::StringVector());
    122122        const Ogre::StringVector& groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
    123         for (Ogre::StringVector::const_iterator it = groups.begin(); it != groups.end(); ++it)
     123        for (const auto & group : groups)
    124124        {
    125             StringVectorPtr temp = Ogre::ResourceGroupManager::getSingleton().findResourceNames(*it, pattern);
     125            StringVectorPtr temp = Ogre::ResourceGroupManager::getSingleton().findResourceNames(group, pattern);
    126126            resourceNames->insert(resourceNames->end(), temp->begin(), temp->end());
    127127        }
  • code/branches/cpp11_v2/src/libraries/core/class/Identifier.cc

    r10768 r10821  
    8787        for (std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
    8888            const_cast<Identifier*>(*it)->directChildren_.erase(this);
    89         for (std::set<const Identifier*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    90             const_cast<Identifier*>(*it)->parents_.remove(this);
    91         for (std::set<const Identifier*>::const_iterator it = this->directChildren_.begin(); it != this->directChildren_.end(); ++it)
    92             const_cast<Identifier*>(*it)->directParents_.remove(this);
    93 
    94         for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it)
    95             delete (it->second);
    96         for (std::map<std::string, XMLPortParamContainer*>::iterator it = this->xmlportParamContainers_.begin(); it != this->xmlportParamContainers_.end(); ++it)
    97             delete (it->second);
    98         for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it)
    99             delete (it->second);
     89        for (const auto & elem : this->children_)
     90            const_cast<Identifier*>(elem)->parents_.remove(this);
     91        for (const auto & elem : this->directChildren_)
     92            const_cast<Identifier*>(elem)->directParents_.remove(this);
     93
     94        for (auto & elem : this->configValues_)
     95            delete (elem.second);
     96        for (auto & elem : this->xmlportParamContainers_)
     97            delete (elem.second);
     98        for (auto & elem : this->xmlportObjectContainers_)
     99            delete (elem.second);
    100100    }
    101101
     
    157157        if (this->directParents_.empty())
    158158        {
    159             for (std::list<const Identifier*>::const_iterator it = initializationTrace.begin(); it != initializationTrace.end(); ++it)
    160                 if (*it != this)
    161                     this->parents_.push_back(*it);
     159            for (const auto & elem : initializationTrace)
     160                if (elem != this)
     161                    this->parents_.push_back(elem);
    162162        }
    163163        else
     
    261261
    262262        // if any parent class is virtual, it will be instantiated first, so we need to add them first.
    263         for (std::list<const Identifier*>::const_iterator it_parent = this->parents_.begin(); it_parent != this->parents_.end(); ++it_parent)
    264         {
    265             if ((*it_parent)->isVirtualBase())
     263        for (const auto & elem : this->parents_)
     264        {
     265            if ((elem)->isVirtualBase())
    266266            {
    267                 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)
     267                for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(elem)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(elem)->parents_.end(); ++it_parent_parent)
    268268                    this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent);
    269                 this->addIfNotExists(expectedIdentifierTrace, *it_parent);
     269                this->addIfNotExists(expectedIdentifierTrace, elem);
    270270            }
    271271        }
    272272
    273273        // now all direct parents get created recursively. already added identifiers (e.g. virtual base classes) are not added again.
    274         for (std::list<const Identifier*>::const_iterator it_parent = this->directParents_.begin(); it_parent != this->directParents_.end(); ++it_parent)
    275         {
    276             for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)
     274        for (const auto & elem : this->directParents_)
     275        {
     276            for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(elem)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(elem)->parents_.end(); ++it_parent_parent)
    277277                this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent);
    278             this->addIfNotExists(expectedIdentifierTrace, *it_parent);
     278            this->addIfNotExists(expectedIdentifierTrace, elem);
    279279        }
    280280
     
    285285
    286286            orxout(internal_warning) << "  Actual trace (after creating a sample instance):" << endl << "    ";
    287             for (std::list<const Identifier*>::const_iterator it_parent = this->parents_.begin(); it_parent != this->parents_.end(); ++it_parent)
    288                 orxout(internal_warning) << " " << (*it_parent)->getName();
     287            for (const auto & elem : this->parents_)
     288                orxout(internal_warning) << " " << (elem)->getName();
    289289            orxout(internal_warning) << endl;
    290290
     
    295295
    296296            orxout(internal_warning) << "  Direct parents (according to class hierarchy definitions):" << endl << "    ";
    297             for (std::list<const Identifier*>::const_iterator it_parent = this->directParents_.begin(); it_parent != this->directParents_.end(); ++it_parent)
    298                 orxout(internal_warning) << " " << (*it_parent)->getName();
     297            for (const auto & elem : this->directParents_)
     298                orxout(internal_warning) << " " << (elem)->getName();
    299299            orxout(internal_warning) << endl;
    300300        }
  • code/branches/cpp11_v2/src/libraries/core/class/Identifier.h

    r10817 r10821  
    462462
    463463        if (updateChildren)
    464             for (std::set<const Identifier*>::const_iterator it = this->getChildren().begin(); it != this->getChildren().end(); ++it)
    465                 (*it)->updateConfigValues(false);
     464            for (const auto & elem : this->getChildren())
     465                (elem)->updateConfigValues(false);
    466466    }
    467467
  • code/branches/cpp11_v2/src/libraries/core/class/IdentifierManager.cc

    r10768 r10821  
    9393        {
    9494            Context temporaryContext(nullptr);
    95             for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
     95            for (auto identifier : this->identifiers_)
    9696            {
    97                 Identifier* identifier = (*it);
     97               
    9898                if (identifier->isInitialized())
    9999                    continue;
     
    127127
    128128        // finish the initialization of all identifiers
    129         for (std::set<Identifier*>::const_iterator it = initializedIdentifiers.begin(); it != initializedIdentifiers.end(); ++it)
    130             (*it)->finishInitialization();
     129        for (const auto & initializedIdentifier : initializedIdentifiers)
     130            (initializedIdentifier)->finishInitialization();
    131131
    132132        // only check class hierarchy in dev mode because it's an expensive operation and it requires a developer to fix detected problems anyway.
     
    144144    {
    145145        // check if there are any uninitialized identifiers remaining
    146         for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
    147             if (!(*it)->isInitialized())
    148                 orxout(internal_error) << "Identifier was registered late and is not initialized: " << (*it)->getName() << " / " << (*it)->getTypeInfo().name() << endl;
     146        for (const auto & elem : this->identifiers_)
     147            if (!(elem)->isInitialized())
     148                orxout(internal_error) << "Identifier was registered late and is not initialized: " << (elem)->getName() << " / " << (elem)->getTypeInfo().name() << endl;
    149149
    150150        // for all initialized identifiers, check if a sample instance behaves as expected according to the class hierarchy
    151151        Context temporaryContext(nullptr);
    152         for (std::set<Identifier*>::const_iterator it1 = initializedIdentifiers.begin(); it1 != initializedIdentifiers.end(); ++it1)
     152        for (const auto & initializedIdentifier : initializedIdentifiers)
    153153        {
    154             if (!(*it1)->hasFactory())
     154            if (!(initializedIdentifier)->hasFactory())
    155155                continue;
    156156
    157             Identifiable* temp = (*it1)->fabricate(&temporaryContext);
    158 
    159             for (std::set<Identifier*>::const_iterator it2 = this->identifiers_.begin(); it2 != this->identifiers_.end(); ++it2)
     157            Identifiable* temp = (initializedIdentifier)->fabricate(&temporaryContext);
     158
     159            for (const auto & elem : this->identifiers_)
    160160            {
    161                 bool isA_AccordingToRtti = (*it2)->canDynamicCastObjectToIdentifierClass(temp);
    162                 bool isA_AccordingToClassHierarchy = temp->isA((*it2));
     161                bool isA_AccordingToRtti = (elem)->canDynamicCastObjectToIdentifierClass(temp);
     162                bool isA_AccordingToClassHierarchy = temp->isA((elem));
    163163
    164164                if (isA_AccordingToRtti != isA_AccordingToClassHierarchy)
    165165                {
    166                     orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << (*it1)->getName() <<
    167                         (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << (*it2)->getName() << " but RTTI says the opposite." << endl;
     166                    orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << (initializedIdentifier)->getName() <<
     167                        (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << (elem)->getName() << " but RTTI says the opposite." << endl;
    168168                }
    169169            }
     
    184184    {
    185185        orxout(internal_status) << "Destroy class-hierarchy" << endl;
    186         for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
    187             (*it)->reset();
     186        for (const auto & elem : this->identifiers_)
     187            (elem)->reset();
    188188    }
    189189
     
    260260    {
    261261        // TODO: use std::type_index and a map to find identifiers by type_info (only with c++11)
    262         for (std::set<Identifier*>::iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
    263             if ((*it)->getTypeInfo() == typeInfo)
    264                 return (*it);
     262        for (const auto & elem : this->identifiers_)
     263            if ((elem)->getTypeInfo() == typeInfo)
     264                return (elem);
    265265        return nullptr;
    266266    }
  • code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc

    r10769 r10821  
    7777            bool groupIsVisible(const std::map<std::string, ConsoleCommand*>& group, bool bOnlyShowHidden)
    7878            {
    79                 for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = group.begin(); it_command != group.end(); ++it_command)
    80                     if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden)
     79                for (const auto & elem : group)
     80                    if (elem.second->isActive() && elem.second->hasAccess() && (!elem.second->isHidden())^bOnlyShowHidden)
    8181                        return true;
    8282
     
    100100                // get all the groups that are visible (except the shortcut group "")
    101101                const std::map<std::string, std::map<std::string, ConsoleCommand*>>& commands = ConsoleCommandManager::getInstance().getCommands();
    102                 for (std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group)
    103                     if (groupIsVisible(it_group->second, bOnlyShowHidden) && it_group->first != "" && (fragmentLC == "" || getLowercase(it_group->first).find(fragmentLC) == 0))
    104                         groupList.push_back(ArgumentCompletionListElement(it_group->first, getLowercase(it_group->first)));
     102                for (const auto & command : commands)
     103                    if (groupIsVisible(command.second, bOnlyShowHidden) && command.first != "" && (fragmentLC == "" || getLowercase(command.first).find(fragmentLC) == 0))
     104                        groupList.push_back(ArgumentCompletionListElement(command.first, getLowercase(command.first)));
    105105
    106106                // now add all shortcuts (in group "")
     
    113113
    114114                    // add the shortcuts
    115                     for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
    116                         if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(it_command->first).find(fragmentLC) == 0))
    117                             groupList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first)));
     115                    for (const auto & elem : it_group->second)
     116                        if (elem.second->isActive() && elem.second->hasAccess() && (!elem.second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(elem.first).find(fragmentLC) == 0))
     117                            groupList.push_back(ArgumentCompletionListElement(elem.first, getLowercase(elem.first)));
    118118                }
    119119
     
    146146                if (it_group != ConsoleCommandManager::getInstance().getCommands().end())
    147147                {
    148                     for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
    149                         if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden)
    150                             commandList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first)));
     148                    for (const auto & elem : it_group->second)
     149                        if (elem.second->isActive() && elem.second->hasAccess() && (!elem.second->isHidden())^bOnlyShowHidden)
     150                            commandList.push_back(ArgumentCompletionListElement(elem.first, getLowercase(elem.first)));
    151151                }
    152152
     
    281281
    282282            const std::set<std::string>& names = SettingsConfigFile::getInstance().getSectionNames();
    283             for (std::set<std::string>::const_iterator it = names.begin(); it != names.end(); ++it)
    284                 sectionList.push_back(ArgumentCompletionListElement(*it, getLowercase(*it)));
     283            for (const auto & name : names)
     284                sectionList.push_back(ArgumentCompletionListElement(name, getLowercase(name)));
    285285
    286286            return sectionList;
  • code/branches/cpp11_v2/src/libraries/core/command/CommandEvaluation.cc

    r10769 r10821  
    306306                // the user typed 1-2 arguments, check what he tried to type and print a suitable error
    307307                std::string groupLC = getLowercase(this->getToken(0));
    308                 for (std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = ConsoleCommandManager::getInstance().getCommandsLC().begin(); it_group != ConsoleCommandManager::getInstance().getCommandsLC().end(); ++it_group)
    309                     if (it_group->first == groupLC)
     308                for (const auto & elem : ConsoleCommandManager::getInstance().getCommandsLC())
     309                    if (elem.first == groupLC)
    310310                        return std::string("Error: There is no command in group \"") + this->getToken(0) + "\" starting with \"" + this->getToken(1) + "\".";
    311311
     
    328328
    329329        // iterate through all groups and their commands and calculate the distance to the current command. keep the best.
    330         for (std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = ConsoleCommandManager::getInstance().getCommandsLC().begin(); it_group != ConsoleCommandManager::getInstance().getCommandsLC().end(); ++it_group)
    331         {
    332             if (it_group->first != "")
    333             {
    334                 for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); ++it_name)
    335                 {
    336                     std::string command = it_group->first + " " + it_name->first;
     330        for (const auto & elem : ConsoleCommandManager::getInstance().getCommandsLC())
     331        {
     332            if (elem.first != "")
     333            {
     334                for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = elem.second.begin(); it_name != elem.second.end(); ++it_name)
     335                {
     336                    std::string command = elem.first + " " + it_name->first;
    337337                    unsigned int distance = getLevenshteinDistance(command, token0_LC + " " + token1_LC);
    338338                    if (distance < nearestDistance)
     
    349349        if (it_group !=  ConsoleCommandManager::getInstance().getCommandsLC().end())
    350350        {
    351             for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); ++it_name)
    352             {
    353                 std::string command = it_name->first;
     351            for (const auto & elem : it_group->second)
     352            {
     353                std::string command = elem.first;
    354354                unsigned int distance = getLevenshteinDistance(command, token0_LC);
    355355                if (distance < nearestDistance)
     
    429429    {
    430430        size_t count = 0;
    431         for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    432             if (it->getComparable() != "")
     431        for (const auto & elem : list)
     432            if (elem.getComparable() != "")
    433433                ++count;
    434434        return count;
     
    495495        {
    496496            // only one (non-empty) value in the list - search it and return it
    497             for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    498             {
    499                 if (it->getComparable() != "")
     497            for (const auto & elem : list)
     498            {
     499                if (elem.getComparable() != "")
    500500                {
    501501                    // arguments that have a separate string to be displayed need a little more care - just return them without modification. add a space character to the others.
    502                     if (it->hasDisplay())
    503                         return (it->getString());
     502                    if (elem.hasDisplay())
     503                        return (elem.getString());
    504504                    else
    505                         return (it->getString() + ' ');
     505                        return (elem.getString() + ' ');
    506506                }
    507507            }
     
    517517                char tempComparable = '\0';
    518518                char temp = '\0';
    519                 for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    520                 {
    521                     const std::string& argumentComparable = it->getComparable();
    522                     const std::string& argument = it->getString();
     519                for (const auto & elem : list)
     520                {
     521                    const std::string& argumentComparable = elem.getComparable();
     522                    const std::string& argument = elem.getString();
    523523
    524524                    // ignore empty arguments
     
    560560    {
    561561        std::string output;
    562         for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    563         {
    564             output += it->getDisplay();
     562        for (const auto & elem : list)
     563        {
     564            output += elem.getDisplay();
    565565
    566566            // add a space character between two elements for all non-empty arguments
    567             if (it->getComparable() != "")
     567            if (elem.getComparable() != "")
    568568                output += ' ';
    569569        }
  • code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.cc

    r10768 r10821  
    7575        this->baseFunctor_ = executor->getFunctor();
    7676
    77         for (size_t i = 0; i < MAX_FUNCTOR_ARGUMENTS; ++i)
    78             this->argumentCompleter_[i] = nullptr;
     77        for (auto & elem : this->argumentCompleter_)
     78            elem = nullptr;
    7979
    8080        this->keybindMode_ = KeybindMode::OnPress;
  • code/branches/cpp11_v2/src/libraries/core/command/Shell.cc

    r10624 r10821  
    258258        vectorize(text, '\n', &lines);
    259259
    260         for (size_t i = 0; i < lines.size(); ++i)
    261             this->addLine(lines[i], type);
     260        for (auto & line : lines)
     261            this->addLine(line, type);
    262262    }
    263263
  • code/branches/cpp11_v2/src/libraries/core/command/TclThreadList.h

    r7401 r10821  
    262262        boost::shared_lock<boost::shared_mutex> lock(this->mutex_);
    263263
    264         for (typename std::list<T>::const_iterator it = this->list_.begin(); it != this->list_.end(); ++it)
    265             if (*it == value)
     264        for (const auto & elem : this->list_)
     265            if (elem == value)
    266266                return true;
    267267
  • code/branches/cpp11_v2/src/libraries/core/command/TclThreadManager.cc

    r10775 r10821  
    551551
    552552        std::list<unsigned int> threads;
    553         for (std::map<unsigned int, TclInterpreterBundle*>::const_iterator it = this->interpreterBundles_.begin(); it != this->interpreterBundles_.end(); ++it)
    554             if (it->first > 0 && it->first <= this->numInterpreterBundles_) // only list autonumbered interpreters (created with create()) - exclude the default interpreter 0 and all manually numbered interpreters)
    555                 threads.push_back(it->first);
     553        for (const auto & elem : this->interpreterBundles_)
     554            if (elem.first > 0 && elem.first <= this->numInterpreterBundles_) // only list autonumbered interpreters (created with create()) - exclude the default interpreter 0 and all manually numbered interpreters)
     555                threads.push_back(elem.first);
    556556        return threads;
    557557    }
  • code/branches/cpp11_v2/src/libraries/core/commandline/CommandLineParser.cc

    r10768 r10821  
    124124            std::string shortcut;
    125125            std::string value;
    126             for (unsigned int i = 0; i < arguments.size(); ++i)
    127             {
    128                 if (arguments[i].size() != 0)
     126            for (auto & argument : arguments)
     127            {
     128                if (argument.size() != 0)
    129129                {
    130130                    // sure not ""
    131                     if (arguments[i][0] == '-')
     131                    if (argument[0] == '-')
    132132                    {
    133133                        // start with "-"
    134                         if (arguments[i].size() == 1)
     134                        if (argument.size() == 1)
    135135                        {
    136136                            // argument[i] is "-", probably a minus sign
    137137                            value += "- ";
    138138                        }
    139                         else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
     139                        else if (argument[1] <= 57 && argument[1] >= 48)
    140140                        {
    141141                            // negative number as a value
    142                             value += arguments[i] + ' ';
     142                            value += argument + ' ';
    143143                        }
    144144                        else
     
    161161                            }
    162162
    163                             if (arguments[i][1] == '-')
     163                            if (argument[1] == '-')
    164164                            {
    165165                                // full name argument with "--name"
    166                                 name = arguments[i].substr(2);
     166                                name = argument.substr(2);
    167167                            }
    168168                            else
    169169                            {
    170170                                // shortcut with "-s"
    171                                 shortcut = arguments[i].substr(1);
     171                                shortcut = argument.substr(1);
    172172                            }
    173173
     
    186186
    187187                        // Concatenate strings as long as there's no new argument by "-" or "--"
    188                         value += arguments[i] + ' ';
     188                        value += argument + ' ';
    189189                    }
    190190                }
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigFile.cc

    r10817 r10821  
    234234        }
    235235
    236         for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    237         {
    238             file << (*it)->getFileEntry() << endl;
    239 
    240             for (std::list<ConfigFileEntry*>::const_iterator it_entries = (*it)->getEntriesBegin(); it_entries != (*it)->getEntriesEnd(); ++it_entries)
     236        for (const auto & elem : this->sections_)
     237        {
     238            file << (elem)->getFileEntry() << endl;
     239
     240            for (std::list<ConfigFileEntry*>::const_iterator it_entries = (elem)->getEntriesBegin(); it_entries != (elem)->getEntriesEnd(); ++it_entries)
    241241                file << (*it_entries)->getFileEntry() << endl;
    242242
     
    280280    ConfigFileSection* ConfigFile::getSection(const std::string& section) const
    281281    {
    282         for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    283             if ((*it)->getName() == section)
    284                 return (*it);
     282        for (const auto & elem : this->sections_)
     283            if ((elem)->getName() == section)
     284                return (elem);
    285285        return nullptr;
    286286    }
     
    291291    ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& section)
    292292    {
    293         for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    294             if ((*it)->getName() == section)
    295                 return (*it);
     293        for (auto & elem : this->sections_)
     294            if ((elem)->getName() == section)
     295                return (elem);
    296296
    297297        this->bUpdated_ = true;
     
    307307        bool sectionsUpdated = false;
    308308
    309         for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    310         {
    311             if ((*it)->bUpdated_)
     309        for (auto & elem : this->sections_)
     310        {
     311            if ((elem)->bUpdated_)
    312312            {
    313313                sectionsUpdated = true;
    314                 (*it)->bUpdated_ = false;
     314                (elem)->bUpdated_ = false;
    315315            }
    316316        }
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigFileManager.cc

    r10776 r10821  
    5353    ConfigFileManager::~ConfigFileManager()
    5454    {
    55         for (std::array<ConfigFile*, 3>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
    56             if (*it)
    57                 delete (*it);
     55        for (const auto & elem : this->configFiles_)
     56            if (elem)
     57                delete (elem);
    5858    }
    5959
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigFileSection.cc

    r10765 r10821  
    8080    {
    8181        unsigned int size = 0;
    82         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
    83             if ((*it)->getName() == name)
    84                 if ((*it)->getIndex() >= size)
    85                     size = (*it)->getIndex() + 1;
     82        for (const auto & elem : this->entries_)
     83            if ((elem)->getName() == name)
     84                if ((elem)->getIndex() >= size)
     85                    size = (elem)->getIndex() + 1;
    8686        return size;
    8787    }
     
    105105    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name) const
    106106    {
    107         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
     107        for (const auto & elem : this->entries_)
    108108        {
    109             if ((*it)->getName() == name)
    110                 return *it;
     109            if ((elem)->getName() == name)
     110                return elem;
    111111        }
    112112        return nullptr;
     
    121121    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name, unsigned int index) const
    122122    {
    123         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
     123        for (const auto & elem : this->entries_)
    124124        {
    125             if (((*it)->getName() == name) && ((*it)->getIndex() == index))
    126                 return *it;
     125            if (((elem)->getName() == name) && ((elem)->getIndex() == index))
     126                return elem;
    127127        }
    128128        return nullptr;
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.h

    r10817 r10821  
    130130
    131131                this->value_ = V();
    132                 for (unsigned int i = 0; i < defvalue.size(); i++)
    133                     this->valueVector_.push_back(MultiType(defvalue[i]));
     132                for (auto & elem : defvalue)
     133                    this->valueVector_.push_back(MultiType(elem));
    134134
    135135                this->initVector();
     
    183183                    std::vector<T> temp = *value;
    184184                    value->clear();
    185                     for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
    186                         value->push_back(this->valueVector_[i]);
     185                    for (auto & elem : this->valueVector_)
     186                        value->push_back(elem);
    187187
    188188                    if (value->size() != temp.size())
     
    211211                {
    212212                    value->clear();
    213                     for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
    214                         value->push_back(this->valueVector_[i]);
     213                    for (auto & elem : this->valueVector_)
     214                        value->push_back(elem);
    215215                }
    216216                return *this;
  • code/branches/cpp11_v2/src/libraries/core/input/Button.cc

    r10768 r10821  
    196196
    197197                    // add command to the buffer if not yet existing
    198                     for (unsigned int iParamCmd = 0; iParamCmd < paramCommandBuffer_->size(); iParamCmd++)
    199                     {
    200                         if ((*paramCommandBuffer_)[iParamCmd]->evaluation_.getConsoleCommand()
     198                    for (auto & elem : *paramCommandBuffer_)
     199                    {
     200                        if (elem->evaluation_.getConsoleCommand()
    201201                            == eval.getConsoleCommand())
    202202                        {
    203203                            // already in list
    204                             cmd->paramCommand_ = (*paramCommandBuffer_)[iParamCmd];
     204                            cmd->paramCommand_ = elem;
    205205                            break;
    206206                        }
  • code/branches/cpp11_v2/src/libraries/core/input/InputBuffer.cc

    r9667 r10821  
    110110    void InputBuffer::insert(const std::string& input, bool update)
    111111    {
    112         for (unsigned int i = 0; i < input.size(); ++i)
    113         {
    114             this->insert(input[i], false);
     112        for (auto & elem : input)
     113        {
     114            this->insert(elem, false);
    115115
    116116            if (update)
    117                 this->updated(input[i], false);
     117                this->updated(elem, false);
    118118        }
    119119
     
    170170    void InputBuffer::updated()
    171171    {
    172         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    173         {
    174             if ((*it)->bListenToAllChanges_)
    175                 (*it)->callFunction();
     172        for (auto & elem : this->listeners_)
     173        {
     174            if ((elem)->bListenToAllChanges_)
     175                (elem)->callFunction();
    176176        }
    177177    }
     
    179179    void InputBuffer::updated(const char& update, bool bSingleInput)
    180180    {
    181         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    182         {
    183             if ((!(*it)->trueKeyFalseChar_) && ((*it)->bListenToAllChanges_ || ((*it)->char_ == update)) && (!(*it)->bOnlySingleInput_ || bSingleInput))
    184                 (*it)->callFunction();
     181        for (auto & elem : this->listeners_)
     182        {
     183            if ((!(elem)->trueKeyFalseChar_) && ((elem)->bListenToAllChanges_ || ((elem)->char_ == update)) && (!(elem)->bOnlySingleInput_ || bSingleInput))
     184                (elem)->callFunction();
    185185        }
    186186    }
     
    201201            return;
    202202
    203         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    204         {
    205             if ((*it)->trueKeyFalseChar_ && ((*it)->key_ == evt.getKeyCode()))
    206                 (*it)->callFunction();
     203        for (auto & elem : this->listeners_)
     204        {
     205            if ((elem)->trueKeyFalseChar_ && ((elem)->key_ == evt.getKeyCode()))
     206                (elem)->callFunction();
    207207        }
    208208
  • code/branches/cpp11_v2/src/libraries/core/input/InputDevice.h

    r10817 r10821  
    158158
    159159            // Call all the states with the held button event
    160             for (unsigned int iB = 0; iB < pressedButtons_.size(); ++iB)
    161                 for (unsigned int iS = 0; iS < inputStates_.size(); ++iS)
    162                     inputStates_[iS]->template buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>(
    163                         this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(pressedButtons_[iB]));
     160            for (auto & button : pressedButtons_)
     161                for (auto & state : inputStates_)
     162                    state->template buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>(
     163                        this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    164164
    165165            // Call states with device update events
    166             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    167                 inputStates_[i]->update(time.getDeltaTime(), this->getDeviceID());
     166            for (auto & elem : inputStates_)
     167                elem->update(time.getDeltaTime(), this->getDeviceID());
    168168
    169169            static_cast<DeviceClass*>(this)->updateImpl(time);
     
    196196
    197197            // Call states
    198             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    199                 inputStates_[i]->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
     198            for (auto & elem : inputStates_)
     199                elem->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    200200        }
    201201
     
    218218
    219219            // Call states
    220             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    221                 inputStates_[i]->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
     220            for (auto & elem : inputStates_)
     221                elem->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    222222        }
    223223
  • code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc

    r10778 r10821  
    373373        // check whether a state has changed its EMPTY situation
    374374        bool bUpdateRequired = false;
    375         for (std::map<int, InputState*>::iterator it = activeStates_.begin(); it != activeStates_.end(); ++it)
    376         {
    377             if (it->second->hasExpired())
    378             {
    379                 it->second->resetExpiration();
     375        for (auto & elem : activeStates_)
     376        {
     377            if (elem.second->hasExpired())
     378            {
     379                elem.second->resetExpiration();
    380380                bUpdateRequired = true;
    381381            }
     
    391391
    392392        // Collect function calls for the update
    393         for (unsigned int i = 0; i < activeStatesTicked_.size(); ++i)
    394             activeStatesTicked_[i]->update(time.getDeltaTime());
     393        for (auto & elem : activeStatesTicked_)
     394            elem->update(time.getDeltaTime());
    395395
    396396        // Execute all cached function calls in order
     
    401401        // If we delay the calls, then OIS and and the InputStates are not anymore
    402402        // in the call stack and can therefore be edited.
    403         for (size_t i = 0; i < this->callBuffer_.size(); ++i)
    404             this->callBuffer_[i]();
     403        for (auto & elem : this->callBuffer_)
     404            elem();
    405405
    406406        this->callBuffer_.clear();
     
    437437        // Using an std::set to avoid duplicates
    438438        std::set<InputState*> tempSet;
    439         for (unsigned int i = 0; i < devices_.size(); ++i)
    440             if (devices_[i] != nullptr)
    441                 for (unsigned int iState = 0; iState < devices_[i]->getStateListRef().size(); ++iState)
    442                     tempSet.insert(devices_[i]->getStateListRef()[iState]);
     439        for (auto & elem : devices_)
     440            if (elem != nullptr)
     441                for (unsigned int iState = 0; iState < elem->getStateListRef().size(); ++iState)
     442                    tempSet.insert(elem->getStateListRef()[iState]);
    443443
    444444        // Copy the content of the std::set back to the actual vector
    445445        activeStatesTicked_.clear();
    446         for (std::set<InputState*>::const_iterator it = tempSet.begin();it != tempSet.end(); ++it)
    447             activeStatesTicked_.push_back(*it);
     446        for (const auto & elem : tempSet)
     447            activeStatesTicked_.push_back(elem);
    448448
    449449        // Check whether we have to change the mouse mode
  • code/branches/cpp11_v2/src/libraries/core/input/JoyStick.cc

    r10778 r10821  
    186186    void JoyStick::clearBuffersImpl()
    187187    {
    188         for (int j = 0; j < 4; ++j)
    189             povStates_[j] = 0;
     188        for (auto & elem : povStates_)
     189            elem = 0;
    190190    }
    191191
  • code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc

    r10772 r10821  
    153153    void KeyBinder::buttonThresholdChanged()
    154154    {
    155         for (unsigned int i = 0; i < allHalfAxes_.size(); i++)
    156             if (!allHalfAxes_[i]->bButtonThresholdUser_)
    157                 allHalfAxes_[i]->buttonThreshold_ = this->buttonThreshold_;
     155        for (auto & elem : allHalfAxes_)
     156            if (!elem->bButtonThresholdUser_)
     157                elem->buttonThreshold_ = this->buttonThreshold_;
    158158    }
    159159
     
    383383            it->second->clear();
    384384
    385         for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
    386             delete paramCommandBuffer_[i];
     385        for (auto & elem : paramCommandBuffer_)
     386            delete elem;
    387387        paramCommandBuffer_.clear();
    388388    }
     
    394394    {
    395395        // iterate over all buttons
    396         for (std::map<std::string, Button*>::iterator it = this->allButtons_.begin(); it != this->allButtons_.end(); ++it)
    397         {
    398             Button* button = it->second;
     396        for (const auto & elem : this->allButtons_)
     397        {
     398            Button* button = elem.second;
    399399
    400400            // iterate over all modes
     
    465465        this->mousePosition_[1] = 0.0f;
    466466
    467         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
    468             mouseAxes_[i].reset();
     467        for (auto & elem : mouseAxes_)
     468            elem.reset();
    469469    }
    470470
     
    505505        }
    506506
    507         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
     507        for (auto & elem : mouseAxes_)
    508508        {
    509509            // Why dividing relative value by dt? The reason lies in the simple fact, that when you
     
    515515            {
    516516                // just ignore if dt == 0.0 because we have multiplied by 0.0 anyway..
    517                 mouseAxes_[i].relVal_ /= dt;
    518             }
    519 
    520             tickHalfAxis(mouseAxes_[i]);
     517                elem.relVal_ /= dt;
     518            }
     519
     520            tickHalfAxis(elem);
    521521        }
    522522    }
  • code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.h

    r10817 r10821  
    226226    {
    227227        // execute all buffered bindings (additional parameter)
    228         for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
     228        for (auto & elem : paramCommandBuffer_)
    229229        {
    230             paramCommandBuffer_[i]->rel_ *= dt;
    231             paramCommandBuffer_[i]->execute();
     230            elem->rel_ *= dt;
     231            elem->execute();
    232232        }
    233233
    234234        // always reset the relative movement of the mouse
    235         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
    236             mouseAxes_[i].relVal_ = 0.0f;
     235        for (auto & elem : mouseAxes_)
     236            elem.relVal_ = 0.0f;
    237237    }
    238238}// tolua_export
  • code/branches/cpp11_v2/src/libraries/core/input/Mouse.cc

    r10768 r10821  
    8282            IntVector2 rel(e.state.X.rel, e.state.Y.rel);
    8383            IntVector2 clippingSize(e.state.width, e.state.height);
    84             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    85                 inputStates_[i]->mouseMoved(abs, rel, clippingSize);
     84            for (auto & elem : inputStates_)
     85                elem->mouseMoved(abs, rel, clippingSize);
    8686        }
    8787
     
    8989        if (e.state.Z.rel != 0)
    9090        {
    91             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    92                 inputStates_[i]->mouseScrolled(e.state.Z.abs, e.state.Z.rel);
     91            for (auto & elem : inputStates_)
     92                elem->mouseScrolled(e.state.Z.abs, e.state.Z.rel);
    9393        }
    9494
  • code/branches/cpp11_v2/src/libraries/core/module/DynLibManager.cc

    r10768 r10821  
    7575    {
    7676        // Unload & delete resources in turn
    77         for (DynLibList::iterator it = mLibList.begin(); it != mLibList.end(); ++it)
     77        for (auto & elem : mLibList)
    7878        {
    79             it->second->unload();
    80             delete it->second;
     79            elem.second->unload();
     80            delete elem.second;
    8181        }
    8282
  • code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc

    r10769 r10821  
    5959    {
    6060        const std::set<StaticallyInitializedInstance*>& instances = this->staticallyInitializedInstancesByType_[type];
    61         for (std::set<StaticallyInitializedInstance*>::iterator it = instances.begin(); it != instances.end(); ++it)
    62             (*it)->load();
     61        for (const auto & instance : instances)
     62            (instance)->load();
    6363    }
    6464
     
    7575        std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>> copy(this->staticallyInitializedInstancesByType_);
    7676        this->staticallyInitializedInstancesByType_.clear();
    77         for (std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>>::iterator it1 = copy.begin(); it1 != copy.end(); ++it1)
    78             for (std::set<StaticallyInitializedInstance*>::iterator it2 = it1->second.begin(); it2 != it1->second.end(); ++it2)
     77        for (auto & elem : copy)
     78            for (std::set<StaticallyInitializedInstance*>::iterator it2 = elem.second.begin(); it2 != elem.second.end(); ++it2)
    7979                delete (*it2);
    8080    }
  • code/branches/cpp11_v2/src/libraries/core/module/PluginManager.cc

    r10768 r10821  
    5959        ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject(nullptr);
    6060
    61         for (std::map<std::string, PluginReference*>::iterator it = this->references_.begin(); it != this->references_.end(); ++it)
    62             delete it->second;
    63         for (std::map<std::string, Plugin*>::iterator it = this->plugins_.begin(); it != this->plugins_.end(); ++it)
    64             delete it->second;
     61        for (auto & elem : this->references_)
     62            delete elem.second;
     63        for (auto & elem : this->plugins_)
     64            delete elem.second;
    6565    }
    6666
     
    6868    {
    6969        const std::vector<std::string>& pluginPaths = ApplicationPaths::getInstance().getPluginPaths();
    70         for (std::vector<std::string>::const_iterator it = pluginPaths.begin(); it != pluginPaths.end(); ++it)
     70        for (auto libraryName : pluginPaths)
    7171        {
    7272            std::string name;
    73             std::string libraryName = (*it);
     73           
    7474            std::string filename = libraryName +  + specialConfig::pluginExtension;
    7575            std::ifstream infile(filename.c_str());
  • code/branches/cpp11_v2/src/libraries/core/module/StaticInitializationManager.cc

    r10768 r10821  
    5050    {
    5151        // attention: loading a module may add new handlers to the list
    52         for (std::list<StaticInitializationHandler*>::iterator it = this->handlers_.begin(); it != this->handlers_.end(); ++it)
    53             (*it)->loadModule(module);
     52        for (auto & elem : this->handlers_)
     53            (elem)->loadModule(module);
    5454    }
    5555
  • code/branches/cpp11_v2/src/libraries/core/object/Context.cc

    r10768 r10821  
    7070        // unregister context from object lists before object lists are destroyed
    7171        this->unregisterObject();
    72         for (size_t i = 0; i < this->objectLists_.size(); ++i)
    73             delete this->objectLists_[i];
     72        for (auto & elem : this->objectLists_)
     73            delete elem;
    7474    }
    7575
  • code/branches/cpp11_v2/src/libraries/core/object/Listable.cc

    r10624 r10821  
    7676    void Listable::unregisterObject()
    7777    {
    78         for (size_t i = 0; i < this->elements_.size(); ++i)
    79             Listable::deleteObjectListElement(this->elements_[i]);
     78        for (auto & elem : this->elements_)
     79            Listable::deleteObjectListElement(elem);
    8080        this->elements_.clear();
    8181    }
     
    9191        this->elements_.clear();
    9292
    93         for (size_t i = 0; i < copy.size(); ++i)
     93        for (auto & elem : copy)
    9494        {
    95             copy[i]->changeContext(this->context_, context);
    96             Listable::deleteObjectListElement(copy[i]);
     95            elem->changeContext(this->context_, context);
     96            Listable::deleteObjectListElement(elem);
    9797        }
    9898
  • code/branches/cpp11_v2/src/libraries/core/object/ObjectListBase.cc

    r10768 r10821  
    9292    void ObjectListBase::notifyRemovalListeners(ObjectListBaseElement* element) const
    9393    {
    94         for (std::vector<ObjectListElementRemovalListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    95             (*it)->removedElement(element);
     94        for (const auto & elem : this->listeners_)
     95            (elem)->removedElement(element);
    9696    }
    9797
  • code/branches/cpp11_v2/src/libraries/core/singleton/ScopeManager.cc

    r10768 r10821  
    7373    void ScopeManager::activateListenersForScope(ScopeID::Value scope)
    7474    {
    75         for (std::set<ScopeListener*>::iterator it = this->listeners_[scope].begin(); it != this->listeners_[scope].end(); ++it)
    76             this->activateListener(*it);
     75        for (const auto & elem : this->listeners_[scope])
     76            this->activateListener(elem);
    7777    }
    7878
    7979    void ScopeManager::deactivateListenersForScope(ScopeID::Value scope)
    8080    {
    81         for (std::set<ScopeListener*>::iterator it = this->listeners_[scope].begin(); it != this->listeners_[scope].end(); ++it)
    82             this->deactivateListener(*it);
     81        for (const auto & elem : this->listeners_[scope])
     82            this->deactivateListener(elem);
    8383    }
    8484
  • code/branches/cpp11_v2/src/libraries/network/FunctionCall.cc

    r10765 r10821  
    131131  *(uint32_t*)(mem+2*sizeof(uint32_t)) = this->objectID_;
    132132  mem += 3*sizeof(uint32_t);
    133   for( std::vector<MultiType>::iterator it = this->arguments_.begin(); it!=this->arguments_.end(); ++it )
     133  for(auto & elem : this->arguments_)
    134134  {
    135     it->exportData( mem );
     135    elem.exportData( mem );
    136136  }
    137137}
  • code/branches/cpp11_v2/src/libraries/network/Host.cc

    r10768 r10821  
    8080  void Host::addPacket(ENetPacket *packet, int clientID, uint8_t channelID)
    8181  {
    82     for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
     82    for(auto & instances_ : instances_s)
    8383    {
    84       if( (*it)->isActive() )
     84      if( (instances_)->isActive() )
    8585      {
    86         (*it)->queuePacket(packet, clientID, channelID);
     86        (instances_)->queuePacket(packet, clientID, channelID);
    8787      }
    8888    }
     
    9797  void Host::sendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
    9898  {
    99     for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
    100       if( (*it)->isActive() )
    101         (*it)->doSendChat(message, sourceID, targetID);
     99    for(auto & instances_ : instances_s)
     100      if( (instances_)->isActive() )
     101        (instances_)->doSendChat(message, sourceID, targetID);
    102102  }
    103103
     
    114114  bool Host::isServer()
    115115  {
    116     for (std::vector<Host*>::iterator it=instances_s.begin(); it!=instances_s.end(); ++it )
     116    for (auto & instances_ : instances_s)
    117117    {
    118       if( (*it)->isActive() )
     118      if( (instances_)->isActive() )
    119119      {
    120         if( (*it)->isServer_() )
     120        if( (instances_)->isServer_() )
    121121          return true;
    122122      }
  • code/branches/cpp11_v2/src/libraries/network/synchronisable/Synchronisable.cc

    r10768 r10821  
    8888    }
    8989    // delete all Synchronisable Variables from syncList_ ( which are also in stringList_ )
    90     for(std::vector<SynchronisableVariableBase*>::iterator it = syncList_.begin(); it!=syncList_.end(); it++)
    91       delete (*it);
     90    for(auto & elem : syncList_)
     91      delete (elem);
    9292    syncList_.clear();
    9393    stringList_.clear();
  • code/branches/cpp11_v2/src/libraries/tools/DebugDrawer.cc

    r10768 r10821  
    392392            manualObject->estimateVertexCount(lineVertices.size());
    393393            manualObject->estimateIndexCount(lineIndices.size());
    394             for (std::list<VertexPair>::iterator i = lineVertices.begin(); i != lineVertices.end(); i++)
     394            for (auto & elem : lineVertices)
    395395            {
    396                 manualObject->position(i->first);
    397                 manualObject->colour(i->second);
     396                manualObject->position(elem.first);
     397                manualObject->colour(elem.second);
    398398            }
    399             for (std::list<int>::iterator i = lineIndices.begin(); i != lineIndices.end(); i++)
    400                 manualObject->index(*i);
     399            for (auto & elem : lineIndices)
     400                manualObject->index(elem);
    401401        }
    402402        else
     
    409409            manualObject->estimateVertexCount(triangleVertices.size());
    410410            manualObject->estimateIndexCount(triangleIndices.size());
    411             for (std::list<VertexPair>::iterator i = triangleVertices.begin(); i != triangleVertices.end(); i++)
     411            for (auto & elem : triangleVertices)
    412412            {
    413                 manualObject->position(i->first);
    414                 manualObject->colour(i->second.r, i->second.g, i->second.b, fillAlpha);
     413                manualObject->position(elem.first);
     414                manualObject->colour(elem.second.r, elem.second.g, elem.second.b, fillAlpha);
    415415            }
    416             for (std::list<int>::iterator i = triangleIndices.begin(); i != triangleIndices.end(); i++)
    417                 manualObject->index(*i);
     416            for (auto & elem : triangleIndices)
     417                manualObject->index(elem);
    418418        }
    419419        else
  • code/branches/cpp11_v2/src/libraries/tools/IcoSphere.cc

    r10262 r10821  
    116116            std::list<TriangleIndices> faces2;
    117117
    118             for (std::list<TriangleIndices>::iterator j = faces.begin(); j != faces.end(); j++)
     118            for (auto f : faces)
    119119            {
    120                 TriangleIndices f = *j;
     120               
    121121                int a = getMiddlePoint(f.v1, f.v2);
    122122                int b = getMiddlePoint(f.v2, f.v3);
     
    194194    void IcoSphere::addToLineIndices(int baseIndex, std::list<int>* target) const
    195195    {
    196         for (std::list<LineIndices>::const_iterator i = lineIndices.begin(); i != lineIndices.end(); i++)
     196        for (const auto & elem : lineIndices)
    197197        {
    198             target->push_back(baseIndex + (*i).v1);
    199             target->push_back(baseIndex + (*i).v2);
     198            target->push_back(baseIndex + (elem).v1);
     199            target->push_back(baseIndex + (elem).v2);
    200200        }
    201201    }
     
    203203    void IcoSphere::addToTriangleIndices(int baseIndex, std::list<int>* target) const
    204204    {
    205         for (std::list<TriangleIndices>::const_iterator i = faces.begin(); i != faces.end(); i++)
     205        for (const auto & elem : faces)
    206206        {
    207             target->push_back(baseIndex + (*i).v1);
    208             target->push_back(baseIndex + (*i).v2);
    209             target->push_back(baseIndex + (*i).v3);
     207            target->push_back(baseIndex + (elem).v1);
     208            target->push_back(baseIndex + (elem).v2);
     209            target->push_back(baseIndex + (elem).v3);
    210210        }
    211211    }
     
    217217        transform.setScale(Ogre::Vector3(scale, scale, scale));
    218218
    219         for (int i = 0; i < (int) vertices.size(); i++)
    220             target->push_back(VertexPair(transform * vertices[i], colour));
     219        for (auto & elem : vertices)
     220            target->push_back(VertexPair(transform * elem, colour));
    221221
    222222        return vertices.size();
  • code/branches/cpp11_v2/src/libraries/tools/Shader.cc

    r10768 r10821  
    197197    {
    198198        // iterate through the list of parameters
    199         for (std::list<ParameterContainer>::iterator it = this->parameters_.begin(); it != this->parameters_.end(); ++it)
    200         {
    201             Ogre::Technique* techniquePtr = materialPtr->getTechnique(it->technique_);
     199        for (auto & elem : this->parameters_)
     200        {
     201            Ogre::Technique* techniquePtr = materialPtr->getTechnique(elem.technique_);
    202202            if (techniquePtr)
    203203            {
    204                 Ogre::Pass* passPtr = techniquePtr->getPass(it->pass_);
     204                Ogre::Pass* passPtr = techniquePtr->getPass(elem.pass_);
    205205                if (passPtr)
    206206                {
    207207                    // change the value of the parameter depending on its type
    208                     if (it->value_.isType<int>())
    209                         passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.get<int>());
    210                     else if (it->value_.isType<float>())
    211                         passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.get<float>());
     208                    if (elem.value_.isType<int>())
     209                        passPtr->getFragmentProgramParameters()->setNamedConstant(elem.parameter_, elem.value_.get<int>());
     210                    else if (elem.value_.isType<float>())
     211                        passPtr->getFragmentProgramParameters()->setNamedConstant(elem.parameter_, elem.value_.get<float>());
    212212                }
    213213                else
    214                     orxout(internal_warning) << "No pass " << it->pass_ << " in technique " << it->technique_ << " in compositor \"" << this->compositorName_ << "\" or pass has no shader." << endl;
     214                    orxout(internal_warning) << "No pass " << elem.pass_ << " in technique " << elem.technique_ << " in compositor \"" << this->compositorName_ << "\" or pass has no shader." << endl;
    215215            }
    216216            else
    217                 orxout(internal_warning) << "No technique " << it->technique_ << " in compositor \"" << this->compositorName_ << "\" or technique has no pass with shader." << endl;
     217                orxout(internal_warning) << "No technique " << elem.technique_ << " in compositor \"" << this->compositorName_ << "\" or technique has no pass with shader." << endl;
    218218        }
    219219        this->parameters_.clear();
     
    228228        {
    229229            const Ogre::Root::PluginInstanceList& plugins = Ogre::Root::getSingleton().getInstalledPlugins();
    230             for (size_t i = 0; i < plugins.size(); ++i)
    231                 if (plugins[i]->getName() == "Cg Program Manager")
     230            for (auto & plugin : plugins)
     231                if (plugin->getName() == "Cg Program Manager")
    232232                    return true;
    233233        }
  • code/branches/cpp11_v2/src/libraries/util/DisplayStringConversions.h

    r6417 r10821  
    5151            {
    5252                Ogre::UTFString::code_point cp;
    53                 for (unsigned int i = 0; i < input.size(); ++i)
     53                for (auto & elem : input)
    5454                {
    55                   cp = input[i];
     55                  cp = elem;
    5656                  cp &= 0xFF;
    5757                  output->append(1, cp);
  • code/branches/cpp11_v2/src/libraries/util/Serialise.h

    r8706 r10821  
    672672    {
    673673        uint32_t tempsize = sizeof(uint32_t); // for the number of entries
    674         for( typename std::set<T>::iterator it=((std::set<T>*)(&variable))->begin(); it!=((std::set<T>*)(&variable))->end(); ++it)
    675             tempsize += returnSize( *it );
     674        for(const auto & elem : *((std::set<T>*)(&variable)))
     675            tempsize += returnSize( elem );
    676676        return tempsize;
    677677    }
  • code/branches/cpp11_v2/src/libraries/util/SignalHandler.cc

    r10768 r10821  
    8181    void SignalHandler::dontCatch()
    8282    {
    83       for ( SignalRecList::iterator it = sigRecList.begin(); it != sigRecList.end(); it++ )
    84       {
    85         signal( it->signal, it->handler );
     83      for (auto & elem : sigRecList)
     84      {
     85        signal( elem.signal, elem.handler );
    8686      }
    8787
     
    133133      }
    134134
    135       for ( SignalCallbackList::iterator it = SignalHandler::getInstance().callbackList.begin(); it != SignalHandler::getInstance().callbackList.end(); it++  )
    136       {
    137         (*(it->cb))( it->someData );
     135      for (auto & elem : SignalHandler::getInstance().callbackList)
     136      {
     137        (*(elem.cb))( elem.someData );
    138138      }
    139139
  • code/branches/cpp11_v2/src/libraries/util/SmallObjectAllocator.cc

    r10768 r10821  
    5353    SmallObjectAllocator::~SmallObjectAllocator()
    5454    {
    55         for (std::vector<char*>::iterator it = this->blocks_.begin(); it != this->blocks_.end(); ++it)
    56             delete[] *it;
     55        for (auto & elem : this->blocks_)
     56            delete[] elem;
    5757    }
    5858
  • code/branches/cpp11_v2/src/libraries/util/StringUtils.cc

    r10777 r10821  
    262262        std::string output(str.size() * 2, ' ');
    263263        size_t i = 0;
    264         for (size_t pos = 0; pos < str.size(); ++pos)
    265         {
    266             switch (str[pos])
     264        for (auto & elem : str)
     265        {
     266            switch (elem)
    267267            {
    268268            case '\\': output[i] = '\\'; output[i + 1] = '\\'; break;
     
    276276            case  '"': output[i] = '\\'; output[i + 1] =  '"'; break;
    277277            case '\0': output[i] = '\\'; output[i + 1] =  '0'; break;
    278             default  : output[i] = str[pos]; ++i; continue;
     278            default  : output[i] = elem; ++i; continue;
    279279            }
    280280            i += 2;
     
    336336    void lowercase(std::string* str)
    337337    {
    338         for (size_t i = 0; i < str->size(); ++i)
    339         {
    340             (*str)[i] = static_cast<char>(tolower((*str)[i]));
     338        for (auto & elem : *str)
     339        {
     340            elem = static_cast<char>(tolower(elem));
    341341        }
    342342    }
     
    353353    void uppercase(std::string* str)
    354354    {
    355         for (size_t i = 0; i < str->size(); ++i)
    356         {
    357             (*str)[i] = static_cast<char>(toupper((*str)[i]));
     355        for (auto & elem : *str)
     356        {
     357            elem = static_cast<char>(toupper(elem));
    358358        }
    359359    }
     
    460460    {
    461461        size_t j = 0;
    462         for (size_t i = 0; i < str.size(); ++i)
    463         {
    464             if (str[i] == target)
     462        for (auto & elem : str)
     463        {
     464            if (elem == target)
    465465            {
    466                 str[i] = replacement;
     466                elem = replacement;
    467467                ++j;
    468468            }
  • code/branches/cpp11_v2/src/libraries/util/output/BaseWriter.cc

    r8858 r10821  
    116116
    117117        // iterate over all strings in the config-vector
    118         for (size_t i = 0; i < this->configurableAdditionalContexts_.size(); ++i)
     118        for (auto & full_name : this->configurableAdditionalContexts_)
    119119        {
    120             const std::string& full_name = this->configurableAdditionalContexts_[i];
     120           
    121121
    122122            // split the name into main-name and sub-name (if given; otherwise sub-name remains empty). both names are separated by ::
  • code/branches/cpp11_v2/src/libraries/util/output/MemoryWriter.cc

    r9550 r10821  
    6565    void MemoryWriter::resendOutput(OutputListener* listener) const
    6666    {
    67         for (size_t i = 0; i < this->messages_.size(); ++i)
     67        for (auto & message : this->messages_)
    6868        {
    69             const Message& message = this->messages_[i];
     69           
    7070            listener->unfilteredOutput(message.level, *message.context, message.lines);
    7171        }
  • code/branches/cpp11_v2/src/libraries/util/output/OutputListener.cc

    r9550 r10821  
    111111        this->levelMask_ = mask;
    112112
    113         for (size_t i = 0; i < this->listeners_.size(); ++i)
    114             this->listeners_[i]->updatedLevelMask(this);
     113        for (auto & elem : this->listeners_)
     114            elem->updatedLevelMask(this);
    115115    }
    116116
     
    142142        this->additionalContextsLevelMask_ = mask;
    143143
    144         for (size_t i = 0; i < this->listeners_.size(); ++i)
    145             this->listeners_[i]->updatedAdditionalContextsLevelMask(this);
     144        for (auto & elem : this->listeners_)
     145            elem->updatedAdditionalContextsLevelMask(this);
    146146    }
    147147
     
    153153        this->additionalContextsMask_ = mask;
    154154
    155         for (size_t i = 0; i < this->listeners_.size(); ++i)
    156             this->listeners_[i]->updatedAdditionalContextsMask(this);
     155        for (auto & elem : this->listeners_)
     156            elem->updatedAdditionalContextsMask(this);
    157157    }
    158158
  • code/branches/cpp11_v2/src/libraries/util/output/OutputManager.cc

    r10768 r10821  
    132132        vectorize(message, '\n', &lines);
    133133
    134         for (size_t i = 0; i < this->listeners_.size(); ++i)
    135             this->listeners_[i]->unfilteredOutput(level, context, lines);
     134        for (auto & elem : this->listeners_)
     135            elem->unfilteredOutput(level, context, lines);
    136136    }
    137137
     
    179179    {
    180180        int mask = 0;
    181         for (size_t i = 0; i < this->listeners_.size(); ++i)
    182             mask |= this->listeners_[i]->getLevelMask();
     181        for (auto & elem : this->listeners_)
     182            mask |= elem->getLevelMask();
    183183        this->combinedLevelMask_ = static_cast<OutputLevel>(mask);
    184184    }
     
    190190    {
    191191        int mask = 0;
    192         for (size_t i = 0; i < this->listeners_.size(); ++i)
    193             mask |= this->listeners_[i]->getAdditionalContextsLevelMask();
     192        for (auto & elem : this->listeners_)
     193            mask |= elem->getAdditionalContextsLevelMask();
    194194        this->combinedAdditionalContextsLevelMask_ = static_cast<OutputLevel>(mask);
    195195    }
     
    201201    {
    202202        this->combinedAdditionalContextsMask_ = 0;
    203         for (size_t i = 0; i < this->listeners_.size(); ++i)
    204             this->combinedAdditionalContextsMask_ |= this->listeners_[i]->getAdditionalContextsMask();
     203        for (auto & elem : this->listeners_)
     204            this->combinedAdditionalContextsMask_ |= elem->getAdditionalContextsMask();
    205205    }
    206206
  • code/branches/cpp11_v2/src/libraries/util/output/SubcontextOutputListener.cc

    r8858 r10821  
    7979
    8080        // compose the mask of subcontexts and build the set of sub-context-IDs
    81         for (std::set<const OutputContextContainer*>::const_iterator it = subcontexts.begin(); it != subcontexts.end(); ++it)
     81        for (const auto & subcontext : subcontexts)
    8282        {
    83             this->subcontextsCheckMask_ |= (*it)->mask;
    84             this->subcontexts_.insert((*it)->sub_id);
     83            this->subcontextsCheckMask_ |= (subcontext)->mask;
     84            this->subcontexts_.insert((subcontext)->sub_id);
    8585        }
    8686
  • code/branches/cpp11_v2/src/modules/docking/Dock.cc

    r10765 r10821  
    327327    const DockingEffect* Dock::getEffect(unsigned int i) const
    328328    {
    329         for (std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)
     329        for (const auto & elem : this->effects_)
    330330        {
    331331            if(i == 0)
    332                return *effect;
     332               return elem;
    333333            i--;
    334334        }
     
    346346    const DockingAnimation* Dock::getAnimation(unsigned int i) const
    347347    {
    348         for (std::list<DockingAnimation*>::const_iterator animation = this->animations_.begin(); animation != this->animations_.end(); ++animation)
     348        for (const auto & elem : this->animations_)
    349349        {
    350350            if(i == 0)
    351                return *animation;
     351               return elem;
    352352            i--;
    353353        }
  • code/branches/cpp11_v2/src/modules/docking/DockingAnimation.cc

    r10765 r10821  
    5757        bool check = true;
    5858
    59         for (std::list<DockingAnimation*>::iterator animation = animations.begin(); animation != animations.end(); animation++)
     59        for (auto & animations_animation : animations)
    6060        {
    6161            if(dock)
    62                 check &= (*animation)->docking(player);
     62                check &= (animations_animation)->docking(player);
    6363            else
    64                 check &= (*animation)->release(player);
     64                check &= (animations_animation)->release(player);
    6565        }
    6666
  • code/branches/cpp11_v2/src/modules/docking/DockingEffect.cc

    r10765 r10821  
    5353        bool check = true;
    5454
    55         for (std::list<DockingEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
     55        for (auto & effects_effect : effects)
    5656        {
    5757            if (dock)
    58                 check &= (*effect)->docking(player);
     58                check &= (effects_effect)->docking(player);
    5959            else
    60                 check &= (*effect)->release(player);
     60                check &= (effects_effect)->release(player);
    6161        }
    6262
  • code/branches/cpp11_v2/src/modules/gametypes/RaceCheckPoint.cc

    r10765 r10821  
    146146    {
    147147        Vector3 checkpoints(-1,-1,-1); int count=0;
    148         for (std::set<int>::iterator it= nextCheckpoints_.begin();it!=nextCheckpoints_.end(); it++ )
     148        for (const auto & elem : nextCheckpoints_)
    149149        {
    150150            switch (count)
    151151            {
    152                 case 0: checkpoints.x = static_cast<Ogre::Real>(*it); break;
    153                 case 1: checkpoints.y = static_cast<Ogre::Real>(*it); break;
    154                 case 2: checkpoints.z = static_cast<Ogre::Real>(*it); break;
     152                case 0: checkpoints.x = static_cast<Ogre::Real>(elem); break;
     153                case 1: checkpoints.y = static_cast<Ogre::Real>(elem); break;
     154                case 2: checkpoints.z = static_cast<Ogre::Real>(elem); break;
    155155            }
    156156            ++count;
  • code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc

    r10768 r10821  
    154154    {
    155155        std::map<RaceCheckPoint*, int> zaehler; // counts how many times the checkpoint was reached (for simulation)
    156         for (unsigned int i = 0; i < allCheckpoints.size(); i++)
    157         {
    158             zaehler.insert(std::pair<RaceCheckPoint*, int>(allCheckpoints[i],0));
     156        for (auto & allCheckpoint : allCheckpoints)
     157        {
     158            zaehler.insert(std::pair<RaceCheckPoint*, int>(allCheckpoint,0));
    159159        }
    160160        int maxWays = rekSimulationCheckpointsReached(currentCheckpoint, zaehler);
    161161
    162162        std::vector<RaceCheckPoint*> returnVec;
    163         for (std::map<RaceCheckPoint*, int>::iterator iter = zaehler.begin(); iter != zaehler.end(); iter++)
    164         {
    165             if (iter->second == maxWays)
    166             {
    167                 returnVec.push_back(iter->first);
     163        for (auto & elem : zaehler)
     164        {
     165            if (elem.second == maxWays)
     166            {
     167                returnVec.push_back(elem.first);
    168168            }
    169169        }
     
    226226
    227227        // find the next checkpoint with the minimal distance
    228         for (std::set<int>::iterator it = raceCheckpoint->getNextCheckpoints().begin(); it != raceCheckpoint->getNextCheckpoints().end(); ++it)
    229         {
    230             RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(*it);
     228        for (auto elem : raceCheckpoint->getNextCheckpoints())
     229        {
     230            RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(elem);
    231231            float distance = recCalculateDistance(nextRaceCheckPoint, this->getControllableEntity()->getPosition());
    232232
     
    289289    RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const
    290290    {
    291         for (size_t i = 0; i < this->checkpoints_.size(); ++i)
    292             if (this->checkpoints_[i]->getCheckpointIndex() == index)
    293                 return this->checkpoints_[i];
     291        for (auto & elem : this->checkpoints_)
     292            if (elem->getCheckpointIndex() == index)
     293                return elem;
    294294        return nullptr;
    295295    }
     
    414414        btScalar radiusObject;
    415415
    416         for (std::vector<StaticEntity*>::const_iterator it = allObjects.begin(); it != allObjects.end(); ++it)
    417         {
    418             for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape) != nullptr; everyShape++)
    419             {
    420                 btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape();
     416        for (const auto & allObject : allObjects)
     417        {
     418            for (int everyShape=0; (allObject)->getAttachedCollisionShape(everyShape) != nullptr; everyShape++)
     419            {
     420                btCollisionShape* currentShape = (allObject)->getAttachedCollisionShape(everyShape)->getCollisionShape();
    421421                if(currentShape == nullptr)
    422422                continue;
  • code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceManager.cc

    r10768 r10821  
    5454    SpaceRaceManager::~SpaceRaceManager()
    5555    {
    56         for (size_t i = 0; i < this->checkpoints_.size(); ++i)
    57         this->checkpoints_[i]->destroy();
     56        for (auto & elem : this->checkpoints_)
     57        elem->destroy();
    5858    }
    5959
     
    7777        }
    7878
    79         for ( std::map< PlayerInfo*, Player>::iterator it = players_.begin(); it != players_.end(); ++it)
     79        for (auto & elem : players_)
    8080        {
    8181
    82             for (size_t i = 0; i < this->checkpoints_.size(); ++i)
     82            for (auto & _i : this->checkpoints_)
    8383            {
    84                 if (this->checkpoints_[i]->playerWasHere(it->first)){
    85                 this->checkpointReached(this->checkpoints_[i], it->first /*this->checkpoints_[i]->getPlayer()*/);
     84                if (_i->playerWasHere(elem.first)){
     85                this->checkpointReached(_i, elem.first /*this->checkpoints_[i]->getPlayer()*/);
    8686                }
    8787            }
     
    113113    RaceCheckPoint* SpaceRaceManager::findCheckpoint(int index) const
    114114    {
    115         for (size_t i = 0; i < this->checkpoints_.size(); ++i)
    116         if (this->checkpoints_[i]->getCheckpointIndex() == index)
    117         return this->checkpoints_[i];
     115        for (auto & elem : this->checkpoints_)
     116        if (elem->getCheckpointIndex() == index)
     117        return elem;
    118118        return nullptr;
    119119    }
     
    125125            // the player already visited an old checkpoint; see which checkpoints are possible now
    126126            const std::set<int>& possibleCheckpoints = oldCheckpoint->getNextCheckpoints();
    127             for (std::set<int>::const_iterator it = possibleCheckpoints.begin(); it != possibleCheckpoints.end(); ++it)
    128             if (this->findCheckpoint(*it) == newCheckpoint)
     127            for (const auto & possibleCheckpoint : possibleCheckpoints)
     128            if (this->findCheckpoint(possibleCheckpoint) == newCheckpoint)
    129129            return true;
    130130            return false;
     
    179179        {
    180180            const std::set<int>& oldVisible = oldCheckpoint->getNextCheckpoints();
    181             for (std::set<int>::const_iterator it = oldVisible.begin(); it != oldVisible.end(); ++it)
    182             this->findCheckpoint(*it)->setRadarVisibility(false);
     181            for (const auto & elem : oldVisible)
     182            this->findCheckpoint(elem)->setRadarVisibility(false);
    183183        }
    184184
     
    188188
    189189            const std::set<int>& newVisible = newCheckpoint->getNextCheckpoints();
    190             for (std::set<int>::const_iterator it = newVisible.begin(); it != newVisible.end(); ++it)
    191             this->findCheckpoint(*it)->setRadarVisibility(true);
     190            for (const auto & elem : newVisible)
     191            this->findCheckpoint(elem)->setRadarVisibility(true);
    192192        }
    193193    }
  • code/branches/cpp11_v2/src/modules/jump/Jump.cc

    r10817 r10821  
    633633
    634634
    635         for (int i = 0; i < numI; ++i)
     635        for (auto & elem : matrix)
    636636        {
    637637            for (int j = 0; j < numJ; ++j)
    638638            {
    639                 matrix[i][j].type = PLATFORM_EMPTY;
    640                 matrix[i][j].done = false;
     639                elem[j].type = PLATFORM_EMPTY;
     640                elem[j].done = false;
    641641            }
    642642        }
     
    795795
    796796        // Fill matrix with selected platform types
    797         for (int i = 0; i < numI; ++ i)
     797        for (auto & elem : matrix)
    798798        {
    799799            for (int j = 0; j < numJ; ++ j)
     
    801801                if (rand()%3 == 0)
    802802                {
    803                     matrix[i][j].type = platformtype1;
     803                    elem[j].type = platformtype1;
    804804                }
    805805                else
    806806                {
    807                     matrix[i][j].type = platformtype2;
     807                    elem[j].type = platformtype2;
    808808                }
    809                 matrix[i][j].done = false;
     809                elem[j].done = false;
    810810            }
    811811        }
  • code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.cc

    r10768 r10821  
    155155    {
    156156        // first spawn human players to assign always the left bat to the player in singleplayer
    157         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    158             if (it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
    159                 this->spawnPlayer(it->first);
     157        for (auto & elem : this->players_)
     158            if (elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))
     159                this->spawnPlayer(elem.first);
    160160        // now spawn bots
    161         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    162             if (!it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
    163                 this->spawnPlayer(it->first);
     161        for (auto & elem : this->players_)
     162            if (!elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))
     163                this->spawnPlayer(elem.first);
    164164    }
    165165
  • code/branches/cpp11_v2/src/modules/notifications/NotificationManager.cc

    r10765 r10821  
    6969    {
    7070        // Destroys all Notifications.
    71         for(std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it!= this->allNotificationsList_.end(); it++)
    72             it->second->destroy();
     71        for(auto & elem : this->allNotificationsList_)
     72            elem.second->destroy();
    7373        this->allNotificationsList_.clear();
    7474
     
    152152        bool executed = false;
    153153        // Clear all NotificationQueues that have the input sender as target.
    154         for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.
    155         {
    156             const std::set<std::string>& set = it->second->getTargetsSet();
     154        for(auto & elem : this->queues_) // Iterate through all NotificationQueues.
     155        {
     156            const std::set<std::string>& set = elem.second->getTargetsSet();
    157157            // If either the sender is 'all', the NotificationQueue has as target all or the NotificationQueue has the input sender as a target.
    158158            if(all || set.find(NotificationListener::ALL) != set.end() || set.find(sender) != set.end())
    159                 executed = it->second->tidy() || executed;
     159                executed = elem.second->tidy() || executed;
    160160        }
    161161
     
    187187
    188188        // Insert the Notification in all NotificationQueues that have its sender as target.
    189         for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.
    190         {
    191             const std::set<std::string>& set = it->second->getTargetsSet();
     189        for(auto & elem : this->queues_) // Iterate through all NotificationQueues.
     190        {
     191            const std::set<std::string>& set = elem.second->getTargetsSet();
    192192            bool bAll = set.find(NotificationListener::ALL) != set.end();
    193193            // If either the Notification has as sender 'all', the NotificationQueue displays all Notifications or the NotificationQueue has the sender of the Notification as target.
     
    195195            {
    196196                if(!bAll)
    197                     this->notificationLists_[it->second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue.
    198                 it->second->update(notification, time); // Update the NotificationQueue.
     197                    this->notificationLists_[elem.second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue.
     198                elem.second->update(notification, time); // Update the NotificationQueue.
    199199            }
    200200        }
     
    345345
    346346        // Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationQueue.
    347         for(std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)
    348         {
    349             if(!bAll && set.find(it->second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target.
    350                 map->insert(std::pair<std::time_t, Notification*>(it->first, it->second));
     347        for(auto & elem : this->allNotificationsList_)
     348        {
     349            if(!bAll && set.find(elem.second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target.
     350                map->insert(std::pair<std::time_t, Notification*>(elem.first, elem.second));
    351351        }
    352352
  • code/branches/cpp11_v2/src/modules/notifications/NotificationQueue.cc

    r9667 r10821  
    206206        {
    207207            // Add all Notifications that have been created after this NotificationQueue was created.
    208             for(std::multimap<std::time_t, Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++)
     208            for(auto & notification : *notifications)
    209209            {
    210                 if(it->first >= this->creationTime_)
    211                     this->push(it->second, it->first);
     210                if(notification.first >= this->creationTime_)
     211                    this->push(notification.second, notification.first);
    212212            }
    213213        }
     
    336336        this->ordering_.clear();
    337337        // Delete all NotificationContainers in the list.
    338         for(std::vector<NotificationContainer*>::iterator it = this->notifications_.begin(); it != this->notifications_.end(); it++)
    339             delete *it;
     338        for(auto & elem : this->notifications_)
     339            delete elem;
    340340
    341341        this->notifications_.clear();
     
    426426        bool first = true;
    427427        // Iterate through the set of targets.
    428         for(std::set<std::string>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
     428        for(const auto & elem : this->targets_)
    429429        {
    430430            if(!first)
     
    432432            else
    433433                first = false;
    434             stream << *it;
     434            stream << elem;
    435435        }
    436436
  • code/branches/cpp11_v2/src/modules/objects/Attacher.cc

    r10768 r10821  
    6161        SUPER(Attacher, changedActivity);
    6262
    63         for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
    64             (*it)->setActive(this->isActive());
     63        for (auto & elem : this->objects_)
     64            (elem)->setActive(this->isActive());
    6565    }
    6666
     
    6969        SUPER(Attacher, changedVisibility);
    7070
    71         for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
    72             (*it)->setVisible(this->isVisible());
     71        for (auto & elem : this->objects_)
     72            (elem)->setVisible(this->isVisible());
    7373    }
    7474
     
    8383    {
    8484        unsigned int i = 0;
    85         for (std::list<WorldEntity*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
     85        for (const auto & elem : this->objects_)
    8686        {
    8787            if (i == index)
    88                 return (*it);
     88                return (elem);
    8989
    9090            ++i;
  • code/branches/cpp11_v2/src/modules/objects/Script.cc

    r10765 r10821  
    196196            {
    197197                const std::map<unsigned int, PlayerInfo*> clients = PlayerManager::getInstance().getClients();
    198                 for(std::map<unsigned int, PlayerInfo*>::const_iterator it = clients.begin(); it != clients.end(); it++)
     198                for(const auto & client : clients)
    199199                {
    200                     callStaticNetworkFunction(&Script::executeHelper, it->first, this->getCode(), this->getMode(), this->getNeedsGraphics());
     200                    callStaticNetworkFunction(&Script::executeHelper, client.first, this->getCode(), this->getMode(), this->getNeedsGraphics());
    201201                    if(this->times_ != Script::INF) // Decrement the number of remaining executions.
    202202                    {
  • code/branches/cpp11_v2/src/modules/objects/SpaceBoundaries.cc

    r10769 r10821  
    5959            this->pawnsIn_.clear();
    6060
    61             for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++)
     61            for(auto & elem : this->billboards_)
    6262            {
    63                 if( current->billy != nullptr)
    64                 {
    65                     delete current->billy;
     63                if( elem.billy != nullptr)
     64                {
     65                    delete elem.billy;
    6666                }
    6767            }
     
    138138    void SpaceBoundaries::removeAllBillboards()
    139139    {
    140         for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++ )
    141         {
    142             current->usedYet = false;
    143             current->billy->setVisible(false);
     140        for(auto & elem : this->billboards_)
     141        {
     142            elem.usedYet = false;
     143            elem.billy->setVisible(false);
    144144        }
    145145    }
     
    208208        float distance;
    209209        bool humanItem;
    210         for( std::list<WeakPtr<Pawn>>::iterator current = pawnsIn_.begin(); current != pawnsIn_.end(); current++ )
    211         {
    212             Pawn* currentPawn = *current;
     210        for(auto currentPawn : pawnsIn_)
     211        {
     212           
    213213            if( currentPawn && currentPawn->getNode() )
    214214            {
  • code/branches/cpp11_v2/src/modules/objects/eventsystem/EventDispatcher.cc

    r10768 r10821  
    4545    {
    4646        if (this->isInitialized())
    47             for (std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
    48                 (*it)->destroy();
     47            for (auto & elem : this->targets_)
     48                (elem)->destroy();
    4949    }
    5050
     
    6161    void EventDispatcher::processEvent(Event& event)
    6262    {
    63         for (std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
    64             (*it)->processEvent(event);
     63        for (auto & elem : this->targets_)
     64            (elem)->processEvent(event);
    6565    }
    6666
     
    7373    {
    7474        unsigned int i = 0;
    75         for (std::list<BaseObject*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
     75        for (const auto & elem : this->targets_)
    7676        {
    7777            if (i == index)
    78                 return (*it);
     78                return (elem);
    7979            ++i;
    8080        }
  • code/branches/cpp11_v2/src/modules/objects/eventsystem/EventFilter.cc

    r10768 r10821  
    9696    {
    9797        unsigned int i = 0;
    98         for (std::list<BaseObject*>::const_iterator it = this->sources_.begin(); it != this->sources_.end(); ++it)
     98        for (const auto & elem : this->sources_)
    9999        {
    100100            if (i == index)
    101                 return (*it);
     101                return (elem);
    102102            ++i;
    103103        }
     
    113113    {
    114114        unsigned int i = 0;
    115         for (std::list<EventName*>::const_iterator it = this->names_.begin(); it != this->names_.end(); ++it)
     115        for (const auto & elem : this->names_)
    116116        {
    117117            if (i == index)
    118                 return (*it);
     118                return (elem);
    119119            ++i;
    120120        }
  • code/branches/cpp11_v2/src/modules/objects/triggers/DistanceMultiTrigger.cc

    r10769 r10821  
    160160                const std::set<WorldEntity*> attached = entity->getAttachedObjects();
    161161                bool found = false;
    162                 for(std::set<WorldEntity*>::const_iterator it = attached.begin(); it != attached.end(); it++)
     162                for(const auto & elem : attached)
    163163                {
    164                     if((*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(*it)->getName() == this->targetName_)
     164                    if((elem)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(elem)->getName() == this->targetName_)
    165165                    {
    166166                        found = true;
  • code/branches/cpp11_v2/src/modules/objects/triggers/DistanceTrigger.cc

    r10765 r10821  
    182182                const std::set<WorldEntity*> attached = entity->getAttachedObjects();
    183183                bool found = false;
    184                 for(std::set<WorldEntity*>::const_iterator it = attached.begin(); it != attached.end(); it++)
     184                for(const auto & elem : attached)
    185185                {
    186                     if((*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(*it)->getName() == this->targetName_)
     186                    if((elem)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(elem)->getName() == this->targetName_)
    187187                    {
    188188                        found = true;
  • code/branches/cpp11_v2/src/modules/objects/triggers/MultiTrigger.cc

    r10765 r10821  
    504504    bool MultiTrigger::checkAnd(BaseObject* triggerer)
    505505    {
    506         for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    507         {
    508             TriggerBase* trigger = *it;
     506        for(auto trigger : this->children_)
     507        {
     508           
    509509            if(trigger->isMultiTrigger())
    510510            {
     
    531531    bool MultiTrigger::checkOr(BaseObject* triggerer)
    532532    {
    533         for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    534         {
    535             TriggerBase* trigger = *it;
     533        for(auto trigger : this->children_)
     534        {
     535           
    536536            if(trigger->isMultiTrigger())
    537537            {
     
    559559    {
    560560        bool triggered = false;
    561         for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    562         {
    563             TriggerBase* trigger = *it;
     561        for(auto trigger : this->children_)
     562        {
     563           
    564564            if(triggered)
    565565            {
  • code/branches/cpp11_v2/src/modules/objects/triggers/Trigger.cc

    r10624 r10821  
    234234    {
    235235        // Iterate over all sub-triggers.
    236         for (std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    237         {
    238             if (!(*it)->isActive())
     236        for (const auto & elem : this->children_)
     237        {
     238            if (!(elem)->isActive())
    239239                return false;
    240240        }
     
    252252    {
    253253        // Iterate over all sub-triggers.
    254         for (std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    255         {
    256             if ((*it)->isActive())
     254        for (const auto & elem : this->children_)
     255        {
     256            if ((elem)->isActive())
    257257                return true;
    258258        }
     
    270270    {
    271271        bool test = false;
    272         for (std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    273         {
    274             if (test && (*it)->isActive())
     272        for (const auto & elem : this->children_)
     273        {
     274            if (test && (elem)->isActive())
    275275                return false;
    276             if ((*it)->isActive())
     276            if ((elem)->isActive())
    277277                test = true;
    278278        }
  • code/branches/cpp11_v2/src/modules/overlays/hud/ChatOverlay.cc

    r9667 r10821  
    5858    ChatOverlay::~ChatOverlay()
    5959    {
    60         for (std::set<Timer*>::iterator it = this->timers_.begin(); it != this->timers_.end(); ++it)
    61             delete (*it);
     60        for (const auto & elem : this->timers_)
     61            delete (elem);
    6262    }
    6363
     
    9292        this->text_->setCaption("");
    9393
    94         for (std::list<Ogre::DisplayString>::iterator it = this->messages_.begin(); it != this->messages_.end(); ++it)
     94        for (auto & elem : this->messages_)
    9595        {
    96             this->text_->setCaption(this->text_->getCaption() + "\n" + (*it));
     96            this->text_->setCaption(this->text_->getCaption() + "\n" + (elem));
    9797        }
    9898    }
  • code/branches/cpp11_v2/src/modules/overlays/hud/HUDNavigation.cc

    r10774 r10821  
    131131        }
    132132        this->fontName_ = font;
    133         for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it)
    134         {
    135             if (it->second.text_ != nullptr)
    136                 it->second.text_->setFontName(this->fontName_);
     133        for (auto & elem : this->activeObjectList_)
     134        {
     135            if (elem.second.text_ != nullptr)
     136                elem.second.text_->setFontName(this->fontName_);
    137137        }
    138138    }
     
    151151        }
    152152        this->textSize_ = size;
    153         for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it!=this->activeObjectList_.end(); ++it)
    154         {
    155             if (it->second.text_)
    156                 it->second.text_->setCharHeight(size);
     153        for (auto & elem : this->activeObjectList_)
     154        {
     155            if (elem.second.text_)
     156                elem.second.text_->setCharHeight(size);
    157157        }
    158158    }
     
    186186        const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix();
    187187
    188         for (std::list<std::pair<RadarViewable*, unsigned int>>::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt)
    189         listIt->second = (int)((listIt->first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f);
     188        for (auto & elem : this->sortedObjectList_)
     189        elem.second = (int)((elem.first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f);
    190190
    191191        this->sortedObjectList_.sort(compareDistance);
     
    531531        float yScale = this->getActualSize().y;
    532532
    533         for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it)
    534         {
    535             if (it->second.health_ != nullptr)
    536                 it->second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale);
    537             if (it->second.healthLevel_ != nullptr)
    538                 it->second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale);
    539             if (it->second.panel_ != nullptr)
    540                 it->second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale);
    541             if (it->second.text_ != nullptr)
    542                 it->second.text_->setCharHeight(this->textSize_ * yScale);
    543             if (it->second.target_ != nullptr)
    544                 it->second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale);
     533        for (auto & elem : this->activeObjectList_)
     534        {
     535            if (elem.second.health_ != nullptr)
     536                elem.second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale);
     537            if (elem.second.healthLevel_ != nullptr)
     538                elem.second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale);
     539            if (elem.second.panel_ != nullptr)
     540                elem.second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale);
     541            if (elem.second.text_ != nullptr)
     542                elem.second.text_->setCharHeight(this->textSize_ * yScale);
     543            if (elem.second.target_ != nullptr)
     544                elem.second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale);
    545545        }
    546546    }
     
    670670    {
    671671        const std::set<RadarViewable*>& respawnObjects = this->getOwner()->getScene()->getRadar()->getRadarObjects();
    672         for (std::set<RadarViewable*>::const_iterator it = respawnObjects.begin(); it != respawnObjects.end(); ++it)
    673         {
    674             if (!(*it)->isHumanShip_)
    675             this->addObject(*it);
     672        for (const auto & respawnObject : respawnObjects)
     673        {
     674            if (!(respawnObject)->isHumanShip_)
     675            this->addObject(respawnObject);
    676676        }
    677677    }
  • code/branches/cpp11_v2/src/modules/overlays/hud/HUDRadar.cc

    r10768 r10821  
    9292            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DBack_);
    9393
    94             for (std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it = this->radarObjects_.begin();
    95                 it != this->radarObjects_.end(); ++it)
    96             {
    97                 Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second);
     94            for (auto & elem : this->radarObjects_)
     95            {
     96                Ogre::OverlayManager::getSingleton().destroyOverlayElement(elem.second);
    9897            }
    9998        }
  • code/branches/cpp11_v2/src/modules/overlays/stats/Scoreboard.cc

    r9667 r10821  
    6060        SUPER(Scoreboard, changedVisibility);
    6161
    62         for (unsigned int i = 0; i < this->lines_.size(); ++i)
    63             this->lines_[i]->changedVisibility();
     62        for (auto & elem : this->lines_)
     63            elem->changedVisibility();
    6464    }
    6565
     
    9494
    9595        unsigned int index = 0;
    96         for (std::map<PlayerInfo*, Player>::const_iterator it = playerList.begin(); it != playerList.end(); ++it)
     96        for (const auto & elem : playerList)
    9797        {
    98             this->lines_[index]->setPlayerName(multi_cast<std::string>(it->first->getName()));
    99             this->lines_[index]->setScore(multi_cast<std::string>(it->second.frags_));
    100             this->lines_[index]->setDeaths(multi_cast<std::string>(it->second.killed_));
     98            this->lines_[index]->setPlayerName(multi_cast<std::string>(elem.first->getName()));
     99            this->lines_[index]->setScore(multi_cast<std::string>(elem.second.frags_));
     100            this->lines_[index]->setDeaths(multi_cast<std::string>(elem.second.killed_));
    101101            index++;
    102102        }
  • code/branches/cpp11_v2/src/modules/pickup/PickupCollection.cc

    r10765 r10821  
    6868    {
    6969        // Destroy all Pickupables constructing this PickupCollection.
    70         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    71         {
    72             (*it)->wasRemovedFromCollection();
    73             (*it)->destroy();
     70        for(auto & elem : this->pickups_)
     71        {
     72            (elem)->wasRemovedFromCollection();
     73            (elem)->destroy();
    7474        }
    7575        this->pickups_.clear();
     
    9999        this->processingUsed_ = true;
    100100        // Change used for all Pickupables this PickupCollection consists of.
    101         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    102             (*it)->setUsed(this->isUsed());
     101        for(auto & elem : this->pickups_)
     102            (elem)->setUsed(this->isUsed());
    103103
    104104        this->processingUsed_ = false;
     
    119119        size_t numPickupsEnabled = 0;
    120120        size_t numPickupsInUse = 0;
    121         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    122         {
    123             if ((*it)->isEnabled())
     121        for(auto & elem : this->pickups_)
     122        {
     123            if ((elem)->isEnabled())
    124124                ++numPickupsEnabled;
    125             if ((*it)->isUsed())
     125            if ((elem)->isUsed())
    126126                ++numPickupsInUse;
    127127        }
     
    146146
    147147        // Change the PickupCarrier for all Pickupables this PickupCollection consists of.
    148         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
     148        for(auto & elem : this->pickups_)
    149149        {
    150150            if(this->getCarrier() == nullptr)
    151                 (*it)->setCarrier(nullptr);
     151                (elem)->setCarrier(nullptr);
    152152            else
    153                 (*it)->setCarrier(this->getCarrier()->getTarget(*it));
     153                (elem)->setCarrier(this->getCarrier()->getTarget(elem));
    154154        }
    155155    }
     
    186186        // If at least all the enabled pickups of this PickupCollection are no longer picked up.
    187187        bool isOnePickupEnabledAndPickedUp = false;
    188         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    189         {
    190             if ((*it)->isEnabled() && (*it)->isPickedUp())
     188        for(auto & elem : this->pickups_)
     189        {
     190            if ((elem)->isEnabled() && (elem)->isPickedUp())
    191191            {
    192192                isOnePickupEnabledAndPickedUp = true;
     
    208208    bool PickupCollection::isTarget(const PickupCarrier* carrier) const
    209209    {
    210         for(std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    211         {
    212             if(!carrier->isTarget(*it))
     210        for(const auto & elem : this->pickups_)
     211        {
     212            if(!carrier->isTarget(elem))
    213213                return false;
    214214        }
  • code/branches/cpp11_v2/src/modules/pickup/PickupManager.cc

    r10765 r10821  
    9191
    9292        // Destroying all the PickupInventoryContainers that are still there.
    93         for(std::map<uint32_t, PickupInventoryContainer*>::iterator it = this->pickupInventoryContainers_.begin(); it != this->pickupInventoryContainers_.end(); it++)
    94             delete it->second;
     93        for(auto & elem : this->pickupInventoryContainers_)
     94            delete elem.second;
    9595        this->pickupInventoryContainers_.clear();
    9696
  • code/branches/cpp11_v2/src/modules/pickup/items/MetaPickup.cc

    r10765 r10821  
    118118                std::set<Pickupable*> pickups = carrier->getPickups();
    119119                // Iterate over all Pickupables of the PickupCarrier.
    120                 for(std::set<Pickupable*>::iterator it = pickups.begin(); it != pickups.end(); it++)
     120                for(auto pickup : pickups)
    121121                {
    122                     Pickupable* pickup = (*it);
     122                   
    123123                    if(pickup == nullptr || pickup == this)
    124124                        continue;
  • code/branches/cpp11_v2/src/modules/pong/Pong.cc

    r10768 r10821  
    145145
    146146            // If one of the bats is missing, create it. Apply the template for the bats as specified in the centerpoint.
    147             for (size_t i = 0; i < 2; ++i)
     147            for (auto & elem : this->bat_)
    148148            {
    149                 if (this->bat_[i] == nullptr)
     149                if (elem == nullptr)
    150150                {
    151                     this->bat_[i] = new PongBat(this->center_->getContext());
    152                     this->bat_[i]->addTemplate(this->center_->getBattemplate());
     151                    elem = new PongBat(this->center_->getContext());
     152                    elem->addTemplate(this->center_->getBattemplate());
    153153                }
    154154            }
     
    211211    {
    212212        // first spawn human players to assign always the left bat to the player in singleplayer
    213         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    214             if (it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
    215                 this->spawnPlayer(it->first);
     213        for (auto & elem : this->players_)
     214            if (elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))
     215                this->spawnPlayer(elem.first);
    216216        // now spawn bots
    217         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    218             if (!it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
    219                 this->spawnPlayer(it->first);
     217        for (auto & elem : this->players_)
     218            if (!elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))
     219                this->spawnPlayer(elem.first);
    220220    }
    221221
  • code/branches/cpp11_v2/src/modules/pong/PongAI.cc

    r10769 r10821  
    7777    PongAI::~PongAI()
    7878    {
    79         for (std::list<std::pair<Timer*, char>>::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it)
    80             it->first->destroy();
     79        for (auto & elem : this->reactionTimers_)
     80            elem.first->destroy();
    8181    }
    8282
  • code/branches/cpp11_v2/src/modules/questsystem/GlobalQuest.cc

    r10765 r10821  
    9494
    9595        // Iterate through all players possessing this Quest.
    96         for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
    97             QuestEffect::invokeEffects(*it, this->getFailEffectList());
     96        for(const auto & elem : players_)
     97            QuestEffect::invokeEffects(elem, this->getFailEffectList());
    9898
    9999        return true;
     
    119119
    120120        // Iterate through all players possessing the Quest.
    121         for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
    122             QuestEffect::invokeEffects(*it, this->getCompleteEffectList());
     121        for(const auto & elem : players_)
     122            QuestEffect::invokeEffects(elem, this->getCompleteEffectList());
    123123
    124124        Quest::complete(player);
     
    242242    {
    243243        int i = index;
    244         for (std::list<QuestEffect*>::const_iterator effect = this->rewards_.begin(); effect != this->rewards_.end(); ++effect)
     244        for (const auto & elem : this->rewards_)
    245245        {
    246246            if(i == 0)
    247                return *effect;
     247               return elem;
    248248
    249249            i--;
  • code/branches/cpp11_v2/src/modules/questsystem/Quest.cc

    r10765 r10821  
    190190
    191191        // Iterate through all subquests.
    192         for (std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest)
     192        for (const auto & elem : this->subQuests_)
    193193        {
    194194            if(i == 0) // We're counting down...
    195                return *subQuest;
     195               return elem;
    196196
    197197            i--;
     
    214214
    215215        // Iterate through all QuestHints.
    216         for (std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint)
     216        for (const auto & elem : this->hints_)
    217217        {
    218218            if(i == 0) // We're counting down...
    219                return *hint;
     219               return elem;
    220220
    221221            i--;
     
    237237
    238238        // Iterate through all fail QuestEffects.
    239         for (std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect)
     239        for (const auto & elem : this->failEffects_)
    240240        {
    241241            if(i == 0) // We're counting down...
    242                return *effect;
     242               return elem;
    243243
    244244            i--;
     
    260260
    261261        // Iterate through all complete QuestEffects.
    262         for (std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect)
     262        for (const auto & elem : this->completeEffects_)
    263263        {
    264264            if(i == 0) // We're counting down...
    265                return *effect;
     265               return elem;
    266266
    267267            i--;
  • code/branches/cpp11_v2/src/modules/questsystem/QuestEffect.cc

    r10624 r10821  
    7474        orxout(verbose, context::quests) << "Invoking QuestEffects on player: " << player << " ."  << endl;
    7575
    76         for (std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
    77             temp = temp && (*effect)->invoke(player);
     76        for (auto & effects_effect : effects)
     77            temp = temp && (effects_effect)->invoke(player);
    7878
    7979        return temp;
  • code/branches/cpp11_v2/src/modules/questsystem/QuestEffectBeacon.cc

    r10765 r10821  
    236236    {
    237237        int i = index;
    238         for (std::list<QuestEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)
     238        for (const auto & elem : this->effects_)
    239239        {
    240240            if(i == 0)
    241                return *effect;
     241               return elem;
    242242
    243243            i--;
  • code/branches/cpp11_v2/src/modules/questsystem/QuestListener.cc

    r10765 r10821  
    9797    /* static */ void QuestListener::advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status)
    9898    {
    99         for (std::list<QuestListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) // Iterate through all QuestListeners
    100         {
    101             QuestListener* listener = *it;
     99        for (auto listener : listeners) // Iterate through all QuestListeners
     100        {
     101           
    102102            if(listener->getMode() == status || listener->getMode() == QuestListener::ALL) // Check whether the status change affects the give QuestListener.
    103103                listener->execute();
  • code/branches/cpp11_v2/src/modules/questsystem/QuestManager.cc

    r10765 r10821  
    235235    {
    236236        int numQuests = 0;
    237         for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)
    238         {
    239             if(it->second->getParentQuest() == nullptr && !it->second->isInactive(player))
     237        for(auto & elem : this->questMap_)
     238        {
     239            if(elem.second->getParentQuest() == nullptr && !elem.second->isInactive(player))
    240240                numQuests++;
    241241        }
     
    255255    Quest* QuestManager::getRootQuest(PlayerInfo* player, int index)
    256256    {
    257         for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)
    258         {
    259             if(it->second->getParentQuest() == nullptr && !it->second->isInactive(player) && index-- == 0)
    260                 return it->second;
     257        for(auto & elem : this->questMap_)
     258        {
     259            if(elem.second->getParentQuest() == nullptr && !elem.second->isInactive(player) && index-- == 0)
     260                return elem.second;
    261261        }
    262262        return nullptr;
     
    280280        std::list<Quest*> quests = quest->getSubQuestList();
    281281        int numQuests = 0;
    282         for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
    283         {
    284             if(!(*it)->isInactive(player))
     282        for(auto & quest : quests)
     283        {
     284            if(!(quest)->isInactive(player))
    285285                numQuests++;
    286286        }
     
    304304
    305305        std::list<Quest*> quests = quest->getSubQuestList();
    306         for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
    307         {
    308             if(!(*it)->isInactive(player) && index-- == 0)
    309                 return *it;
     306        for(auto & quest : quests)
     307        {
     308            if(!(quest)->isInactive(player) && index-- == 0)
     309                return quest;
    310310        }
    311311        return nullptr;
     
    326326        std::list<QuestHint*> hints = quest->getHintsList();
    327327        int numHints = 0;
    328         for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)
    329         {
    330             if((*it)->isActive(player))
     328        for(auto & hint : hints)
     329        {
     330            if((hint)->isActive(player))
    331331                numHints++;
    332332        }
     
    349349    {
    350350        std::list<QuestHint*> hints = quest->getHintsList();
    351         for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)
    352         {
    353             if((*it)->isActive(player) && index-- == 0)
    354                 return *it;
     351        for(auto & hint : hints)
     352        {
     353            if((hint)->isActive(player) && index-- == 0)
     354                return hint;
    355355        }
    356356        return nullptr;
  • code/branches/cpp11_v2/src/modules/questsystem/effects/AddReward.cc

    r10765 r10821  
    8484    {
    8585        int i = index;
    86         for (std::list<Rewardable*>::const_iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)
     86        for (const auto & elem : this->rewards_)
    8787        {
    8888            if(i == 0)
    89                return *reward;
     89               return elem;
    9090            i--;
    9191        }
     
    106106
    107107        bool temp = true;
    108         for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward )
    109             temp = temp && (*reward)->reward(player);
     108        for (auto & elem : this->rewards_)
     109            temp = temp && (elem)->reward(player);
    110110
    111111        orxout(verbose, context::quests) << "Rewardable successfully added to player." << player << " ." << endl;
  • code/branches/cpp11_v2/src/modules/tetris/Tetris.cc

    r10769 r10821  
    104104        }
    105105
    106         for (std::list<StrongPtr<TetrisStone>>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
    107             (*it)->destroy();
     106        for (auto & elem : this->stones_)
     107            (elem)->destroy();
    108108        this->stones_.clear();
    109109    }
     
    341341    {
    342342        // Spawn a human player.
    343         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    344             if (it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
    345                 this->spawnPlayer(it->first);
     343        for (auto & elem : this->players_)
     344            if (elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))
     345                this->spawnPlayer(elem.first);
    346346    }
    347347   
     
    502502        }
    503503      // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug.
    504         for(std::list<StrongPtr<TetrisStone>>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
    505         {
    506             if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) > row)
    507                 (*it)->setPosition((*it)->getPosition()-Vector3(0,10,0));
     504        for(auto & elem : this->stones_)
     505        {
     506            if(static_cast<unsigned int>(((elem)->getPosition().y - 5)/this->center_->getStoneSize()) > row)
     507                (elem)->setPosition((elem)->getPosition()-Vector3(0,10,0));
    508508        }
    509509
  • code/branches/cpp11_v2/src/modules/tetris/TetrisBrick.cc

    r10765 r10821  
    239239    {
    240240        assert(this->tetris_);
    241         for(unsigned int i = 0; i < this->brickStones_.size(); i++)
    242         {
    243             this->brickStones_[i]->detachFromParent();
    244             this->brickStones_[i]->attachToParent(center);
    245             this->brickStones_[i]->setPosition(this->getPosition()+this->tetris_->rotateVector(this->brickStones_[i]->getPosition(),this->rotationCount_ ));
     241        for(auto & elem : this->brickStones_)
     242        {
     243            elem->detachFromParent();
     244            elem->attachToParent(center);
     245            elem->setPosition(this->getPosition()+this->tetris_->rotateVector(elem->getPosition(),this->rotationCount_ ));
    246246        }
    247247        this->brickStones_.clear();
  • code/branches/cpp11_v2/src/modules/towerdefense/TowerDefense.cc

    r10769 r10821  
    183183            en1->lookAt(waypoints_.at(1)->getPosition() + offset_);
    184184
    185             for (unsigned int i = 0; i < waypoints_.size(); ++ i)
     185            for (auto & elem : waypoints_)
    186186            {
    187187                orxonox::WeakPtr<MovableEntity> waypoint = new MovableEntity(this->center_->getContext());
    188                 waypoint->setPosition(waypoints_.at(i)->getPosition() + offset_);
     188                waypoint->setPosition(elem->getPosition() + offset_);
    189189                controller->addWaypoint(waypoint);
    190190            }
  • code/branches/cpp11_v2/src/orxonox/Level.cc

    r10818 r10821  
    106106    void Level::networkCallbackTemplatesChanged()
    107107    {
    108         for( std::set<std::string>::iterator it = this->networkTemplateNames_.begin(); it!=this->networkTemplateNames_.end(); ++it )
    109         {
    110             assert(Template::getTemplate(*it));
    111             Template::getTemplate(*it)->applyOn(this);
     108        for(const auto & elem : this->networkTemplateNames_)
     109        {
     110            assert(Template::getTemplate(elem));
     111            Template::getTemplate(elem)->applyOn(this);
    112112        }
    113113    }
     
    135135        //       objects alive when ~Level is called. This is the reason why we cannot directly destroy() the Plugins - instead we need
    136136        //       to call destroyLater() to ensure that no instances from this plugin exist anymore.
    137         for (std::list<PluginReference*>::iterator it = this->plugins_.begin(); it != this->plugins_.end(); ++it)
    138             (*it)->destroyLater();
     137        for (auto & elem : this->plugins_)
     138            (elem)->destroyLater();
    139139        this->plugins_.clear();
    140140    }
     
    173173    {
    174174        unsigned int i = 0;
    175         for (std::list<BaseObject*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
     175        for (const auto & elem : this->objects_)
    176176        {
    177177            if (i == index)
    178                 return (*it);
     178                return (elem);
    179179            ++i;
    180180        }
  • code/branches/cpp11_v2/src/orxonox/LevelInfo.cc

    r9667 r10821  
    107107        SubString substr = SubString(tags, ",", " "); // Split the string into tags.
    108108        const std::vector<std::string>& strings = substr.getAllStrings();
    109         for (std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); it++)
    110             this->addTag(*it, false);
     109        for (const auto & strings_it : strings)
     110            this->addTag(strings_it, false);
    111111
    112112        this->tagsUpdated();
     
    122122        SubString substr = SubString(ships, ",", " "); // Split the string into tags.
    123123        const std::vector<std::string>& strings = substr.getAllStrings();
    124         for(std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); it++)
    125             this->addStartingShip(*it, false);
     124        for(const auto & strings_it : strings)
     125            this->addStartingShip(strings_it, false);
    126126
    127127        this->startingshipsUpdated();
  • code/branches/cpp11_v2/src/orxonox/LevelManager.cc

    r10768 r10821  
    175175            this->levels_.front()->setActive(true);
    176176            // Make every player enter the newly activated level.
    177             for (std::map<unsigned int, PlayerInfo*>::const_iterator it = PlayerManager::getInstance().getClients().begin(); it != PlayerManager::getInstance().getClients().end(); ++it)
    178                 this->levels_.front()->playerEntered(it->second);
     177            for (const auto & elem : PlayerManager::getInstance().getClients())
     178                this->levels_.front()->playerEntered(elem.second);
    179179        }
    180180    }
  • code/branches/cpp11_v2/src/orxonox/Scene.cc

    r10768 r10821  
    220220        {
    221221            // Remove all WorldEntities and shove them to the queue since they would still like to be in a physical world.
    222             for (std::set<WorldEntity*>::const_iterator it = this->physicalObjects_.begin();
    223                 it != this->physicalObjects_.end(); ++it)
     222            for (const auto & elem : this->physicalObjects_)
    224223            {
    225                 this->physicalWorld_->removeRigidBody((*it)->physicalBody_);
    226                 this->physicalObjectQueue_.insert(*it);
     224                this->physicalWorld_->removeRigidBody((elem)->physicalBody_);
     225                this->physicalObjectQueue_.insert(elem);
    227226            }
    228227            this->physicalObjects_.clear();
     
    256255            {
    257256                // Add all scheduled WorldEntities
    258                 for (std::set<WorldEntity*>::const_iterator it = this->physicalObjectQueue_.begin();
    259                     it != this->physicalObjectQueue_.end(); ++it)
     257                for (const auto & elem : this->physicalObjectQueue_)
    260258                {
    261                     this->physicalWorld_->addRigidBody((*it)->physicalBody_);
    262                     this->physicalObjects_.insert(*it);
     259                    this->physicalWorld_->addRigidBody((elem)->physicalBody_);
     260                    this->physicalObjects_.insert(elem);
    263261                }
    264262                this->physicalObjectQueue_.clear();
     
    321319    {
    322320        unsigned int i = 0;
    323         for (std::list<BaseObject*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
     321        for (const auto & elem : this->objects_)
    324322        {
    325323            if (i == index)
    326                 return (*it);
     324                return (elem);
    327325            ++i;
    328326        }
  • code/branches/cpp11_v2/src/orxonox/collisionshapes/CompoundCollisionShape.cc

    r10768 r10821  
    6565        {
    6666            // Delete all children
    67             for (std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin();
    68                 it != this->attachedShapes_.end(); ++it)
     67            for (auto & elem : this->attachedShapes_)
    6968            {
    7069                // make sure that the child doesn't want to detach itself --> speedup because of the missing update
    71                 it->first->notifyDetached();
    72                 it->first->destroy();
    73                 if (this->collisionShape_ == it->second)
     70                elem.first->notifyDetached();
     71                elem.first->destroy();
     72                if (this->collisionShape_ == elem.second)
    7473                    this->collisionShape_ = nullptr; // don't destroy it twice
    7574            }
     
    247246    {
    248247        unsigned int i = 0;
    249         for (std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)
     248        for (const auto & elem : this->attachedShapes_)
    250249        {
    251250            if (i == index)
    252                 return it->first;
     251                return elem.first;
    253252            ++i;
    254253        }
     
    267266        std::vector<CollisionShape*> shapes;
    268267        // Iterate through all attached CollisionShapes and add them to the list of shapes.
    269         for(std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
    270             shapes.push_back(it->first);
     268        for(auto & elem : this->attachedShapes_)
     269            shapes.push_back(elem.first);
    271270
    272271        // Delete the compound shape and create a new one.
     
    275274
    276275        // Re-attach all CollisionShapes.
    277         for(std::vector<CollisionShape*>::iterator it = shapes.begin(); it != shapes.end(); it++)
    278         {
    279             CollisionShape* shape = *it;
     276        for(auto shape : shapes)
     277        {
     278           
    280279            shape->setScale3D(this->getScale3D());
    281280            // Only actually attach if we didn't pick a CompoundCollisionShape with no content.
  • code/branches/cpp11_v2/src/orxonox/controllers/FormationController.cc

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

    r9667 r10821  
    4444    WaypointController::~WaypointController()
    4545    {
    46         for (size_t i = 0; i < this->waypoints_.size(); ++i)
     46        for (auto & elem : this->waypoints_)
    4747        {
    48             if(this->waypoints_[i])
    49                 this->waypoints_[i]->destroy();
     48            if(elem)
     49                elem->destroy();
    5050        }
    5151    }
  • code/branches/cpp11_v2/src/orxonox/gamestates/GSLevel.cc

    r10768 r10821  
    251251
    252252        // delete states
    253         for (size_t i = 0; i < states.size(); ++i)
    254             delete states[i];
     253        for (auto & state : states)
     254            delete state;
    255255    }
    256256
  • code/branches/cpp11_v2/src/orxonox/gametypes/Dynamicmatch.cc

    r10768 r10821  
    405405    void Dynamicmatch::rewardPig()
    406406    {
    407         for (std::map< PlayerInfo*, int >::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it) //durch alle Spieler iterieren und alle piggys finden
    408         {
    409             if (it->second==piggy)//Spieler mit der Pig-party frags++
    410             {
    411                  this->playerScored(it->first);
     407        for (auto & elem : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden
     408        {
     409            if (elem.second==piggy)//Spieler mit der Pig-party frags++
     410            {
     411                 this->playerScored(elem.first);
    412412            }
    413413        }
     
    422422
    423423                std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
    424                 for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
    425                 {
    426                     if ((*it)->isA(Class(TeamColourable)))
     424                for (const auto & pawnAttachment : pawnAttachments)
     425                {
     426                    if ((pawnAttachment)->isA(Class(TeamColourable)))
    427427                    {
    428                         TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
     428                        TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment);
    429429                        tc->setTeamColour(this->partyColours_[it_player->second]);
    430430                    }
     
    441441            if (tutorial) // Announce selectionphase
    442442            {
    443              for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    444                 {
    445                     if (!it->first)//in order to catch nullpointer
     443             for (auto & elem : this->playerParty_)
     444                {
     445                    if (!elem.first)//in order to catch nullpointer
    446446                        continue;
    447                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     447                    if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    448448                        continue;
    449                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     449                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    450450                }
    451451            }
     
    456456             if(tutorial&&(!notEnoughKillers)&&(!notEnoughChasers)) //Selection phase over
    457457             {
    458                   for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
     458                  for (auto & elem : this->playerParty_)
    459459                  {
    460                        if (!it->first)//in order to catch nullpointer
     460                       if (!elem.first)//in order to catch nullpointer
    461461                           continue;
    462                        if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     462                       if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    463463                           continue;
    464                        else if (it->second==chaser)
     464                       else if (elem.second==chaser)
    465465                       {
    466466                           if (numberOf[killer]>0)
    467                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
     467                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",elem.first->getClientID(),partyColours_[piggy]);
    468468                           else
    469                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
     469                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",elem.first->getClientID(),partyColours_[piggy]);
    470470                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    471471                       }
    472                        else if (it->second==piggy)
    473                        {
    474                            this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]);
     472                       else if (elem.second==piggy)
     473                       {
     474                           this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",elem.first->getClientID(),partyColours_[chaser]);
    475475                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    476476                       }
    477                        else if (it->second==killer)
    478                        {
    479                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]);
     477                       else if (elem.second==killer)
     478                       {
     479                           this->gtinfo_->sendStaticMessage("Take the chasers down.",elem.first->getClientID(),partyColours_[chaser]);
    480480                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    481481                       }
     
    490490            if (tutorial) // Announce selectionphase
    491491            {
    492              for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    493                 {
    494                     if (!it->first)//in order to catch nullpointer
     492             for (auto & elem : this->playerParty_)
     493                {
     494                    if (!elem.first)//in order to catch nullpointer
    495495                        continue;
    496                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     496                    if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    497497                        continue;
    498                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     498                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    499499                }
    500500            }
     
    505505            if(tutorial&&(!notEnoughPigs)&&(!notEnoughChasers)) //Selection phase over
    506506             {
    507                   for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
     507                  for (auto & elem : this->playerParty_)
    508508                  {
    509                        if (!it->first)
     509                       if (!elem.first)
    510510                           continue;
    511                        if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     511                       if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    512512                           continue;
    513                        else if (it->second==chaser)
     513                       else if (elem.second==chaser)
    514514                       {
    515515                           if (numberOf[killer]>0)
    516                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
     516                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",elem.first->getClientID(),partyColours_[piggy]);
    517517                           else
    518                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
     518                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",elem.first->getClientID(),partyColours_[piggy]);
    519519                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    520520                       }
    521                        else if (it->second==piggy)
    522                        {
    523                            this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[piggy]);
     521                       else if (elem.second==piggy)
     522                       {
     523                           this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",elem.first->getClientID(),partyColours_[piggy]);
    524524                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    525525                       }
    526                        else if (it->second==killer)
    527                        {
    528                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[piggy]);
     526                       else if (elem.second==killer)
     527                       {
     528                           this->gtinfo_->sendStaticMessage("Take the chasers down.",elem.first->getClientID(),partyColours_[piggy]);
    529529                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    530530                       }
     
    540540            if (tutorial) // Announce selectionphase
    541541            {
    542              for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    543                 {
    544                     if (!it->first)//in order to catch nullpointer
     542             for (auto & elem : this->playerParty_)
     543                {
     544                    if (!elem.first)//in order to catch nullpointer
    545545                        continue;
    546                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     546                    if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    547547                        continue;
    548                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     548                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    549549                }
    550550            }
     
    555555             if(tutorial&&(!notEnoughPigs)&&(!notEnoughKillers)) //Selection phase over
    556556             {
    557                   for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
     557                  for (auto & elem : this->playerParty_)
    558558                  {
    559                        if (!it->first)
     559                       if (!elem.first)
    560560                           continue;
    561                        if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     561                       if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    562562                           continue;
    563                        else if (it->second==chaser)
     563                       else if (elem.second==chaser)
    564564                       {
    565565                           if (numberOf[killer]>0)
    566                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
     566                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",elem.first->getClientID(),partyColours_[piggy]);
    567567                           else
    568                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
     568                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",elem.first->getClientID(),partyColours_[piggy]);
    569569                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    570570                       }
    571                        else if (it->second==piggy)
    572                        {
    573                            this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]);
     571                       else if (elem.second==piggy)
     572                       {
     573                           this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",elem.first->getClientID(),partyColours_[chaser]);
    574574                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    575575                       }
    576                        else if (it->second==killer)
    577                        {
    578                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]);
     576                       else if (elem.second==killer)
     577                       {
     578                           this->gtinfo_->sendStaticMessage("Take the chasers down.",elem.first->getClientID(),partyColours_[chaser]);
    579579                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    580580                       }
     
    620620        else if(tutorial) // Announce selectionphase
    621621        {
    622             for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    623             {
    624                 if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     622            for (auto & elem : this->playerParty_)
     623            {
     624                if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    625625                    continue;
    626                 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     626                this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    627627            }
    628628        }
     
    676676            unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
    677677            unsigned int index = 0;
    678             for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
     678            for (const auto & teamSpawnPoint : teamSpawnPoints)
    679679            {
    680680                if (index == randomspawn)
    681                     return (*it);
     681                    return (teamSpawnPoint);
    682682
    683683                ++index;
  • code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc

    r10768 r10821  
    139139        if (!this->gtinfo_->hasStarted())
    140140        {
    141             for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     141            for (auto & elem : this->players_)
    142142            {
    143143                // Inform the GametypeInfo that the player is ready to spawn.
    144                 if(it->first->isHumanPlayer() && it->first->isReadyToSpawn())
    145                     this->gtinfo_->playerReadyToSpawn(it->first);
     144                if(elem.first->isHumanPlayer() && elem.first->isReadyToSpawn())
     145                    this->gtinfo_->playerReadyToSpawn(elem.first);
    146146            }
    147147
     
    169169        }
    170170
    171         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    172         {
    173             if (it->first->getControllableEntity())
    174             {
    175                 ControllableEntity* oldentity = it->first->getControllableEntity();
     171        for (auto & elem : this->players_)
     172        {
     173            if (elem.first->getControllableEntity())
     174            {
     175                ControllableEntity* oldentity = elem.first->getControllableEntity();
    176176
    177177                ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity->getContext());
     
    186186                    entity->setOrientation(oldentity->getWorldOrientation());
    187187                }
    188                 it->first->startControl(entity);
     188                elem.first->startControl(entity);
    189189            }
    190190            else
    191                 this->spawnPlayerAsDefaultPawn(it->first);
     191                this->spawnPlayerAsDefaultPawn(elem.first);
    192192        }
    193193    }
     
    341341            unsigned int index = 0;
    342342            std::vector<SpawnPoint*> activeSpawnPoints;
    343             for (std::set<SpawnPoint*>::const_iterator it = this->spawnpoints_.begin(); it != this->spawnpoints_.end(); ++it)
     343            for (const auto & elem : this->spawnpoints_)
    344344            {
    345345                if (index == randomspawn)
    346                     fallbackSpawnPoint = (*it);
    347 
    348                 if (*it != nullptr && (*it)->isActive())
    349                     activeSpawnPoints.push_back(*it);
     346                    fallbackSpawnPoint = (elem);
     347
     348                if (elem != nullptr && (elem)->isActive())
     349                    activeSpawnPoints.push_back(elem);
    350350
    351351                ++index;
     
    366366    void Gametype::assignDefaultPawnsIfNeeded()
    367367    {
    368         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    369         {
    370             if (!it->first->getControllableEntity())
    371             {
    372                 it->second.state_ = PlayerState::Dead;
    373 
    374                 if (!it->first->isReadyToSpawn() || !this->gtinfo_->hasStarted())
    375                 {
    376                     this->spawnPlayerAsDefaultPawn(it->first);
    377                     it->second.state_ = PlayerState::Dead;
     368        for (auto & elem : this->players_)
     369        {
     370            if (!elem.first->getControllableEntity())
     371            {
     372                elem.second.state_ = PlayerState::Dead;
     373
     374                if (!elem.first->isReadyToSpawn() || !this->gtinfo_->hasStarted())
     375                {
     376                    this->spawnPlayerAsDefaultPawn(elem.first);
     377                    elem.second.state_ = PlayerState::Dead;
    378378                }
    379379            }
     
    404404                    bool allplayersready = true;
    405405                    bool hashumanplayers = false;
    406                     for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     406                    for (auto & elem : this->players_)
    407407                    {
    408                         if (!it->first->isReadyToSpawn())
     408                        if (!elem.first->isReadyToSpawn())
    409409                            allplayersready = false;
    410                         if (it->first->isHumanPlayer())
     410                        if (elem.first->isHumanPlayer())
    411411                            hashumanplayers = true;
    412412                    }
     
    430430    void Gametype::spawnPlayersIfRequested()
    431431    {
    432         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    433         {
    434             if (it->first->isReadyToSpawn() || this->bForceSpawn_)
    435                 this->spawnPlayer(it->first);
     432        for (auto & elem : this->players_)
     433        {
     434            if (elem.first->isReadyToSpawn() || this->bForceSpawn_)
     435                this->spawnPlayer(elem.first);
    436436        }
    437437    }
     
    439439    void Gametype::spawnDeadPlayersIfRequested()
    440440    {
    441         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    442             if (it->second.state_ == PlayerState::Dead)
    443                 if (it->first->isReadyToSpawn() || this->bForceSpawn_)
    444                     this->spawnPlayer(it->first);
     441        for (auto & elem : this->players_)
     442            if (elem.second.state_ == PlayerState::Dead)
     443                if (elem.first->isReadyToSpawn() || this->bForceSpawn_)
     444                    this->spawnPlayer(elem.first);
    445445    }
    446446
     
    538538    GSLevelMementoState* Gametype::exportMementoState()
    539539    {
    540         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    541         {
    542             if (it->first->isHumanPlayer() && it->first->getControllableEntity() && it->first->getControllableEntity()->getCamera())
    543             {
    544                 Camera* camera = it->first->getControllableEntity()->getCamera();
     540        for (auto & elem : this->players_)
     541        {
     542            if (elem.first->isHumanPlayer() && elem.first->getControllableEntity() && elem.first->getControllableEntity()->getCamera())
     543            {
     544                Camera* camera = elem.first->getControllableEntity()->getCamera();
    545545
    546546                GametypeMementoState* state = new GametypeMementoState();
     
    559559        // find correct memento state
    560560        GametypeMementoState* state = nullptr;
    561         for (size_t i = 0; i < states.size(); ++i)
    562         {
    563             state = dynamic_cast<GametypeMementoState*>(states[i]);
     561        for (auto & states_i : states)
     562        {
     563            state = dynamic_cast<GametypeMementoState*>(states_i);
    564564            if (state)
    565565                break;
     
    587587
    588588        // find correct player and assign default entity with original position & orientation
    589         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    590         {
    591             if (it->first->isHumanPlayer())
     589        for (auto & elem : this->players_)
     590        {
     591            if (elem.first->isHumanPlayer())
    592592            {
    593593                ControllableEntity* entity = this->defaultControllableEntity_.fabricate(scene->getContext());
    594594                entity->setPosition(state->cameraPosition_);
    595595                entity->setOrientation(state->cameraOrientation_);
    596                 it->first->startControl(entity);
     596                elem.first->startControl(entity);
    597597                break;
    598598            }
  • code/branches/cpp11_v2/src/orxonox/gametypes/LastManStanding.cc

    r9667 r10821  
    5656    void LastManStanding::spawnDeadPlayersIfRequested()
    5757    {
    58         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    59             if (it->second.state_ == PlayerState::Dead)
    60             {
    61                 bool alive = (0<playerLives_[it->first]&&(inGame_[it->first]));
    62                 if (alive&&(it->first->isReadyToSpawn() || this->bForceSpawn_))
    63                 {
    64                     this->spawnPlayer(it->first);
     58        for (auto & elem : this->players_)
     59            if (elem.second.state_ == PlayerState::Dead)
     60            {
     61                bool alive = (0<playerLives_[elem.first]&&(inGame_[elem.first]));
     62                if (alive&&(elem.first->isReadyToSpawn() || this->bForceSpawn_))
     63                {
     64                    this->spawnPlayer(elem.first);
    6565                }
    6666            }
     
    114114    {
    115115        int min=lives;
    116         for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    117         {
    118             if (it->second<=0)
     116        for (auto & elem : this->playerLives_)
     117        {
     118            if (elem.second<=0)
    119119                continue;
    120             if (it->second<lives)
    121                 min=it->second;
     120            if (elem.second<lives)
     121                min=elem.second;
    122122        }
    123123        return min;
     
    128128        Gametype::end();
    129129
    130         for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    131         {
    132             if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     130        for (auto & elem : this->playerLives_)
     131        {
     132            if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    133133                continue;
    134134
    135             if (it->second > 0)
    136                 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
     135            if (elem.second > 0)
     136                this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.first->getClientID());
    137137            else
    138                 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     138                this->gtinfo_->sendAnnounceMessage("You have lost the match!", elem.first->getClientID());
    139139        }
    140140    }
     
    237237                this->end();
    238238            }
    239             for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
    240             {
    241                 if (playerGetLives(it->first)<=0)//Players without lives shouldn't be affected by time.
     239            for (auto & elem : this->timeToAct_)
     240            {
     241                if (playerGetLives(elem.first)<=0)//Players without lives shouldn't be affected by time.
    242242                    continue;
    243                 it->second-=dt;//Decreases punishment time.
    244                 if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
    245                 {
    246                     playerDelayTime_[it->first]-=dt;
    247                     if (playerDelayTime_[it->first]<=0)
    248                     this->inGame_[it->first]=true;
    249 
    250                     if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
     243                elem.second-=dt;//Decreases punishment time.
     244                if (!inGame_[elem.first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
     245                {
     246                    playerDelayTime_[elem.first]-=dt;
     247                    if (playerDelayTime_[elem.first]<=0)
     248                    this->inGame_[elem.first]=true;
     249
     250                    if (elem.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    251251                        continue;
    252                     int output=1+(int)playerDelayTime_[it->first];
     252                    int output=1+(int)playerDelayTime_[elem.first];
    253253                    const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown
    254                     this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
    255                 }
    256                 else if (it->second<0.0f)
    257                 {
    258                     it->second=timeRemaining+3.0f;//reset punishment-timer
    259                     if (playerGetLives(it->first)>0)
     254                    this->gtinfo_->sendFadingMessage(message,elem.first->getClientID());
     255                }
     256                else if (elem.second<0.0f)
     257                {
     258                    elem.second=timeRemaining+3.0f;//reset punishment-timer
     259                    if (playerGetLives(elem.first)>0)
    260260                    {
    261                         this->punishPlayer(it->first);
    262                         if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
     261                        this->punishPlayer(elem.first);
     262                        if (elem.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    263263                            return;
    264264                        const std::string& message = ""; // resets Camper-Warning-message
    265                         this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
     265                        this->gtinfo_->sendFadingMessage(message,elem.first->getClientID());
    266266                    }
    267267                }
    268                 else if (it->second<timeRemaining/5)//Warning message
    269                 {
    270                     if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
     268                else if (elem.second<timeRemaining/5)//Warning message
     269                {
     270                    if (elem.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    271271                        continue;
    272272                    const std::string& message = "Camper Warning! Don't forget to shoot.";
    273                     this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
     273                    this->gtinfo_->sendFadingMessage(message,elem.first->getClientID());
    274274                }
    275275            }
  • code/branches/cpp11_v2/src/orxonox/gametypes/LastTeamStanding.cc

    r9941 r10821  
    145145    void LastTeamStanding::spawnDeadPlayersIfRequested()
    146146    {
    147         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    148             if (it->second.state_ == PlayerState::Dead)
    149             {
    150                 bool alive = (0 < playerLives_[it->first]&&(inGame_[it->first]));
    151                 if (alive&&(it->first->isReadyToSpawn() || this->bForceSpawn_))
    152                 {
    153                     this->spawnPlayer(it->first);
     147        for (auto & elem : this->players_)
     148            if (elem.second.state_ == PlayerState::Dead)
     149            {
     150                bool alive = (0 < playerLives_[elem.first]&&(inGame_[elem.first]));
     151                if (alive&&(elem.first->isReadyToSpawn() || this->bForceSpawn_))
     152                {
     153                    this->spawnPlayer(elem.first);
    154154                }
    155155            }
     
    184184                this->end();
    185185            }
    186             for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
    187             {
    188                 if (playerGetLives(it->first) <= 0)//Players without lives shouldn't be affected by time.
     186            for (auto & elem : this->timeToAct_)
     187            {
     188                if (playerGetLives(elem.first) <= 0)//Players without lives shouldn't be affected by time.
    189189                    continue;
    190                 it->second -= dt;//Decreases punishment time.
    191                 if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
    192                 {
    193                     playerDelayTime_[it->first] -= dt;
    194                     if (playerDelayTime_[it->first] <= 0)
    195                     this->inGame_[it->first] = true;
    196 
    197                     if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
     190                elem.second -= dt;//Decreases punishment time.
     191                if (!inGame_[elem.first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
     192                {
     193                    playerDelayTime_[elem.first] -= dt;
     194                    if (playerDelayTime_[elem.first] <= 0)
     195                    this->inGame_[elem.first] = true;
     196
     197                    if (elem.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    198198                        continue;
    199                     int output = 1 + (int)playerDelayTime_[it->first];
     199                    int output = 1 + (int)playerDelayTime_[elem.first];
    200200                    const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown
    201                     this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
    202                 }
    203                 else if (it->second < 0.0f)
    204                 {
    205                     it->second = timeRemaining + 3.0f;//reset punishment-timer
    206                     if (playerGetLives(it->first) > 0)
     201                    this->gtinfo_->sendFadingMessage(message,elem.first->getClientID());
     202                }
     203                else if (elem.second < 0.0f)
     204                {
     205                    elem.second = timeRemaining + 3.0f;//reset punishment-timer
     206                    if (playerGetLives(elem.first) > 0)
    207207                    {
    208                         this->punishPlayer(it->first);
    209                         if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     208                        this->punishPlayer(elem.first);
     209                        if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    210210                            return;
    211211                        const std::string& message = ""; // resets Camper-Warning-message
    212                         this->gtinfo_->sendFadingMessage(message, it->first->getClientID());
     212                        this->gtinfo_->sendFadingMessage(message, elem.first->getClientID());
    213213                    }
    214214                }
    215                 else if (it->second < timeRemaining/5)//Warning message
    216                 {
    217                   if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
     215                else if (elem.second < timeRemaining/5)//Warning message
     216                {
     217                  if (elem.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    218218                        continue;
    219219                    const std::string& message = "Camper Warning! Don't forget to shoot.";
    220                     this->gtinfo_->sendFadingMessage(message, it->first->getClientID());
     220                    this->gtinfo_->sendFadingMessage(message, elem.first->getClientID());
    221221                }
    222222            }
     
    229229        int party = -1;
    230230        //find a player who survived
    231         for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    232         {
    233           if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     231        for (auto & elem : this->playerLives_)
     232        {
     233          if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    234234                continue;
    235235
    236             if (it->second > 0)//a player that is alive
     236            if (elem.second > 0)//a player that is alive
    237237            {
    238238                //which party has survived?
    239                 std::map<PlayerInfo*, int>::iterator it2 = this->teamnumbers_.find(it->first);
     239                std::map<PlayerInfo*, int>::iterator it2 = this->teamnumbers_.find(elem.first);
    240240                if (it2 != this->teamnumbers_.end())
    241241                {
     
    255255    {
    256256        int min = lives;
    257         for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    258         {
    259             if (it->second <= 0)
     257        for (auto & elem : this->playerLives_)
     258        {
     259            if (elem.second <= 0)
    260260                continue;
    261             if (it->second < lives)
    262                 min = it->second;
     261            if (elem.second < lives)
     262                min = elem.second;
    263263        }
    264264        return min;
  • code/branches/cpp11_v2/src/orxonox/gametypes/TeamBaseMatch.cc

    r10768 r10821  
    152152        int amountControlled2 = 0;
    153153
    154         for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
    155         {
    156             if((*it)->getState() == BaseState::ControlTeam1)
     154        for (const auto & elem : this->bases_)
     155        {
     156            if((elem)->getState() == BaseState::ControlTeam1)
    157157            {
    158158                amountControlled++;
    159159            }
    160             if((*it)->getState() == BaseState::ControlTeam2)
     160            if((elem)->getState() == BaseState::ControlTeam2)
    161161            {
    162162                amountControlled2++;
     
    187187            }
    188188
    189             for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    190             {
    191                 if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     189            for (auto & elem : this->teamnumbers_)
     190            {
     191                if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    192192                    continue;
    193193
    194                 if (it->second == winningteam)
    195                     this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
     194                if (elem.second == winningteam)
     195                    this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.first->getClientID());
    196196                else
    197                     this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     197                    this->gtinfo_->sendAnnounceMessage("You have lost the match!", elem.first->getClientID());
    198198            }
    199199
     
    238238        int count = 0;
    239239
    240         for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
    241         {
    242             if ((*it)->getState() == BaseState::ControlTeam1 && team == 0)
     240        for (const auto & elem : this->bases_)
     241        {
     242            if ((elem)->getState() == BaseState::ControlTeam1 && team == 0)
    243243                count++;
    244             if ((*it)->getState() == BaseState::ControlTeam2 && team == 1)
     244            if ((elem)->getState() == BaseState::ControlTeam2 && team == 1)
    245245                count++;
    246246        }
     
    258258    {
    259259        unsigned int i = 0;
    260         for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
     260        for (const auto & elem : this->bases_)
    261261        {
    262262            i++;
    263263            if (i > index)
    264                 return (*it);
     264                return (elem);
    265265        }
    266266        return nullptr;
  • code/branches/cpp11_v2/src/orxonox/gametypes/TeamDeathmatch.cc

    r9941 r10821  
    6969        int winnerTeam = 0;
    7070        int highestScore = 0;
    71         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     71        for (auto & elem : this->players_)
    7272        {
    73             if ( this->getTeamScore(it->first) > highestScore )
     73            if ( this->getTeamScore(elem.first) > highestScore )
    7474            {
    75                 winnerTeam = this->getTeam(it->first);
    76                 highestScore = this->getTeamScore(it->first);
     75                winnerTeam = this->getTeam(elem.first);
     76                highestScore = this->getTeamScore(elem.first);
    7777            }
    7878        }
  • code/branches/cpp11_v2/src/orxonox/gametypes/TeamGametype.cc

    r10768 r10821  
    9999        std::vector<unsigned int> playersperteam(this->teams_, 0);
    100100
    101         for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    102             if (it->second < static_cast<int>(this->teams_) && it->second >= 0)
    103                 playersperteam[it->second]++;
     101        for (auto & elem : this->teamnumbers_)
     102            if (elem.second < static_cast<int>(this->teams_) && elem.second >= 0)
     103                playersperteam[elem.second]++;
    104104
    105105        unsigned int minplayers = static_cast<unsigned int>(-1);
     
    123123        if( (this->players_.size() >= maxPlayers_) && (allowedInGame_[player] == true) ) // if there's a "waiting list"
    124124        {
    125             for (std::map<PlayerInfo*, bool>::iterator it = this->allowedInGame_.begin(); it != this->allowedInGame_.end(); ++it)
    126             {
    127                  if(it->second == false) // waiting player found
    128                  {it->second = true; break;} // allow player to enter
     125            for (auto & elem : this->allowedInGame_)
     126            {
     127                 if(elem.second == false) // waiting player found
     128                 {elem.second = true; break;} // allow player to enter
    129129            }
    130130        }
     
    141141    void TeamGametype::spawnDeadPlayersIfRequested()
    142142    {
    143         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)\
    144         {
    145             if(allowedInGame_[it->first] == false)//check if dead player is allowed to enter
     143        for (auto & elem : this->players_)\
     144        {
     145            if(allowedInGame_[elem.first] == false)//check if dead player is allowed to enter
    146146            {
    147147                continue;
    148148            }
    149             if (it->second.state_ == PlayerState::Dead)
    150             {
    151                 if ((it->first->isReadyToSpawn() || this->bForceSpawn_))
     149            if (elem.second.state_ == PlayerState::Dead)
     150            {
     151                if ((elem.first->isReadyToSpawn() || this->bForceSpawn_))
    152152                {
    153                    this->spawnPlayer(it->first);
     153                   this->spawnPlayer(elem.first);
    154154                }
    155155            }
     
    178178        if(!player || this->getTeam(player) == -1)
    179179            return 0;
    180         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    181         {
    182             if ( this->getTeam(it->first) ==  this->getTeam(player) )
    183             {
    184                 teamscore += it->second.frags_;
     180        for (auto & elem : this->players_)
     181        {
     182            if ( this->getTeam(elem.first) ==  this->getTeam(player) )
     183            {
     184                teamscore += elem.second.frags_;
    185185            }
    186186        }
     
    191191    {
    192192        int teamSize = 0;
    193         for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    194         {
    195             if (it->second == team)
     193        for (auto & elem : this->teamnumbers_)
     194        {
     195            if (elem.second == team)
    196196                teamSize++;
    197197        }
     
    202202    {
    203203        int teamSize = 0;
    204         for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    205         {
    206             if (it->second == team  && it->first->isHumanPlayer())
     204        for (auto & elem : this->teamnumbers_)
     205        {
     206            if (elem.second == team  && elem.first->isHumanPlayer())
    207207                teamSize++;
    208208        }
     
    241241            unsigned int index = 0;
    242242            // Get random fallback spawnpoint in case there is no active SpawnPoint.
    243             for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
     243            for (const auto & teamSpawnPoint : teamSpawnPoints)
    244244            {
    245245                if (index == randomspawn)
    246246                {
    247                     fallbackSpawnPoint = (*it);
     247                    fallbackSpawnPoint = (teamSpawnPoint);
    248248                    break;
    249249                }
     
    266266            randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
    267267            index = 0;
    268             for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
     268            for (const auto & teamSpawnPoint : teamSpawnPoints)
    269269            {
    270270                if (index == randomspawn)
    271                     return (*it);
     271                    return (teamSpawnPoint);
    272272
    273273                ++index;
     
    364364
    365365        std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
    366         for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
    367         {
    368             if ((*it)->isA(Class(TeamColourable)))
    369             {
    370                 TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
     366        for (const auto & pawnAttachment : pawnAttachments)
     367        {
     368            if ((pawnAttachment)->isA(Class(TeamColourable)))
     369            {
     370                TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment);
    371371                tc->setTeamColour(this->teamcolours_[teamNr]);
    372372            }
     
    376376    void TeamGametype::announceTeamWin(int winnerTeam)
    377377    {
    378         for (std::map<PlayerInfo*, int>::iterator it3 = this->teamnumbers_.begin(); it3 != this->teamnumbers_.end(); ++it3)
    379         {
    380             if (it3->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     378        for (auto & elem : this->teamnumbers_)
     379        {
     380            if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    381381                continue;
    382             if (it3->second == winnerTeam)
    383             {
    384                 this->gtinfo_->sendAnnounceMessage("Your team has won the match!", it3->first->getClientID());
     382            if (elem.second == winnerTeam)
     383            {
     384                this->gtinfo_->sendAnnounceMessage("Your team has won the match!", elem.first->getClientID());
    385385            }
    386386            else
    387387            {
    388                 this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", it3->first->getClientID());
     388                this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", elem.first->getClientID());
    389389            }
    390390        }   
  • code/branches/cpp11_v2/src/orxonox/gametypes/UnderAttack.cc

    r10768 r10821  
    7474        this->gameEnded_ = true;
    7575
    76         for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    77         {
    78             if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     76        for (auto & elem : this->teamnumbers_)
     77        {
     78            if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    7979                continue;
    8080
    81             if (it->second == attacker_)
    82                 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
     81            if (elem.second == attacker_)
     82                this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.first->getClientID());
    8383            else
    84                 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     84                this->gtinfo_->sendAnnounceMessage("You have lost the match!", elem.first->getClientID());
    8585        }
    8686    }
     
    155155                ChatManager::message(message);
    156156
    157                 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    158                 {
    159                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     157                for (auto & elem : this->teamnumbers_)
     158                {
     159                    if (elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    160160                        continue;
    161161
    162                     if (it->second == 1)
    163                         this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
     162                    if (elem.second == 1)
     163                        this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.first->getClientID());
    164164                    else
    165                         this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     165                        this->gtinfo_->sendAnnounceMessage("You have lost the match!", elem.first->getClientID());
    166166                }
    167167            }
  • code/branches/cpp11_v2/src/orxonox/interfaces/PickupCarrier.cc

    r10765 r10821  
    135135        // Go recursively through all children to check whether they are the target.
    136136        std::vector<PickupCarrier*>* children = this->getCarrierChildren();
    137         for(std::vector<PickupCarrier*>::iterator it = children->begin(); it != children->end(); it++)
     137        for(auto & elem : *children)
    138138        {
    139             if(pickup->isTarget(*it))
     139            if(pickup->isTarget(elem))
    140140            {
    141                 target = *it;
     141                target = elem;
    142142                break;
    143143            }
  • code/branches/cpp11_v2/src/orxonox/interfaces/Pickupable.cc

    r10765 r10821  
    160160    {
    161161        // Iterate through all targets of this Pickupable.
    162         for(std::list<Identifier*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
     162        for(const auto & elem : this->targets_)
    163163        {
    164             if(identifier->isA(*it))
     164            if(identifier->isA(elem))
    165165                return true;
    166166        }
  • code/branches/cpp11_v2/src/orxonox/items/MultiStateEngine.cc

    r10768 r10821  
    219219    {
    220220        unsigned int i = 0;
    221         for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
     221        for (const auto & elem : this->effectContainers_)
    222222        {
    223223            if (i == index)
    224                 return (*it);
     224                return (elem);
     225            i++;
    225226        }
    226227        return nullptr;
  • code/branches/cpp11_v2/src/orxonox/items/ShipPart.cc

    r10765 r10821  
    148148    bool ShipPart::hasEntity(StaticEntity* entity) const
    149149    {
    150         for(unsigned int i = 0; i < this->entityList_.size(); i++)
    151         {
    152             if(this->entityList_[i] == entity)
     150        for(auto & elem : this->entityList_)
     151        {
     152            if(elem == entity)
    153153                return true;
    154154        }
  • code/branches/cpp11_v2/src/orxonox/overlays/OverlayGroup.cc

    r10769 r10821  
    6262    OverlayGroup::~OverlayGroup()
    6363    {
    64         for (std::set<StrongPtr<OrxonoxOverlay>>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    65             (*it)->destroy();
     64        for (const auto & elem : hudElements_)
     65            (elem)->destroy();
    6666        this->hudElements_.clear();
    6767    }
     
    8686    void OverlayGroup::setScale(const Vector2& scale)
    8787    {
    88         for (std::set<StrongPtr<OrxonoxOverlay>>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    89             (*it)->scale(scale / this->scale_);
     88        for (const auto & elem : hudElements_)
     89            (elem)->scale(scale / this->scale_);
    9090        this->scale_ = scale;
    9191    }
     
    9494    void OverlayGroup::setScroll(const Vector2& scroll)
    9595    {
    96         for (std::set<StrongPtr<OrxonoxOverlay>>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    97             (*it)->scroll(scroll - this->scroll_);
     96        for (const auto & elem : hudElements_)
     97            (elem)->scroll(scroll - this->scroll_);
    9898        this->scroll_ = scroll;
    9999    }
     
    147147        SUPER( OverlayGroup, changedVisibility );
    148148
    149         for (std::set<StrongPtr<OrxonoxOverlay>>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    150             (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
     149        for (const auto & elem : hudElements_)
     150            (elem)->changedVisibility(); //inform all Child Overlays that our visibility has changed
    151151    }
    152152
     
    155155        this->owner_ = owner;
    156156
    157         for (std::set<StrongPtr<OrxonoxOverlay>>::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    158             (*it)->setOwner(owner);
     157        for (const auto & elem : hudElements_)
     158            (elem)->setOwner(owner);
    159159    }
    160160
  • code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc

    r10771 r10821  
    407407        if (ambient != nullptr)
    408408        {
    409             for (AmbientList::iterator it = this->ambientSounds_.begin(); it != this->ambientSounds_.end(); ++it)
    410             {
    411                 if (it->first == ambient)
     409            for (auto & elem : this->ambientSounds_)
     410            {
     411                if (elem.first == ambient)
    412412                {
    413                     it->second = true;
    414                     this->fadeOut(it->first);
     413                    elem.second = true;
     414                    this->fadeOut(elem.first);
    415415                    return;
    416416                }
  • code/branches/cpp11_v2/src/orxonox/sound/SoundStreamer.cc

    r10765 r10821  
    6868        int current_section;
    6969
    70         for(int i = 0; i < 4; i++)
     70        for(auto & initbuffer : initbuffers)
    7171        {
    7272            long ret = ov_read(&vf, inbuffer, sizeof(inbuffer), 0, 2, 1, &current_section);
     
    8282            }
    8383
    84             alBufferData(initbuffers[i], format, &inbuffer, ret, vorbisInfo->rate);
     84            alBufferData(initbuffer, format, &inbuffer, ret, vorbisInfo->rate);
    8585        }
    8686        alSourceQueueBuffers(audioSource, 4, initbuffers);
  • code/branches/cpp11_v2/src/orxonox/weaponsystem/Munition.cc

    r10768 r10821  
    5555    Munition::~Munition()
    5656    {
    57         for (std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)
    58             delete it->second;
     57        for (auto & elem : this->currentMagazines_)
     58            delete elem.second;
    5959    }
    6060
     
    268268        {
    269269            // Return true if any of the current magazines is not full (loading counts as full although it returns 0 munition)
    270             for (std::map<WeaponMode*, Magazine*>::const_iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)
    271                 if (it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)
     270            for (const auto & elem : this->currentMagazines_)
     271                if (elem.second->munition_ < this->maxMunitionPerMagazine_ && elem.second->bLoaded_)
    272272                    return true;
    273273        }
     
    316316            {
    317317                bool change = false;
    318                 for (std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)
     318                for (auto & elem : this->currentMagazines_)
    319319                {
    320320                    // Add munition if the magazine isn't full (but only to loaded magazines)
    321                     if (amount > 0 && it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)
     321                    if (amount > 0 && elem.second->munition_ < this->maxMunitionPerMagazine_ && elem.second->bLoaded_)
    322322                    {
    323                         it->second->munition_++;
     323                        elem.second->munition_++;
    324324                        amount--;
    325325                        change = true;
  • code/branches/cpp11_v2/src/orxonox/weaponsystem/Weapon.cc

    r10768 r10821  
    6161                this->weaponPack_->removeWeapon(this);
    6262
    63             for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    64                 it->second->destroy();
     63            for (auto & elem : this->weaponmodes_)
     64                elem.second->destroy();
    6565        }
    6666    }
     
    8585    {
    8686        unsigned int i = 0;
    87         for (std::multimap<unsigned int, WeaponMode*>::const_iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
     87        for (const auto & elem : this->weaponmodes_)
    8888        {
    8989            if (i == index)
    90                 return it->second;
     90                return elem.second;
    9191
    9292            ++i;
     
    136136    void Weapon::reload()
    137137    {
    138         for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    139             it->second->reload();
     138        for (auto & elem : this->weaponmodes_)
     139            elem.second->reload();
    140140    }
    141141
     
    148148    void Weapon::notifyWeaponModes()
    149149    {
    150         for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    151             it->second->setWeapon(this);
     150        for (auto & elem : this->weaponmodes_)
     151            elem.second->setWeapon(this);
    152152    }
    153153}
  • code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponPack.cc

    r10768 r10821  
    7676    void WeaponPack::fire(unsigned int weaponmode)
    7777    {
    78         for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    79             (*it)->fire(weaponmode);
     78        for (auto & elem : this->weapons_)
     79            (elem)->fire(weaponmode);
    8080    }
    8181
     
    8686    void WeaponPack::reload()
    8787    {
    88         for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    89             (*it)->reload();
     88        for (auto & elem : this->weapons_)
     89            (elem)->reload();
    9090    }
    9191
     
    114114        unsigned int i = 0;
    115115
    116         for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     116        for (const auto & elem : this->weapons_)
    117117        {
    118118            if (i == index)
    119                 return (*it);
     119                return (elem);
    120120            ++i;
    121121        }
     
    132132    {
    133133        unsigned int i = 0;
    134         for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
     134        for (const auto & elem : this->links_)
    135135        {
    136136            if (i == index)
    137                 return (*it);
     137                return (elem);
    138138
    139139            ++i;
     
    144144    unsigned int WeaponPack::getDesiredWeaponmode(unsigned int firemode) const
    145145    {
    146         for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
    147             if ((*it)->getFiremode() == firemode)
    148                 return (*it)->getWeaponmode();
     146        for (const auto & elem : this->links_)
     147            if ((elem)->getFiremode() == firemode)
     148                return (elem)->getWeaponmode();
    149149
    150150        return WeaponSystem::WEAPON_MODE_UNASSIGNED;
  • code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSet.cc

    r10768 r10821  
    6363    {
    6464        // Fire all WeaponPacks with their defined weaponmode
    65         for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
    66             if (it->second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
    67                 it->first->fire(it->second);
     65        for (auto & elem : this->weaponpacks_)
     66            if (elem.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
     67                elem.first->fire(elem.second);
    6868    }
    6969
     
    7171    {
    7272        // Reload all WeaponPacks with their defined weaponmode
    73         for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
    74             it->first->reload();
     73        for (auto & elem : this->weaponpacks_)
     74            elem.first->reload();
    7575    }
    7676
  • code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSystem.cc

    r10768 r10821  
    106106    {
    107107        unsigned int i = 0;
    108         for (std::vector<WeaponSlot*>::const_iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
     108        for (const auto & elem : this->weaponSlots_)
    109109        {
    110110            ++i;
    111111            if (i > index)
    112                 return (*it);
     112                return (elem);
    113113        }
    114114        return nullptr;
     
    153153    {
    154154        unsigned int i = 0;
    155         for (std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
     155        for (const auto & elem : this->weaponSets_)
    156156        {
    157157            ++i;
    158158            if (i > index)
    159                 return it->second;
     159                return elem.second;
    160160        }
    161161        return nullptr;
     
    168168
    169169        unsigned int freeSlots = 0;
    170         for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
    171         {
    172             if (!(*it)->isOccupied())
     170        for (auto & elem : this->weaponSlots_)
     171        {
     172            if (!(elem)->isOccupied())
    173173                ++freeSlots;
    174174        }
     
    184184        // Attach all weapons to the first free slots (and to the Pawn)
    185185        unsigned int i = 0;
    186         for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
    187         {
    188             if (!(*it)->isOccupied() && i < wPack->getNumWeapons())
     186        for (auto & elem : this->weaponSlots_)
     187        {
     188            if (!(elem)->isOccupied() && i < wPack->getNumWeapons())
    189189            {
    190190                Weapon* weapon = wPack->getWeapon(i);
    191                 (*it)->attachWeapon(weapon);
     191                (elem)->attachWeapon(weapon);
    192192                this->getPawn()->attach(weapon);
    193193                ++i;
     
    196196
    197197        // Assign the desired weaponmode to the firemodes
    198         for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
    199         {
    200             unsigned int weaponmode = wPack->getDesiredWeaponmode(it->first);
     198        for (auto & elem : this->weaponSets_)
     199        {
     200            unsigned int weaponmode = wPack->getDesiredWeaponmode(elem.first);
    201201            if (weaponmode != WeaponSystem::WEAPON_MODE_UNASSIGNED)
    202                 it->second->setWeaponmodeLink(wPack, weaponmode);
     202                elem.second->setWeaponmodeLink(wPack, weaponmode);
    203203        }
    204204
     
    219219
    220220        // Remove all added links from the WeaponSets
    221         for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
    222             it->second->removeWeaponmodeLink(wPack);
     221        for (auto & elem : this->weaponSets_)
     222            elem.second->removeWeaponmodeLink(wPack);
    223223
    224224        // Remove the WeaponPack from the WeaponSystem
     
    231231    {
    232232        unsigned int i = 0;
    233         for (std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
     233        for (const auto & elem : this->weaponPacks_)
    234234        {
    235235            ++i;
    236236            if (i > index)
    237                 return (*it);
     237                return (elem);
    238238        }
    239239        return nullptr;
     
    268268        // Check if the WeaponSet belongs to this WeaponSystem
    269269        bool foundWeaponSet = false;
    270         for (std::map<unsigned int, WeaponSet *>::iterator it2 = this->weaponSets_.begin(); it2 != this->weaponSets_.end(); ++it2)
    271         {
    272             if (it2->second == wSet)
     270        for (auto & elem : this->weaponSets_)
     271        {
     272            if (elem.second == wSet)
    273273            {
    274274                foundWeaponSet = true;
     
    296296    void WeaponSystem::reload()
    297297    {
    298         for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
    299             it->second->reload();
     298        for (auto & elem : this->weaponSets_)
     299            elem.second->reload();
    300300    }
    301301
  • code/branches/cpp11_v2/src/orxonox/worldentities/ControllableEntity.cc

    r10769 r10821  
    165165    {
    166166        unsigned int i = 0;
    167         for (std::list<StrongPtr<CameraPosition>>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     167        for (const auto & elem : this->cameraPositions_)
    168168        {
    169169            if (i == index)
    170                 return (*it);
     170                return (elem);
    171171            ++i;
    172172        }
     
    180180
    181181        unsigned int counter = 0;
    182         for (std::list<StrongPtr<CameraPosition>>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    183         {
    184             if ((*it) == this->currentCameraPosition_)
     182        for (const auto & elem : this->cameraPositions_)
     183        {
     184            if ((elem) == this->currentCameraPosition_)
    185185                break;
    186186            counter++;
     
    477477        if (parent)
    478478        {
    479             for (std::list<StrongPtr<CameraPosition>>::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    480                 if ((*it)->getIsAbsolute())
    481                     parent->attach((*it));
     479            for (auto & elem : this->cameraPositions_)
     480                if ((elem)->getIsAbsolute())
     481                    parent->attach((elem));
    482482        }
    483483    }
  • code/branches/cpp11_v2/src/orxonox/worldentities/EffectContainer.cc

    r10765 r10821  
    8989    {
    9090        unsigned int i = 0;
    91         for (std::vector<WorldEntity*>::const_iterator it = this->effects_.begin(); it != this->effects_.end(); ++it)
     91        for (const auto & elem : this->effects_)
    9292            if (i == index)
    93                 return (*it);
     93                return (elem);
    9494        return nullptr;
    9595    }
  • code/branches/cpp11_v2/src/orxonox/worldentities/WorldEntity.cc

    r10774 r10821  
    233233
    234234            // iterate over all children and change their activity as well
    235             for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
     235            for (const auto & elem : this->getAttachedObjects())
    236236            {
    237237                if(!this->isActive())
    238238                {
    239                     (*it)->bActiveMem_ = (*it)->isActive();
    240                     (*it)->setActive(this->isActive());
     239                    (elem)->bActiveMem_ = (elem)->isActive();
     240                    (elem)->setActive(this->isActive());
    241241                }
    242242                else
    243243                {
    244                     (*it)->setActive((*it)->bActiveMem_);
     244                    (elem)->setActive((elem)->bActiveMem_);
    245245                }
    246246            }
     
    259259        {
    260260            // iterate over all children and change their visibility as well
    261             for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
     261            for (const auto & elem : this->getAttachedObjects())
    262262            {
    263263                if(!this->isVisible())
    264264                {
    265                     (*it)->bVisibleMem_ = (*it)->isVisible();
    266                     (*it)->setVisible(this->isVisible());
     265                    (elem)->bVisibleMem_ = (elem)->isVisible();
     266                    (elem)->setVisible(this->isVisible());
    267267                }
    268268                else
    269269                {
    270                     (*it)->setVisible((*it)->bVisibleMem_);
     270                    (elem)->setVisible((elem)->bVisibleMem_);
    271271                }
    272272            }
     
    518518    {
    519519        unsigned int i = 0;
    520         for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
     520        for (const auto & elem : this->children_)
    521521        {
    522522            if (i == index)
    523                 return (*it);
     523                return (elem);
    524524            ++i;
    525525        }
     
    938938        // Recalculate mass
    939939        this->childrenMass_ = 0.0f;
    940         for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    941             this->childrenMass_ += (*it)->getMass();
     940        for (const auto & elem : this->children_)
     941            this->childrenMass_ += (elem)->getMass();
    942942        recalculateMassProps();
    943943        // Notify parent WE
  • code/branches/cpp11_v2/src/orxonox/worldentities/pawns/ModularSpaceShip.cc

    r10768 r10821  
    9999            }
    100100            // iterate through all attached parts
    101             for(unsigned int j = 0; j < this->partList_.size(); j++)
     101            for(auto & elem : 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((this->partList_[j]->getName() == this->getAttachedObject(i)->getName()) && !this->partList_[j]->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
     104                if((elem->getName() == this->getAttachedObject(i)->getName()) && !elem->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
    105105                {
    106106                    // The Entity is added to the part's entityList_
    107                     this->partList_[j]->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
     107                    elem->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)), this->partList_[j]);
     109                    this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), elem);
    110110                }
    111111            }
     
    146146    ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const
    147147    {
    148         for (std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)
    149         {
    150             if (it->first == entity)
    151                 return it->second;
     148        for (const auto & elem : this->partMap_)
     149        {
     150            if (elem.first == entity)
     151                return elem.second;
    152152        }
    153153        return nullptr;
     
    242242    ShipPart* ModularSpaceShip::getShipPartByName(std::string name)
    243243    {
    244         for(std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)
    245         {
    246             if(orxonox_cast<ShipPart*>(*it)->getName() == name)
    247             {
    248                 return orxonox_cast<ShipPart*>(*it);
     244        for(auto & elem : this->partList_)
     245        {
     246            if(orxonox_cast<ShipPart*>(elem)->getName() == name)
     247            {
     248                return orxonox_cast<ShipPart*>(elem);
    249249            }
    250250        }
     
    261261    bool ModularSpaceShip::hasShipPart(ShipPart* part) const
    262262    {
    263         for(unsigned int i = 0; i < this->partList_.size(); i++)
    264         {
    265             if(this->partList_[i] == part)
     263        for(auto & elem : this->partList_)
     264        {
     265            if(elem == part)
    266266                return true;
    267267        }
  • code/branches/cpp11_v2/src/orxonox/worldentities/pawns/SpaceShip.cc

    r10768 r10821  
    158158
    159159        // Run the engines
    160         for(std::vector<Engine*>::iterator it = this->engineList_.begin(); it != this->engineList_.end(); it++)
    161             (*it)->run(dt);
     160        for(auto & elem : this->engineList_)
     161            (elem)->run(dt);
    162162
    163163        if (this->hasLocalController())
     
    318318    bool SpaceShip::hasEngine(Engine* engine) const
    319319    {
    320         for(unsigned int i = 0; i < this->engineList_.size(); i++)
    321         {
    322             if(this->engineList_[i] == engine)
     320        for(auto & elem : this->engineList_)
     321        {
     322            if(elem == engine)
    323323                return true;
    324324        }
     
    350350    Engine* SpaceShip::getEngineByName(const std::string& name)
    351351    {
    352         for(size_t i = 0; i < this->engineList_.size(); ++i)
    353             if(this->engineList_[i]->getName() == name)
    354                 return this->engineList_[i];
     352        for(auto & elem : this->engineList_)
     353            if(elem->getName() == name)
     354                return elem;
    355355
    356356        orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl;
     
    396396    void SpaceShip::addSpeedFactor(float factor)
    397397    {
    398         for(unsigned int i=0; i<this->engineList_.size(); i++)
    399             this->engineList_[i]->addSpeedMultiply(factor);
     398        for(auto & elem : this->engineList_)
     399            elem->addSpeedMultiply(factor);
    400400    }
    401401
     
    408408    void SpaceShip::addSpeed(float speed)
    409409    {
    410         for(unsigned int i=0; i<this->engineList_.size(); i++)
    411             this->engineList_[i]->addSpeedAdd(speed);
     410        for(auto & elem : this->engineList_)
     411            elem->addSpeedAdd(speed);
    412412    }
    413413
     
    436436    {
    437437        float speed=0;
    438         for(unsigned int i=0; i<this->engineList_.size(); i++)
    439         {
    440             if(this->engineList_[i]->getMaxSpeedFront() > speed)
    441                 speed = this->engineList_[i]->getMaxSpeedFront();
     438        for(auto & elem : this->engineList_)
     439        {
     440            if(elem->getMaxSpeedFront() > speed)
     441                speed = elem->getMaxSpeedFront();
    442442        }
    443443        return speed;
  • code/branches/cpp11_v2/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc

    r10624 r10821  
    8080
    8181        std::set<WorldEntity*> attachments = this->getAttachedObjects();
    82         for (std::set<WorldEntity*>::iterator it = attachments.begin(); it != attachments.end(); ++it)
     82        for (const auto & attachment : attachments)
    8383        {
    84             if ((*it)->isA(Class(TeamColourable)))
     84            if ((attachment)->isA(Class(TeamColourable)))
    8585            {
    86                 TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
     86                TeamColourable* tc = orxonox_cast<TeamColourable*>(attachment);
    8787                tc->setTeamColour(colour);
    8888            }
Note: See TracChangeset for help on using the changeset viewer.