Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 10, 2012, 11:01:40 PM (12 years ago)
Author:
landauf
Message:

Fixed crash with MSVC if a PickupCollection was used
A depleted CollectiblePickup is now destroyed instead of being dropped
A destroyed CollectiblePickup removes itself from the PickupCollection
PickupCollection has to use a list instead of a vector because of this reason
Also PickupCollectionIdentifier needed to be changed because the number of pickups in a collection may now change
Probably also fixed a bug in PickupCollectionIdentifier::compare() because it2 was not incremented

not completely clean yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2012merge/src/modules/pickup/PickupCollection.h

    r8351 r9290  
    8989            bool addPickupable(CollectiblePickup* pickup); //!< Add the input Pickupable to list of Pickupables combined by this PickupCollection.
    9090            const Pickupable* getPickupable(unsigned int index) const; //!< Get the Pickupable at the given index.
     91            bool removePickupable(CollectiblePickup* pickup); //!< Removes the input Pickupable from the list of Pickupables in this PickupCollection.
     92
     93            inline const std::list<CollectiblePickup*>& getPickups() const
     94                { return this->pickups_; }
    9195
    9296            void pickupChangedUsed(bool changed); //!< Informs the PickupCollection, that one of its pickups has changed its used status to the input value.
     
    9599
    96100        protected:
    97             void initializeIdentifier(void); //!< Initializes the PickupIdentifier for this pickup.
    98 
    99101            virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
    100102
     
    105107            void changedPickedUpAction(void); //!< Helper method.
    106108
    107             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.
     109            std::list<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.
    108110
    109111            unsigned int usedCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are in use.
Note: See TracChangeset for help on using the changeset viewer.