Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 18, 2012, 12:47:54 PM (13 years ago)
Author:
lkevin
Message:

Finished DamageBoost Pickup and the XML inclusions are working now.

Location:
code/branches/pickup2012/src/modules/pickup/items
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.cc

    r9155 r9184  
    7070    void DamageBoostPickup::initialize(void)
    7171    {
    72         this->duration_ = 0.0f;
    73         this->damageMultiplier_ = 1.0f; //The default damage multiplier.
     72        this->duration_ = 0.0f;
     73        this->damageMultiplier_ = 1.0f; //The default damage multiplier.
    7474        //Defines who is allowed to pick up the pickup.
    7575        this->addTarget(ClassIdentifier<SpaceShip>::getIdentifier());
     
    8989
    9090        stream.clear();
    91         stream << this->damageMultiplier_;
     91        stream << this->getDamageMultiplier();
    9292        std::string type2 = "damageMultiplier";
    9393        std::string val2 = stream.str();
     
    116116        {
    117117            this->damageMultiplier_ = damageMultiplier;
    118             orxout() << "Set Damage " << damageMultiplier << endl;
    119         }
    120     }
    121 
    122 
    123     /**
    124     @brief
    125         Is called when the pickup has transited from used to unused or the other way around.
     118        }
     119    }
     120
     121
     122    /**
     123    @brief
     124        Is called when the pickup has transisted from used to unused or the other way around.
    126125    */
    127126    void DamageBoostPickup::changedUsed(void)
     
    151150
    152151            // Saves the old default Damage that is needed to restore the original damage
    153             this->olddamageMultiplier_ = ship->getDamageMultiplier();
    154             // Sets the new Damage with the damage multiplier.
    155             ship->setDamageMultiplier( this->damageMultiplier_ );
     152            this->olddamageMultiplier_ = 1.0f;
     153            // Sets the new Damage with the damage multiplier
     154            ship->setDamageMultiplier(this->getDamageMultiplier());
    156155        }
    157156        else
     
    206205        DamageBoostPickup* pickup = dynamic_cast<DamageBoostPickup*>(item);
    207206        pickup->setDuration(this->getDuration());
    208        
    209 
     207        pickup->setDamageMultiplier(this->getDamageMultiplier());
    210208        pickup->initializeIdentifier();
    211209    }
  • code/branches/pickup2012/src/modules/pickup/items/DamageBoostPickup.h

    r9155 r9184  
    6363            inline float getDuration(void) const
    6464                { return this->duration_; }
     65
    6566            inline void setDuration( float duration );
    6667
     
    7980        protected:
    8081            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    81             void setDamageMultiplier(float damageMultiplier);
     82            void setDamageMultiplier(float damageMultiplier); //!< Sets the DamageMultiplier according to the XML.
    8283
    8384
Note: See TracChangeset for help on using the changeset viewer.