Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 13, 2010, 12:41:52 AM (15 years ago)
Author:
dafrick
Message:

Small adaptations in SpeedPickup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ppspickups1/src/modules/pickup/items/SpeedPickup.cc

    r6694 r6706  
    7575    void SpeedPickup::initialize(void)
    7676    {
    77         this->duration_ = 0.0;
    78         this->speedAdd_ = 0.0;
    79         this->speedMultiply_ = 1.0;
     77        this->duration_ = 0.0f;
     78        this->speedAdd_ = 0.0f;
     79        this->speedMultiply_ = 1.0f;
    8080
    8181        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
     
    134134            return;
    135135
     136        Engine* engine = this->carrierToEngineHelper();
     137        if(engine == NULL) //!< If the PickupCarrier is no Engine, then this pickup is useless and therefore is destroyed.
     138            this->destroy();
     139       
    136140        //! If the pickup has transited to used.
    137141        if(this->isUsed())
    138142        {
    139             Engine* engine = this->carrierToEngineHelper();
    140             if(engine == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    141                 this->destroy();
    142 
    143143            this->startPickupTimer(this->getDuration());
    144144            engine->setSpeedAdd(this->getSpeedAdd());
    145145            engine->setSpeedMultiply(this->getSpeedMultiply());
    146146        }
    147     }
    148 
    149 
     147        else
     148        {
     149            engine->setSpeedAdd(0.0f);
     150            engine->setSpeedMultiply(1.0f);
     151           
     152            if(this->isOnce())
     153            {
     154                this->destroy();
     155            }
     156        }
     157    }
    150158
    151159    /**
     
    250258    }
    251259
    252     void SpeedPickup::PickupTimerCallBack(void) {
    253             Engine* engine = this->carrierToEngineHelper();
    254             if(engine == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    255                 this->destroy();
    256 
    257             engine->setSpeedAdd(0.0f);
    258             engine->setSpeedMultiply(1.0f);
     260    void SpeedPickup::pickupTimerCallback(void)
     261    {       
     262        this->setUsed(false);
    259263    }
    260264}
Note: See TracChangeset for help on using the changeset viewer.