Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11065


Ignore:
Timestamp:
Jan 17, 2016, 1:59:00 PM (9 years ago)
Author:
landauf
Message:

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

Location:
code/branches/cpp11_v3
Files:
53 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3/src/modules/hover/FlagHUD.cc

    r11043 r11065  
    4848        RegisterObject(FlagHUD);
    4949
    50         this->hoverGame_ = NULL;
     50        this->hoverGame_ = nullptr;
    5151        this->panel_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
    5252            .createOverlayElement("Panel", "FlagHUD_Panel_" + getUniqueNumberString()));
     
    101101        else
    102102        {
    103             this->hoverGame_ = 0;
     103            this->hoverGame_ = nullptr;
    104104        }
    105105    }
  • code/branches/cpp11_v3/src/modules/hover/FlagHUD.h

    r11041 r11065  
    4747        virtual ~FlagHUD();
    4848
    49         virtual void tick(float dt);
    50         virtual void changedOwner();
     49        virtual void tick(float dt) override;
     50        virtual void changedOwner() override;
    5151
    5252        void setFlagCount(int flagCount);
  • code/branches/cpp11_v3/src/modules/hover/Hover.cc

    r11043 r11065  
    4848        RegisterObject(Hover);
    4949
    50         this->origin_ = NULL;
     50        this->origin_ = nullptr;
    5151        this->numberOfFlags_ = 1;
    5252        this->firstTick_ = true;
  • code/branches/cpp11_v3/src/modules/hover/Hover.h

    r11043 r11065  
    5050            Hover(Context* context);
    5151
    52             virtual void tick(float dt);         
     52            virtual void tick(float dt) override;
    5353
    5454            void setOrigin(HoverOrigin* origin)
  • code/branches/cpp11_v3/src/modules/hover/HoverFlag.cc

    r11043 r11065  
    4949        RegisterObject(HoverFlag);
    5050
    51         this->model_ = NULL;
    52         this->cs_ = NULL;
     51        this->model_ = nullptr;
     52        this->cs_ = nullptr;
    5353        this->collided_ = false;
    5454
  • code/branches/cpp11_v3/src/modules/hover/HoverFlag.h

    r11042 r11065  
    5151            void init(int xCoordinate, int yCoordinate, int cellSize);
    5252
    53             virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint);           
     53            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    5454
    5555            inline bool getCollided() const
  • code/branches/cpp11_v3/src/modules/hover/HoverOrigin.cc

    r11040 r11065  
    5858    void HoverOrigin::checkGametype()
    5959    {
    60         if (getGametype() != NULL && this->getGametype()->isA(Class(Hover)))
     60        if (getGametype() != nullptr && this->getGametype()->isA(Class(Hover)))
    6161        {
    6262            Hover* hoverGametype = orxonox_cast<Hover*>(this->getGametype());
  • code/branches/cpp11_v3/src/modules/hover/HoverOrigin.h

    r11041 r11065  
    108108        public:
    109109            HoverOrigin(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Hover.
    110             virtual ~HoverOrigin() {}
    111             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a HoverOrigin through XML.
     110            virtual ~HoverOrigin() = default;
     111            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method to create a HoverOrigin through XML.
    112112           
    113113            inline void setNumCells(int numCells)
  • code/branches/cpp11_v3/src/modules/hover/HoverShip.h

    r11041 r11065  
    4444            HoverShip(Context* context);
    4545
    46             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    4848            /// sets this ships jumpBoost
     
    5353                { return this->jumpBoost_; }
    5454
    55             virtual void moveFrontBack(const Vector2& value);
     55            virtual void moveFrontBack(const Vector2& value) override;
    5656
    57             virtual void moveRightLeft(const Vector2& value);
     57            virtual void moveRightLeft(const Vector2& value) override;
    5858
    59             virtual void moveUpDown(const Vector2& value);
     59            virtual void moveUpDown(const Vector2& value) override;
    6060
    61             virtual void rotateYaw(const Vector2& value);
     61            virtual void rotateYaw(const Vector2& value) override;
    6262
    63             virtual void rotatePitch(const Vector2& value);
     63            virtual void rotatePitch(const Vector2& value) override;
    6464
    65             virtual void rotateRoll(const Vector2& value);
     65            virtual void rotateRoll(const Vector2& value) override;
    6666
    67             virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
     67            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override;
    6868
    69             virtual void boost(bool bBoost);
     69            virtual void boost(bool bBoost) override;
    7070
    7171        private:
  • code/branches/cpp11_v3/src/modules/hover/HoverWall.cc

    r11043 r11065  
    4646        RegisterObject(HoverWall);
    4747
    48         this->model_ = NULL;
    49         this->cs_ = NULL;
     48        this->model_ = nullptr;
     49        this->cs_ = nullptr;
    5050
    5151        this->enableCollisionCallback();
  • code/branches/cpp11_v3/src/modules/hover/TimeHUD.cc

    r11043 r11065  
    4747        this->time_ = 0.0f;
    4848        this->running_ = false;
    49         this->hoverGame_ = 0;
     49        this->hoverGame_ = nullptr;
    5050        setRunning(true);
    5151    }
     
    9898        else
    9999        {
    100             this->hoverGame_ = 0;
     100            this->hoverGame_ = nullptr;
    101101        }
    102102    }
  • code/branches/cpp11_v3/src/modules/hover/TimeHUD.h

    r11041 r11065  
    4545            TimeHUD(Context* context);
    4646
    47             virtual void tick(float dt);
    48             virtual void changedOwner();
     47            virtual void tick(float dt) override;
     48            virtual void changedOwner() override;
    4949
    5050            /// sets if the clock is running
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDEnemyShieldBar.cc

    r11052 r11065  
    4141
    4242        this->setConfigValues();
    43         this->owner_ = NULL;
     43        this->owner_ = nullptr;
    4444    }
    4545
     
    6262    void HUDEnemyShieldBar::updateTarget()
    6363    {
    64         Pawn* pawn = NULL;
     64        Pawn* pawn = nullptr;
    6565        if (this->owner_ && this->useEnemyBar_)
    6666        {
     
    7373            // Don't show the EnemyShieldBar if the pawn is invisible
    7474            if (pawn && !pawn->isVisible())
    75                 pawn = NULL;
     75                pawn = nullptr;
    7676        }
    7777        // Set the pawn as owner of the EnemyShieldBar
    7878        this->setShieldBarOwner(pawn);
    79         this->setVisible(pawn != NULL);
     79        this->setVisible(pawn != nullptr);
    8080    }
    8181
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDEnemyShieldBar.h

    r11052 r11065  
    4545
    4646            void setConfigValues();
    47             virtual void tick(float dt);
     47            virtual void tick(float dt) override;
    4848
    49             void changedOwner();
     49            virtual void changedOwner() override;
    5050
    5151        private:
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDRocketFuelBar.cc

    r11052 r11065  
    4040        RegisterObject(HUDRocketFuelBar);
    4141
    42         this->owner_ = NULL;
     42        this->owner_ = nullptr;
    4343    }
    4444
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDRocketFuelBar.h

    r11052 r11065  
    4949        virtual ~HUDRocketFuelBar();
    5050
    51         virtual void tick(float dt);
    52         virtual void changedOwner();
     51        virtual void tick(float dt) override;
     52        virtual void changedOwner() override;
    5353
    5454    private:
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDShieldBar.cc

    r11052 r11065  
    4141        RegisterObject(HUDShieldBar);
    4242
    43         this->owner_ = NULL;
     43        this->owner_ = nullptr;
    4444    }
    4545
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDShieldBar.h

    r11052 r11065  
    4949        virtual ~HUDShieldBar();
    5050
    51         virtual void tick(float dt);
    52         virtual void changedOwner();
     51        virtual void tick(float dt) override;
     52        virtual void changedOwner() override;
    5353
    5454        inline void setShieldBarOwner(Pawn* owner)
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDWeapon.cc

    r11059 r11065  
    7676        if (!weapon_)
    7777        {
    78             // TODO: destroy this HUD id the Weapon does no more exist. (Wehen the weak pointer is NULL)
     78            // TODO: destroy this HUD id the Weapon does no more exist. (Wehen the weak pointer is null)
    7979        }
    8080    }   
     
    114114        bool visible = this->isVisible();
    115115
    116         for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
    117         {
    118             (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
    119             (*it)->setVisible(visible);
     116        for (HUDWeaponMode* hudWeaponMode : hudWeaponModes_)
     117        {
     118            hudWeaponMode->changedVisibility(); //inform all Child Overlays that our visibility has changed
     119            hudWeaponMode->setVisible(visible);
    120120        }
    121121    }
     
    154154    void HUDWeapon::createHUDChilds()
    155155    {
    156         if (weapon_ == NULL)
     156        if (weapon_ == nullptr)
    157157        {
    158158            return;
     
    161161        int positionIndex = 0;
    162162
    163         for (std::multimap<unsigned int, WeaponMode*>::const_iterator it = weapon_->getAllWeaponmodes().begin(); it != weapon_->getAllWeaponmodes().end(); ++it)
     163        for (const auto& mapEntry : weapon_->getAllWeaponmodes())
    164164        {
    165165            HUDWeaponMode* hudWeaponMode = new HUDWeaponMode(this->getContext());
     
    167167            hudWeaponMode->setOverlayGroup(this->getOverlayGroup());
    168168            hudWeaponMode->setVisible(this->isVisible());
    169             hudWeaponMode->setWeaponMode(it->second);
     169            hudWeaponMode->setWeaponMode(mapEntry.second);
    170170            hudWeaponMode->setWeaponIndex(this->weaponIndex_);                   
    171171            hudWeaponMode->setAspectCorrection(false);
     
    182182        int positionIndex = 0;
    183183
    184         for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
    185         {
    186             (*it)->setPositionOffset(this->positionOffset_);
    187             (*it)->setWeaponModeIndex(positionIndex);
    188             (*it)->setWeaponIndex(this->weaponIndex_);
    189             (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
     184        for (HUDWeaponMode* hudWeaponMode : hudWeaponModes_)
     185        {
     186            hudWeaponMode->setPositionOffset(this->positionOffset_);
     187            hudWeaponMode->setWeaponModeIndex(positionIndex);
     188            hudWeaponMode->setWeaponIndex(this->weaponIndex_);
     189            hudWeaponMode->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
    190190
    191191            ++ positionIndex;
     
    195195    void HUDWeapon::destroyHUDChilds()
    196196    {
    197         for (std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)
    198         {
    199             (*it)->destroy();
     197        for (HUDWeaponMode* hudWeaponMode : hudWeaponModes_)
     198        {
     199            hudWeaponMode->destroy();
    200200        }
    201201
     
    205205    void HUDWeapon::updateSize()
    206206    {
    207         if (weapon_ != NULL)
     207        if (weapon_ != nullptr)
    208208        {
    209209            this->setSize(Vector2(weaponModeHUDActualSize_.x,weaponModeHUDActualSize_.y*weapon_->getAllWeaponmodes().size()));
     
    214214    void HUDWeapon::updatePosition()
    215215    {
    216         if (weapon_ != NULL)
     216        if (weapon_ != nullptr)
    217217        {
    218218            this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,0.0f) + this->positionOffset_);
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDWeapon.h

    r11064 r11065  
    5555        virtual ~HUDWeapon();
    5656
    57         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    58         virtual void tick(float dt);
    59         virtual void changedOwner();
    60         virtual void changedOverlayGroup();
    61         virtual void changedVisibility();
    62         virtual void changedName();
    63         virtual void positionChanged();
    64         virtual void sizeChanged();
     57        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     58        virtual void tick(float dt) override;
     59        virtual void changedOwner() override;
     60        virtual void changedOverlayGroup() override;
     61        virtual void changedVisibility() override;
     62        virtual void changedName() override;
     63        virtual void positionChanged() override;
     64        virtual void sizeChanged() override;
    6565
    6666        void setWeapon(Weapon* weapon);
     
    9494        WeakPtr<Weapon> weapon_;
    9595
    96         std::vector<WeakPtr<HUDWeaponMode> > hudWeaponModes_;
     96        std::vector<WeakPtr<HUDWeaponMode>> hudWeaponModes_;
    9797
    9898        Ogre::PanelOverlayElement* overlayElement_;
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDWeaponMode.cc

    r11063 r11065  
    126126            Munition* munition = this->weaponMode_->getMunition();
    127127
    128             if (munition != NULL)
     128            if (munition != nullptr)
    129129            {
    130130                MunitionDeployment deployment = munition->getMunitionDeployment();
     
    237237        Munition* munition = this->weaponMode_->getMunition();
    238238
    239         if (munition != NULL)
     239        if (munition != nullptr)
    240240        {
    241241            MunitionDeployment deployment = munition->getMunitionDeployment();
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDWeaponMode.h

    r11064 r11065  
    5757        virtual ~HUDWeaponMode();
    5858
    59         virtual void tick(float dt);
    60         virtual void changedOwner();
    61         virtual void changedOverlayGroup();
    62         virtual void changedVisibility();
    63         virtual void changedName();
    64         virtual void positionChanged();
    65         virtual void sizeChanged();
     59        virtual void tick(float dt) override;
     60        virtual void changedOwner() override;
     61        virtual void changedOverlayGroup() override;
     62        virtual void changedVisibility() override;
     63        virtual void changedName() override;
     64        virtual void positionChanged() override;
     65        virtual void sizeChanged() override;
    6666
    6767        void setWeaponMode(WeaponMode* weaponMode);
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDWeaponSystem.cc

    r11059 r11065  
    103103        bool visible = this->isVisible();
    104104
    105         for (std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)
     105        for (HUDWeapon* hudWeapon : hudWeapons_)
    106106        {
    107             (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
    108             (*it)->setVisible(visible);
     107            hudWeapon->changedVisibility(); //inform all Child Overlays that our visibility has changed
     108            hudWeapon->setVisible(visible);
    109109        }
    110110    }
     
    129129        {
    130130            const std::vector<WeaponPack*>& weaponPacks = owner_->getWeaponSystem()->getAllWeaponPacks();
    131 
    132             for (std::vector<WeaponPack*>::const_iterator itPacks = weaponPacks.begin(); itPacks != weaponPacks.end(); ++itPacks)
     131            for (WeaponPack* weaponPack : weaponPacks)
    133132            {
    134                 const std::vector<Weapon*>& weapons = (*itPacks)->getAllWeapons();
    135 
    136                 for (std::vector<Weapon*>::const_iterator itWeapons = weapons.begin(); itWeapons != weapons.end(); ++itWeapons)
     133                const std::vector<Weapon*>& weapons = weaponPack->getAllWeapons();
     134                for (Weapon* weapon : weapons)
    137135                {
    138                     this->weapons_.push_back(*itWeapons);
     136                    this->weapons_.push_back(weapon);
    139137                }
    140138            }
     
    149147        int positionIndex = 0;
    150148
    151         for (std::vector<WeakPtr<Weapon> >::iterator it = weapons_.begin(); it != weapons_.end(); ++it)
     149        for (Weapon* weapon : weapons_)
    152150        {
    153151            HUDWeapon* hudWeapon = new HUDWeapon(this->getContext());
     
    155153            hudWeapon->setOverlayGroup(this->getOverlayGroup());
    156154            hudWeapon->setVisible(this->isVisible());
    157             hudWeapon->setWeapon(*it);
     155            hudWeapon->setWeapon(weapon);
    158156            hudWeapon->setAspectCorrection(false);
    159157            hudWeapon->setPickPoint(Vector2(0.0f,0.0f));
     
    170168        Vector2 offset = this->getPosition();
    171169
    172         for (std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)
     170        for (HUDWeapon* hudWeapon : hudWeapons_)
    173171        {
    174             (*it)->setPositionOffset(offset);
    175             (*it)->setWeaponIndex(positionIndex);
    176             (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
     172            hudWeapon->setPositionOffset(offset);
     173            hudWeapon->setWeaponIndex(positionIndex);
     174            hudWeapon->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);
    177175
    178176            ++ positionIndex;
     
    182180    void HUDWeaponSystem::destroyHUDChilds()
    183181    {
    184         for (std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)
     182        for (HUDWeapon* hudWeapon : hudWeapons_)
    185183        {
    186             (*it)->destroy();
     184            hudWeapon->destroy();
    187185        }
    188186
  • code/branches/cpp11_v3/src/modules/overlays/hud/HUDWeaponSystem.h

    r11064 r11065  
    4949        virtual ~HUDWeaponSystem();
    5050
    51         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    52         virtual void changedOwner();
    53         virtual void changedOverlayGroup();
    54         virtual void changedVisibility();
    55         virtual void changedName();
    56         virtual void positionChanged();
    57         virtual void sizeChanged();
     51        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     52        virtual void changedOwner() override;
     53        virtual void changedOverlayGroup() override;
     54        virtual void changedVisibility() override;
     55        virtual void changedName() override;
     56        virtual void positionChanged() override;
     57        virtual void sizeChanged() override;
    5858    protected:
    5959        inline void setWeaponModeHUDSize(Vector2 vector)
     
    7171        WeakPtr<Pawn> owner_;
    7272
    73         std::vector<WeakPtr<Weapon> > weapons_;
    74         std::vector<WeakPtr<HUDWeapon> > hudWeapons_;
     73        std::vector<WeakPtr<Weapon>> weapons_;
     74        std::vector<WeakPtr<HUDWeapon>> hudWeapons_;
    7575
    7676        Vector2 weaponModeHUDSize_;
  • code/branches/cpp11_v3/src/modules/pickup/items/BoostPickup.cc

    r11052 r11065  
    106106
    107107        SpaceShip* ship = this->carrierToSpaceShipHelper();
    108         if(ship == NULL) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.
     108        if(ship == nullptr) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.
    109109            this->Pickupable::destroy();
    110110
     
    128128        Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails.
    129129    @return
    130         A pointer to the SpaceShip, or NULL if the conversion failed.
     130        A pointer to the SpaceShip, or nullptr if the conversion failed.
    131131    */
    132132    SpaceShip* BoostPickup::carrierToSpaceShipHelper(void)
     
    135135        SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier);
    136136
    137         if(ship == NULL)
     137        if(ship == nullptr)
    138138        {
    139139            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in BoostPickup." << endl;
  • code/branches/cpp11_v3/src/modules/pickup/items/BoostPickup.h

    r11052 r11065  
    5252            virtual ~BoostPickup(); //!< Destructor.
    5353
    54             virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a BoostPickup object through XML.
     54            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) override; //!< Method for creating a BoostPickup object through XML.
    5555
    56             virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
     56            virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around.
    5757            inline float getBoostRefill()
    5858                { return this->boostRefill_; }
  • code/branches/cpp11_v3/src/modules/pickup/items/MunitionContainer.h

    r11052 r11065  
    5353            virtual ~MunitionContainer();
    5454
    55             virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode);
     55            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) override;
    5656
    5757            inline const std::string& getMunitionName() const
  • code/branches/cpp11_v3/src/modules/pickup/items/MunitionPickup.cc

    r11052 r11065  
    8686    void MunitionPickup::addMunitionContainer(MunitionContainer* munitionContainer)
    8787    {
    88         OrxAssert(munitionContainer != NULL, "The munitionContainer cannot be NULL.");
     88        OrxAssert(munitionContainer != nullptr, "The munitionContainer cannot be nullptr.");
    8989        this->munitionContainers_.push_back(munitionContainer);
    9090    }
     
    9393    {
    9494        if(this->munitionContainers_.size() >= index)
    95             return NULL;
     95            return nullptr;
    9696        else
    9797            return this->munitionContainers_[index];
     
    108108        Pawn* pawn = this->carrierToPawnHelper();
    109109
    110         if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     110        if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    111111            this->Pickupable::destroy();
    112112
     
    114114        if(this->isUsed())
    115115        {
    116             for(std::vector<MunitionContainer*>::iterator it = this->munitionContainers_.begin(); it != this->munitionContainers_.end(); ++it)
     116            for(MunitionContainer* container : this->munitionContainers_)
    117117            {
    118118                //Get pointer to the appropriate munition
    119                 SubclassIdentifier<Munition> identifier = (*it)->getMunitionType();
     119                SubclassIdentifier<Munition> identifier = container->getMunitionType();
    120120                Munition* munition = pawn->getMunition(&identifier);
    121121                if (munition)
    122122                {
    123123                    // Add munition and magzines
    124                     munition->addMunition((*it)->getMunitionAmount());
    125                     munition->addMagazines((*it)->getMagazinesAmount());
     124                    munition->addMunition(container->getMunitionAmount());
     125                    munition->addMagazines(container->getMagazinesAmount());
    126126                }
    127                 (*it)->destroy();
     127                container->destroy();
    128128            }
    129129            // This will destroy the pickp
     
    140140        Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    141141    @return
    142         A pointer to the Pawn, or NULL if the conversion failed.
     142        A pointer to the Pawn, or nullptr if the conversion failed.
    143143    */
    144144    Pawn* MunitionPickup::carrierToPawnHelper(void)
     
    147147        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    148148
    149         if(pawn == NULL)
     149        if(pawn == nullptr)
    150150        {
    151151            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in MunitionPickup." << endl;
  • code/branches/cpp11_v3/src/modules/pickup/items/MunitionPickup.h

    r11064 r11065  
    5959            virtual ~MunitionPickup(); //!< Destructor.
    6060
    61             virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a MunitionPickup object through XML.
     61            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) override; //!< Method for creating a MunitionPickup object through XML.
    6262
    63             virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
     63            virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around.
    6464
    6565            void addMunitionContainer(MunitionContainer* munitionContainer);
  • code/branches/cpp11_v3/src/modules/weapons/projectiles/MineProjectile.cc

    r11054 r11065  
    112112        modelRing4_->yaw(Degree(270));
    113113
    114         emitter_ = NULL;
     114        emitter_ = nullptr;
    115115
    116116        if (GameMode::isMaster())
     
    217217            {
    218218                // Damage all pawns within the damage radius
    219                 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>().begin(); it; ++it)
     219                for (Pawn* pawn : ObjectList<Pawn>())
    220220                {
    221                     Vector3 distanceVector = it->getWorldPosition()-this->getWorldPosition();
     221                    Vector3 distanceVector = pawn->getWorldPosition()-this->getWorldPosition();
    222222                    if(distanceVector.length()< damageRadius_)
    223223                    {
    224                         it->hit(this->getShooter(), it->getWorldPosition(), NULL, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
     224                        pawn->hit(this->getShooter(), pawn->getWorldPosition(), nullptr, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
    225225                    }
    226226                }
  • code/branches/cpp11_v3/src/modules/weapons/projectiles/MineProjectile.h

    r11064 r11065  
    5757            virtual ~MineProjectile();
    5858
    59             virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
     59            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
    6060
    6161            void setMaxTimeUntilExplosion(float maxTimeUntilExplosion);
  • code/branches/cpp11_v3/src/modules/weapons/weaponmodes/MineGun.h

    r11052 r11065  
    5959            virtual ~MineGun();
    6060
    61             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    62             virtual void fire();
     61            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     62            virtual void fire() override;
    6363
    6464            inline float getMaxTimeUntilExplosion() const
  • code/branches/cpp11_v3/src/orxonox/controllers/ActionpointController.cc

    r11054 r11065  
    339339            inLoop = this->bInLoop_;
    340340
    341             Action::Value value;
     341            Action value;
    342342           
    343343            if ( actionName == "FIGHT" )
     
    371371            return this->actionpoints_[index];
    372372        else
    373             return 0;
     373            return nullptr;
    374374    }
    375375    //XML method
    376     Action::Value ActionpointController::getAction ()
     376    Action ActionpointController::getAction ()
    377377    {
    378378        return this->action_;
     
    401401    }
    402402    //XML method
    403     void ActionpointController::setAction (Action::Value action)
     403    void ActionpointController::setAction (Action action)
    404404    {
    405405        this->action_ = action;
    406406    }
    407407    //set action and target/protect
    408     void ActionpointController::setAction (Action::Value action, ControllableEntity* target)
     408    void ActionpointController::setAction (Action action, ControllableEntity* target)
    409409    {
    410410        if (!this || !this->getControllableEntity())
     
    423423    }
    424424    //set action and target position
    425     void ActionpointController::setAction (Action::Value action, const Vector3& target)
     425    void ActionpointController::setAction (Action action, const Vector3& target)
    426426    {
    427427        if (!this || !this->getControllableEntity())
     
    434434    }
    435435    //set action and target position and orientation
    436     void ActionpointController::setAction (Action::Value action, const Vector3& target,  const Quaternion& orient )
     436    void ActionpointController::setAction (Action action, const Vector3& target,  const Quaternion& orient )
    437437    {
    438438        if (!this || !this->getControllableEntity())
     
    476476                return;
    477477
    478             this->setTarget(0);
     478            this->setTarget(nullptr);
    479479            this->setTargetPosition(this->getControllableEntity()->getWorldPosition());
    480480            this->action_ = Action::NONE;
     
    506506                if (targetName == "")
    507507                    break;
    508                 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
    509                 {
    510                     if (!this || !this->getControllableEntity())
    511                         return;
    512                     if (CommonController::getName(*itP) == targetName)
     508                for (Pawn* pawn : ObjectList<Pawn>())
     509                {
     510                    if (!this || !this->getControllableEntity())
     511                        return;
     512                    if (CommonController::getName(pawn) == targetName)
    513513                    {
    514                         this->setTarget (static_cast<ControllableEntity*>(*itP));
     514                        this->setTarget (static_cast<ControllableEntity*>(pawn));
    515515                    }
    516516                }
     
    541541                if (protectName == "reservedKeyword:human")
    542542                {
    543                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
     543                    for (Pawn* pawn : ObjectList<Pawn>())
    544544                    {
    545                         if (orxonox_cast<ControllableEntity*>(*itP) && ((*itP)->getController()) && ((*itP)->getController()->getIdentifier()->getName() == "NewHumanController"))
     545                        if (orxonox_cast<ControllableEntity*>(pawn) && (pawn->getController()) && (pawn->getController()->getIdentifier()->getName() == "NewHumanController"))
    546546                        {
    547                             this->setProtect (static_cast<ControllableEntity*>(*itP));
     547                            this->setProtect (static_cast<ControllableEntity*>(pawn));
    548548                        }
    549549                    }
     
    551551                else
    552552                {
    553                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
     553                    for (Pawn* pawn : ObjectList<Pawn>())
    554554                    {
    555                         if (CommonController::getName(*itP) == protectName)
     555                        if (CommonController::getName(pawn) == protectName)
    556556                        {
    557                             this->setProtect (static_cast<ControllableEntity*>(*itP));
     557                            this->setProtect (static_cast<ControllableEntity*>(pawn));
    558558                        }
    559559                    }                           
     
    578578                std::string targetName = p.name;
    579579
    580                 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
    581                 {
    582                     if (CommonController::getName(*itP) == targetName)
     580                for (Pawn* pawn : ObjectList<Pawn>())
     581                {
     582                    if (CommonController::getName(pawn) == targetName)
    583583                    {
    584584                        if (!this || !this->getControllableEntity())
    585585                            return;
    586                         this->setTarget (static_cast<ControllableEntity*>(*itP));
     586                        this->setTarget (static_cast<ControllableEntity*>(pawn));
    587587                    }
    588588                }
     
    702702    {
    703703        if (!this || !this->getControllableEntity())
    704             return 0;
    705 
    706         Pawn* closestTarget = 0;
     704            return nullptr;
     705
     706        Pawn* closestTarget = nullptr;
    707707        float minDistance =  std::numeric_limits<float>::infinity();
    708708        Gametype* gt = this->getGametype();
    709         for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
     709        for (Pawn* pawn : ObjectList<Pawn>())
    710710        {
    711711            if (!this || !this->getControllableEntity())
    712                 return 0;
    713             if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
     712                return nullptr;
     713            if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), gt) )
    714714                continue;
    715715
    716             float distance = CommonController::distance (*itP, this->getControllableEntity());
     716            float distance = CommonController::distance (pawn, this->getControllableEntity());
    717717            if (distance < minDistance)
    718718            {
    719                 closestTarget = *itP;
     719                closestTarget = pawn;
    720720                minDistance = distance;
    721721            }
     
    725725           return closestTarget;
    726726        }
    727         return 0; 
     727        return nullptr;
    728728    }
    729729    //push action FIGHT to the stack and set target to the closest enemy
  • code/branches/cpp11_v3/src/orxonox/controllers/ActionpointController.h

    r11052 r11065  
    6565        All the demos are in a file called AITest.oxw. In the menu look for New AI Testing Level.
    6666    */
    67     namespace Action
     67    enum class Action
    6868    { 
    69         enum Value
    70         {
    71             NONE, FLY, FIGHT, PROTECT, FIGHTALL, ATTACK
    72         };
    73        
    74     }
     69        NONE, FLY, FIGHT, PROTECT, FIGHTALL, ATTACK
     70    };
    7571   
    7672    struct Point {
    77         Action::Value action;
     73        Action action;
    7874        std::string name;
    7975        Vector3 position;
    8076        bool inLoop;
    81     } ;
    82     namespace PickupType
    83     {
    84         enum Value
    85         { 
    86             NONE, DAMAGE, HEALTH, SPEED, PORTAL
    87         };
    88     }
     77    };
    8978
    9079    class _OrxonoxExport ActionpointController : public FightingController, public Tickable
     
    9483            ActionpointController(Context* context);
    9584            virtual ~ActionpointController();
    96             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);         
     85            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    9786               
    9887            /**
     
    10190                In tick ship flies and fires.
    10291            */
    103             virtual void tick(float dt);   
     92            virtual void tick(float dt) override;
    10493            /**
    10594            @brief
     
    186175            virtual void takeActionpoints (const std::vector<Point>& vector, const std::vector<Point>& loop, bool b);
    187176
    188             virtual Action::Value getAction ();
     177            virtual Action getAction ();
    189178            virtual std::string getActionName();
    190179
    191             void setAction (Action::Value action);
    192             void setAction (Action::Value action, ControllableEntity* target);
    193             void setAction (Action::Value action, const Vector3& target);
    194             void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
     180            void setAction (Action action);
     181            void setAction (Action action, ControllableEntity* target);
     182            void setAction (Action action, const Vector3& target);
     183            void setAction (Action action, const Vector3& target,  const Quaternion& orient );
    195184
    196185            virtual bool setWingman(ActionpointController* wingman)
     
    210199                WeakPtr<ActionpointController> myDivisionLeader_;
    211200            //----[Actionpoint information]----
    212                 Action::Value action_;
     201                Action action_;
    213202                std::string protectName_;
    214203                std::string targetName_;
    215                 std::vector<WeakPtr<WorldEntity> > actionpoints_;
     204                std::vector<WeakPtr<WorldEntity>> actionpoints_;
    216205                float squaredaccuracy_;
    217                 std::vector<Point > parsedActionpoints_;//<! actionpoints as they are stored here after being parsed from XML
    218                 std::vector<Point > loopActionpoints_;  //<! actionpoints that are to be looped
     206                std::vector<Point> parsedActionpoints_; //<! actionpoints as they are stored here after being parsed from XML
     207                std::vector<Point> loopActionpoints_;   //<! actionpoints that are to be looped
    219208                bool bInLoop_;                          //<! variable for addActionpoint method
    220209                bool bLoop_;                            //<! is state machine looping?
  • code/branches/cpp11_v3/src/orxonox/controllers/CommonController.cc

    r11052 r11065  
    8383        int team2 = entity2->getTeam();
    8484
    85         Controller* controller = 0;
     85        Controller* controller = nullptr;
    8686        if (entity1->getController())
    8787            controller = entity1->getController();
     
    120120        }
    121121
    122         TeamBaseMatchBase* base = 0;
     122        TeamBaseMatchBase* base = nullptr;
    123123        base = orxonox_cast<TeamBaseMatchBase*>(entity1);
    124124        if (base)
     
    154154        }
    155155
    156         DroneController* droneController = 0;
     156        DroneController* droneController = nullptr;
    157157        droneController = orxonox_cast<DroneController*>(entity1->getController());
    158158        if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity2)
  • code/branches/cpp11_v3/src/orxonox/controllers/DivisionController.cc

    r11058 r11065  
    4040        RegisterObject(DivisionController);
    4141        this->setFormationMode(FormationMode::DIAMOND);
    42         this->target_ = 0;
    43         this->myFollower_ = 0;
    44         this->myWingman_ = 0;
     42        this->target_ = nullptr;
     43        this->myFollower_ = nullptr;
     44        this->myWingman_ = nullptr;
    4545    }
    4646
    4747    DivisionController::~DivisionController()
    4848    {
    49         for (size_t i = 0; i < this->actionpoints_.size(); ++i)
     49        for (WorldEntity* actionpoint : this->actionpoints_)
    5050        {
    51             if(this->actionpoints_[i])
    52                 this->actionpoints_[i]->destroy();
     51            if (actionpoint)
     52                actionpoint->destroy();
    5353        }
    5454        this->parsedActionpoints_.clear();
  • code/branches/cpp11_v3/src/orxonox/controllers/DivisionController.h

    r11058 r11065  
    5151
    5252            //----[own functions]----
    53                 virtual bool setFollower(ActionpointController* newFollower);
    54                 virtual bool setWingman(ActionpointController* newWingman);
    55                 virtual bool hasWingman();
    56                 virtual bool hasFollower();
     53                virtual bool setFollower(ActionpointController* newFollower) override;
     54                virtual bool setWingman(ActionpointController* newWingman) override;
     55                virtual bool hasWingman() override;
     56                virtual bool hasFollower() override;
    5757               
    5858            //----[/own functions]----
    59             virtual void stayNearProtect();
     59            virtual void stayNearProtect() override;
    6060
    6161        protected:
    6262            //----action must only be managed by this----
    63             virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
     63            virtual void action() override; //<! action() is called in regular intervals managing the bot's behaviour.
    6464
    6565        private:
  • code/branches/cpp11_v3/src/orxonox/controllers/FightingController.cc

    r11057 r11065  
    238238    {
    239239        if (!this || !this->getControllableEntity())
    240             return 0;
    241 
    242         Pawn* closestTarget = 0;
     240            return nullptr;
     241
     242        Pawn* closestTarget = nullptr;
    243243        float minDistance =  std::numeric_limits<float>::infinity();
    244244        Gametype* gt = this->getGametype();
    245         for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
    246         {
    247             if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
     245        for (Pawn* pawn : ObjectList<Pawn>())
     246        {
     247            if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), gt) )
    248248                continue;
    249249
    250             float distance = CommonController::distance (*itP, this->getControllableEntity());
     250            float distance = CommonController::distance (pawn, this->getControllableEntity());
    251251            if (distance < minDistance)
    252252            {
    253                 closestTarget = *itP;
     253                closestTarget = pawn;
    254254                minDistance = distance;
    255255            }
     
    259259           return closestTarget;
    260260        }
    261         return 0; 
     261        return nullptr;
    262262    }
    263263    //I checked it out, rockets DO NOT cause any problems! this->getControllableEntity() is always a SpaceShip
     
    335335            {
    336336                this->weaponModes_.clear(); // reset previous weapon information
    337                 WeaponSlot* wSlot = 0;
     337                WeaponSlot* wSlot = nullptr;
    338338                for(int l=0; (wSlot = pawn->getWeaponSlot(l)) ; l++)
    339339                {
    340                     WeaponMode* wMode = 0;
     340                    WeaponMode* wMode = nullptr;
    341341                    for(int i=0; (wMode = wSlot->getWeapon()->getWeaponmode(i)) ; i++)
    342342                    {
     
    356356    }
    357357
    358     int FightingController::getFiremode(std::string name)
    359     {
    360         for (std::map< std::string, int >::iterator it = this->weaponModes_.begin(); it != this->weaponModes_.end(); ++it)
    361         {
    362             if (it->first == name)
    363                 return it->second;
     358    int FightingController::getFiremode(const std::string& name)
     359    {
     360        for (const auto& mapEntry : this->weaponModes_)
     361        {
     362            if (mapEntry.first == name)
     363                return mapEntry.second;
    364364        }
    365365        return -1;
  • code/branches/cpp11_v3/src/orxonox/controllers/FightingController.h

    r11057 r11065  
    7272                                                                        //<! this and target_ plus or minus some amount in difference vector direction,
    7373                                                                        //<! depending on whether it is better to close up or survive.
    74             void dodgeTowards (Vector3& position);  //fly towards position and awoid being hit
    7574            void doFire();  //<! choose weapon, set aim at target_ and fire
    7675            WeakPtr<ControllableEntity> target_;
     
    9796            void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed.
    9897            bool bSetupWorked; //<! If false, setupWeapons() is called.
    99             int getFiremode(std::string name);
     98            int getFiremode(const std::string& name);
    10099         
    101100    };
  • code/branches/cpp11_v3/src/orxonox/controllers/FlyingController.cc

    r11052 r11065  
    6161    }
    6262   
    63     void FlyingController::setFormationModeXML(std::string val)
     63    void FlyingController::setFormationModeXML(const std::string& val)
    6464    {
    6565        const std::string valUpper = getUppercase(val);
    66         FormationMode::Value value;
     66        FormationMode value;
    6767       
    6868        if (valUpper == "WALL")
     
    233233            return;
    234234        SpaceShip* ship = orxonox_cast<SpaceShip*>(this->getControllableEntity());
    235         if(ship == NULL) return;
     235        if(ship == nullptr) return;
    236236        if(ship->getBoostPower()*1.5f > ship->getInitialBoostPower()) //upper limit ->boost
    237237        {
  • code/branches/cpp11_v3/src/orxonox/controllers/FlyingController.h

    r11052 r11065  
    4141
    4242    //Formation mode for the divisions
    43     namespace FormationMode
     43    enum class FormationMode
    4444    {
    45         enum Value
    46         {
    47             FINGER4, DIAMOND, WALL
    48         };
    49     }
     45        FINGER4, DIAMOND, WALL
     46    };
    5047
    5148    class _OrxonoxExport FlyingController : public CommonController
     
    5855            FlyingController(Context* context);
    5956            virtual ~FlyingController();
    60             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     57            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    6158
    6259            void setSpread (int spread)                         //<! spread is a multiplier for formation flight, should be bigger than 100
     
    6562                { return this->spread_; }
    6663
    67             void setFormationModeXML(std::string val);
     64            void setFormationModeXML(const std::string& val);
    6865            std::string getFormationModeXML() const;
    6966
    70             void setFormationMode(FormationMode::Value val)
     67            void setFormationMode(FormationMode val)
    7168                { this->formationMode_ = val; }
    72             FormationMode::Value getFormationMode() const
     69            FormationMode getFormationMode() const
    7370                { return this->formationMode_; }
    7471            bool bCopyOrientation_;                             //<! set to true by default, MasterController sets it in its tick(),
     
    9188                                                                    //<! this stays in a certain position relative to leader     
    9289           
    93             FormationMode::Value formationMode_;
     90            FormationMode formationMode_;
    9491         
    9592            float rotationProgress_;    //<! for slerping
  • code/branches/cpp11_v3/src/orxonox/controllers/MasterController.cc

    r11054 r11065  
    5858        {
    5959            //fill the vector in the first tick
    60             for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>().begin(); it; ++it)
     60            for (ActionpointController* controller : ObjectList<ActionpointController>())
    6161            {
    6262                //----0ptr?----
    63                 if (!it)
     63                if (!controller)
    6464                    continue;
    65                 this->controllers_.push_back(*it);
     65                this->controllers_.push_back(controller);
    6666            }
    6767        }
  • code/branches/cpp11_v3/src/orxonox/controllers/MasterController.h

    r11052 r11065  
    6161
    6262            //----[orxonox demanded functions]----
    63                 virtual void tick(float dt);
     63                virtual void tick(float dt) override;
    6464
    6565            //----[orxonox demanded functions]----
     
    6868         
    6969        private:
    70             std::vector<WeakPtr<ActionpointController> > controllers_;  //<! vector of controllers, which action(), canFire() and maneuver() methods are to be called
     70            std::vector<WeakPtr<ActionpointController>> controllers_;//<! vector of controllers, which action(), canFire() and maneuver() methods are to be called
    7171            size_t indexOfCurrentController_;                        //<! index of current controller
    7272            unsigned int numberOfTicksPassedSinceLastActionCall_;
  • code/branches/cpp11_v3/src/orxonox/controllers/SectionController.cc

    r11058 r11065  
    4040        this->setFormationMode(FormationMode::FINGER4);
    4141
    42         this->myWingman_ = 0;
    43         this->myDivisionLeader_ = 0;
     42        this->myWingman_ = nullptr;
     43        this->myDivisionLeader_ = nullptr;
    4444        this->bFirstAction_ = true;
    4545
     
    4848    SectionController::~SectionController()
    4949    {
    50        for (size_t i = 0; i < this->actionpoints_.size(); ++i)
    51         {
    52             if(this->actionpoints_[i])
    53                 this->actionpoints_[i]->destroy();
     50        for (WorldEntity* actionpoint : this->actionpoints_)
     51        {
     52            if (actionpoint)
     53                actionpoint->destroy();
    5454        }
    5555        this->parsedActionpoints_.clear();
     
    117117    {
    118118        //----If division leader fights, cover him by fighting emenies close to his target----
    119         Action::Value action = this->myDivisionLeader_->getAction();
     119        Action action = this->myDivisionLeader_->getAction();
    120120
    121121        if (action == Action::FIGHT || action == Action::FIGHTALL || action == Action::ATTACK)
     
    133133                    Vector3 divisionTargetPosition = this->myDivisionLeader_->getTarget()->getWorldPosition();
    134134                    Gametype* gt = this->getGametype();
    135                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
     135                    for (Pawn* pawn : ObjectList<Pawn>())
    136136                    {
    137137                        //----is enemy?----
    138                         if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
     138                        if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), gt) )
    139139                            continue;           
    140140                        //----in range?----
    141                         if (((*itP)->getWorldPosition() - divisionTargetPosition).length() < 3000 &&
    142                             (*itP) != this->myDivisionLeader_->getTarget())
     141                        if ((pawn->getWorldPosition() - divisionTargetPosition).length() < 3000 &&
     142                            pawn != this->myDivisionLeader_->getTarget())
    143143                        {
    144144                            foundTarget = true;
    145                             target =  (*itP);
     145                            target = pawn;
    146146                            break;
    147147                        }
     
    212212
    213213        if (!this->getControllableEntity())
    214             return 0;
    215 
    216         ActionpointController* closestLeader = 0;
     214            return nullptr;
     215
     216        ActionpointController* closestLeader = nullptr;
    217217        float minDistance =  std::numeric_limits<float>::infinity();
    218218        //go through all pawns
    219         for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>().begin(); it; ++it)
     219        for (ActionpointController* controller : ObjectList<ActionpointController>())
    220220        {
    221221            //0ptr or not DivisionController?
    222             if (!(it) || !((it)->getIdentifier()->getName() == "DivisionController") || !(it->getControllableEntity()))
     222            if (!controller || !(controller->getIdentifier()->getName() == "DivisionController") || !(controller->getControllableEntity()))
    223223                continue;
    224224            //same team?
    225             if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()))
     225            if ((this->getControllableEntity()->getTeam() != controller->getControllableEntity()->getTeam()))
    226226                continue;
    227227
    228228            //is equal to this?
    229             if (orxonox_cast<ControllableEntity*>(*it) == this->getControllableEntity())
     229            if (orxonox_cast<ControllableEntity*>(controller) == this->getControllableEntity())
    230230                continue;
    231231
    232             float distance = CommonController::distance (it->getControllableEntity(), this->getControllableEntity());
     232            float distance = CommonController::distance (controller->getControllableEntity(), this->getControllableEntity());
    233233           
    234             if (distance < minDistance && !(it->hasFollower()))
    235             {
    236                 closestLeader = *it;
     234            if (distance < minDistance && !(controller->hasFollower()))
     235            {
     236                closestLeader = controller;
    237237                minDistance = distance;
    238238            }
     
    244244                return closestLeader;
    245245        }
    246         return 0;
     246        return nullptr;
    247247    }
    248248
  • code/branches/cpp11_v3/src/orxonox/controllers/SectionController.h

    r11058 r11065  
    5252                ActionpointController* findNewDivisionLeader();
    5353
    54                 virtual bool setWingman(ActionpointController* newWingman);
    55                 virtual bool hasWingman();
    56                 virtual bool hasFollower()
     54                virtual bool setWingman(ActionpointController* newWingman) override;
     55                virtual bool hasWingman() override;
     56                virtual bool hasFollower() override
    5757                    { return false; }
    5858                void chooseTarget();
     
    6161        protected:       
    6262            //----action must only be managed by this----     
    63                 virtual void action(); //<! action() is called in regular intervals by MasterController managing the bot's behaviour.
     63                virtual void action() override; //<! action() is called in regular intervals by MasterController managing the bot's behaviour.
    6464                Vector3 getFormationPosition ();
    6565                void keepFormation();
  • code/branches/cpp11_v3/src/orxonox/controllers/WingmanController.cc

    r11058 r11065  
    3939    {
    4040        RegisterObject(WingmanController);
    41         this->myLeader_ = 0;
     41        this->myLeader_ = nullptr;
    4242        this->bFirstAction_ = true;
    4343
     
    4646    WingmanController::~WingmanController()
    4747    {
    48         for (size_t i = 0; i < this->actionpoints_.size(); ++i)
    49         {
    50             if(this->actionpoints_[i])
    51                 this->actionpoints_[i]->destroy();
     48        for (WorldEntity* actionpoint : this->actionpoints_)
     49        {
     50            if (actionpoint)
     51                actionpoint->destroy();
    5252        }
    5353        this->parsedActionpoints_.clear();
     
    170170
    171171        if (!this->getControllableEntity())
    172             return 0;
     172            return nullptr;
    173173
    174174        //----vars for finding the closest leader----
    175         ActionpointController* closestLeader = 0;
     175        ActionpointController* closestLeader = nullptr;
    176176        float minDistance =  std::numeric_limits<float>::infinity();
    177177        Gametype* gt = this->getGametype();
    178178
    179         for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>().begin(); it; ++it)
     179        for (ActionpointController* controller : ObjectList<ActionpointController>())
    180180        {
    181181            //----0ptr or not a leader or dead?----
    182             if (!it ||
    183                 (it->getIdentifier()->getName() != "SectionController" && it->getIdentifier()->getName() != "DivisionController") ||
    184                 !(it->getControllableEntity()))
     182            if (!controller ||
     183                (controller->getIdentifier()->getName() != "SectionController" && controller->getIdentifier()->getName() != "DivisionController") ||
     184                !(controller->getControllableEntity()))
    185185                continue;
    186186           
    187187            //----same team?----
    188             if ( !CommonController::sameTeam (this->getControllableEntity(), (it)->getControllableEntity(), gt) )
     188            if ( !CommonController::sameTeam (this->getControllableEntity(), controller->getControllableEntity(), gt) )
    189189                continue;
    190190           
    191191            //----check distance----
    192             float distance = CommonController::distance (it->getControllableEntity(), this->getControllableEntity());
    193             if (distance < minDistance && !(it->hasWingman()))
    194             {
    195                 closestLeader = *it;
     192            float distance = CommonController::distance (controller->getControllableEntity(), this->getControllableEntity());
     193            if (distance < minDistance && !(controller->hasWingman()))
     194            {
     195                closestLeader = controller;
    196196                minDistance = distance;
    197197            }
     
    207207            }
    208208        }
    209         return 0;
     209        return nullptr;
    210210    }
    211211
  • code/branches/cpp11_v3/src/orxonox/controllers/WingmanController.h

    r11058 r11065  
    5151           
    5252            //----[orxonox demanded functions]----
    53                 virtual bool hasWingman()
     53                virtual bool hasWingman() override
    5454                    { return false; }
    55                 virtual bool hasFollower()
     55                virtual bool hasFollower() override
    5656                    { return false; }
    5757            //----[/orxonox demanded functions]----
     
    6363        protected:
    6464            //----action must only be managed by this----
    65                 virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
     65                virtual void action() override; //<! action() is called in regular intervals managing the bot's behaviour.
    6666                Vector3 getFormationPosition ();
    6767                void keepFormation();
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/Munition.cc

    r11062 r11065  
    345345            std::map<WeaponMode*, Magazine*>::iterator it;
    346346
    347             // 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
     347            // If the pointer to the weapon mode whose magazine got munition added to is nullptr, then set the iterator to the beginning of the map
    348348            // Otherwise set it to the next weapon mode
    349349            if (lastFilledWeaponMode_ == nullptr)
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/ReplenishingMunition.h

    r11064 r11065  
    5252        public:
    5353            ReplenishingMunition(Context* context);
    54             virtual ~ReplenishingMunition() {}
     54            virtual ~ReplenishingMunition() = default;
    5555
    56             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     56            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5757           
    5858            float getProgress();
  • code/branches/cpp11_v3/src/orxonox/worldentities/Actionpoint.h

    r11052 r11065  
    9292        public:
    9393            Actionpoint(Context* context);
    94             virtual ~Actionpoint() {}
     94            virtual ~Actionpoint() = default;
    9595
    96             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     96            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    9797
    9898            /** @brief Decides what AI will do. @param val action to execute */
  • code/branches/cpp11_v3/src/orxonox/worldentities/ExplosionPart.cc

    r11052 r11065  
    4747        this->effect2_ = "";
    4848        this->model_= new Model(this->getContext());
    49         this->effect1Particle_= NULL;
    50         this->effect2Particle_= NULL;
     49        this->effect1Particle_= nullptr;
     50        this->effect2Particle_= nullptr;
    5151        this->explosionEntity_ = new MovableEntity(this->getContext());
    5252        this->posOffset_ = Vector3::ZERO;
  • code/branches/cpp11_v3/src/orxonox/worldentities/ExplosionPart.h

    r11052 r11065  
    5151            ExplosionPart(Context* context);
    5252            ~ExplosionPart();
    53             void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     53            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     54
    5455            void Explode();
    5556            void stop();
  • code/branches/cpp11_v3/test/core_plugin/PluginTest.cc

    r11054 r11065  
    2323                PluginTest()
    2424                {
    25                     this->plugin_ = NULL;
     25                    this->plugin_ = nullptr;
    2626                }
    2727
     
    4444                {
    4545                    delete this->plugin_;
    46                     this->plugin_ = NULL;
    47                 }
    48 
    49                 virtual void TearDown()
     46                    this->plugin_ = nullptr;
     47                }
     48
     49                virtual void TearDown() override
    5050                {
    5151                    // make sure the plugin is unloaded
     
    7777    TEST_F(PluginTest, LoadsIdentifier)
    7878    {
    79         EXPECT_TRUE(getIdentifier() == NULL);
    80         this->loadPlugin();
    81         EXPECT_TRUE(getIdentifier() != NULL);
     79        EXPECT_TRUE(getIdentifier() == nullptr);
     80        this->loadPlugin();
     81        EXPECT_TRUE(getIdentifier() != nullptr);
    8282        this->unloadPlugin();
    8383    }
     
    8686    {
    8787        this->loadPlugin();
    88         EXPECT_TRUE(getIdentifier() != NULL);
    89         this->unloadPlugin();
    90         EXPECT_TRUE(getIdentifier() == NULL);
     88        EXPECT_TRUE(getIdentifier() != nullptr);
     89        this->unloadPlugin();
     90        EXPECT_TRUE(getIdentifier() == nullptr);
    9191    }
    9292
     
    9494    {
    9595        this->loadPlugin();
    96         EXPECT_TRUE(getIdentifier() != NULL);
    97         this->unloadPlugin();
    98         EXPECT_TRUE(getIdentifier() == NULL);
    99         this->loadPlugin();
    100         EXPECT_TRUE(getIdentifier() != NULL);
     96        EXPECT_TRUE(getIdentifier() != nullptr);
     97        this->unloadPlugin();
     98        EXPECT_TRUE(getIdentifier() == nullptr);
     99        this->loadPlugin();
     100        EXPECT_TRUE(getIdentifier() != nullptr);
    101101        this->unloadPlugin();
    102102    }
     
    107107
    108108        Identifier* identifier = getIdentifier();
    109         ASSERT_TRUE(identifier != NULL);
    110 
    111         Identifiable* object = identifier->fabricate(NULL);
    112         ASSERT_TRUE(object != NULL);
     109        ASSERT_TRUE(identifier != nullptr);
     110
     111        Identifiable* object = identifier->fabricate(nullptr);
     112        ASSERT_TRUE(object != nullptr);
    113113
    114114        Testclass* testclass = orxonox_cast<Testclass*>(object);
    115         ASSERT_TRUE(testclass != NULL);
     115        ASSERT_TRUE(testclass != nullptr);
    116116
    117117        EXPECT_EQ(666, testclass->getValue());
     
    131131        std::vector<Testsingleton*> singletons;
    132132
    133         for (ObjectList<Listable>::iterator it = ObjectList<Listable>().begin(); it; ++it)
    134         {
    135             Testsingleton* singleton = dynamic_cast<Testsingleton*>(*it);
     133        for (Listable* listable : ObjectList<Listable>())
     134        {
     135            Testsingleton* singleton = dynamic_cast<Testsingleton*>(listable);
    136136            if (singleton)
    137137                singletons.push_back(singleton);
     
    141141        {
    142142            case 0:
    143                 return NULL;
     143                return nullptr;
    144144            case 1:
    145145                return singletons[0];
     
    151151    TEST_F(PluginTest, LoadsSingleton)
    152152    {
    153         EXPECT_TRUE(getSingleton() == NULL);
    154         this->loadPlugin();
    155         EXPECT_TRUE(getSingleton() != NULL);
     153        EXPECT_TRUE(getSingleton() == nullptr);
     154        this->loadPlugin();
     155        EXPECT_TRUE(getSingleton() != nullptr);
    156156        this->unloadPlugin();
    157157    }
     
    160160    {
    161161        this->loadPlugin();
    162         EXPECT_TRUE(getSingleton() != NULL);
    163         this->unloadPlugin();
    164         EXPECT_TRUE(getSingleton() == NULL);
     162        EXPECT_TRUE(getSingleton() != nullptr);
     163        this->unloadPlugin();
     164        EXPECT_TRUE(getSingleton() == nullptr);
    165165    }
    166166
     
    168168    {
    169169        this->loadPlugin();
    170         EXPECT_TRUE(getSingleton() != NULL);
    171         this->unloadPlugin();
    172         EXPECT_TRUE(getSingleton() == NULL);
    173         this->loadPlugin();
    174         EXPECT_TRUE(getSingleton() != NULL);
     170        EXPECT_TRUE(getSingleton() != nullptr);
     171        this->unloadPlugin();
     172        EXPECT_TRUE(getSingleton() == nullptr);
     173        this->loadPlugin();
     174        EXPECT_TRUE(getSingleton() != nullptr);
    175175        this->unloadPlugin();
    176176    }
     
    181181
    182182        Testsingleton* singleton = getSingleton();
    183         ASSERT_TRUE(singleton != NULL);
     183        ASSERT_TRUE(singleton != nullptr);
    184184
    185185        EXPECT_EQ(999, singleton->getValue());
     
    255255    TEST_F(PluginTest, LoadsConsoleCommand)
    256256    {
    257         EXPECT_TRUE(getConsoleCommand() == NULL);
    258         this->loadPlugin();
    259         EXPECT_TRUE(getConsoleCommand() != NULL);
     257        EXPECT_TRUE(getConsoleCommand() == nullptr);
     258        this->loadPlugin();
     259        EXPECT_TRUE(getConsoleCommand() != nullptr);
    260260        this->unloadPlugin();
    261261    }
     
    264264    {
    265265        this->loadPlugin();
    266         EXPECT_TRUE(getConsoleCommand() != NULL);
    267         this->unloadPlugin();
    268         EXPECT_TRUE(getConsoleCommand() == NULL);
     266        EXPECT_TRUE(getConsoleCommand() != nullptr);
     267        this->unloadPlugin();
     268        EXPECT_TRUE(getConsoleCommand() == nullptr);
    269269    }
    270270
     
    272272    {
    273273        this->loadPlugin();
    274         EXPECT_TRUE(getConsoleCommand() != NULL);
    275         this->unloadPlugin();
    276         EXPECT_TRUE(getConsoleCommand() == NULL);
    277         this->loadPlugin();
    278         EXPECT_TRUE(getConsoleCommand() != NULL);
     274        EXPECT_TRUE(getConsoleCommand() != nullptr);
     275        this->unloadPlugin();
     276        EXPECT_TRUE(getConsoleCommand() == nullptr);
     277        this->loadPlugin();
     278        EXPECT_TRUE(getConsoleCommand() != nullptr);
    279279        this->unloadPlugin();
    280280    }
     
    285285
    286286        ConsoleCommand* command = getConsoleCommand();
    287         ASSERT_TRUE(command != NULL);
     287        ASSERT_TRUE(command != nullptr);
    288288
    289289        EXPECT_EQ(999, (*command->getExecutor())(333, 666).get<int>());
Note: See TracChangeset for help on using the changeset viewer.