Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (9 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/pickup/CollectiblePickup.cc

    r10624 r11071  
    4747        Registers the object and initializes variables.
    4848    */
    49     CollectiblePickup::CollectiblePickup() : collection_(NULL)
     49    CollectiblePickup::CollectiblePickup() : collection_(nullptr)
    5050    {
    5151        RegisterObject(CollectiblePickup);
     
    103103    void CollectiblePickup::wasRemovedFromCollection(void)
    104104    {
    105         this->collection_ = NULL;
     105        this->collection_ = nullptr;
    106106    }
    107107}
  • code/trunk/src/modules/pickup/CollectiblePickup.h

    r9348 r11071  
    6161            virtual ~CollectiblePickup(); //! Destructor.
    6262
    63             virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    64             virtual void changedPickedUp(void); //!< Is called when the pickup has transited from picked up to dropped 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.
     64            virtual void changedPickedUp(void) override; //!< Is called when the pickup has transited from picked up to dropped or the other way around.
    6565
    6666            /**
     
    6969            */
    7070            bool isInCollection(void) const
    71                 { return this->collection_ != NULL; }
     71                { return this->collection_ != nullptr; }
    7272
    7373        private:
  • code/trunk/src/modules/pickup/Pickup.cc

    r9667 r11071  
    7878    void Pickup::initialize(void)
    7979    {
    80         this->activationType_ = pickupActivationType::immediate;
    81         this->durationType_ = pickupDurationType::once;
     80        this->activationType_ = PickupActivationType::immediate;
     81        this->durationType_ = PickupDurationType::once;
    8282    }
    8383
     
    105105        switch(this->getActivationType())
    106106        {
    107             case pickupActivationType::immediate:
     107            case PickupActivationType::immediate:
    108108                return activationTypeImmediate_s;
    109             case pickupActivationType::onUse:
     109            case PickupActivationType::onUse:
    110110                return activationTypeOnUse_s;
    111111            default:
     
    124124        switch(this->getDurationType())
    125125        {
    126             case pickupDurationType::once:
     126            case PickupDurationType::once:
    127127                return durationTypeOnce_s;
    128             case pickupDurationType::continuous:
     128            case PickupDurationType::continuous:
    129129                return durationTypeContinuous_s;
    130130            default:
     
    142142    {
    143143        if(type == Pickup::activationTypeImmediate_s)
    144             this->setActivationType(pickupActivationType::immediate);
     144            this->setActivationType(PickupActivationType::immediate);
    145145        else if(type == Pickup::activationTypeOnUse_s)
    146             this->setActivationType(pickupActivationType::onUse);
     146            this->setActivationType(PickupActivationType::onUse);
    147147        else
    148148            orxout(internal_error, context::pickups) << "Invalid activationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl;
     
    158158    {
    159159        if(type == Pickup::durationTypeOnce_s)
    160             this->setDurationType(pickupDurationType::once);
     160            this->setDurationType(PickupDurationType::once);
    161161        else if(type == Pickup::durationTypeContinuous_s)
    162             this->setDurationType(pickupDurationType::continuous);
     162            this->setDurationType(PickupDurationType::continuous);
    163163        else
    164164            orxout(internal_error, context::pickups) << "Invalid durationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl;
  • code/trunk/src/modules/pickup/Pickup.h

    r9667 r11071  
    5353    @ingroup Pickup
    5454    */
    55     namespace pickupActivationType
     55    enum class PickupActivationType
    5656    {
    57         enum Value
    58         {
    59             immediate, //!< Means that the @ref orxonox::Pickup "Pickup" will be used immediately after pickup.
    60             onUse, //!< Means that the @ref orxonox::Pickup "Pickup" will be used at a later point trough some external influence.
    61         };
    62     }
     57        immediate, //!< Means that the @ref orxonox::Pickup "Pickup" will be used immediately after pickup.
     58        onUse, //!< Means that the @ref orxonox::Pickup "Pickup" will be used at a later point trough some external influence.
     59    };
    6360
    6461    /**
     
    6865    @ingroup Pickup
    6966    */
    70     namespace pickupDurationType
     67    enum class PickupDurationType
    7168    {
    72         enum Value
    73         {
    74             once, //!< Means that the @ref orxonox::Pickup "Pickup" will be used only once at a singular time instant.
    75             continuous, //!< Means that the @ref orxonox::Pickup "Pickup" will be used over a continuous timespan.
    76         };
    77     }
     69        once, //!< Means that the @ref orxonox::Pickup "Pickup" will be used only once at a singular time instant.
     70        continuous, //!< Means that the @ref orxonox::Pickup "Pickup" will be used over a continuous timespan.
     71    };
    7872
    7973    /**
     
    10397            virtual ~Pickup(); //!< Destructor.
    10498
    105             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     99            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    106100
    107             virtual const std::string& getRepresentationName() const
     101            virtual const std::string& getRepresentationName() const override
    108102                { return this->representationName_; }
    109103
     
    112106            @return Returns the activation type of the Pickup.
    113107            */
    114             inline pickupActivationType::Value getActivationType(void) const
     108            inline PickupActivationType getActivationType(void) const
    115109                { return this->activationType_; }
    116110            /**
     
    118112            @return Returns the duration type of the Pickup.
    119113            */
    120             inline pickupDurationType::Value getDurationType(void) const
     114            inline PickupDurationType getDurationType(void) const
    121115                { return this->durationType_; }
    122116
     
    129123            */
    130124            inline bool isImmediate(void) const
    131                 { return this->getActivationType() == pickupActivationType::immediate; }
     125                { return this->getActivationType() == PickupActivationType::immediate; }
    132126            /**
    133127            @brief Get whether the activation type is 'onUse'.
     
    135129            */
    136130            inline bool isOnUse(void) const
    137                 { return this->getActivationType() == pickupActivationType::onUse; }
     131                { return this->getActivationType() == PickupActivationType::onUse; }
    138132            /**
    139133            @brief Get whether the duration type is 'once'.
     
    141135            */
    142136            inline bool isOnce(void) const
    143                 { return this->getDurationType() == pickupDurationType::once; }
     137                { return this->getDurationType() == PickupDurationType::once; }
    144138            /**
    145139            @brief Get whether the duration type is 'continuous'.
     
    147141            */
    148142            inline bool isContinuous(void) const
    149                 { return this->getDurationType() == pickupDurationType::continuous; }
     143                { return this->getDurationType() == PickupDurationType::continuous; }
    150144
    151             virtual void changedPickedUp(void); //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
     145            virtual void changedPickedUp(void) override; //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
    152146
    153147        protected:
    154             virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
     148            virtual bool createSpawner(void) override; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
    155149
    156150            /**
     
    164158            @param type The activation type of the Pickup.
    165159            */
    166             inline void setActivationType(pickupActivationType::Value type)
     160            inline void setActivationType(PickupActivationType type)
    167161                { this->activationType_ = type; }
    168162            /**
     
    170164            @param type The duration type of the Pickup.
    171165            */
    172             inline void setDurationType(pickupDurationType::Value type)
     166            inline void setDurationType(PickupDurationType type)
    173167                { this->durationType_ = type; }
    174168
     
    180174
    181175            std::string representationName_; //!< The name of the associated PickupRepresentation.
    182             pickupActivationType::Value activationType_; //!< The activation type of the Pickup.
    183             pickupDurationType::Value durationType_; //!< The duration type of the Pickup.
     176            PickupActivationType activationType_; //!< The activation type of the Pickup.
     177            PickupDurationType durationType_; //!< The duration type of the Pickup.
    184178
    185179            //! Strings for the activation and duration types.
  • code/trunk/src/modules/pickup/PickupCollection.cc

    r9667 r11071  
    6868    {
    6969        // Destroy all Pickupables constructing this PickupCollection.
    70         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    71         {
    72             (*it)->wasRemovedFromCollection();
    73             (*it)->destroy();
     70        for(CollectiblePickup* pickup : this->pickups_)
     71        {
     72            pickup->wasRemovedFromCollection();
     73            pickup->destroy();
    7474        }
    7575        this->pickups_.clear();
     
    9999        this->processingUsed_ = true;
    100100        // Change used for all Pickupables this PickupCollection consists of.
    101         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    102             (*it)->setUsed(this->isUsed());
     101        for(CollectiblePickup* pickup : this->pickups_)
     102            pickup->setUsed(this->isUsed());
    103103
    104104        this->processingUsed_ = false;
     
    119119        size_t numPickupsEnabled = 0;
    120120        size_t numPickupsInUse = 0;
    121         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    122         {
    123             if ((*it)->isEnabled())
     121        for(CollectiblePickup* pickup : this->pickups_)
     122        {
     123            if (pickup->isEnabled())
    124124                ++numPickupsEnabled;
    125             if ((*it)->isUsed())
     125            if (pickup->isUsed())
    126126                ++numPickupsInUse;
    127127        }
     
    146146
    147147        // Change the PickupCarrier for all Pickupables this PickupCollection consists of.
    148         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    149         {
    150             if(this->getCarrier() == NULL)
    151                 (*it)->setCarrier(NULL);
     148        for(CollectiblePickup* pickup : this->pickups_)
     149        {
     150            if(this->getCarrier() == nullptr)
     151                pickup->setCarrier(nullptr);
    152152            else
    153                 (*it)->setCarrier(this->getCarrier()->getTarget(*it));
     153                pickup->setCarrier(this->getCarrier()->getTarget(pickup));
    154154        }
    155155    }
     
    186186        // If at least all the enabled pickups of this PickupCollection are no longer picked up.
    187187        bool isOnePickupEnabledAndPickedUp = false;
    188         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    189         {
    190             if ((*it)->isEnabled() && (*it)->isPickedUp())
     188        for(CollectiblePickup* pickup : this->pickups_)
     189        {
     190            if (pickup->isEnabled() && pickup->isPickedUp())
    191191            {
    192192                isOnePickupEnabledAndPickedUp = true;
     
    208208    bool PickupCollection::isTarget(const PickupCarrier* carrier) const
    209209    {
    210         for(std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    211         {
    212             if(!carrier->isTarget(*it))
     210        for(CollectiblePickup* pickup : this->pickups_)
     211        {
     212            if(!carrier->isTarget(pickup))
    213213                return false;
    214214        }
     
    227227    bool PickupCollection::addPickupable(CollectiblePickup* pickup)
    228228    {
    229         if(pickup == NULL)
     229        if(pickup == nullptr)
    230230            return false;
    231231
     
    247247    {
    248248        if(this->pickups_.size() >= index)
    249             return NULL;
     249            return nullptr;
    250250
    251251        std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin();
  • code/trunk/src/modules/pickup/PickupCollection.h

    r9667 r11071  
    7373            virtual ~PickupCollection(); //!< Destructor.
    7474
    75             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates an instance of this Class through XML.
     75            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Creates an instance of this Class through XML.
    7676
    77             virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    78             virtual void changedCarrier(void); //!< Is called when the pickup has changed its PickupCarrier.
    79             virtual void changedPickedUp(void); //!< Is called when the pickup has transited from picked up to dropped or the other way around.
     77            virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around.
     78            virtual void changedCarrier(void) override; //!< Is called when the pickup has changed its PickupCarrier.
     79            virtual void changedPickedUp(void) override; //!< Is called when the pickup has transited from picked up to dropped or the other way around.
    8080
    81             virtual bool isTarget(const PickupCarrier* carrier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection.
     81            virtual bool isTarget(const PickupCarrier* carrier) const override; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection.
    8282
    8383            inline void setRepresentationName(const std::string& name)
    8484                { this->representationName_ = name; }
    85             virtual const std::string& getRepresentationName() const
     85            virtual const std::string& getRepresentationName() const override
    8686                { return this->representationName_; }
    8787
     
    9898
    9999        protected:
    100             virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
     100            virtual bool createSpawner(void) override; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
    101101
    102102        private:
  • code/trunk/src/modules/pickup/PickupManager.cc

    r10624 r11071  
    6868        Constructor. Registers the PickupManager and creates the default PickupRepresentation.
    6969    */
    70     PickupManager::PickupManager() : guiLoaded_(false), pickupHighestIndex_(0), defaultRepresentation_(NULL)
     70    PickupManager::PickupManager() : guiLoaded_(false), pickupHighestIndex_(0), defaultRepresentation_(nullptr)
    7171    {
    7272        RegisterObject(PickupManager);
     
    8585    {
    8686        // Destroying the default representation.
    87         if(this->defaultRepresentation_ != NULL)
     87        if(this->defaultRepresentation_ != nullptr)
    8888            this->defaultRepresentation_->destroy();
    8989
     
    9191
    9292        // Destroying all the PickupInventoryContainers that are still there.
    93         for(std::map<uint32_t, PickupInventoryContainer*>::iterator it = this->pickupInventoryContainers_.begin(); it != this->pickupInventoryContainers_.end(); it++)
    94             delete it->second;
     93        for(const auto& mapEntry : this->pickupInventoryContainers_)
     94            delete mapEntry.second;
    9595        this->pickupInventoryContainers_.clear();
    9696
     
    184184        CollectiblePickup* collectible = orxonox_cast<CollectiblePickup*>(pickup);
    185185        // If the Pickupable is part of a PickupCollection it isn't displayed in the PickupInventory, just the PickupCollection is.
    186         if(collectible != NULL && collectible->isInCollection())
     186        if(collectible != nullptr && collectible->isInCollection())
    187187            return;
    188188
    189189        // Getting clientId of the host this change of the pickup's used status concerns.
    190190        PickupCarrier* carrier = pickup->getCarrier();
    191         while(carrier->getCarrierParent() != NULL)
     191        while(carrier->getCarrierParent() != nullptr)
    192192            carrier = carrier->getCarrierParent();
    193193        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    194         if(pawn == NULL)
     194        if(pawn == nullptr)
    195195            return;
    196196        PlayerInfo* info = pawn->getPlayer();
    197         if(info == NULL)
     197        if(info == nullptr)
    198198            return;
    199199        unsigned int clientId = info->getClientID();
     
    265265        CollectiblePickup* collectible = orxonox_cast<CollectiblePickup*>(pickup);
    266266        // If the Pickupable is part of a PickupCollection it isn't displayed in the PickupInventory, just the PickupCollection is.
    267         if(collectible != NULL && collectible->isInCollection())
     267        if(collectible != nullptr && collectible->isInCollection())
    268268            return;
    269269
    270270        // Getting clientId of the host this change of the pickup's pickedUp status concerns.
    271271        PickupCarrier* carrier = pickup->getCarrier();
    272         while(carrier->getCarrierParent() != NULL)
     272        while(carrier->getCarrierParent() != nullptr)
    273273            carrier = carrier->getCarrierParent();
    274274        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    275         if(pawn == NULL)
     275        if(pawn == nullptr)
    276276            return;
    277277        PlayerInfo* info = pawn->getFormerPlayer();
    278         if(info == NULL)
     278        if(info == nullptr)
    279279            return;
    280280        unsigned int clientId = info->getClientID();
     
    399399                return;
    400400            Pickupable* pickupable = this->pickups_.find(pickup)->second;
    401             if(pickupable != NULL)
     401            if(pickupable != nullptr)
    402402                pickupable->drop();
    403403        }
     
    442442                return;
    443443            Pickupable* pickupable = this->pickups_.find(pickup)->second;
    444             if(pickupable != NULL)
     444            if(pickupable != nullptr)
    445445                pickupable->setUsed(use);
    446446        }
  • code/trunk/src/modules/pickup/PickupManager.h

    r10624 r11071  
    117117            PickupRepresentation* getRepresentation(const std::string& name); // tolua_export
    118118
    119             virtual void pickupChangedUsed(Pickupable* pickup, bool used); //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input used state.
     119            virtual void pickupChangedUsed(Pickupable* pickup, bool used) override; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input used state.
    120120            static void pickupChangedUsedNetwork(uint32_t pickup, bool inUse, bool usable, bool unusable); //!< Helper method to react to the change in the used status of a Pickupable.
    121             virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp); //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input pickedUp state.
     121            virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp) override; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input pickedUp state.
    122122            static void pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, uint32_t representationObjectId, const std::string& representationName, bool pickedUp); //!< Helper method to react to the change in the pickedUp status of a Pickupable.
    123123
     
    161161            std::map<uint32_t, PickupInventoryContainer*>::iterator pickupsIterator_; //!< An iterator pointing to the current Pickupable in pickupsList_.
    162162
    163             std::map<uint32_t, WeakPtr<Pickupable> > pickups_; //!< Map linking a number identifying a Pickupable to a weak pointer of a Pickupable.
     163            std::map<uint32_t, WeakPtr<Pickupable>> pickups_; //!< Map linking a number identifying a Pickupable to a weak pointer of a Pickupable.
    164164            std::map<Pickupable*, uint32_t> indexes_;//!< Map linking Pickupable to the number identifying it.
    165165
  • code/trunk/src/modules/pickup/PickupRepresentation.cc

    r11052 r11071  
    5252        This is primarily for use of the PickupManager in creating a default PickupRepresentation.
    5353    */
    54     PickupRepresentation::PickupRepresentation() : BaseObject(NULL), Synchronisable(NULL), spawnerRepresentation_(NULL)
     54    PickupRepresentation::PickupRepresentation() : BaseObject(nullptr), Synchronisable(nullptr), spawnerRepresentation_(nullptr)
    5555    {
    5656        RegisterObject(PickupRepresentation);
     
    6464        Default Constructor. Registers the object and initializes its member variables.
    6565    */
    66     PickupRepresentation::PickupRepresentation(Context* context) : BaseObject(context), Synchronisable(context), spawnerRepresentation_(NULL)
     66    PickupRepresentation::PickupRepresentation(Context* context) : BaseObject(context), Synchronisable(context), spawnerRepresentation_(nullptr)
    6767    {
    6868        RegisterObject(PickupRepresentation);
     
    7878    PickupRepresentation::~PickupRepresentation()
    7979    {
    80         if(this->spawnerRepresentation_ != NULL)
     80        if(this->spawnerRepresentation_ != nullptr)
    8181            this->spawnerRepresentation_->destroy();
    8282
     
    135135    StaticEntity* PickupRepresentation::createSpawnerRepresentation(PickupSpawner* spawner)
    136136    {
    137         if(this->spawnerRepresentation_ == NULL)
     137        if(this->spawnerRepresentation_ == nullptr)
    138138        {
    139139            orxout(verbose, context::pickups) << "PickupRepresentation: No spawner representation found." << endl;
     
    149149        this->spawnerRepresentation_->setVisible(true);
    150150        StaticEntity* temp = this->spawnerRepresentation_;
    151         this->spawnerRepresentation_ = NULL;
     151        this->spawnerRepresentation_ = nullptr;
    152152
    153153        return temp;
     
    164164    {
    165165        this->spawnerRepresentation_ = representation;
    166         if(this->spawnerRepresentation_ != NULL)
     166        if(this->spawnerRepresentation_ != nullptr)
    167167            this->spawnerRepresentation_->setVisible(false);
    168168    }
  • code/trunk/src/modules/pickup/PickupRepresentation.h

    r9667 r11071  
    9898            virtual ~PickupRepresentation(); //!< Destructor.
    9999
    100             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PickupRepresentation object through XML.
     100            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a PickupRepresentation object through XML.
    101101
    102102            /**
     
    119119            @brief Get the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like.
    120120            @param index The index.
    121             @return Returns (for index = 0) a pointer to the StaticEntity. For index > 0 it returns NULL.
     121            @return Returns (for index = 0) a pointer to the StaticEntity. For index > 0 it returns nullptr.
    122122            */
    123123            inline const StaticEntity* getSpawnerRepresentationIndex(unsigned int index) const
    124                 { if(index == 0) return this->spawnerRepresentation_; return NULL; }
     124                { if(index == 0) return this->spawnerRepresentation_; return nullptr; }
    125125            /**
    126126            @brief Get the name of the image representing the pickup in the PickupInventory.
     
    129129            inline const std::string& getInventoryRepresentation(void) const { return this->inventoryRepresentation_; } // tolua_export
    130130
    131             virtual void changedName();
     131            virtual void changedName() override;
    132132
    133133            StaticEntity* createSpawnerRepresentation(PickupSpawner* spawner); //!< Create a spawnerRepresentation for a specific PickupSpawner.
  • code/trunk/src/modules/pickup/PickupSpawner.cc

    r10624 r11071  
    5555        Pointer to the object which created this item.
    5656    */
    57     PickupSpawner::PickupSpawner(Context* context) : StaticEntity(context), pickup_(NULL), representation_(NULL), pickupTemplate_(NULL)
     57    PickupSpawner::PickupSpawner(Context* context) : StaticEntity(context), pickup_(nullptr), representation_(nullptr), pickupTemplate_(nullptr)
    5858    {
    5959        RegisterObject(PickupSpawner);
     
    7474        this->selfDestruct_ = false;
    7575
    76         this->setPickupable(NULL);
     76        this->setPickupable(nullptr);
    7777    }
    7878
     
    8383    PickupSpawner::~PickupSpawner()
    8484    {
    85         if(this->isInitialized() && this->selfDestruct_ && this->pickup_ != NULL)
     85        if(this->isInitialized() && this->selfDestruct_ && this->pickup_ != nullptr)
    8686            this->pickup_->destroy();
    8787    }
     
    158158
    159159            // Iterate trough all Pawns.
    160             for(ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
     160            for(Pawn* pawn : ObjectList<Pawn>())
    161161            {
    162                 if(spawner == NULL) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute).
     162                if(spawner == nullptr) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute).
    163163                    break;
    164164
    165                 Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
    166                 PickupCarrier* carrier = static_cast<PickupCarrier*>(*it);
     165                Vector3 distance = pawn->getWorldPosition() - this->getWorldPosition();
     166                PickupCarrier* carrier = static_cast<PickupCarrier*>(pawn);
    167167                // If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawner, is in trigger-distance and the carrier is not blocked.
    168                 if(distance.length() < this->triggerDistance_ && carrier != NULL && this->blocked_.find(carrier) == this->blocked_.end())
     168                if(distance.length() < this->triggerDistance_ && carrier != nullptr && this->blocked_.find(carrier) == this->blocked_.end())
    169169                {
    170170                    if(carrier->isTarget(this->pickup_))
    171                         this->trigger(*it);
     171                        this->trigger(pawn);
    172172                }
    173173            }
     
    195195        pickedUp = false; // To avoid compiler warning.
    196196
    197         this->setPickupable(NULL);
     197        this->setPickupable(nullptr);
    198198        this->decrementSpawnsRemaining();
    199199    }
     
    282282        {
    283283            orxout(internal_error, context::pickups) << "Massive Error: PickupSpawner still alive until having spawned last item." << endl;
    284             return NULL;
    285         }
    286 
    287         if (this->pickupTemplate_ != NULL)
     284            return nullptr;
     285        }
     286
     287        if (this->pickupTemplate_ != nullptr)
    288288        {
    289289            Identifier* identifier = this->pickupTemplate_->getBaseclassIdentifier();
    290             if (identifier != NULL)
     290            if (identifier != nullptr)
    291291            {
    292292                Pickupable* pickup = orxonox_cast<Pickupable*>(identifier->fabricate(this->getContext()));
     
    298298        }
    299299
    300         return NULL;
     300        return nullptr;
    301301    }
    302302
     
    309309    void PickupSpawner::setPickupable(Pickupable* pickup)
    310310    {
    311         if (this->representation_ != NULL)
     311        if (this->representation_ != nullptr)
    312312        {
    313313            this->representation_->destroy();
    314             this->representation_ = NULL;
    315         }
    316 
    317         if (pickup != NULL)
    318         {
    319             if (this->pickup_ != NULL)
     314            this->representation_ = nullptr;
     315        }
     316
     317        if (pickup != nullptr)
     318        {
     319            if (this->pickup_ != nullptr)
    320320                this->pickup_->destroy();
    321321
  • code/trunk/src/modules/pickup/PickupSpawner.h

    r9667 r11071  
    8282            static PickupSpawner* createDroppedPickup(Context* context, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance = 10.0);
    8383
    84             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< Method for creating a PickupSpawner through XML.
    85             virtual void tick(float dt); //!< Tick, checks if any Pawn is close enough to trigger.
     84            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;  //!< Method for creating a PickupSpawner through XML.
     85            virtual void tick(float dt) override; //!< Tick, checks if any Pawn is close enough to trigger.
    8686
    8787            /**
  • code/trunk/src/modules/pickup/items/BoostPickup.cc

    r11052 r11071  
    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/trunk/src/modules/pickup/items/BoostPickup.h

    r11052 r11071  
    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/trunk/src/modules/pickup/items/DamageBoostPickup.cc

    r9667 r11071  
    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
     
    152152        Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails.
    153153    @return
    154         A pointer to the SpaceShip, or NULL if the conversion failed.
     154        A pointer to the SpaceShip, or nullptr if the conversion failed.
    155155    */
    156156    SpaceShip* DamageBoostPickup::carrierToSpaceShipHelper(void)
     
    159159        SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier);
    160160
    161         if(ship == NULL)
     161        if(ship == nullptr)
    162162        {
    163163            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in DamageBoostPickup." << endl;
  • code/trunk/src/modules/pickup/items/DronePickup.cc

    r9667 r11071  
    7474    {
    7575        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
    76         this->setDurationType(pickupDurationType::once);
     76        this->setDurationType(PickupDurationType::once);
    7777        this->droneTemplate_ = "";
    7878    }
     
    122122
    123123                Pawn* pawn = this->carrierToPawnHelper();
    124                 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     124                if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    125125                    this->Pickupable::destroy();
    126126
     
    131131                Controller* controller = drone->getController();
    132132                DroneController* droneController = orxonox_cast<DroneController*>(controller);
    133                 if(droneController != NULL)
     133                if(droneController != nullptr)
    134134                {
    135135                    droneController->setOwner(pawn);
     
    156156        Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    157157    @return
    158         A pointer to the Pawn, or NULL if the conversion failed.
     158        A pointer to the Pawn, or nullptr if the conversion failed.
    159159    */
    160160    Pawn* DronePickup::carrierToPawnHelper(void)
     
    163163        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    164164
    165         if(pawn == NULL)
     165        if(pawn == nullptr)
    166166        {
    167167            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in DronePickup." << endl;
  • code/trunk/src/modules/pickup/items/HealthPickup.cc

    r9667 r11071  
    7777        this->health_ = 0.0f;
    7878        this->healthRate_ = 0.0f;
    79         this->healthType_ = pickupHealthType::limited;
     79        this->healthType_ = PickupHealthType::limited;
    8080        this->maxHealthSave_ = 0.0f;
    8181        this->maxHealthOverwrite_ = 0.0f;
     
    114114        {
    115115            Pawn* pawn = this->carrierToPawnHelper();
    116             if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     116            if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    117117                this->Pickupable::destroy();
    118118
     
    127127            switch(this->getHealthType())
    128128            {
    129                 case pickupHealthType::permanent:
     129                case PickupHealthType::permanent:
    130130                    if(pawn->getMaxHealth() < fullHealth)
    131131                        pawn->setMaxHealth(fullHealth);
    132                 case pickupHealthType::limited:
     132                case PickupHealthType::limited:
    133133                    pawn->addHealth(health);
    134134                    break;
    135                 case pickupHealthType::temporary:
     135                case PickupHealthType::temporary:
    136136                    if(pawn->getMaxHealth() > fullHealth)
    137137                    {
     
    168168            {
    169169                Pawn* pawn = this->carrierToPawnHelper();
    170                 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     170                if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    171171                    this->Pickupable::destroy();
    172172
     
    174174                switch(this->getHealthType())
    175175                {
    176                     case pickupHealthType::permanent:
     176                    case PickupHealthType::permanent:
    177177                        health = pawn->getHealth()+this->getHealth();
    178178                        if(pawn->getMaxHealth() < health)
    179179                            pawn->setMaxHealth(health);
    180                     case pickupHealthType::limited:
     180                    case PickupHealthType::limited:
    181181                        pawn->addHealth(this->getHealth());
    182182                        break;
    183                     case pickupHealthType::temporary:
     183                    case PickupHealthType::temporary:
    184184                        health = pawn->getHealth()+this->getHealth();
    185185                        if(pawn->getMaxHealth() < health)
     
    201201        else
    202202        {
    203             if(this->getHealthType() == pickupHealthType::temporary)
     203            if(this->getHealthType() == PickupHealthType::temporary)
    204204            {
    205205                PickupCarrier* carrier = this->getCarrier();
    206206                Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    207207
    208                 if(pawn == NULL)
     208                if(pawn == nullptr)
    209209                {
    210210                    orxout(internal_error, context::pickups) << "Something went horribly wrong in Health Pickup. PickupCarrier is '" << carrier->getIdentifier()->getName() << "' instead of Pawn." << endl;
     
    233233        Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    234234    @return
    235         A pointer to the Pawn, or NULL if the conversion failed.
     235        A pointer to the Pawn, or nullptr if the conversion failed.
    236236    */
    237237    Pawn* HealthPickup::carrierToPawnHelper(void)
     
    240240        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    241241
    242         if(pawn == NULL)
     242        if(pawn == nullptr)
    243243            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in HealthPickup." << endl;
    244244
     
    256256        switch(this->getHealthType())
    257257        {
    258             case pickupHealthType::limited:
     258            case PickupHealthType::limited:
    259259                return HealthPickup::healthTypeLimited_s;
    260             case pickupHealthType::temporary:
     260            case PickupHealthType::temporary:
    261261                return HealthPickup::healthTypeTemporary_s;
    262             case pickupHealthType::permanent:
     262            case PickupHealthType::permanent:
    263263                return HealthPickup::healthTypePermanent_s;
    264264            default:
     
    308308    {
    309309        if(type == HealthPickup::healthTypeLimited_s)
    310             this->setHealthType(pickupHealthType::limited);
     310            this->setHealthType(PickupHealthType::limited);
    311311        else if(type == HealthPickup::healthTypeTemporary_s)
    312             this->setHealthType(pickupHealthType::temporary);
     312            this->setHealthType(PickupHealthType::temporary);
    313313        else if(type == HealthPickup::healthTypePermanent_s)
    314             this->setHealthType(pickupHealthType::permanent);
     314            this->setHealthType(PickupHealthType::permanent);
    315315        else
    316316            orxout(internal_error, context::pickups) << "Invalid healthType '" << type << "' in HealthPickup." << endl;
  • code/trunk/src/modules/pickup/items/HealthPickup.h

    r9667 r11071  
    5151    @ingroup PickupItems
    5252    */
    53     namespace pickupHealthType
     53    enum class PickupHealthType
    5454    {
    55         enum Value
    56         {
    57             limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health.
    58             temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use.
    59             permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health.
    60         };
    61     }
     55        limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health.
     56        temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use.
     57        permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health.
     58    };
    6259
    6360    /**
     
    115112            @return Returns the health type as an enum.
    116113            */
    117             inline pickupHealthType::Value getHealthType(void) const
     114            inline PickupHealthType getHealthType(void) const
    118115                { return this->healthType_; }
    119116            const std::string& getHealthTypeAsString(void) const; //!< Get the health type of this pickup.
     
    127124            @param type The type of this pickup as an enum.
    128125            */
    129             inline void setHealthType(pickupHealthType::Value type)
     126            inline void setHealthType(PickupHealthType type)
    130127                { this->healthType_ = type; }
    131128            void setHealthTypeAsString(const std::string& type); //!< Set the type of the HealthPickup.
     
    139136            float maxHealthSave_; //!< Helper to remember what the actual maxHealth of the Pawn was before we changed it.
    140137            float maxHealthOverwrite_; //!< Helper to remember with which value we overwrote the maxHealh, to detect if someone else changed it as well.
    141             pickupHealthType::Value healthType_; //!< The type of the HealthPickup.
     138            PickupHealthType healthType_; //!< The type of the HealthPickup.
    142139
    143140            //! Strings for the health types.
  • code/trunk/src/modules/pickup/items/InvisiblePickup.cc

    r9667 r11071  
    139139    {
    140140        Pawn* pawn = this->carrierToPawnHelper();
    141         if(pawn == NULL)
     141        if(pawn == nullptr)
    142142            return false;
    143143
     
    163163        Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    164164    @return
    165         A pointer to the Pawn, or NULL if the conversion failed.
     165        A pointer to the Pawn, or nullptr if the conversion failed.
    166166    */
    167167    Pawn* InvisiblePickup::carrierToPawnHelper(void)
     
    170170        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    171171
    172         if(pawn == NULL)
     172        if(pawn == nullptr)
    173173        {
    174174            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in InvisiblePickup." << endl;
  • code/trunk/src/modules/pickup/items/MetaPickup.cc

    r9667 r11071  
    7979        this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier());
    8080
    81         this->setDurationType(pickupDurationType::once);
    82         this->metaType_ = pickupMetaType::none;
     81        this->setDurationType(PickupDurationType::once);
     82        this->metaType_ = PickupMetaType::none;
    8383    }
    8484
     
    104104
    105105        // If the MetaPickup transited to used, and the metaType is not none.
    106         if(this->isUsed() && this->metaType_ != pickupMetaType::none)
     106        if(this->isUsed() && this->metaType_ != PickupMetaType::none)
    107107        {
    108108            PickupCarrier* carrier = this->getCarrier();
    109             if(this->getMetaType() != pickupMetaType::none && carrier != NULL)
     109            if(this->getMetaType() != PickupMetaType::none && carrier != nullptr)
    110110            {
    111111                // If the metaType is destroyCarrier, then the PickupCarrier is destroyed.
    112                 if(this->getMetaType() == pickupMetaType::destroyCarrier)
     112                if(this->getMetaType() == PickupMetaType::destroyCarrier)
    113113                {
    114114                    Pawn* pawn = orxonox_cast<Pawn*>(carrier);
     
    118118                std::set<Pickupable*> pickups = carrier->getPickups();
    119119                // Iterate over all Pickupables of the PickupCarrier.
    120                 for(std::set<Pickupable*>::iterator it = pickups.begin(); it != pickups.end(); it++)
     120                for(Pickupable* pickup : pickups)
    121121                {
    122                     Pickupable* pickup = (*it);
    123                     if(pickup == NULL || pickup == this)
     122                    if(pickup == nullptr || pickup == this)
    124123                        continue;
    125124
    126125                    // If the metaType is use, then the Pickupable is set to used.
    127                     if(this->getMetaType() == pickupMetaType::use && !pickup->isUsed())
     126                    if(this->getMetaType() == PickupMetaType::use && !pickup->isUsed())
    128127                    {
    129128                        pickup->setUsed(true);
    130129                    }
    131130                    // If the metaType is drop, then the Pickupable is dropped.
    132                     else if(this->getMetaType() == pickupMetaType::drop)
     131                    else if(this->getMetaType() == PickupMetaType::drop)
    133132                    {
    134133                        pickup->drop();
    135134                    }
    136135                    // If the metaType is destroy, then the Pickupable is destroyed.
    137                     else if(this->getMetaType() == pickupMetaType::destroy)
     136                    else if(this->getMetaType() == PickupMetaType::destroy)
    138137                    {
    139138                        pickup->Pickupable::destroy();
     
    155154        switch(this->getMetaType())
    156155        {
    157             case pickupMetaType::none:
     156            case PickupMetaType::none:
    158157                return MetaPickup::metaTypeNone_s;
    159             case pickupMetaType::use:
     158            case PickupMetaType::use:
    160159                return MetaPickup::metaTypeUse_s;
    161             case pickupMetaType::drop:
     160            case PickupMetaType::drop:
    162161                return MetaPickup::metaTypeDrop_s;
    163             case pickupMetaType::destroy:
     162            case PickupMetaType::destroy:
    164163                return MetaPickup::metaTypeDestroy_s;
    165             case pickupMetaType::destroyCarrier:
     164            case PickupMetaType::destroyCarrier:
    166165                return MetaPickup::metaTypeDestroyCarrier_s;
    167166            default:
     
    180179        if(type == MetaPickup::metaTypeNone_s)
    181180        {
    182             this->setMetaType(pickupMetaType::none);
     181            this->setMetaType(PickupMetaType::none);
    183182        }
    184183        else if(type == MetaPickup::metaTypeUse_s)
    185184        {
    186             this->setMetaType(pickupMetaType::use);
     185            this->setMetaType(PickupMetaType::use);
    187186        }
    188187        else if(type == MetaPickup::metaTypeDrop_s)
    189188        {
    190             this->setMetaType(pickupMetaType::drop);
     189            this->setMetaType(PickupMetaType::drop);
    191190        }
    192191        else if(type == MetaPickup::metaTypeDestroy_s)
    193192        {
    194             this->setMetaType(pickupMetaType::destroy);
     193            this->setMetaType(PickupMetaType::destroy);
    195194        }
    196195        else if(type == MetaPickup::metaTypeDestroyCarrier_s)
    197196        {
    198             this->setMetaType(pickupMetaType::destroyCarrier);
     197            this->setMetaType(PickupMetaType::destroyCarrier);
    199198        }
    200199        else
  • code/trunk/src/modules/pickup/items/MetaPickup.h

    r9667 r11071  
    4848    @ingroup PickupItems
    4949    */
    50     namespace pickupMetaType
     50    enum class PickupMetaType
    5151    {
    52         enum Value
    53         {
    54             none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing.
    55             use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables".
    56             drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables".
    57             destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables".
    58             destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier".
    59         };
    60     }
     52        none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing.
     53        use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables".
     54        drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables".
     55        destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables".
     56        destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier".
     57    };
    6158
    6259    /**
     
    10097            @return Returns an enum with the meta type of the MetaPickup.
    10198            */
    102             inline pickupMetaType::Value getMetaType(void) const
     99            inline PickupMetaType getMetaType(void) const
    103100                { return this->metaType_; }
    104101            const std::string& getMetaTypeAsString(void) const; //!< Get the meta type of this MetaPickup.
     
    109106            @param type The meta type as an enum.
    110107            */
    111             inline void setMetaType(pickupMetaType::Value type)
     108            inline void setMetaType(PickupMetaType type)
    112109                { this->metaType_ =  type; }
    113110            void setMetaTypeAsString(const std::string& type); //!< Set the meta type of this MetaPickup.
     
    116113            void initialize(void); //!< Initializes the member variables.
    117114
    118             pickupMetaType::Value metaType_; //!< The meta type of the MetaPickup, determines which actions are taken.
     115            PickupMetaType metaType_; //!< The meta type of the MetaPickup, determines which actions are taken.
    119116
    120117            //! Static strings for the meta types.
  • code/trunk/src/modules/pickup/items/MunitionContainer.h

    r11052 r11071  
    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/trunk/src/modules/pickup/items/MunitionPickup.cc

    r11052 r11071  
    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/trunk/src/modules/pickup/items/MunitionPickup.h

    r11052 r11071  
    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
    65             virtual void addMunitionContainer(MunitionContainer* munitionContainer);
     65            void addMunitionContainer(MunitionContainer* munitionContainer);
    6666            MunitionContainer* getMunitionContainer(unsigned int index);
    6767
  • code/trunk/src/modules/pickup/items/ShieldPickup.cc

    r9667 r11071  
    9999
    100100        Pawn* pawn = this->carrierToPawnHelper();
    101         if(pawn == NULL)
     101        if(pawn == nullptr)
    102102            this->Pickupable::destroy();
    103103
     
    143143    Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    144144    @return
    145     A pointer to the Pawn, or NULL if the conversion failed.
     145    A pointer to the Pawn, or nullptr if the conversion failed.
    146146    */
    147147    Pawn* ShieldPickup::carrierToPawnHelper(void)
     
    150150        Pawn* pawn = orxonox_cast<Pawn*>(carrier);
    151151
    152         if(pawn == NULL)
     152        if(pawn == nullptr)
    153153        {
    154154            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in ShieldPickup." << endl;
  • code/trunk/src/modules/pickup/items/ShrinkPickup.cc

    r10624 r11071  
    146146        {
    147147            Pawn* pawn = this->carrierToPawnHelper();
    148             if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     148            if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    149149            {
    150150                this->Pickupable::destroy();
     
    173173                //TODO: Deploy particle effect.
    174174                Pawn* pawn = this->carrierToPawnHelper();
    175                 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     175                if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    176176                    return;
    177177
     
    182182
    183183                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    184                 const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     184                const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();
    185185                int size = cameraPositions.size();
    186186                for(int index = 0; index < size; index++)
    187187                {
    188188                    CameraPosition* cameraPos = pawn->getCameraPosition(index);
    189                     if(cameraPos == NULL)
     189                    if(cameraPos == nullptr)
    190190                        continue;
    191191                    cameraPos->setPosition(cameraPos->getPosition()/factor);
     
    201201                //TODO: Deploy particle effect.
    202202                Pawn* pawn = this->carrierToPawnHelper();
    203                 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     203                if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    204204                    return;
    205205
     
    208208
    209209                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    210                 const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     210                const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();
    211211                int size = cameraPositions.size();
    212212                for(int index = 0; index < size; index++)
    213213                {
    214214                    CameraPosition* cameraPos = pawn->getCameraPosition(index);
    215                     if(cameraPos == NULL)
     215                    if(cameraPos == nullptr)
    216216                        continue;
    217217                    cameraPos->setPosition(cameraPos->getPosition()/this->shrinkFactor_);
     
    237237            {
    238238                Pawn* pawn = this->carrierToPawnHelper();
    239                 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     239                if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    240240                {
    241241                    this->Pickupable::destroy();
     
    263263
    264264                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    265                 const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     265                const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();
    266266                int size = cameraPositions.size();
    267267                for(int index = 0; index < size; index++)
    268268                {
    269269                    CameraPosition* cameraPos = pawn->getCameraPosition(index);
    270                     if(cameraPos == NULL)
     270                    if(cameraPos == nullptr)
    271271                        continue;
    272272                    cameraPos->setPosition(cameraPos->getPosition()/factor);
     
    277277            {
    278278                Pawn* pawn = this->carrierToPawnHelper();
    279                 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     279                if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    280280                    this->Pickupable::destroy();
    281281
     
    304304
    305305                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    306                 const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     306                const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();
    307307                int size = cameraPositions.size();
    308308                for(int index = 0; index < size; index++)
    309309                {
    310310                    CameraPosition* cameraPos = pawn->getCameraPosition(index);
    311                     if(cameraPos == NULL)
     311                    if(cameraPos == nullptr)
    312312                        continue;
    313313                    cameraPos->setPosition(cameraPos->getPosition()/factor);
  • code/trunk/src/modules/pickup/items/SpeedPickup.cc

    r9667 r11071  
    9999
    100100        SpaceShip* ship = this->carrierToSpaceShipHelper();
    101         if(ship == NULL) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.
     101        if(ship == nullptr) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.
    102102            this->Pickupable::destroy();
    103103
     
    143143        Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails.
    144144    @return
    145         A pointer to the SpaceShip, or NULL if the conversion failed.
     145        A pointer to the SpaceShip, or nullptr if the conversion failed.
    146146    */
    147147    SpaceShip* SpeedPickup::carrierToSpaceShipHelper(void)
     
    150150        SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier);
    151151
    152         if(ship == NULL)
     152        if(ship == nullptr)
    153153        {
    154154            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in SpeedPickup." << endl;
Note: See TracChangeset for help on using the changeset viewer.