Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2010, 7:33:11 AM (15 years ago)
Author:
dafrick
Message:

Added changedPickedUp method to Pickupable to solve a problem in PickupCollection, which, for the most part, works now.

Location:
code/branches/pickup3/src/modules/pickup
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/src/modules/pickup/Pickup.cc

    r6515 r6521  
    182182    @brief
    183183        Should be called when the pickup has transited from picked up to dropped or the other way around.
    184         Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedCarrier); to their changedCarrier method.
    185     */
    186     void Pickup::changedCarrier(void)
    187     {
    188         SUPER(Pickup, changedCarrier);
     184        Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedPickedUp); to their changedPickedUp method.
     185    */
     186    void Pickup::changedPickedUp(void)
     187    {
     188        SUPER(Pickup, changedPickedUp);
    189189       
    190190        //! Sets the Pickup to used if the Pickup has activation type 'immediate' and gets picked up.
  • code/branches/pickup3/src/modules/pickup/Pickup.h

    r6497 r6521  
    117117                { return this->getDurationTypeDirect() == pickupDurationType::continuous; }
    118118           
    119             virtual void changedCarrier(void); //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
     119            virtual void changedPickedUp(void); //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
    120120                                   
    121121            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the Pickup.
  • code/branches/pickup3/src/modules/pickup/PickupCollection.cc

    r6519 r6521  
    138138    }
    139139   
    140     //TODO: Steal description from Pickupable.
    141140    void PickupCollection::changedUsed(void)
    142141    {
     
    150149    }
    151150   
    152     void PickupCollection::changedCarrier()
     151    void PickupCollection::changedCarrier(void)
    153152    {
    154153        SUPER(PickupCollection, changedCarrier);
    155154       
     155        //! Change used for all Pickupables this PickupCollection consists of.
     156        for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
     157        {
     158            (*it)->setCarrier(this->getCarrier());
     159        }
     160    }
     161   
     162    void PickupCollection::changedPickedUp()
     163    {
     164        SUPER(PickupCollection, changedPickedUp);
     165       
    156166        //! Change the carrier for all Pickupables this PickupCollection consists of.
    157167        for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
    158168        {
    159             (*it)->setCarrier(this->getCarrier());
    160         }
    161     }
    162    
    163     //TODO: Steal description from Pickupable.
     169            (*it)->setPickedUp(this->isPickedUp());
     170        }
     171    }
     172   
    164173    void PickupCollection::clone(OrxonoxClass*& item)
    165174    {
  • code/branches/pickup3/src/modules/pickup/PickupCollection.h

    r6519 r6521  
    5858
    5959            virtual void changedUsed(void);
    60            
    6160            virtual void changedCarrier(void);
     61            virtual void changedPickedUp(void);
    6262           
    6363            virtual void clone(OrxonoxClass*& item);
Note: See TracChangeset for help on using the changeset viewer.