Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 13, 2010, 9:32:08 AM (15 years ago)
Author:
dafrick
Message:

Merged ppspickups1 into trunk.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/interfaces/PickupCarrier.h

    r6563 r6709  
    4747namespace orxonox
    4848{
    49 
    50     //! Pre-declarations.
     49    class Pickupable;
    5150    class Pickup;
    5251    class HealthPickup;
    5352    class MetaPickup;
     53    class SpeedPickup;
    5454
    5555    /**
     
    6767        friend class HealthPickup;
    6868        friend class MetaPickup;
    69        
     69        friend class SpeedPickup;
     70
    7071        public:
    7172            PickupCarrier(); //!< Constructor.
    7273            virtual ~PickupCarrier(); //!< Destructor.
    73            
     74
    7475            /**
    7576            @brief Can be called to pick up a Pickupable.
     
    8788                    return pickedUp;
    8889                }
    89                
     90
    9091            /**
    9192            @brief Can be called to drop a Pickupable.
     
    9596            */
    9697            bool drop(Pickupable* pickup, bool drop = true)
    97                 { 
     98                {
    9899                    bool dropped = this->pickups_.erase(pickup) == 1;
    99100                    if(dropped && drop)
     
    104105                    return dropped;
    105106                }
    106                
     107
    107108            /**
    108109            @brief Can be used to check whether the PickupCarrier or a child of his is a target ot the input Pickupable.
     
    114115                    if(pickup->isTarget(this)) //!< If the PickupCarrier itself is a target.
    115116                        return true;
    116                    
     117
    117118                    //! Go recursively through all children to check whether they are a target.
    118119                    std::list<PickupCarrier*>* children = this->getCarrierChildren();
     
    122123                            return true;
    123124                    }
    124                    
     125
    125126                    children->clear();
    126127                    delete children;
    127                    
     128
    128129                    return false;
    129130                }
    130                
     131
    131132            /**
    132133            @brief Get the carrier that is both a child of the PickupCarrier (or the PickupCarrier itself) and a target of the input Pickupable.
     
    138139                    if(!this->isTarget(pickup))
    139140                        return NULL;
    140                    
     141
    141142                    if(pickup->isTarget(this)) //!< If the PickupCarrier itself is a target.
    142143                        return this;
    143                    
     144
    144145                    //! Go recursively through all children to check whether they are the target.
    145146                    std::list<PickupCarrier*>* children = this->getCarrierChildren();
     
    149150                            return *it;
    150151                    }
    151                    
     152
    152153                    children->clear();
    153154                    delete children;
    154                    
     155
    155156                    return NULL;
    156157                }
    157                
     158
    158159            /**
    159160            @brief Get the (absolute) position of the PickupCarrier.
     
    162163            */
    163164            virtual const Vector3& getCarrierPosition(void) = 0;
    164            
    165         protected:       
     165
     166        protected:
    166167            /**
    167168            @brief Get all direct children of this PickupSpawner.
    168169                   This method needs to be implemented by any direct derivative class of PickupCarrier.
    169170                   The returned list will be deleted by the methods calling this function.
    170             @return Returns a pointer to a list of all direct children. 
     171            @return Returns a pointer to a list of all direct children.
    171172            */
    172173            virtual std::list<PickupCarrier*>* getCarrierChildren(void) = 0;
     
    177178            */
    178179            virtual PickupCarrier* getCarrierParent(void) = 0;
    179                            
     180
    180181            /**
    181182            @brief Get all Pickupables this PickupCarrier has.
     
    184185            std::set<Pickupable*>& getPickups(void)
    185186                { return this->pickups_; }
    186        
     187
    187188        private:
    188189            std::set<Pickupable*> pickups_; //!< The list of Pickupables carried by this PickupCarrier.
    189            
     190
    190191    };
    191192}
Note: See TracChangeset for help on using the changeset viewer.