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/PickupSpawner.cc

    r7150 r7162  
    107107        this->maxSpawnedItems_ = INF;
    108108        this->spawnsRemaining_ = INF;
     109        this->selfDestruct_ = false;
    109110    }
    110111
     
    115116    PickupSpawner::~PickupSpawner()
    116117    {
    117         if(this->pickup_ != NULL)
     118        if(this->selfDestruct_ && this->pickup_ != NULL)
    118119            this->pickup_->destroy();
    119120    }
     
    176177        if (this->isActive())
    177178        {
    178             SmartPtr<PickupSpawner> temp = this; // create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup)
     179            SmartPtr<PickupSpawner> temp = this; //Create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup)
    179180
    180181            //! Iterate trough all Pawns.
     
    305306            {
    306307                if(pickup->pickup(target))
    307                 {
    308308                    this->decrementSpawnsRemaining();
    309                 }
    310309                else
    311310                {
     311                    this->selfDestruct_ = true;
    312312                    pickup->destroy();
    313313                }
     
    319319
    320320                if(pickup == NULL)
    321                 {
    322321                    COUT(1) << "PickupSpawner (&" << this << "): getPickup produced an error, no Pickupable created." << std::endl;
    323                 }
    324322                else
    325323                {
     324                    this->selfDestruct_ = true;
    326325                    pickup->destroy();
    327326                }
Note: See TracChangeset for help on using the changeset viewer.