Changeset 11071 for code/trunk/src/modules/overlays/hud/HUDNavigation.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/modules/overlays/hud/HUDNavigation.cc
r11023 r11071 53 53 #include "core/config/ConfigValueIncludes.h" 54 54 #include "tools/TextureGenerator.h" 55 // #include <boost/bind/bind_template.hpp>56 55 57 56 … … 69 68 RegisterClass ( HUDNavigation ); 70 69 71 HUDNavigation* HUDNavigation::localHUD_s = 0;70 HUDNavigation* HUDNavigation::localHUD_s = nullptr; 72 71 73 72 HUDNavigation::HUDNavigation(Context* context) : … … 132 131 } 133 132 this->fontName_ = font; 134 for ( std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it)135 { 136 if ( it->second.text_ != NULL)137 it->second.text_->setFontName(this->fontName_);133 for (const auto& mapEntry : this->activeObjectList_) 134 { 135 if (mapEntry.second.text_ != nullptr) 136 mapEntry.second.text_->setFontName(this->fontName_); 138 137 } 139 138 } … … 152 151 } 153 152 this->textSize_ = size; 154 for ( std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it!=this->activeObjectList_.end(); ++it)155 { 156 if ( it->second.text_)157 it->second.text_->setCharHeight(size);153 for (const auto& mapEntry : this->activeObjectList_) 154 { 155 if (mapEntry.second.text_) 156 mapEntry.second.text_->setCharHeight(size); 158 157 } 159 158 } … … 183 182 184 183 Camera* cam = CameraManager::getInstance().getActiveCamera(); 185 if (cam == NULL)184 if (cam == nullptr) 186 185 return; 187 186 const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 188 187 189 for (std:: list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt)190 listIt->second = (int)((listIt->first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f);188 for (std::pair<RadarViewable*, unsigned int>& pair : this->sortedObjectList_) 189 pair.second = (int)((pair.first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f); 191 190 192 191 this->sortedObjectList_.sort(compareDistance); … … 209 208 bool nextHasToBeSelected = false; 210 209 211 for (std::list<std::pair<RadarViewable*, unsigned int> 210 for (std::list<std::pair<RadarViewable*, unsigned int>>::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++markerCount, ++listIt) 212 211 { 213 212 … … 469 468 if(!it->second.selected_ 470 469 || it->first->getRVVelocity().squaredLength() == 0 471 || pawn == NULL470 || pawn == nullptr 472 471 /* TODO : improve getTeam in such a way that it works 473 * || humanPawn == NULL472 * || humanPawn == nullptr 474 473 * || pawn->getTeam() == humanPawn->getTeam()*/) 475 474 { … … 525 524 float yScale = this->getActualSize().y; 526 525 527 for ( std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it)528 { 529 if ( it->second.health_ != NULL)530 it->second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale);531 if ( it->second.healthLevel_ != NULL)532 it->second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale);533 if ( it->second.panel_ != NULL)534 it->second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale);535 if ( it->second.text_ != NULL)536 it->second.text_->setCharHeight(this->textSize_ * yScale);537 if ( it->second.target_ != NULL)538 it->second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale);526 for (const auto& mapEntry : this->activeObjectList_) 527 { 528 if (mapEntry.second.health_ != nullptr) 529 mapEntry.second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale); 530 if (mapEntry.second.healthLevel_ != nullptr) 531 mapEntry.second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale); 532 if (mapEntry.second.panel_ != nullptr) 533 mapEntry.second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale); 534 if (mapEntry.second.text_ != nullptr) 535 mapEntry.second.text_->setCharHeight(this->textSize_ * yScale); 536 if (mapEntry.second.target_ != nullptr) 537 mapEntry.second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale); 539 538 } 540 539 } … … 546 545 547 546 if (this->activeObjectList_.size() >= this->markerLimit_) 548 if (object == NULL)547 if (object == nullptr) 549 548 return; 550 549 … … 634 633 } 635 634 636 for (std::list<std::pair<RadarViewable*, unsigned int> 635 for (std::list<std::pair<RadarViewable*, unsigned int>>::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt) 637 636 { 638 637 if ((listIt->first) == viewable) … … 664 663 { 665 664 const std::set<RadarViewable*>& respawnObjects = this->getOwner()->getScene()->getRadar()->getRadarObjects(); 666 for ( std::set<RadarViewable*>::const_iterator it = respawnObjects.begin(); it != respawnObjects.end(); ++it)667 { 668 if (! (*it)->isHumanShip_)669 this->addObject( *it);665 for (RadarViewable* respawnObject : respawnObjects) 666 { 667 if (!respawnObject->isHumanShip_) 668 this->addObject(respawnObject); 670 669 } 671 670 }
Note: See TracChangeset
for help on using the changeset viewer.