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/CollectiblePickup.h

    r7547 r9290  
    5555    class _PickupExport CollectiblePickup : public Pickupable
    5656    {
     57        friend class PickupCollection;
    5758
    5859        public:
     
    6869            */
    6970            bool isInCollection(void) const
    70                 { return this->isInCollection_; }
    71 
    72             bool addToCollection(PickupCollection* collection); //!< Adds this CollectiblePickup to the input PickupCollection.
    73             bool removeFromCollection(void); //!< Removes this CollectiblePickup from its PickupCollection.
     71                { return this->collection_ != NULL; }
    7472
    7573            void carrierDestroyed(void); //!< Is called by the PickupCarrier when it is being destroyed.
    7674
    77         protected:
    78             virtual void preDestroy(void); //!< Is called by OrxonoxClass::destroy() before the object is actually destroyed.
    79             virtual void destroyPickup(void); //!< Destroys a Pickupable.
     75        private:
     76            void wasAddedToCollection(PickupCollection* collection);
     77            void wasRemovedFromCollection(void);
    8078
    81         private:
    82             bool isInCollection_; //!< True if the CollectiblePickup is in a PickupCollection.
    8379            PickupCollection* collection_; //!< A pointer to the PickupCollection this CollectiblePickup is in.
    84 
    8580    };
    8681}
Note: See TracChangeset for help on using the changeset viewer.