Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2016, 4:53:34 PM (8 years ago)
Author:
fvultier
Message:

merged discharger, thats the last one

Location:
code/branches/presentationFS16
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationFS16

  • code/branches/presentationFS16/src/orxonox/weaponsystem/Weapon.cc

    r11071 r11208  
    9999        Fire this Weapon with the the WeaponMode defined by @param mode
    100100    */
    101     void Weapon::fire(unsigned int mode)
     101    void Weapon::push(unsigned int mode)
    102102    {
    103103        // To avoid firing with more than one mode at the same time, we lock the weapon (reloading) for
     
    114114        // Note: The reloading of each WeaponMode is internally handled by each A, B and C.
    115115        //       The reloading of the weapon is only performed to avoid firing with different modes at the same time.
     116   
     117   
    116118        if (this->bReloading_ && this->reloadingWeaponmode_ != mode)
    117119            return;
     
    123125        {
    124126            float reloading_time = 0;
    125             if (it->second->fire(&reloading_time))
     127            if (it->second->push(&reloading_time))
     128            {
     129                this->bReloading_ = true;
     130                this->reloadingWeaponmode_ = mode;
     131
     132                this->reloadTimer_.setInterval(reloading_time);
     133                this->reloadTimer_.startTimer();
     134            }
     135        }
     136    }
     137
     138    void Weapon::release(unsigned int mode)
     139    {
     140        if (this->bReloading_ && this->reloadingWeaponmode_ != mode)
     141            return;
     142
     143        std::multimap<unsigned int, WeaponMode*>::iterator start = this->weaponmodes_.lower_bound(mode);
     144        std::multimap<unsigned int, WeaponMode*>::iterator end   = this->weaponmodes_.upper_bound(mode);
     145
     146        for (std::multimap<unsigned int, WeaponMode*>::iterator it = start; it != end; ++it)
     147        {
     148            float reloading_time = 0;
     149            if (it->second->release(&reloading_time))
    126150            {
    127151                this->bReloading_ = true;
Note: See TracChangeset for help on using the changeset viewer.