Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (9 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/modules
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • 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            }
Note: See TracChangeset for help on using the changeset viewer.