Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/Radar.cc

    r10624 r11071  
    4949
    5050    Radar::Radar()
    51         : itFocus_(0)
    52         , focus_(0)
     51        : itFocus_(nullptr)
     52        , focus_(nullptr)
    5353        , objectTypeCounter_(0)
    5454    {
    5555        // TODO: make this mapping configurable. Maybe there's a possibility with self configured
    5656        //       configValues..
    57         this->objectTypes_["Asteroid"] = RadarViewable::Dot;
    58         this->objectTypes_["SpaceShip"] = RadarViewable::Square;
    59         this->objectTypes_["AsdfQwerty"] = RadarViewable::Triangle;
     57        this->objectTypes_["Asteroid"] = RadarViewable::Shape::Dot;
     58        this->objectTypes_["SpaceShip"] = RadarViewable::Shape::Square;
     59        this->objectTypes_["AsdfQwerty"] = RadarViewable::Shape::Triangle;
    6060
    6161        /*WorldEntity* object;
     
    8484        this->radarObjects_.insert(rv);
    8585        // iterate through all radarlisteners and notify them
    86         for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
    87         {
    88             (*itListener)->addObject(rv);
     86        for (RadarListener* listener : ObjectList<RadarListener>())
     87        {
     88            listener->addObject(rv);
    8989        }
    9090    }
     
    9595        this->radarObjects_.erase(rv);
    9696        // iterate through all radarlisteners and notify them
    97         for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
    98         {
    99             (*itListener)->removeObject(rv);
     97        for (RadarListener* listener : ObjectList<RadarListener>())
     98        {
     99            listener->removeObject(rv);
    100100        }
    101101    }
     
    106106            return *(this->itFocus_);
    107107        else
    108             return 0;
     108            return nullptr;
    109109    }
    110110
     
    113113        std::map<std::string, RadarViewable::Shape>::iterator it = this->objectTypes_.find(name);
    114114        if (it == this->objectTypes_.end())
    115             return this->objectTypes_[name] = RadarViewable::Square; // default, configure!!
     115            return this->objectTypes_[name] = RadarViewable::Shape::Square; // default, configure!!
    116116        else
    117117            return this->objectTypes_[name];
     
    126126        {
    127127            // focus object was deleted, release focus
    128             this->focus_ = 0;
    129             this->itFocus_ = 0;
    130         }
    131 
    132         for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
    133         {
    134             (*itListener)->radarTick(dt);
     128            this->focus_ = nullptr;
     129            this->itFocus_ = nullptr;
     130        }
     131
     132        for (RadarListener* listener : ObjectList<RadarListener>())
     133        {
     134            listener->radarTick(dt);
    135135        }
    136136    }
     
    138138    void Radar::cycleFocus()
    139139    {
    140         if (ObjectList<RadarViewable>::begin() == ObjectList<RadarViewable>::end())
     140        ObjectList<RadarViewable> listRadarViewable;
     141        if (listRadarViewable.size() == 0)
    141142        {
    142143            // list is empty
    143             this->itFocus_ = 0;
    144             this->focus_ = 0;
     144            this->itFocus_ = nullptr;
     145            this->focus_ = nullptr;
    145146        }
    146147
     
    156157            float nextDistance = FLT_MAX;
    157158            float minimumDistance = FLT_MAX;
    158             ObjectList<RadarViewable>::iterator itFallback = 0;
    159 
    160             for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it)
     159            ObjectList<RadarViewable>::iterator itFallback = nullptr;
     160
     161            for (ObjectList<RadarViewable>::iterator it = listRadarViewable.begin(); it; ++it)
    161162            {
    162163                if (*it == static_cast<RadarViewable*>(HumanController::getLocalControllerEntityAsPawn()))
     
    191192    void Radar::releaseFocus()
    192193    {
    193         this->itFocus_ = 0;
    194         this->focus_ = 0;
     194        this->itFocus_ = nullptr;
     195        this->focus_ = nullptr;
    195196    }
    196197
     
    200201        // iterate through all Radar Objects
    201202        unsigned int i = 0;
    202         for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it, ++i)
    203         {
    204             orxout(debug_output) << i++ << ": " << (*it)->getRVWorldPosition() << endl;
     203        for (RadarViewable* viewable : ObjectList<RadarViewable>())
     204        {
     205            orxout(debug_output) << i++ << ": " << viewable->getRVWorldPosition() << endl;
     206            ++i;
    205207        }
    206208    }
     
    208210    void Radar::radarObjectChanged(RadarViewable* rv)
    209211    {
    210         for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
    211         {
    212           (*itListener)->objectChanged(rv);
     212        for (RadarListener* listener : ObjectList<RadarListener>())
     213        {
     214            listener->objectChanged(rv);
    213215        }
    214216    }
Note: See TracChangeset for help on using the changeset viewer.