Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2008, 2:38:33 PM (17 years ago)
Author:
polakma
Message:

changed Weapon::fire and munition reloading

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/Munition.cc

    r2232 r2379  
    4646    }
    4747
    48     unsigned int Munition::getBullets()
    49     { return this->bullets_; }
     48    bool Munition::bullets()
     49    {
     50        if (this->bullets_ > 0)
     51            return true;
     52        else
     53            return false;
     54    }
    5055
    51     unsigned int Munition::getMagazines()
    52     { return this->magazines_; }
     56    bool Munition::magazines()
     57    {
     58        if (this->magazines_ > 0)
     59            return true;
     60        else
     61            return false;
     62    }
    5363
    5464    void Munition::setMaxBullets(unsigned int amount)
     
    6070    void Munition::removeBullets(unsigned int amount, Weapon * parentWeapon)
    6171    {
    62         //if actual magazine is empty, decrement it and set the bullets amount to full (masBullets_)
    6372        if ( this->bullets_ == 0 )
    6473        {
    6574            this->removeMagazines(1);
    66             parentWeapon->magazineTimer();
     75            parentWeapon->magazineTimer(0);
    6776            this->bullets_ = this->maxBullets_;
    6877        }
     
    8594        }
    8695        else
    87             this->magazines_ = this->magazines_ - amount; }
     96            this->magazines_ = this->magazines_ - amount;
     97    }
    8898
    8999    void Munition::addBullets(unsigned int amount)
     
    108118
    109119
     120    void Munition::fillBullets()
     121    {
     122        this->bullets_ = this->maxBullets_;
     123    }
     124   
     125    void Munition::fillMagazines()
     126    {
     127        this->magazines_ = this->maxMagazines_;
     128    }
     129   
    110130    void Munition::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    111131    {
Note: See TracChangeset for help on using the changeset viewer.