Changeset 8864 for code/trunk/src/modules/pickup/items
- Timestamp:
- Aug 24, 2011, 2:57:53 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/pickup/items/HealthPickup.cc
r8858 r8864 76 76 void HealthPickup::initialize(void) 77 77 { 78 this->health_ = 0 ;79 this->healthRate_ = 0 ;78 this->health_ = 0.0f; 79 this->healthRate_ = 0.0f; 80 80 this->healthType_ = pickupHealthType::limited; 81 this->maxHealthSave_ = 0 ;82 this->maxHealthOverwrite_ = 0 ;81 this->maxHealthSave_ = 0.0f; 82 this->maxHealthOverwrite_ = 0.0f; 83 83 84 84 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); … … 121 121 122 122 if(!this->isContinuous()) 123 this->healthRate_ = 0.0 ;123 this->healthRate_ = 0.0f; 124 124 125 125 this->initializeIdentifier(); … … 173 173 174 174 // If all health has been transferred. 175 if(this->getHealth() == 0 )175 if(this->getHealth() == 0.0f) 176 176 { 177 177 this->setUsed(false); … … 197 197 this->Pickupable::destroy(); 198 198 199 float health = 0 ;199 float health = 0.0f; 200 200 switch(this->getHealthTypeDirect()) 201 201 { … … 234 234 if(pawn == NULL) 235 235 { 236 orxout(internal_error, context::pickups) << "Something went horribly wrong in Health Pickup. PickupCarrier is noPawn." << endl;236 orxout(internal_error, context::pickups) << "Something went horribly wrong in Health Pickup. PickupCarrier is '" << carrier->getIdentifier()->getName() << "' instead of Pawn." << endl; 237 237 this->Pickupable::destroy(); 238 238 return; … … 248 248 249 249 // If either the pickup can only be used once or it is continuous and used up, it is destroyed upon setting it to unused. 250 if(this->isOnce() || (this->isContinuous() && this->getHealth() == 0 ))250 if(this->isOnce() || (this->isContinuous() && this->getHealth() == 0.0f)) 251 251 { 252 252 this->Pickupable::destroy(); … … 267 267 268 268 if(pawn == NULL) 269 {270 269 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in HealthPickup." << endl; 271 }272 270 273 271 return pawn; … … 326 324 { 327 325 if(health >= 0.0f) 328 {329 326 this->health_ = health; 330 }331 327 else 332 328 { 333 orxout(internal_error, context::pickups) << "Invalid health in HealthPickup." << endl;334 this->health_ = 0.0 ;329 orxout(internal_error, context::pickups) << "Invalid health '" << health << "' in HealthPickup. The health must be non.negative." << endl; 330 this->health_ = 0.0f; 335 331 } 336 332 } … … 344 340 void HealthPickup::setHealthRate(float rate) 345 341 { 346 if(rate >= 0) 347 { 342 if(rate >= 0.0f) 348 343 this->healthRate_ = rate; 349 }350 344 else 351 { 352 orxout(internal_error, context::pickups) << "Invalid healthSpeed in HealthPickup." << endl; 353 } 345 orxout(internal_error, context::pickups) << "Invalid healthRate '" << rate << "' in HealthPickup. The healthRate must be non-negative." << endl; 354 346 } 355 347 … … 363 355 { 364 356 if(type == HealthPickup::healthTypeLimited_s) 365 {366 357 this->setHealthTypeDirect(pickupHealthType::limited); 367 }368 358 else if(type == HealthPickup::healthTypeTemporary_s) 369 {370 359 this->setHealthTypeDirect(pickupHealthType::temporary); 371 }372 360 else if(type == HealthPickup::healthTypePermanent_s) 373 {374 361 this->setHealthTypeDirect(pickupHealthType::permanent); 375 }376 362 else 377 { 378 orxout(internal_error, context::pickups) << "Invalid healthType in HealthPickup." << endl; 379 } 363 orxout(internal_error, context::pickups) << "Invalid healthType '" << type << "' in HealthPickup." << endl; 380 364 } 381 365
Note: See TracChangeset
for help on using the changeset viewer.