Changeset 11071 for code/trunk/src/orxonox/Radar.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/Radar.cc
r10624 r11071 49 49 50 50 Radar::Radar() 51 : itFocus_( 0)52 , focus_( 0)51 : itFocus_(nullptr) 52 , focus_(nullptr) 53 53 , objectTypeCounter_(0) 54 54 { 55 55 // TODO: make this mapping configurable. Maybe there's a possibility with self configured 56 56 // configValues.. 57 this->objectTypes_["Asteroid"] = RadarViewable:: Dot;58 this->objectTypes_["SpaceShip"] = RadarViewable::S quare;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; 60 60 61 61 /*WorldEntity* object; … … 84 84 this->radarObjects_.insert(rv); 85 85 // 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); 89 89 } 90 90 } … … 95 95 this->radarObjects_.erase(rv); 96 96 // 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); 100 100 } 101 101 } … … 106 106 return *(this->itFocus_); 107 107 else 108 return 0;108 return nullptr; 109 109 } 110 110 … … 113 113 std::map<std::string, RadarViewable::Shape>::iterator it = this->objectTypes_.find(name); 114 114 if (it == this->objectTypes_.end()) 115 return this->objectTypes_[name] = RadarViewable::S quare; // default, configure!!115 return this->objectTypes_[name] = RadarViewable::Shape::Square; // default, configure!! 116 116 else 117 117 return this->objectTypes_[name]; … … 126 126 { 127 127 // 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); 135 135 } 136 136 } … … 138 138 void Radar::cycleFocus() 139 139 { 140 if (ObjectList<RadarViewable>::begin() == ObjectList<RadarViewable>::end()) 140 ObjectList<RadarViewable> listRadarViewable; 141 if (listRadarViewable.size() == 0) 141 142 { 142 143 // list is empty 143 this->itFocus_ = 0;144 this->focus_ = 0;144 this->itFocus_ = nullptr; 145 this->focus_ = nullptr; 145 146 } 146 147 … … 156 157 float nextDistance = FLT_MAX; 157 158 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) 161 162 { 162 163 if (*it == static_cast<RadarViewable*>(HumanController::getLocalControllerEntityAsPawn())) … … 191 192 void Radar::releaseFocus() 192 193 { 193 this->itFocus_ = 0;194 this->focus_ = 0;194 this->itFocus_ = nullptr; 195 this->focus_ = nullptr; 195 196 } 196 197 … … 200 201 // iterate through all Radar Objects 201 202 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; 205 207 } 206 208 } … … 208 210 void Radar::radarObjectChanged(RadarViewable* rv) 209 211 { 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); 213 215 } 214 216 }
Note: See TracChangeset
for help on using the changeset viewer.