Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 18, 2006, 2:12:53 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the WeaponManager back to the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/power_ups/param_power_up.cc

    r6512 r6547  
    3232
    3333const char* ParamPowerUp::paramTypes[] = {
    34   "shield"
     34  "shield",
     35  "max-shield",
     36  "health",
     37  "max-health",
    3538};
    3639
     
    7780}
    7881
    79 void ParamPowerUp::setValue(int value)
     82void ParamPowerUp::setValue(float value)
    8083{
    8184  this->value = value;
     
    8487void ParamPowerUp::setType(const char* type)
    8588{
    86   for(int i = 0; i < PARAM_size; ++i) {
     89  for(int i = 0; i < POWERUP_PARAM_size; ++i) {
    8790    if(strcmp(type, paramTypes[i]) == 0) {
    8891      this->type = (EnumParamPowerUpType)i;
     
    9295}
    9396
    94 void ParamPowerUp::setMaxValue(int value)
     97void ParamPowerUp::setMaxValue(float value)
    9598{
    9699  this->max_value = value;
    97100}
    98101
    99 void ParamPowerUp::setMinValue(int value)
     102void ParamPowerUp::setMinValue(float value)
    100103{
    101104  this->min_value = value;
    102105}
    103106
    104 int ParamPowerUp::getValue()
     107float ParamPowerUp::getValue()
    105108{
    106109  return this->value;
     
    116119  if(this->min_value != this->max_value)
    117120  {
    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);
    119122  }
    120123}
     
    132135  SYNCHELP_READ_INT( i );
    133136  this->type = (EnumParamPowerUpType)i;
    134   SYNCHELP_READ_INT( this->value );
     137  SYNCHELP_READ_FLOAT( this->value );
    135138
    136139  if ( this->value != 0 )
    137140  {
    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 );
    140143    respawn();
    141144  }
     
    165168    int i = (int)this->type;
    166169    SYNCHELP_WRITE_INT( i );
    167     SYNCHELP_WRITE_INT( this->value );
     170    SYNCHELP_WRITE_FLOAT( this->value );
    168171
    169172    if ( this->value != 0 )
    170173    {
    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 );
    173176    }
    174177
Note: See TracChangeset for help on using the changeset viewer.