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/modules/overlays/hud/HUDNavigation.cc

    r11023 r11071  
    5353#include "core/config/ConfigValueIncludes.h"
    5454#include "tools/TextureGenerator.h"
    55 // #include <boost/bind/bind_template.hpp>
    5655
    5756
     
    6968    RegisterClass ( HUDNavigation );
    7069
    71     HUDNavigation* HUDNavigation::localHUD_s = 0;
     70    HUDNavigation* HUDNavigation::localHUD_s = nullptr;
    7271
    7372    HUDNavigation::HUDNavigation(Context* context) :
     
    132131        }
    133132        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_);
    138137        }
    139138    }
     
    152151        }
    153152        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);
    158157        }
    159158    }
     
    183182
    184183        Camera* cam = CameraManager::getInstance().getActiveCamera();
    185         if (cam == NULL)
     184        if (cam == nullptr)
    186185        return;
    187186        const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix();
    188187
    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);
    191190
    192191        this->sortedObjectList_.sort(compareDistance);
     
    209208        bool nextHasToBeSelected = false;
    210209
    211         for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++markerCount, ++listIt)
     210        for (std::list<std::pair<RadarViewable*, unsigned int>>::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++markerCount, ++listIt)
    212211        {
    213212
     
    469468                    if(!it->second.selected_
    470469                            || it->first->getRVVelocity().squaredLength() == 0
    471                             || pawn == NULL
     470                            || pawn == nullptr
    472471                            /* TODO : improve getTeam in such a way that it works
    473                              * || humanPawn == NULL
     472                             * || humanPawn == nullptr
    474473                             * || pawn->getTeam() == humanPawn->getTeam()*/)
    475474                    {
     
    525524        float yScale = this->getActualSize().y;
    526525
    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);
    539538        }
    540539    }
     
    546545
    547546        if (this->activeObjectList_.size() >= this->markerLimit_)
    548         if (object == NULL)
     547        if (object == nullptr)
    549548        return;
    550549
     
    634633        }
    635634
    636         for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt)
     635        for (std::list<std::pair<RadarViewable*, unsigned int>>::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt)
    637636        {
    638637            if ((listIt->first) == viewable)
     
    664663    {
    665664        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);
    670669        }
    671670    }
Note: See TracChangeset for help on using the changeset viewer.