- Timestamp:
- Apr 13, 2010, 12:41:52 AM (15 years ago)
- Location:
- code/branches/ppspickups1/src/modules/pickup/items
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ppspickups1/src/modules/pickup/items/SpeedPickup.cc
r6694 r6706 75 75 void SpeedPickup::initialize(void) 76 76 { 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; 80 80 81 81 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); … … 134 134 return; 135 135 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 136 140 //! If the pickup has transited to used. 137 141 if(this->isUsed()) 138 142 { 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 143 143 this->startPickupTimer(this->getDuration()); 144 144 engine->setSpeedAdd(this->getSpeedAdd()); 145 145 engine->setSpeedMultiply(this->getSpeedMultiply()); 146 146 } 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 } 150 158 151 159 /** … … 250 258 } 251 259 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); 259 263 } 260 264 } -
code/branches/ppspickups1/src/modules/pickup/items/SpeedPickup.h
r6705 r6706 38 38 39 39 #include <string> 40 #include <worldentities/pawns/Pawn.h>40 #include "worldentities/pawns/Pawn.h" 41 41 #include "worldentities/StaticEntity.h" 42 42 … … 78 78 protected: 79 79 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. 80 81 virtual void pickupTimerCallback(void); //!< Function that gets called when timer ends. 80 82 81 83 void setDuration(float duration); … … 85 87 private: 86 88 void initialize(void); //!< Initializes the member variables. 87 void PickupTimerCallBack(void); //!< Function that gets called when timer ends.88 89 Engine* carrierToEngineHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 89 90
Note: See TracChangeset
for help on using the changeset viewer.