Changeset 10919 for code/branches/cpp11_v2/src/modules/overlays
- Timestamp:
- Dec 5, 2015, 10:47:51 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/overlays/hud/HUDRadar.cc
r10917 r10919 165 165 { 166 166 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); 170 169 this->radarTick(0); 171 170 } … … 183 182 184 183 // update the distances for all objects 185 std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it;186 187 184 188 185 if(RadarMode_) … … 201 198 } 202 199 203 for( it = this->radarObjects_.begin(); it != this->radarObjects_.end(); ++it)200 for( const auto& mapEntry : this->radarObjects_ ) 204 201 { 205 202 // Make sure the object really is a WorldEntity 206 const WorldEntity* wePointer = it->first->getWorldEntity();203 const WorldEntity* wePointer = mapEntry.first->getWorldEntity(); 207 204 if( !wePointer ) 208 205 { … … 210 207 assert(0); 211 208 } 212 bool isFocus = ( it->first == focusObject);209 bool isFocus = (mapEntry.first == focusObject); 213 210 // set size to fit distance... 214 211 float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length(); … … 217 214 float size; 218 215 if(RadarMode_) 219 size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();216 size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * mapEntry.first->getRadarObjectScale(); 220 217 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); 223 220 224 221 // calc position on radar... … … 234 231 int zOrder = determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_); 235 232 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); 237 234 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); 239 236 } 240 237 else … … 242 239 243 240 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); 245 242 246 243 if( distance < detectionLimit_ || detectionLimit_ < 0 ) 247 it->second->show();244 mapEntry.second->show(); 248 245 else 249 it->second->hide();246 mapEntry.second->hide(); 250 247 251 248 // if this object is in focus, then set the focus marker … … 255 252 this->marker_->setPosition((1.0f + coord.x - size * 1.5f) * 0.5f, (1.0f - coord.y - size * 1.5f) * 0.5f); 256 253 if(RadarMode_) 257 this->marker_->_notifyZOrder( it->second->getZOrder() -1);254 this->marker_->_notifyZOrder(mapEntry.second->getZOrder() -1); 258 255 this->marker_->show(); 259 256 }
Note: See TracChangeset
for help on using the changeset viewer.