Changeset 6547 in orxonox.OLD for trunk/src/world_entities/power_ups/param_power_up.cc
- Timestamp:
- Jan 18, 2006, 2:12:53 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/power_ups/param_power_up.cc
r6512 r6547 32 32 33 33 const char* ParamPowerUp::paramTypes[] = { 34 "shield" 34 "shield", 35 "max-shield", 36 "health", 37 "max-health", 35 38 }; 36 39 … … 77 80 } 78 81 79 void ParamPowerUp::setValue( int value)82 void ParamPowerUp::setValue(float value) 80 83 { 81 84 this->value = value; … … 84 87 void ParamPowerUp::setType(const char* type) 85 88 { 86 for(int i = 0; i < P ARAM_size; ++i) {89 for(int i = 0; i < POWERUP_PARAM_size; ++i) { 87 90 if(strcmp(type, paramTypes[i]) == 0) { 88 91 this->type = (EnumParamPowerUpType)i; … … 92 95 } 93 96 94 void ParamPowerUp::setMaxValue( int value)97 void ParamPowerUp::setMaxValue(float value) 95 98 { 96 99 this->max_value = value; 97 100 } 98 101 99 void ParamPowerUp::setMinValue( int value)102 void ParamPowerUp::setMinValue(float value) 100 103 { 101 104 this->min_value = value; 102 105 } 103 106 104 int ParamPowerUp::getValue()107 float ParamPowerUp::getValue() 105 108 { 106 109 return this->value; … … 116 119 if(this->min_value != this->max_value) 117 120 { 118 value = this->min_value + (int)(rand() * (this->max_value - this->min_value));121 this->value = this->min_value + rand() * (this->max_value - this->min_value); 119 122 } 120 123 } … … 132 135 SYNCHELP_READ_INT( i ); 133 136 this->type = (EnumParamPowerUpType)i; 134 SYNCHELP_READ_ INT( this->value );137 SYNCHELP_READ_FLOAT( this->value ); 135 138 136 139 if ( this->value != 0 ) 137 140 { 138 SYNCHELP_READ_ INT( this->min_value );139 SYNCHELP_READ_ INT( this->max_value );141 SYNCHELP_READ_FLOAT( this->min_value ); 142 SYNCHELP_READ_FLOAT( this->max_value ); 140 143 respawn(); 141 144 } … … 165 168 int i = (int)this->type; 166 169 SYNCHELP_WRITE_INT( i ); 167 SYNCHELP_WRITE_ INT( this->value );170 SYNCHELP_WRITE_FLOAT( this->value ); 168 171 169 172 if ( this->value != 0 ) 170 173 { 171 SYNCHELP_WRITE_ INT( this->min_value );172 SYNCHELP_WRITE_ INT( this->max_value );174 SYNCHELP_WRITE_FLOAT( this->min_value ); 175 SYNCHELP_WRITE_FLOAT( this->max_value ); 173 176 } 174 177
Note: See TracChangeset
for help on using the changeset viewer.