Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 10, 2016, 1:54:11 PM (9 years ago)
Author:
landauf
Message:

merged branch cpp11_v2 into cpp11_v3

Location:
code/branches/cpp11_v3
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/orxonox/interfaces/NotificationListener.cc

    r10624 r11054  
    108108    {
    109109        // Iterate through all NotificationListeners and notify them by calling the method they overloaded.
    110         for(ObjectList<NotificationListener>::iterator it = ObjectList<NotificationListener>::begin(); it != ObjectList<NotificationListener>::end(); ++it)
     110        for(NotificationListener* listener : ObjectList<NotificationListener>())
    111111        {
    112112            // If the notification is a message.
    113113            if(!isCommand)
    114                 it->registerNotification(message, sender, notificationMessageType::Value(messageType));
     114                listener->registerNotification(message, sender, notificationMessageType::Value(messageType));
    115115
    116116            // If the notification is a command.
     
    119119                notificationCommand::Value command = str2Command(message);
    120120                if(command != notificationCommand::none)
    121                     it->executeCommand(command, sender);
     121                    listener->executeCommand(command, sender);
    122122            }
    123123        }
  • code/branches/cpp11_v3/src/orxonox/interfaces/PickupCarrier.cc

    r10624 r11054  
    101101        // Go recursively through all children to check whether they are a target.
    102102        std::vector<PickupCarrier*>* children = this->getCarrierChildren();
    103         for(std::vector<PickupCarrier*>::const_iterator it = children->begin(); it != children->end(); it++)
     103        for(PickupCarrier* carrier : *children)
    104104        {
    105             if((*it)->isTarget(pickup))
     105            if(carrier->isTarget(pickup))
    106106            {
    107107                isTarget = true;
     
    127127    {
    128128        if(!this->isTarget(pickup))
    129             return NULL;
     129            return nullptr;
    130130
    131131        if(pickup->isTarget(this)) // If the PickupCarrier itself is a target.
    132132            return this;
    133133
    134         PickupCarrier* target = NULL;
     134        PickupCarrier* target = nullptr;
    135135        // Go recursively through all children to check whether they are the target.
    136136        std::vector<PickupCarrier*>* children = this->getCarrierChildren();
    137         for(std::vector<PickupCarrier*>::iterator it = children->begin(); it != children->end(); it++)
     137        for(PickupCarrier* child : *children)
    138138        {
    139             if(pickup->isTarget(*it))
     139            if(pickup->isTarget(child))
    140140            {
    141                 target = *it;
     141                target = child;
    142142                break;
    143143            }
  • code/branches/cpp11_v3/src/orxonox/interfaces/PickupCarrier.h

    r9667 r11054  
    5959        But this structure has to be established first.
    6060        - <b>getCarrierChildren()</b> To this end a PickupCarrier needs to implement getCarrierChildren() which returns a list of its direct PickupCarrier children. If you need an example, have a look at @ref orxonox::Pawn "Pawn" and @ref orxonox::Engine "Engine".
    61         - <b>getCarrierParent()</b> This is the method in the other direction. It returns the parent of this PickupCarrier, or NULL if the PickupCarrier is a root node in this hierarchy.
     61        - <b>getCarrierParent()</b> This is the method in the other direction. It returns the parent of this PickupCarrier, or nullptr if the PickupCarrier is a root node in this hierarchy.
    6262
    6363    @author
     
    7777            PickupCarrier(); //!< Constructor.
    7878            virtual ~PickupCarrier(); //!< Destructor.
    79             void preDestroy(void); //!< Is called before the PickupCarrier is effectively destroyed.
     79            virtual void preDestroy(void) override; //!< Is called before the PickupCarrier is effectively destroyed.
    8080
    8181            bool isTarget(const Pickupable* pickup) const; //!< Can be used to check whether the PickupCarrier or a child of his is a target ot the input Pickupable.
  • code/branches/cpp11_v3/src/orxonox/interfaces/PickupListener.cc

    r10624 r11054  
    7474
    7575        // Iterate through all PickupListeners and notify them by calling the method they overloaded.
    76         for(ObjectList<PickupListener>::iterator it = ObjectList<PickupListener>::begin(); it != ObjectList<PickupListener>::end(); ++it)
    77             it->pickupChangedUsed(pickup, used);
     76        for(PickupListener* listener : ObjectList<PickupListener>())
     77            listener->pickupChangedUsed(pickup, used);
    7878    }
    7979
     
    9292
    9393        // Iterate through all PickupListeners and notify them by calling the method they overloaded.
    94         for(ObjectList<PickupListener>::iterator it = ObjectList<PickupListener>::begin(); it != ObjectList<PickupListener>::end(); ++it)
    95             it->pickupChangedPickedUp(pickup, pickedUp);
     94        for(PickupListener* listener : ObjectList<PickupListener>())
     95            listener->pickupChangedPickedUp(pickup, pickedUp);
    9696    }
    9797
  • code/branches/cpp11_v3/src/orxonox/interfaces/Pickupable.cc

    r10624 r11054  
    5656        RegisterObject(Pickupable);
    5757
    58         this->carrier_ = NULL;
     58        this->carrier_ = nullptr;
    5959
    6060        this->beingDestroyed_ = false;
     
    143143    bool Pickupable::isTarget(const PickupCarrier* carrier) const
    144144    {
    145         if(carrier == NULL)
     145        if(carrier == nullptr)
    146146            return false;
    147147
     
    160160    {
    161161        // Iterate through all targets of this Pickupable.
    162         for(std::list<Identifier*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
     162        for(Identifier* target : this->targets_)
    163163        {
    164             if(identifier->isA(*it))
     164            if(identifier->isA(target))
    165165                return true;
    166166        }
     
    210210    bool Pickupable::pickup(PickupCarrier* carrier)
    211211    {
    212         if(carrier == NULL || this->isPickedUp()) // If carrier is NULL or the Pickupable is already picked up.
     212        if(carrier == nullptr || this->isPickedUp()) // If carrier is nullptr or the Pickupable is already picked up.
    213213            return false;
    214214
     
    237237            return false;
    238238
    239         assert(this->getCarrier()); // The Carrier cannot be NULL at this point.
     239        assert(this->getCarrier()); // The Carrier cannot be nullptr at this point.
    240240        if(!this->getCarrier()->removePickup(this)) //TODO Shouldn't this be a little later?
    241241            orxout(internal_warning, context::pickups) << "Pickupable (&" << this << ", " << this->getIdentifier()->getName() << ") is being dropped, but it was not present in the PickupCarriers list of pickups." << endl;
     
    249249            created = this->createSpawner();
    250250
    251         this->setCarrier(NULL);
     251        this->setCarrier(nullptr);
    252252
    253253        if(!created && createSpawner) // If a PickupSpawner should have been created but wasn't.
     
    301301        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") changed Carrier (& " << carrier << ")." << endl;
    302302
    303         if(carrier != NULL && tell)
     303        if(carrier != nullptr && tell)
    304304        {
    305305            if(!carrier->addPickup(this))
  • code/branches/cpp11_v3/src/orxonox/interfaces/Pickupable.h

    r10624 r11054  
    144144
    145145        protected:
    146             virtual void preDestroy(void); //!< A method that is called by Destroyable::destroy() before the object is actually destroyed.
     146            virtual void preDestroy(void) override; //!< A method that is called by Destroyable::destroy() before the object is actually destroyed.
    147147            virtual void destroyPickup(void); //!< Destroys a Pickupable.
    148148            virtual void carrierDestroyed(void); //!< Is called by the PickupCarrier when it is being destroyed.
     
    182182        // For implementing the Rewardable interface:
    183183        public:
    184             virtual bool reward(PlayerInfo* player); //!< Method to transcribe a Pickupable as a Rewardable to the player.
     184            virtual bool reward(PlayerInfo* player) override; //!< Method to transcribe a Pickupable as a Rewardable to the player.
    185185
    186186    };
  • code/branches/cpp11_v3/src/orxonox/interfaces/RadarViewable.h

    r10624 r11054  
    6666                if (name == "HIDDEN")
    6767                {
    68                     this->bVisibility_ = 0;
     68                    this->bVisibility_ = false;
    6969                    this->settingsChanged();
    7070                }
Note: See TracChangeset for help on using the changeset viewer.