Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2008, 2:10:11 AM (15 years ago)
Author:
landauf
Message:

merged weapon2 branch to presentation

Location:
code/branches/presentation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/orxonox/objects/weaponSystem/Munition.cc

    r2097 r2493  
    3737namespace orxonox
    3838{
     39    CreateFactory(Munition);
     40
    3941    Munition::Munition(BaseObject* creator) : BaseObject(creator)
    4042    {
     
    4648    }
    4749
     50    unsigned int Munition::bullets()
     51    {
     52        if (this->bullets_ > 0)
     53            return bullets_;
     54        else
     55            return 0;
     56    }
     57
     58    unsigned int Munition::magazines()
     59    {
     60        if (this->magazines_ > 0)
     61            return magazines_;
     62        else
     63            return 0;
     64    }
     65
     66    void Munition::setMaxBullets(unsigned int amount)
     67    { this->maxBullets_ = amount; }
     68
     69    void Munition::setMaxMagazines(unsigned int amount)
     70    { this->maxMagazines_ = amount; }
     71
     72    void Munition::removeBullets(unsigned int amount)
     73    {
     74        if ( this->bullets_ != 0 )
     75            this->bullets_ = this->bullets_ - amount;
     76    }
     77
     78    void Munition::removeMagazines(unsigned int amount)
     79    {
     80        if ( this->magazines_ != 0 )
     81            this->magazines_ = this->magazines_ - amount;
     82    }
     83
     84    void Munition::addBullets(unsigned int amount)
     85    {
     86        if ( this->bullets_ == this->maxBullets_ )
     87        {
     88            //cannot add bullets to actual magazine
     89        }
     90        else
     91            this->bullets_ = this->bullets_ + amount;
     92    }
     93
     94    void Munition::addMagazines(unsigned int amount)
     95    {
     96        if ( this->magazines_ == this->maxMagazines_ )
     97        {
     98            //no more capacity for another magazine
     99        }
     100        else
     101            this->magazines_ = this->magazines_ + amount;
     102    }
     103
     104
     105    void Munition::fillBullets()
     106    {
     107//COUT(0) << "Munition::fillBullets maxBullets_=" << this->maxBullets_ << std::endl;
     108        this->bullets_ = this->maxBullets_;
     109    }
     110
     111    void Munition::fillMagazines()
     112    {
     113        this->magazines_ = this->maxMagazines_;
     114    }
     115
    48116    void Munition::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    49117    {
    50 
     118        SUPER(Munition, XMLPort, xmlelement, mode);
    51119    }
    52120
Note: See TracChangeset for help on using the changeset viewer.