Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2015, 10:47:51 PM (9 years ago)
Author:
landauf
Message:

use range-based for-loop where it makes sense (e.g. ObjectList)

Location:
code/branches/cpp11_v2/src/modules
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/modules/docking/Dock.cc

    r10916 r10919  
    214214    {
    215215        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
    216         for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
    217         {
    218             if(it->dock(player))
     216        for(Dock* dock : ObjectList<Dock>())
     217        {
     218            if(dock->dock(player))
    219219                break;
    220220        }
     
    224224    {
    225225        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
    226         for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
    227         {
    228             if(it->undock(player))
     226        for(Dock* dock : ObjectList<Dock>())
     227        {
     228            if(dock->undock(player))
    229229                break;
    230230        }
     
    295295        int i = 0;
    296296        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
    297         for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
    298         {
    299             if(it->candidates_.find(player) != it->candidates_.end())
     297        for(Dock* dock : ObjectList<Dock>())
     298        {
     299            if(dock->candidates_.find(player) != dock->candidates_.end())
    300300                i++;
    301301        }
     
    306306    {
    307307        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
    308         for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
    309         {
    310             if(it->candidates_.find(player) != it->candidates_.end())
     308        for(Dock* dock : ObjectList<Dock>())
     309        {
     310            if(dock->candidates_.find(player) != dock->candidates_.end())
    311311            {
    312312                if(index == 0)
    313                     return *it;
     313                    return dock;
    314314                index--;
    315315            }
  • code/branches/cpp11_v2/src/modules/docking/DockingEffect.cc

    r10916 r10919  
    6565
    6666    DockingTarget *DockingEffect::findTarget(std::string name) {
    67         for (ObjectList<DockingTarget>::iterator it = ObjectList<DockingTarget>::begin(); it != ObjectList<DockingTarget>::end(); ++it)
     67        for (DockingTarget* target : ObjectList<DockingTarget>())
    6868        {
    69             if ((*it)->getName().compare(name) == 0)
    70                 return (*it);
     69            if (target->getName().compare(name) == 0)
     70                return target;
    7171        }
    7272        return nullptr;
  • code/branches/cpp11_v2/src/modules/dodgerace/DodgeRace.cc

    r10768 r10919  
    136136        if (player == nullptr)
    137137        {
    138             for (ObjectList<DodgeRaceShip>::iterator it = ObjectList<DodgeRaceShip>::begin(); it != ObjectList<DodgeRaceShip>::end(); ++it)
    139             {
    140                 player = *it;
     138            for (DodgeRaceShip* ship : ObjectList<DodgeRaceShip>())
     139            {
     140                player = ship;
    141141            }
    142142        }
  • code/branches/cpp11_v2/src/modules/dodgerace/DodgeRaceShip.cc

    r10818 r10919  
    154154        if (game == nullptr)
    155155        {
    156             for (ObjectList<DodgeRace>::iterator it = ObjectList<DodgeRace>::begin(); it != ObjectList<DodgeRace>::end(); ++it)
     156            for (DodgeRace* race : ObjectList<DodgeRace>())
    157157            {
    158                 game = *it;
     158                game = race;
    159159            }
    160160        }
  • code/branches/cpp11_v2/src/modules/gametypes/SpaceRace.cc

    r9804 r10919  
    8888            this->cantMove_ = true;
    8989
    90             for (ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it)
    91                 it->setActive(false);
     90            for (Engine* engine : ObjectList<Engine>())
     91                engine->setActive(false);
    9292        }
    9393
     
    9595        if (!this->isStartCountdownRunning() && this->cantMove_)
    9696        {
    97             for (ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it)
    98                 it->setActive(true);
     97            for (Engine* engine : ObjectList<Engine>())
     98                engine->setActive(true);
    9999
    100100            this->cantMove_= false;
  • code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc

    r10917 r10919  
    6161        if (ObjectList<SpaceRaceManager>::size() != 1)
    6262            orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager>::size() << endl;
    63         for (ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it != ObjectList<SpaceRaceManager>::end(); ++it)
    64         {
    65             checkpoints = it->getAllCheckpoints();
    66             nextRaceCheckpoint_ = it->findCheckpoint(0);
     63        for (SpaceRaceManager* manager : ObjectList<SpaceRaceManager>())
     64        {
     65            checkpoints = manager->getAllCheckpoints();
     66            nextRaceCheckpoint_ = manager->findCheckpoint(0);
    6767        }
    6868
     
    187187        {
    188188            int numberOfWays = 0; // counts number of ways from this Point to the last point
    189             for (std::set<int>::iterator it = currentCheckpoint->getNextCheckpoints().begin(); it!= currentCheckpoint->getNextCheckpoints().end(); ++it)
    190             {
    191                 if (currentCheckpoint == findCheckpoint(*it))
     189            for (int checkpointIndex : currentCheckpoint->getNextCheckpoints())
     190            {
     191                if (currentCheckpoint == findCheckpoint(checkpointIndex))
    192192                {
    193193                    //orxout() << currentCheckpoint->getCheckpointIndex()<<endl;
    194194                    continue;
    195195                }
    196                 if (findCheckpoint(*it) == nullptr)
    197                     orxout(internal_warning) << "Problematic Point: " << (*it) << endl;
     196                if (findCheckpoint(checkpointIndex) == nullptr)
     197                    orxout(internal_warning) << "Problematic Point: " << checkpointIndex << endl;
    198198                else
    199                     numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(*it), zaehler);
     199                    numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(checkpointIndex), zaehler);
    200200            }
    201201            zaehler[currentCheckpoint] += numberOfWays;
     
    255255        {
    256256            float minimum = std::numeric_limits<float>::max();
    257             for (std::set<int>::iterator it = currentCheckPoint->getNextCheckpoints().begin(); it != currentCheckPoint->getNextCheckpoints().end(); ++it)
     257            for (int checkpointIndex : currentCheckPoint->getNextCheckpoints())
    258258            {
    259259                int dist_currentCheckPoint_currentPosition = static_cast<int> ((currentPosition- currentCheckPoint->getPosition()).length());
    260260
    261                 minimum = std::min(minimum, dist_currentCheckPoint_currentPosition + recCalculateDistance(findCheckpoint(*it), currentCheckPoint->getPosition()));
     261                minimum = std::min(minimum, dist_currentCheckPoint_currentPosition + recCalculateDistance(findCheckpoint(checkpointIndex), currentCheckPoint->getPosition()));
    262262                // minimum of distanz from 'currentPosition' to the next static Checkpoint
    263263            }
  • code/branches/cpp11_v2/src/modules/invader/Invader.cc

    r10768 r10919  
    9898        if (player == nullptr)
    9999        {
    100             for (ObjectList<InvaderShip>::iterator it = ObjectList<InvaderShip>::begin(); it != ObjectList<InvaderShip>::end(); ++it)
    101                 player = *it;
     100            for (InvaderShip* ship : ObjectList<InvaderShip>())
     101                player = ship;
    102102        }
    103103        return player;
  • code/branches/cpp11_v2/src/modules/invader/InvaderEnemy.cc

    r10818 r10919  
    7575        if (game == nullptr)
    7676        {
    77             for (ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)
    78                 game = *it;
     77            for (Invader* invader : ObjectList<Invader>())
     78                game = invader;
    7979        }
    8080        return game;
  • code/branches/cpp11_v2/src/modules/invader/InvaderShip.cc

    r10818 r10919  
    184184        if (game == nullptr)
    185185        {
    186             for (ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)
    187                 game = *it;
     186            for (Invader* invader : ObjectList<Invader>())
     187                game = invader;
    188188        }
    189189        return game;
  • code/branches/cpp11_v2/src/modules/jump/JumpProjectile.cc

    r10768 r10919  
    6969        Vector3 projectilePosition = getPosition();
    7070
    71         for (ObjectList<JumpEnemy>::iterator it = ObjectList<JumpEnemy>::begin(); it != ObjectList<JumpEnemy>::end(); ++it)
     71        for (JumpEnemy* enemy : ObjectList<JumpEnemy>())
    7272        {
    73             Vector3 enemyPosition = it->getPosition();
    74             float enemyWidth = it->getWidth();
    75             float enemyHeight = it->getHeight();
     73            Vector3 enemyPosition = enemy->getPosition();
     74            float enemyWidth = enemy->getWidth();
     75            float enemyHeight = enemy->getHeight();
    7676
    7777            if(projectilePosition.x > enemyPosition.x-enemyWidth && projectilePosition.x < enemyPosition.x+enemyWidth && projectilePosition.z > enemyPosition.z-enemyHeight && projectilePosition.z < enemyPosition.z+enemyHeight)
    7878            {
    79                 it->dead_ = true;
     79                enemy->dead_ = true;
    8080            }
    8181        }
  • code/branches/cpp11_v2/src/modules/objects/Attacher.cc

    r10916 r10919  
    101101            return;
    102102
    103         for (ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)
     103        for (WorldEntity* worldEntity : ObjectList<WorldEntity>())
    104104        {
    105             if (it->getName() == this->targetname_)
     105            if (worldEntity->getName() == this->targetname_)
    106106            {
    107                 this->target_ = *it;
    108                 this->attachToParent(*it);
     107                this->target_ = worldEntity;
     108                this->attachToParent(worldEntity);
    109109            }
    110110        }
  • code/branches/cpp11_v2/src/modules/objects/ForceField.cc

    r9945 r10919  
    118118        {
    119119            // Iterate over all objects that could possibly be affected by the ForceField.
    120             for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
     120            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
    121121            {
    122122                // The direction of the orientation of the force field.
     
    125125
    126126                // Vector from the center of the force field to the object its acting on.
    127                 Vector3 distanceVector = it->getWorldPosition() - (this->getWorldPosition() + (this->halfLength_ * direction));
     127                Vector3 distanceVector = mobileEntity->getWorldPosition() - (this->getWorldPosition() + (this->halfLength_ * direction));
    128128
    129129                // The object is outside a ball around the center with radius length/2 of the ForceField.
     
    132132
    133133                // The distance of the object form the orientation vector. (Or rather the smallest distance from the orientation vector)
    134                 float distanceFromDirectionVector = ((it->getWorldPosition() - this->getWorldPosition()).crossProduct(direction)).length();
     134                float distanceFromDirectionVector = ((mobileEntity->getWorldPosition() - this->getWorldPosition()).crossProduct(direction)).length();
    135135
    136136                // If the object in a tube of radius 'radius' around the direction of orientation.
     
    140140                // Apply a force to the object in the direction of the orientation.
    141141                // The force is highest when the object is directly on the direction vector, with a linear decrease, finally reaching zero, when distanceFromDirectionVector = radius.
    142                 it->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction);
     142                mobileEntity->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction);
    143143            }
    144144        }
     
    146146        {
    147147            // Iterate over all objects that could possibly be affected by the ForceField.
    148             for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
    149             {
    150                 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
     148            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
     149            {
     150                Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition();
    151151                float distance = distanceVector.length();
    152152                // If the object is within 'radius' distance.
     
    155155                    distanceVector.normalise();
    156156                    // Apply a force proportional to the velocity, with highest force at the origin of the sphere, linear decreasing until reaching a distance of 'radius' from the origin, where the force reaches zero.
    157                     it->applyCentralForce((this->radius_ - distance)/this->radius_ * this->velocity_ * distanceVector);
     157                    mobileEntity->applyCentralForce((this->radius_ - distance)/this->radius_ * this->velocity_ * distanceVector);
    158158                }
    159159            }
     
    162162        {
    163163            // Iterate over all objects that could possibly be affected by the ForceField.
    164             for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
    165             {
    166                 Vector3 distanceVector = this->getWorldPosition() - it->getWorldPosition();
     164            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
     165            {
     166                Vector3 distanceVector = this->getWorldPosition() - mobileEntity->getWorldPosition();
    167167                float distance = distanceVector.length();
    168168                // If the object is within 'radius' distance and no more than 'length' away from the boundary of the sphere.
     
    172172                    distanceVector.normalise();
    173173                    // Apply a force proportional to the velocity, with highest force at the boundary of the sphere, linear decreasing until reaching a distance of 'radius-length' from the origin, where the force reaches zero.
    174                     it->applyCentralForce((distance-range)/range * this->velocity_ * distanceVector);
     174                    mobileEntity->applyCentralForce((distance-range)/range * this->velocity_ * distanceVector);
    175175                }
    176176            }
     
    179179        {
    180180            // Iterate over all objects that could possibly be affected by the ForceField.
    181             for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
    182             {
    183                 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
     181            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
     182            {
     183                Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition();
    184184                float distance = distanceVector.length();
    185185                // If the object is within 'radius' distance and especially further away than massRadius_
     
    197197                   
    198198                    // Note: this so called force is actually an acceleration!
    199                     it->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector);
     199                    mobileEntity->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector);
    200200                }
    201201            }
     
    204204        {
    205205            // Iterate over all objects that could possibly be affected by the ForceField.
    206             for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
    207             {
    208                 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
     206            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
     207            {
     208                Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition();
    209209                float distance = distanceVector.length();
    210210                if (distance < this->radius_ && distance > this->massRadius_)
     
    212212                    // Add a Acceleration in forceDirection_.
    213213                    // Vector3(0,0,0) is the direction, where the force should work.
    214                     it->addAcceleration(forceDirection_ , Vector3(0,0,0));
     214                    mobileEntity->addAcceleration(forceDirection_ , Vector3(0,0,0));
    215215                }
    216216            }
  • code/branches/cpp11_v2/src/modules/objects/SpaceBoundaries.cc

    r10916 r10919  
    7373    {
    7474        pawnsIn_.clear();
    75         for(ObjectList<Pawn>::iterator current = ObjectList<Pawn>::begin(); current != ObjectList<Pawn>::end(); ++current)
    76         {
    77             Pawn* currentPawn = *current;
     75        for(Pawn* currentPawn : ObjectList<Pawn>())
     76        {
    7877            if( this->reaction_ == 0 )
    7978            {
  • code/branches/cpp11_v2/src/modules/objects/controllers/TurretController.cc

    r10818 r10919  
    103103        Pawn* minScorePawn = nullptr;
    104104
    105         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
    106         {
    107             Pawn* entity = orxonox_cast<Pawn*>(*it);
    108             if (!entity || FormationController::sameTeam(turret, entity, this->getGametype()))
     105        for (Pawn* pawn : ObjectList<Pawn>())
     106        {
     107            if (!pawn || FormationController::sameTeam(turret, pawn, this->getGametype()))
    109108                continue;
    110             tempScore = turret->isInRange(entity);
     109            tempScore = turret->isInRange(pawn);
    111110            if(tempScore != -1.f)
    112111            {
     
    114113                {
    115114                    minScore = tempScore;
    116                     minScorePawn = entity;
     115                    minScorePawn = pawn;
    117116                }
    118117            }
  • code/branches/cpp11_v2/src/modules/objects/eventsystem/EventFilter.cc

    r10916 r10919  
    7070        {
    7171            bool success = false;
    72             for (std::list<EventName*>::const_iterator it = this->names_.begin(); it != this->names_.end(); ++it)
     72            for (EventName* name : this->names_)
    7373            {
    74                 if ((*it)->getName() == event.name_)
     74                if (name->getName() == event.name_)
    7575                {
    7676                    success = true;
  • code/branches/cpp11_v2/src/modules/objects/eventsystem/EventListener.cc

    r9667 r10919  
    7878            return;
    7979
    80         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
    81             if (it->getName() == this->eventName_)
    82                 this->addEventSource(*it, "");
     80        for (BaseObject* object : ObjectList<BaseObject>())
     81            if (object->getName() == this->eventName_)
     82                this->addEventSource(object, "");
    8383    }
    8484
  • code/branches/cpp11_v2/src/modules/objects/eventsystem/EventTarget.cc

    r9667 r10919  
    7373        this->target_ = name;
    7474
    75         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
    76             if (it->getName() == this->target_)
    77                 this->addEventTarget(*it);
     75        for (BaseObject* object : ObjectList<BaseObject>())
     76            if (object->getName() == this->target_)
     77                this->addEventTarget(object);
    7878    }
    7979
  • code/branches/cpp11_v2/src/modules/objects/triggers/Trigger.cc

    r10916 r10919  
    346346    {
    347347        // Iterate over all Triggers.
    348         for (ObjectList<Trigger>::iterator it = ObjectList<Trigger>::begin(); it != ObjectList<Trigger>::end(); ++it)
    349             it->setVisible(bVisible);
     348        for (Trigger* trigger : ObjectList<Trigger>())
     349            trigger->setVisible(bVisible);
    350350    }
    351351
  • code/branches/cpp11_v2/src/modules/overlays/hud/HUDRadar.cc

    r10917 r10919  
    165165    {
    166166        const std::set<RadarViewable*>& objectSet = this->getCreator()->getScene()->getRadar()->getRadarObjects();
    167         std::set<RadarViewable*>::const_iterator it;
    168         for( it=objectSet.begin(); it!=objectSet.end(); ++it )
    169             this->addObject(*it);
     167        for( RadarViewable* viewable : objectSet )
     168            this->addObject(viewable);
    170169        this->radarTick(0);
    171170    }
     
    183182
    184183        // update the distances for all objects
    185         std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it;
    186 
    187184
    188185        if(RadarMode_)
     
    201198        }
    202199
    203         for( it = this->radarObjects_.begin(); it != this->radarObjects_.end(); ++it )
     200        for( const auto& mapEntry : this->radarObjects_ )
    204201        {
    205202            // Make sure the object really is a WorldEntity
    206             const WorldEntity* wePointer = it->first->getWorldEntity();
     203            const WorldEntity* wePointer = mapEntry.first->getWorldEntity();
    207204            if( !wePointer )
    208205            {
     
    210207                assert(0);
    211208            }
    212             bool isFocus = (it->first == focusObject);
     209            bool isFocus = (mapEntry.first == focusObject);
    213210            // set size to fit distance...
    214211            float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length();
     
    217214            float size;
    218215            if(RadarMode_)
    219                 size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
     216                size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * mapEntry.first->getRadarObjectScale();
    220217            else
    221                 size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
    222             it->second->setDimensions(size, size);
     218                size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * mapEntry.first->getRadarObjectScale();
     219            mapEntry.second->setDimensions(size, size);
    223220
    224221            // calc position on radar...
     
    234231                int zOrder = determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_);
    235232                if(overXZPlain == false /*&& (it->second->getZOrder() >  100 * this->overlay_->getZOrder())*/) // it appears that zOrder of attached Overlayelements is 100 times the zOrder of the Overlay
    236                     it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder);
     233                    mapEntry.second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder);
    237234                if(overXZPlain == true /*&& (it->second->getZOrder() <= 100 * this->overlay_->getZOrder())*/)
    238                     it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder);
     235                    mapEntry.second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder);
    239236            }
    240237            else
     
    242239
    243240            coord *= math::pi / 3.5f; // small adjustment to make it fit the texture
    244             it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f);
     241            mapEntry.second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f);
    245242
    246243            if( distance < detectionLimit_ || detectionLimit_ < 0 )
    247                 it->second->show();
     244                mapEntry.second->show();
    248245            else
    249                 it->second->hide();
     246                mapEntry.second->hide();
    250247
    251248            // if this object is in focus, then set the focus marker
     
    255252                this->marker_->setPosition((1.0f + coord.x - size * 1.5f) * 0.5f, (1.0f - coord.y - size * 1.5f) * 0.5f);
    256253                if(RadarMode_)
    257                     this->marker_->_notifyZOrder(it->second->getZOrder() -1);
     254                    this->marker_->_notifyZOrder(mapEntry.second->getZOrder() -1);
    258255                this->marker_->show();
    259256            }
  • code/branches/cpp11_v2/src/modules/pickup/PickupSpawner.cc

    r10765 r10919  
    158158
    159159            // Iterate trough all Pawns.
    160             for(ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
     160            for(Pawn* pawn : ObjectList<Pawn>())
    161161            {
    162162                if(spawner == nullptr) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute).
    163163                    break;
    164164
    165                 Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
    166                 PickupCarrier* carrier = static_cast<PickupCarrier*>(*it);
     165                Vector3 distance = pawn->getWorldPosition() - this->getWorldPosition();
     166                PickupCarrier* carrier = static_cast<PickupCarrier*>(pawn);
    167167                // If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawner, is in trigger-distance and the carrier is not blocked.
    168168                if(distance.length() < this->triggerDistance_ && carrier != nullptr && this->blocked_.find(carrier) == this->blocked_.end())
    169169                {
    170170                    if(carrier->isTarget(this->pickup_))
    171                         this->trigger(*it);
     171                        this->trigger(pawn);
    172172                }
    173173            }
  • code/branches/cpp11_v2/src/modules/tetris/Tetris.cc

    r10917 r10919  
    136136            return false;
    137137
    138         for(std::list<StrongPtr<TetrisStone>>::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
    139         {
    140             const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
     138        for(TetrisStone* someStone : this->stones_)
     139        {
     140            const Vector3& currentStonePosition = someStone->getPosition(); //!< Saves the position of the currentStone
    141141
    142142            if((position.x == currentStonePosition.x) && abs(position.y-currentStonePosition.y) < this->center_->getStoneSize())
     
    192192
    193193        // check for collisions with all stones
    194         for(std::list<StrongPtr<TetrisStone>>::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
     194        for(TetrisStone* someStone : this->stones_)
    195195        {
    196196            //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount());
    197             const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
     197            const Vector3& currentStonePosition = someStone->getPosition(); //!< Saves the position of the currentStone
    198198
    199199            //filter out cases where the falling stone is already below a steady stone
  • code/branches/cpp11_v2/src/modules/towerdefense/TowerDefenseEnemy.cc

    r10818 r10919  
    4949        if (game == nullptr)
    5050        {
    51             for (ObjectList<TowerDefense>::iterator it = ObjectList<TowerDefense>::begin(); it != ObjectList<TowerDefense>::end(); ++it)
    52                 game = *it;
     51            for (TowerDefense* towerDefense : ObjectList<TowerDefense>())
     52                game = towerDefense;
    5353        }
    5454        return game;
  • code/branches/cpp11_v2/src/modules/weapons/projectiles/GravityBombField.cc

    r10765 r10919  
    125125
    126126            //Check if any pawn is inside the shockwave and hit it with dammage proportional to the distance between explosion centre and pawn. Make sure, the same pawn is damaged only once.
    127             for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
     127            for (Pawn* pawn : ObjectList<Pawn>())
    128128            {
    129                 Vector3 distanceVector = it->getWorldPosition()-this->getWorldPosition();
     129                Vector3 distanceVector = pawn->getWorldPosition()-this->getWorldPosition();
    130130                 //orxout(debug_output) << "Found Pawn:" << it->getWorldPosition() << endl;
    131131                if(distanceVector.length()< forceSphereRadius_)
    132132                {
    133133                    //orxout(debug_output) << "Force sphere radius is: " << forceSphereRadius_ << " Distance to Pawn is: " << distanceVector.length();
    134                     if (std::find(victimsAlreadyDamaged_.begin(),victimsAlreadyDamaged_.end(),*it) == victimsAlreadyDamaged_.end())
     134                    if (std::find(victimsAlreadyDamaged_.begin(),victimsAlreadyDamaged_.end(),pawn) == victimsAlreadyDamaged_.end())
    135135                    {
    136136                        //orxout(debug_output) << "Found Pawn to damage: " << it->getWorldPosition() << endl;
    137137                        float damage = FORCE_FIELD_EXPLOSION_DAMMAGE*(1-distanceVector.length()/EXPLOSION_RADIUS);
    138138                        //orxout(debug_output) << "Damage: " << damage << endl;
    139                         it->hit(shooter_, it->getWorldPosition(), nullptr, damage, 0,0);
    140                         victimsAlreadyDamaged_.push_back(*it);
     139                        pawn->hit(shooter_, pawn->getWorldPosition(), nullptr, damage, 0,0);
     140                        victimsAlreadyDamaged_.push_back(pawn);
    141141                    }
    142142                }
Note: See TracChangeset for help on using the changeset viewer.