Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6497


Ignore:
Timestamp:
Mar 8, 2010, 9:17:22 PM (15 years ago)
Author:
dafrick
Message:

Fixed bug in clone() (Argument needed to be as reference). Pickups seem to be working now (after very sporadic testing), more systematic testing (and probably still some more bug fixes) will follow.

Location:
code/branches/pickup3/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/src/libraries/core/OrxonoxClass.h

    r6466 r6497  
    109109            bool isDirectParentOf(const OrxonoxClass* object);
    110110           
    111             virtual void clone(OrxonoxClass* item) {}
     111            virtual void clone(OrxonoxClass*& item) {}
    112112
    113113            inline unsigned int getReferenceCount() const
  • code/branches/pickup3/src/modules/pickup/Pickup.cc

    r6480 r6497  
    188188        SUPER(Pickup, changedCarrier);
    189189       
     190        COUT(1) << "Changed Carrier: " << this->isPickedUp() << this->isImmediate() << std::endl;
    190191        //! Sets the Pickup to used if the Pickup has activation type 'immediate' and gets picked up.
    191192        if(this->getCarrier() != NULL && this->isPickedUp() && this->isImmediate())
     
    201202        Returns the clone of this pickup as a pointer to a Pickupable.
    202203    */
    203     void Pickup::clone(OrxonoxClass* item)
     204    void Pickup::clone(OrxonoxClass*& item)
    204205    {
    205206        if(item == NULL)
  • code/branches/pickup3/src/modules/pickup/Pickup.h

    r6475 r6497  
    119119            virtual void changedCarrier(void); //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
    120120                                   
    121             virtual void clone(OrxonoxClass* item); //!< Creates a duplicate of the Pickup.
     121            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the Pickup.
    122122               
    123123        protected:
  • code/branches/pickup3/src/modules/pickup/PickupCollection.cc

    r6480 r6497  
    161161   
    162162    //TODO: Steal description from Pickupable.
    163     void PickupCollection::clone(OrxonoxClass* item)
     163    void PickupCollection::clone(OrxonoxClass*& item)
    164164    {
    165165        if(item == NULL)
  • code/branches/pickup3/src/modules/pickup/PickupCollection.h

    r6475 r6497  
    6262            virtual void changedCarrier(void);
    6363           
    64             virtual void clone(OrxonoxClass* item);
     64            virtual void clone(OrxonoxClass*& item);
    6565           
    6666            virtual const PickupIdentifier* getPickupIdentifier(void);
  • code/branches/pickup3/src/modules/pickup/items/HealthPickup.cc

    r6496 r6497  
    280280        A pointer to the Orxonox class.
    281281    */
    282     void HealthPickup::clone(OrxonoxClass* item)
     282    void HealthPickup::clone(OrxonoxClass*& item)
    283283    {
    284284        if(item == NULL)
  • code/branches/pickup3/src/modules/pickup/items/HealthPickup.h

    r6496 r6497  
    7474           
    7575            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    76             virtual void clone(OrxonoxClass* item); //!< Creates a duplicate of the input OrxonoxClass.
     76            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    7777           
    7878            /**
  • code/branches/pickup3/src/orxonox/interfaces/Pickupable.cc

    r6492 r6497  
    172172       
    173173        COUT(4) << "Pickupable (&" << this << ") got picked up by a PickupCarrier (&" << carrier << ")." << std::endl;
     174        this->setPickedUp(true);
    174175        this->setCarrier(carrier);
    175         this->setPickedUp(true);
    176176        return true;
    177177    }
     
    231231    Pickupable* Pickupable::clone(void)
    232232    {
    233         Pickupable* pickup = NULL;
    234         this->clone(pickup);
     233        OrxonoxClass* item = NULL;
     234        this->clone(item);
     235       
     236        Pickupable* pickup = dynamic_cast<Pickupable*>(item);
    235237       
    236238        COUT(4) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << std::endl;
     
    246248    */
    247249    //TODO: Specify how the implementation must be done in detail.
    248     void Pickupable::clone(OrxonoxClass* item)
     250    void Pickupable::clone(OrxonoxClass*& item)
    249251    {
    250252        SUPER(Pickupable, clone, item);
  • code/branches/pickup3/src/orxonox/interfaces/Pickupable.h

    r6490 r6497  
    102102           
    103103            Pickupable* clone(void); //!< Creates a duplicate of the Pickupable.
    104             virtual void clone(OrxonoxClass* item); //!< Creates a duplicate of the input OrxonoxClass.
     104            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    105105           
    106106            /**
Note: See TracChangeset for help on using the changeset viewer.