Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 14, 2016, 4:02:00 PM (9 years ago)
Author:
sagerj
Message:

today I got pawn'ed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.cc

    r11164 r11166  
    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        orxout() << "fire weapon " << mode << endl;
    116117        if (this->bReloading_ && this->reloadingWeaponmode_ != mode)
    117118            return;
     
    135136
    136137    void Weapon::release(unsigned int mode)
    137     {orxout() << "release weapon " << mode << endl;}
     138    {
     139        orxout() << "release weapon " << mode << endl;
     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))
     150            {
     151                this->bReloading_ = true;
     152                this->reloadingWeaponmode_ = mode;
     153
     154                this->reloadTimer_.setInterval(reloading_time);
     155                this->reloadTimer_.startTimer();
     156            }
     157        }
     158    }
    138159
    139160    /**
Note: See TracChangeset for help on using the changeset viewer.