Changeset 4890 in orxonox.OLD for orxonox/trunk/src/world_entities/weapons/weapon.cc
- Timestamp:
- Jul 19, 2005, 12:20:58 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/weapons/weapon.cc
r4885 r4890 122 122 printf("next action will be %s in %f seconds\n", actionToChar(action), this->stateDuration); 123 123 this->requestedAction = action; 124 } 125 } 126 127 128 /** 129 * adds energy to the Weapon 130 * @param energyToAdd The amount of energy 131 * @returns the amount of energy we did not pick up, because the weapon is already full 132 */ 133 float Weapon::increaseEnergy(float energyToAdd) 134 { 135 float maxAddEnergy = this->energyMax - this->energy; 136 137 if (maxAddEnergy >= energyToAdd) 138 { 139 this->energy += energyToAdd; 140 return 0.0; 141 } 142 else 143 { 144 this->energy += maxAddEnergy; 145 return energyToAdd - maxAddEnergy; 124 146 } 125 147 }
Note: See TracChangeset
for help on using the changeset viewer.