Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 14, 2009, 1:44:19 PM (15 years ago)
Author:
rgrieder
Message:

Merged pickup branch revisions to pickup2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup2/src/orxonox/pickup/BaseItem.h

    r5781 r5947  
    4444{
    4545    /**
    46         @brief
    47             Base class for all items/pickups.
     46    @brief
     47        Base class for all items/pickups.
    4848
    49             Provides common methods to be used in derived classes.
    50         @author
    51             Daniel 'Huty' Haggenmueller
     49        Provides common methods to be used in derived classes.
     50    @author
     51        Daniel 'Huty' Haggenmueller
    5252    */
    5353    class _OrxonoxExport BaseItem : public BaseObject
    5454    {
    5555// tolua_end
    56     public:
    57         BaseItem(BaseObject* creator);
    58         virtual ~BaseItem();
     56        public:
     57            BaseItem(BaseObject* creator);
     58            virtual ~BaseItem();
    5959
    60         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
     60            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
    6161
    62         /**
     62            /**
    6363            @brief Checks how many instances of this item can be carried at a time.
    6464            @return How many of this item can be carried.
    65         */
    66         virtual int getMaxCarryAmount() const
    67             { return 1; }
     65            */
     66            virtual int getMaxCarryAmount() const //TODO: Maybe, better to just be virtual.
     67                { return BaseItem::MAX_CARRY_AMOUNT; }
    6868
    69         bool addTo(Pawn* pawn);             //!< Add the item to a pawn.
    70         bool removeFrom(Pawn* pawn);        //!< Removes the item from a pawn.
    71         /**
     69            //TODO: Need to be public?
     70            bool addTo(Pawn* pawn);             //!< Add the item to a pawn.
     71            bool removeFrom(Pawn* pawn);        //!< Removes the item from a pawn.
     72            /**
    7273            @brief
    7374                Method invoked when the item gets picked up.
     
    7879            @param pawn Pawn who picks up the item.
    7980            @return Returns whether the pawn was able to pick up the item.
    80         */
    81         virtual bool pickedUp(Pawn* pawn)
    82             { return false; }
    83         /**
     81            */
     82            virtual bool pickedUp(Pawn* pawn) //TODO: Maybe better to be just virtual.
     83                { return false; }
     84            /**
    8485            @brief
    8586                Method invoked when the item is dropped from a player.
     
    9091            @param pawn Pawn which dropped the item.
    9192            @return Returns whether the item was able to get dropped by the pawn.
    92         */
    93         virtual bool dropped(Pawn* pawn)
    94             { return false; }
     93            */
     94            virtual bool dropped(Pawn* pawn)
     95                { return false; }
    9596
    96         /**
     97            /**
    9798            @brief Gets the current owner of the pickup.
    9899            @return Returns the current owner.
    99         */
    100         inline Pawn* getOwner() const
    101             { return this->owner_; }
    102         /**
     100            */
     101            inline Pawn* getOwner() const
     102                { return this->owner_; }
     103            /**
    103104            @brief Sets the owner of the pickup.
    104105            @param owner New owner for the pickup.
    105         */
    106         inline void setOwner(Pawn* owner)
    107             { this->owner_ = owner; }
     106            */
     107            inline void setOwner(Pawn* owner)
     108                { this->owner_ = owner; }
    108109
    109         /**
     110            /**
    110111            @brief Gets the pickupIdentifier of the item.
    111112            @return Returns the pickupIdentifier of the item.
    112113            @see pickupIdentifier_
    113         */
    114         inline const std::string& getPickupIdentifier() const
    115             { return this->pickupIdentifier_; }
    116         /**
     114            */
     115            inline const std::string& getPickupIdentifier() const
     116                { return this->pickupIdentifier_; }
     117            /**
    117118            @brief Sets the pickupIdentifier for the item.
    118119            @param identifier New pickupIdentifier for the item.
    119120            @see pickupIdentifier_
    120         */
    121         inline void setPickupIdentifier(const std::string& identifier)
    122             { this->pickupIdentifier_ = identifier; }
     121            */
     122            //TODO: Needs to be public?
     123            inline void setPickupIdentifier(const std::string& identifier)
     124                { this->pickupIdentifier_ = identifier; }
    123125
    124         // GUI stuff
    125         virtual const std::string& getGUIText() const; // tolua_export
    126         inline void setGUIText(const std::string& text)
    127             { this->guiText_ = text; }
     126            // GUI stuff
     127            //TODO: Comment. Maybe seperate GUI from Pickup, e.g. ItemDescription...
     128            virtual const std::string& getGUIText() const; // tolua_export
     129            inline void setGUIText(const std::string& text)
     130                { this->guiText_ = text; }
    128131
    129         virtual const std::string& getGUIImage() const
    130             { return this->guiImage_; }
    131         inline void setGUIImage(const std::string& image)
    132             { this->guiImage_ = image; }
    133     private:
    134         Pawn* owner_;   //!< The current owner of the item.
     132            virtual const std::string& getGUIImage() const
     133                { return this->guiImage_; }
     134            inline void setGUIImage(const std::string& image)
     135                { this->guiImage_ = image; }
     136        private:
     137            static const int MAX_CARRY_AMOUNT = 1;
    135138
    136         /**
     139            Pawn* owner_;   //!< The current owner of the item.
     140
     141            /**
    137142            @brief
    138143                The pickupIdentifier of the item..
     
    140145                Usually set to the template name used by a PickupSpawner,
    141146                used to index items in the PickupCollection.
    142         */
    143         std::string pickupIdentifier_;
     147            */
     148            std::string pickupIdentifier_; //TODO: Remove, when always just this->getName().
    144149
    145         std::string guiText_;
    146         std::string guiImage_;
     150            //TODO: Comment.
     151            std::string guiText_;
     152            std::string guiImage_;
    147153    }; // tolua_export
    148154} // tolua_export
Note: See TracChangeset for help on using the changeset viewer.