Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2010, 7:33:11 AM (14 years ago)
Author:
dafrick
Message:

Added changedPickedUp method to Pickupable to solve a problem in PickupCollection, which, for the most part, works now.

File:
1 edited

Legend:

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

    r6519 r6521  
    7070            */
    7171            virtual void changedUsed(void) {}
    72             bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input.
     72           
     73            /**
     74            @brief Get the carrier of the pickup.
     75            @return Returns a pointer to the carrier of the pickup.
     76            */
     77            inline PickupCarrier* getCarrier(void)
     78                { return this->carrier_; }
     79            /**
     80            @brief Should be called when the pickup has changed its PickupCarrier.
     81                   Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedCarrier); to their changedCarrier method.
     82            */
     83            virtual void changedCarrier(void) {}
    7384           
    7485            /**
     
    7889            inline bool isPickedUp(void)
    7990                { return this->pickedUp_; }
     91            /**
     92            @brief  Should be called when the pickup has transited from picked up to dropped or the other way around.
     93                    Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedPickedUp); to their changedPickedUp method.
     94            */
     95            virtual void changedPickedUp(void) {}   
     96           
    8097            //TODO: Better private, or protected?
    8198            bool pickedUp(PickupCarrier* carrier); //!< Sets the Pickupable to picked up.
     
    86103            bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this pickup.
    87104            bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this pickup.
    88            
    89             /**
    90             @brief Get the carrier of the pickup.
    91             @return Returns a pointer to the carrier of the pickup.
    92             */
    93             inline PickupCarrier* getCarrier(void)
    94                 { return this->carrier_; }
    95             /**
    96             @brief  Should be called when the pickup has transited from picked up to dropped or the other way around.
    97                     Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedCarrier); to their changedCarrier method.
    98             */
    99             virtual void changedCarrier(void) {}
    100             //TODO: Maybe private?
    101             bool setCarrier(PickupCarrier* carrier); //!< Sets the carrier of the pickup.
    102105           
    103106            Pickupable* clone(void); //!< Creates a duplicate of the Pickupable.
     
    113116            virtual void destroy(void)
    114117                { delete this; }
     118               
     119            //TODO: Make them work as protected.
     120            bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input.
     121            bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up.
     122            bool setCarrier(PickupCarrier* carrier); //!< Sets the carrier of the pickup.
    115123           
    116124        protected:
     
    134142           
    135143        private:
    136             /**
    137             @brief Helper method to set the Pickupable to either picked up or not picked up.
    138             @param pickedUp The value this->pickedUp_ should be set to.
    139             */
    140             inline void setPickedUp(bool pickedUp)
    141                 { this->pickedUp_ = pickedUp; }
    142144           
    143145            bool used_; //!< Whether the pickup is currently in use or not.
     
    151153    SUPER_FUNCTION(10, Pickupable, changedUsed, false);
    152154    SUPER_FUNCTION(12, Pickupable, changedCarrier, false);
     155    SUPER_FUNCTION(13, Pickupable, changedPickedUp, false);
    153156}
    154157
Note: See TracChangeset for help on using the changeset viewer.