Changeset 7504 for code/trunk/src/modules/pickup/PickupManager.h
- Timestamp:
- Oct 6, 2010, 8:00:40 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/pickup/PickupManager.h
r7456 r7504 39 39 40 40 #include <map> 41 #include "util/Singleton.h" 41 42 42 #include "core/WeakPtr.h" 43 43 44 #include "pickup/PickupIdentifier.h" 45 44 46 #include "PickupRepresentation.h" 45 47 46 #include "core/OrxonoxClass.h" 48 #include "util/Singleton.h" 49 #include "interfaces/PickupListener.h" 47 50 48 51 namespace orxonox // tolua_export 49 52 { // tolua_export 53 54 // tolua_begin 55 struct PickupInventoryContainer 56 { 57 uint64_t pickup; 58 bool inUse; 59 bool pickedUp; 60 bool usable; 61 bool unusable; 62 uint32_t representationObjectId; 63 }; 64 // tolua_end 50 65 51 66 /** … … 57 72 */ 58 73 class _PickupExport PickupManager // tolua_export 59 : public Singleton<PickupManager>, public OrxonoxClass74 : public Singleton<PickupManager>, public PickupListener 60 75 { // tolua_export 61 76 friend class Singleton<PickupManager>; … … 68 83 69 84 bool registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Registers a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents. 85 bool registerRepresentation(PickupRepresentation* representation); 70 86 bool unregisterRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Unegisters a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents. 87 bool unregisterRepresentation(PickupRepresentation* representation); 71 88 PickupRepresentation* getRepresentation(const PickupIdentifier* identifier); //!< Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier. 72 89 73 90 // tolua_begin 74 orxonox::PickupRepresentation* getPickupRepresentation( orxonox::Pickupable*pickup); //!< Get the PickupRepresentation of an input Pickupable.91 orxonox::PickupRepresentation* getPickupRepresentation(uint64_t pickup); //!< Get the PickupRepresentation of an input Pickupable. 75 92 76 93 int getNumPickups(void); //!< Update the list of picked up Pickupables and get the number of Pickupables in the list. … … 80 97 @return Returns the next Pickupable in the list. 81 98 */ 82 orxonox::Pickup able* popPickup(void) { return (this->pickupsIterator_++)->first; }99 orxonox::PickupInventoryContainer* popPickup(void) { return (this->pickupsIterator_++)->second; } 83 100 84 void dropPickup( orxonox::Pickupable*pickup); //!< Drop the input Pickupable.85 void usePickup( orxonox::Pickupable*pickup, bool use); //!< Use (or unuse) the input Pickupable.86 bool isValidPickup( orxonox::Pickupable*pickup); //!< Check whether the input Pickupable is valid, meaning that it is in the PickupManager's list and still exists.101 void dropPickup(uint64_t pickup); //!< Drop the input Pickupable. 102 void usePickup(uint64_t pickup, bool use); //!< Use (or unuse) the input Pickupable. 103 bool isValidPickup(uint64_t pickup); //!< Check whether the input Pickupable is valid, meaning that it is in the PickupManager's list and still exists. 87 104 // tolua_end 105 106 static void dropPickupNetworked(uint64_t pickup); 107 static void usePickupNetworked(uint64_t pickup, bool use); 108 109 virtual void pickupChangedUsed(Pickupable* pickup, bool used); 110 static void pickupChangedUsedNetwork(uint64_t pickup, bool inUse, bool usable, bool unusable); 111 virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp); 112 static void pickupChangedPickedUpNetwork(uint64_t pickup, bool usable, uint32_t representationObjectId, bool pickedUp); 88 113 89 114 private: 90 115 static PickupManager* singletonPtr_s; 91 116 static const std::string guiName_s; //!< The name of the PickupInventory 117 bool guiLoaded_; 118 uint64_t pickupIndex_; 92 119 93 120 PickupRepresentation* defaultRepresentation_; //!< The default PickupRepresentation. 94 121 std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types if Pickupables) and PickupRepresentations. 122 std::map<uint32_t, PickupRepresentation*> representationsNetworked_; 95 123 96 std::map< Pickupable*, WeakPtr<Pickupable> > pickupsList_; //!< A list of all the picked up Pickupables.97 std::map< Pickupable*, WeakPtr<Pickupable>>::iterator pickupsIterator_; //!< An iterator pointing to the current Pickupable in pickupsList_.124 std::map<uint64_t, PickupInventoryContainer*> pickupInventoryContainers_; 125 std::map<uint64_t, PickupInventoryContainer*>::iterator pickupsIterator_; //!< An iterator pointing to the current Pickupable in pickupsList_. 98 126 99 std::vector<PickupCarrier*>* getAllCarriers(PickupCarrier* carrier, std::vector<PickupCarrier*>* carriers = NULL); //!< Helper method. Get all the PickupCarriers that carry Pickupables, recursively. 127 std::map<uint64_t, WeakPtr<Pickupable>*> pickups_; 128 std::map<Pickupable*, uint64_t> indexes_; 129 130 void updateGUI(void); 131 uint64_t getPickupIndex(void); 100 132 101 133 }; // tolua_export
Note: See TracChangeset
for help on using the changeset viewer.