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/modules/pickup/PickupCollection.h

    r7127 r7162  
    3737#include "PickupPrereqs.h"
    3838
    39 #include "interfaces/Pickupable.h"
    4039#include "core/BaseObject.h"
     40#include "CollectiblePickup.h"
    4141
    4242#include <list>
     
    4747    /**
    4848    @brief
    49         The PickupCollection combines different Pickupables to a coherent, single pickup and makes the seem (from the outside looking in) just as if they were just one Pickupable.
     49        The PickupCollection combines different Pickupables to a coherent, single pickup and makes them seem (from the outside looking in) just as if they were just one Pickupable.
    5050    @author
    5151        Damian 'Mozork' Frick
    5252    */
    53     class _PickupExport PickupCollection : public Pickupable, public BaseObject
     53    class _PickupExport PickupCollection : public CollectiblePickup, public BaseObject
    5454    {
    5555
    5656        public:
    57 
    5857            PickupCollection(BaseObject* creator); //!< Default Constructor.
    5958            virtual ~PickupCollection(); //!< Destructor.
     
    7170            virtual const PickupIdentifier* getPickupIdentifier(void); //!< Get the PickupIdentifier of this PickupCollection.
    7271
    73             bool addPickupable(Pickupable* pickup); //!< Add the input Pickupable to list of Pickupables combined by this PickupCollection.
     72            bool addPickupable(CollectiblePickup* pickup); //!< Add the input Pickupable to list of Pickupables combined by this PickupCollection.
    7473            const Pickupable* getPickupable(unsigned int index); //!< Get the Pickupable at the given index.
     74
     75            void pickupChangedUsed(bool changed); //!< Informs the PickupCollection, that one of its pickups has changed its used status to the input value.
     76            void pickupChangedPickedUp(bool changed); //!< Informs the PickupCollection, that one of its pickups has changed its picked up status to the input value.
     77            void pickupDisabled(void); //!< Informs the PickupCollection, that one of its pickups has been disabled.
    7578
    7679        protected:
     
    8285
    8386        private:
     87            void changedUsedAction(void); //!< Helper method.
     88            void changedPickedUpAction(void); //!< Helper method.
     89           
     90            std::vector<CollectiblePickup*> pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid.
    8491
    85             std::vector<WeakPtr<Pickupable> > pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid.
     92            unsigned int usedCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are in use.
     93            unsigned int pickedUpCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are picked up.
     94            unsigned int disabledCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are disabled.
     95
     96            bool processingUsed_; //!< Boolean to ensure, that the PickupCollection doesn't update its used status while its internal state is inconsistent.
     97            bool processingPickedUp_; //!< Boolean to ensure, that the PickupCollection doesn't update its picked upp status while its internal state is inconsistent.
    8698
    8799    };
Note: See TracChangeset for help on using the changeset viewer.