Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 23, 2010, 11:43:10 AM (14 years ago)
Author:
dafrick
Message:

Cleaning up and documenting PickupManager.
Also discovered and fixed a small bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/pickup/PickupManager.h

    r7163 r7206  
    5252        Manages Pickupables.
    5353        In essence has two tasks to fulfill. Firstly it must link Pickupables (through their PickupIdentifiers) and their PickupRepresentations. Secondly it manages the PickupInventory.
    54         //TODO: Manage Pickup GUI.
    5554    @author
    5655        Damian 'Mozork' Frick
     
    7271
    7372            // tolua_begin
    74             int getNumPickups(void);
     73            orxonox::PickupRepresentation* getPickupRepresentation(orxonox::Pickupable* pickup); //!< Get the PickupRepresentation of an input Pickupable.
     74
     75            int getNumPickups(void); //!< Update the list of picked up Pickupables and get the number of Pickupables in the list.
     76            /**
     77            @brief Get the next Pickupable in the list.
     78                   Use this, after having called getNumPickups() to access all the Pickupables individually and in succession.
     79            @return Returns the next Pickupable in the list.
     80            */
    7581            orxonox::Pickupable* popPickup(void) { return (this->pickupsIterator_++)->first; }
    76             orxonox::PickupRepresentation* getPickupRepresentation(orxonox::Pickupable* pickup) { if(pickup != NULL) return this->getRepresentation(pickup->getPickupIdentifier()); return NULL; }
    7782
    78             void dropPickup(orxonox::Pickupable* pickup);
    79             void usePickup(orxonox::Pickupable* pickup, bool use);
    80             bool isValidPickup(orxonox::Pickupable* pickup) { std::map<Pickupable*, WeakPtr<Pickupable> >::iterator it = this->pickupsList_.find(pickup); if(it == this->pickupsList_.end()) return false; return it->second.get() != NULL; }
     83            void dropPickup(orxonox::Pickupable* pickup); //!< Drop the input Pickupable.
     84            void usePickup(orxonox::Pickupable* pickup, bool use); //!< Use (or unuse) the input Pickupable.
     85            bool isValidPickup(orxonox::Pickupable* pickup); //!< Check whether the input Pickupable is valid, meaning that it is in the PickupManager's list and still exists.
    8186            // tolua_end
    8287
    8388        private:
    8489            static PickupManager* singletonPtr_s;
    85             static const std::string guiName_s;
     90            static const std::string guiName_s; //!< The name of the PickupInventory
    8691
    8792            PickupRepresentation* defaultRepresentation_; //!< The default PickupRepresentation.
    8893            std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types if Pickupables) and PickupRepresentations.
    8994
    90             std::map<Pickupable*, WeakPtr<Pickupable> > pickupsList_;
    91             std::map<Pickupable*, WeakPtr<Pickupable> >::iterator pickupsIterator_;
     95            std::map<Pickupable*, WeakPtr<Pickupable> > pickupsList_; //!< A list of all the picked up Pickupables.
     96            std::map<Pickupable*, WeakPtr<Pickupable> >::iterator pickupsIterator_; //!< An iterator pointing to the current Pickupable in pickupsList_.
    9297
    93             std::vector<PickupCarrier*>* getAllCarriers(PickupCarrier* carrier);
     98            std::vector<PickupCarrier*>* getAllCarriers(PickupCarrier* carrier, std::vector<PickupCarrier*>* carriers = NULL); //!< Helper method. Get all the PickupCarriers that carry Pickupables, recursively.
    9499
    95100    }; // tolua_export
Note: See TracChangeset for help on using the changeset viewer.