Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 8, 2010, 9:39:47 AM (15 years ago)
Author:
dafrick
Message:

Added target to HealthPickup, which I had forgotten.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/src/orxonox/interfaces/Pickupable.cc

    r6480 r6490  
    104104    bool Pickupable::isTarget(const PickupCarrier* carrier) const
    105105    {
    106         Identifier* identifier = carrier->getIdentifier();
     106        return this->isTarget(carrier->getIdentifier());
     107    }
     108   
     109    /**
     110    @brief
     111        Get whether a given class, represented by the input Identifier, is a target of this pickup.
     112    @param target
     113        The Identifier of which it has to be determinde whether it is a target of this pickup.
     114    @return
     115        Returns true if the given Identifier is a target.
     116    */
     117    bool Pickupable::isTarget(Identifier* target) const
     118    {
    107119        //! Iterate through all targets of this Pickupable.
    108120        for(std::list<Identifier*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
    109121        {
    110             if(identifier->isA(*it))
     122            if(target->isA(*it))
    111123                return true;
    112124        }
    113125        return false;
    114126    }
    115    
     127       
    116128    /**
    117129    @brief
     
    124136    bool Pickupable::addTarget(PickupCarrier* target)
    125137    {
     138        return this->addTarget(target->getIdentifier());
     139    }
     140   
     141    /**
     142    @brief
     143        Add a class, representetd by the input Identifier, as target of this pickup.
     144    @param target
     145        The Identifier to be added.
     146    @return
     147        Returns true if the target was added, false if not.
     148    */
     149    bool Pickupable::addTarget(Identifier* target)
     150    {
    126151        if(this->isTarget(target)) //!< If the input target is already present in the list of targets.
    127152            return false;
    128153       
    129         COUT(4) << "Target (&" << target << ") added to Pickupable (&" << this << ")." << std::endl;
    130         this->targets_.push_back(target->getIdentifier());
     154        COUT(4) << "Target " << target->getName() << " added to Pickupable (&" << this << ")." << std::endl;
     155        this->targets_.push_back(target);
    131156        return true;
    132157    }
Note: See TracChangeset for help on using the changeset viewer.