Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 8, 2010, 8:53:52 PM (14 years ago)
Author:
dafrick
Message:

Significant structural changes to the pickup module. Lots of bugs found and fixed.
Introduced a new class CollectiblePickup (which is now the only kind a PickupCollection can consist of) to solve some issues cleanly.
MetaPickup received additional functionality. It can now also be set to either destroy all the pickups of a PickupCarrier or destroy the PickupCarrier itself. (This was done mainly for testing purposes)
I've done some extensive testing on the pickups, so they should really work now.

File:
1 edited

Legend:

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

    r7150 r7162  
    9595            virtual void changedPickedUp(void) {}
    9696
    97             bool pickup(PickupCarrier* carrier);
    98             bool drop(bool createSpawner = true);
     97            /**
     98            @brief Returns whether the Pickupable can be used.
     99            @return Returns true if it can be used.
     100            */
     101            inline bool isUsable(void) { return this->enabled_; } // tolua_export
     102           
     103            /**
     104            @brief Returns whether the Pickupable can be unused.
     105            @return Returns true if it can be unused.
     106            */
     107            inline bool isUnusable(void) { return this->enabled_; } // tolua_export
     108
     109            /**
     110            @brief Returns whether the Pickupable is enabled.
     111                   Once a Pickupable is disabled it cannot be enabled again. A Pickupable that is disabled can neither be used nor unused.
     112            @return Returns true if the Pickupable is enabled.
     113            */
     114            inline bool isEnabled(void)
     115                { return this->enabled_; }
     116
     117            bool pickup(PickupCarrier* carrier); //!< Can be called to pick up a Pickupable.
     118            bool drop(bool createSpawner = true); //!< Can be called to drop a Pickupable.
    99119
    100120            virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup.
     
    115135            bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input.
    116136            bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up.
    117             bool setCarrier(PickupCarrier* carrier, bool tell = false); //!< Sets the carrier of the pickup.
     137            //TODO: private?
     138            bool setCarrier(PickupCarrier* carrier, bool tell = true); //!< Sets the carrier of the pickup.
     139
     140            //TODO: private?
     141            virtual void carrierDestroyed(void); //!< Is called by the PickupCarrier when it is being destroyed.
     142
     143            void destroy(void); //!< Is called internally within the pickup module to destroy pickups.
    118144
    119145        protected:
     
    122148            */
    123149            void initializeIdentifier(void) {}
     150
     151            virtual void preDestroy(void); //!< A method that is called by OrxonoxClass::destroy() before the object is actually destroyed.
     152            virtual void destroyPickup(void); //!< Destroys a Pickupable.
     153
     154            /**
     155            @brief Sets the Pickuapble to disabled.
     156            */
     157            inline void setDisabled(void)
     158                { this->enabled_ = false; }
    124159
    125160            /**
     
    136171        private:
    137172
    138             bool used_; //!< Whether the pickup is currently in use or not.
    139             bool pickedUp_; //!< Whether the pickup is currently picked up or not.
     173            bool used_; //!< Whether the Pickupable is currently in use or not.
     174            bool pickedUp_; //!< Whether the Pickupable is currently picked up or not.
    140175
    141             PickupCarrier* carrier_; //!< The carrier of the pickup.
    142             std::list<Identifier*> targets_; //!< The possible targets of this pickup.
     176            bool enabled_; //!< Whether the Pickupable is enabled or not.
     177
     178            PickupCarrier* carrier_; //!< The PickupCarrier of the Pickupable.
     179            std::list<Identifier*> targets_; //!< The possible targets of this Pickupable.
     180
     181            bool beingDestroyed_; //!< Is true if the Pickupable is in the process of being destroyed.
    143182
    144183        // For implementing the Rewardable interface:
Note: See TracChangeset for help on using the changeset viewer.