Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11062


Ignore:
Timestamp:
Jan 13, 2016, 11:13:30 PM (9 years ago)
Author:
landauf
Message:

added c++11 features to code that was modified in presentationHS15

Location:
code/branches/cpp11_v3/src
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3/src/libraries/core/GUIManager.cc

    r11054 r11062  
    267267            ArgumentCompletionList names;
    268268            const std::vector<std::string> guis = GUIManager::getInstance().getLoadedGUIs();
    269             for (size_t i = 0; i < guis.size(); ++i)
    270                 names.push_back(ArgumentCompletionListElement(guis[i], getLowercase(guis[i])));
     269            for (const std::string gui : guis)
     270                names.push_back(ArgumentCompletionListElement(gui, getLowercase(gui)));
    271271            return names;
    272272        }
  • code/branches/cpp11_v3/src/libraries/core/module/Plugin.cc

    r11054 r11062  
    7979    {
    8080        // only load module if it isn't already loaded. otherwise merely activate it.
    81         if (this->moduleInstance_ == NULL)
     81        if (this->moduleInstance_ == nullptr)
    8282            this->loadModule();
    8383        else
     
    112112        Core::getInstance().unloadModule(this->moduleInstance_);
    113113        delete this->moduleInstance_;
    114         this->moduleInstance_ = NULL;
     114        this->moduleInstance_ = nullptr;
    115115    }
    116116    void Plugin::deactivateModule()
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDHealthBar.h

    r11061 r11062  
    112112                { this->owner_ = owner; }
    113113        protected:
    114             virtual void positionChanged();
    115             virtual void sizeChanged();
     114            virtual void positionChanged() override;
     115            virtual void sizeChanged() override;
    116116        private:
    117117            void positionText();
  • code/branches/cpp11_v3/src/modules/weapons/munitions/FusionMunition.h

    r11057 r11062  
    5252        public:
    5353            FusionMunition(Context* context);
    54             virtual ~FusionMunition() {}
     54            virtual ~FusionMunition() = default;
    5555    };
    5656}
  • code/branches/cpp11_v3/src/modules/weapons/munitions/GravityBombMunition.h

    r11057 r11062  
    2727        public:
    2828            GravityBombMunition(Context* context);
    29             virtual ~GravityBombMunition() {}
     29            virtual ~GravityBombMunition() = default;
    3030    };
    3131
  • code/branches/cpp11_v3/src/modules/weapons/munitions/IceMunition.h

    r11057 r11062  
    5252        public:
    5353            IceMunition(Context* context);
    54             virtual ~IceMunition() {}
     54            virtual ~IceMunition() = default;
    5555    };
    5656}
  • code/branches/cpp11_v3/src/modules/weapons/munitions/LaserMunition.h

    r11057 r11062  
    5252        public:
    5353            LaserMunition(Context* context);
    54             virtual ~LaserMunition() {}
     54            virtual ~LaserMunition() = default;
    5555    };
    5656}
  • code/branches/cpp11_v3/src/modules/weapons/munitions/LightningMunition.h

    r11057 r11062  
    5252        public:
    5353            LightningMunition(Context* context);
    54             virtual ~LightningMunition() {}
     54            virtual ~LightningMunition() = default;
    5555    };
    5656}
  • code/branches/cpp11_v3/src/modules/weapons/munitions/MineMunition.h

    r11057 r11062  
    5252        public:
    5353            MineMunition(Context* context);
    54             virtual ~MineMunition() {}
     54            virtual ~MineMunition() = default;
    5555    };
    5656}
  • code/branches/cpp11_v3/src/modules/weapons/munitions/RocketMunition.h

    r11057 r11062  
    5252        public:
    5353            RocketMunition(Context* context);
    54             virtual ~RocketMunition() {}
     54            virtual ~RocketMunition() = default;
    5555    };
    5656}
  • code/branches/cpp11_v3/src/modules/weapons/munitions/SplitMunition.h

    r11057 r11062  
    5252        public:
    5353            SplitMunition(Context* context);
    54             virtual ~SplitMunition() {}
     54            virtual ~SplitMunition() = default;
    5555    };
    5656}
  • code/branches/cpp11_v3/src/orxonox/gametypes/Dynamicmatch.cc

    r11054 r11062  
    8888    Dynamicmatch::~Dynamicmatch()
    8989    {
    90         for (std::set<Timer*>::iterator it = this->piggyTimers_.begin(); it != this->piggyTimers_.end(); ++it)
    91             delete (*it);
     90        for (Timer* timer : this->piggyTimers_)
     91            delete timer;
    9292    }
    9393
  • code/branches/cpp11_v3/src/orxonox/overlays/OverlayGroup.cc

    r11054 r11062  
    5151        {
    5252            ArgumentCompletionList names;
    53             for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>().begin(); it; ++it)
    54                 names.push_back(ArgumentCompletionListElement(it->getName(), getLowercase(it->getName())));
     53            for (OverlayGroup* overlayGroup : ObjectList<OverlayGroup>())
     54                names.push_back(ArgumentCompletionListElement(overlayGroup->getName(), getLowercase(overlayGroup->getName())));
    5555            return names;
    5656        }
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/Munition.cc

    r11054 r11062  
    5252        this->reloadTime_ = 0.5f;
    5353
    54         this->lastFilledWeaponMode_ = NULL;
     54        this->lastFilledWeaponMode_ = nullptr;
    5555    }
    5656
     
    200200                    magazine->munition_ = 0;
    201201
    202                     if (this->reload(NULL))
     202                    if (this->reload(nullptr))
    203203                        // Successfully reloaded, continue recursively
    204204                        return this->takeMunition(amount, 0);
     
    271271            if (it->first == lastFilledWeaponMode_)
    272272            {
    273                 lastFilledWeaponMode_ = NULL;
     273                lastFilledWeaponMode_ = nullptr;
    274274            }           
    275275            delete it->second;
     
    315315        {
    316316            // Stacking munition means, if a magazine gets full, the munition adds to a new magazine
    317             Magazine* magazine = this->getMagazine(NULL);
     317            Magazine* magazine = this->getMagazine(nullptr);
    318318            if (magazine)
    319319            {
     
    347347            // If the pointer to the weapon mode whose magazine got munition added to is NULL, then set the iterator to the beginning of the map
    348348            // Otherwise set it to the next weapon mode
    349             if (lastFilledWeaponMode_ == NULL)
     349            if (lastFilledWeaponMode_ == nullptr)
    350350            {
    351351                it = this->assignedMagazines_.begin();
     
    441441        for (unsigned int i = 0; i < addedMagazines; ++i)
    442442        {
    443             for (std::map<WeaponMode*, Magazine*>::iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)
    444             {
    445                 if (needReload(it->first))
    446                 {
    447                     reload(it->first);
     443            for (const auto& mapEntry : this->assignedMagazines_)
     444            {
     445                if (needReload(mapEntry.first))
     446                {
     447                    reload(mapEntry.first);
    448448                    break;
    449449                }
     
    523523            if (it->first == lastFilledWeaponMode_)
    524524            {
    525                 lastFilledWeaponMode_ = NULL;
     525                lastFilledWeaponMode_ = nullptr;
    526526            }
    527527            delete it->second;
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/Munition.h

    r11052 r11062  
    3939namespace orxonox
    4040{
    41     namespace MunitionDeployment
     41    enum class MunitionDeployment
    4242    {
    43         enum Value
    44         {
    45             Separate, // Every comsuming weapon mode has its own magazine. It is possible that one weapon mode is out of ammo while another still has some.
    46             Share, // All comsuming weapon modes take their munition from the same magazine. If this magazine is empty a new one is loaded.
    47             Stack // There is only one magazine where all the munition is stored. Use this deployment mode for heavy weapons loke rockets, bombs, ...
    48         };
    49     }
     43        Separate, // Every comsuming weapon mode has its own magazine. It is possible that one weapon mode is out of ammo while another still has some.
     44        Share, // All comsuming weapon modes take their munition from the same magazine. If this magazine is empty a new one is loaded.
     45        Stack // There is only one magazine where all the munition is stored. Use this deployment mode for heavy weapons loke rockets, bombs, ...
     46    };
    5047
    5148    class _OrxonoxExport Munition : public BaseObject
     
    6966            virtual ~Munition();
    7067
    71             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     68            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    7269
    7370            unsigned int getNumMunition(WeaponMode* user) const;
     
    8077            inline unsigned int getMaxMunitionPerMagazine() const
    8178                { return this->maxMunitionPerMagazine_; }
    82             inline MunitionDeployment::Value getMunitionDeployment() const
     79            inline MunitionDeployment getMunitionDeployment() const
    8380                { return deployment_; }
    8481
     
    115112            std::map<WeaponMode*, Magazine*> assignedMagazines_; // Maps weapon modes to magazines that are currently used.
    116113
    117             MunitionDeployment::Value deployment_; // Defines the behaviour how munition and magazines are distributed to the consuming weapon modes.
     114            MunitionDeployment deployment_; // Defines the behaviour how munition and magazines are distributed to the consuming weapon modes.
    118115
    119116            bool bAllowMunitionRefilling_;
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/Weapon.cc

    r11054 r11062  
    158158    void Weapon::updateMunition()
    159159    {
    160         for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    161             it->second->updateMunition();
     160        for (const auto& mapEnty : this->weaponmodes_)
     161            mapEnty.second->updateMunition();
    162162    }
    163163}
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponPack.cc

    r11059 r11062  
    159159    void WeaponPack::updateMunition()
    160160    {
    161         for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    162             (*it)->updateMunition();
     161        for (Weapon* weapon : this->weapons_)
     162            weapon->updateMunition();
    163163    }
    164164}
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSystem.cc

    r11059 r11062  
    312312        else
    313313        {
    314             return NULL;
     314            return nullptr;
    315315        }
    316316    }
     
    318318    void WeaponSystem::addMunition(Munition* munition)
    319319    {
    320         if (munition == NULL)
     320        if (munition == nullptr)
    321321        {
    322322            return;
     
    338338    void WeaponSystem::updateMunition()
    339339    {
    340         for (std::vector<WeaponPack*>::iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
    341         {
    342             (*it)->updateMunition();
     340        for (WeaponPack* weaponPack : this->weaponPacks_)
     341        {
     342            weaponPack->updateMunition();
    343343        }
    344344    }
  • code/branches/cpp11_v3/src/orxonox/worldentities/TeamSpawnPoint.h

    r11054 r11062  
    4949            unsigned int getTeamNumber() const
    5050                { return this->teamNumber_; }
    51             virtual Pawn* spawn();
     51            virtual Pawn* spawn() override;
    5252
    5353        private:
  • code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Pawn.cc

    r11059 r11062  
    8686        this->aimPosition_ = Vector3::ZERO;
    8787
    88         //this->explosionPartList_ = NULL;
     88        //this->explosionPartList_ = nullptr;
    8989
    9090        if (GameMode::isMaster())
     
    523523    Munition* Pawn::getMunitionXML() const
    524524    {
    525         return NULL;
     525        return nullptr;
    526526    }
    527527
     
    533533        }
    534534
    535         return NULL;
     535        return nullptr;
    536536    }
    537537
Note: See TracChangeset for help on using the changeset viewer.