Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6076


Ignore:
Timestamp:
Nov 16, 2009, 5:58:34 PM (15 years ago)
Author:
scheusso
Message:

some fixes in the weaponsystem and weaponsettings3.oxi

Location:
code/branches/particles2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/particles2/data/levels/includes/weaponsettings3.oxi

    r6065 r6076  
    4646          <DefaultWeaponmodeLink firemode=1 weaponmode=0 />
    4747        </links>
    48         <Weapon>
    49           <!-- EnergyDrink mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" / -->
    50         </Weapon>
     48        <!--Weapon>
     49          <EnergyDrink mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" />
     50        </Weapon-->
    5151      </WeaponPack>
    5252    </weapons>
  • code/branches/particles2/src/orxonox/weaponsystem/WeaponPack.cc

    r5929 r6076  
    4949    WeaponPack::~WeaponPack()
    5050    {
    51         if (this->isInitialized() && this->weaponSystem_)
     51        if (this->isInitialized())
    5252        {
    53             this->weaponSystem_->removeWeaponPack(this);
     53            if( this->weaponSystem_ )
     54                this->weaponSystem_->removeWeaponPack(this);
    5455
    5556            while (!this->weapons_.empty())
     
    7172    void WeaponPack::fire(unsigned int weaponmode)
    7273    {
    73         for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     74        for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    7475            (*it)->fire(weaponmode);
    7576    }
     
    7778    void WeaponPack::reload()
    7879    {
    79         for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     80        for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    8081            (*it)->reload();
    8182    }
     
    8687            return;
    8788
    88         this->weapons_.insert(weapon);
     89        this->weapons_.push_back(weapon);
    8990        weapon->setWeaponPack(this);
    9091    }
     
    9596            return;
    9697
    97         this->weapons_.erase(weapon);
     98        assert( std::find(this->weapons_.begin(), this->weapons_.end(), weapon)!=this->weapons_.end() );
     99        this->weapons_.erase( std::find(this->weapons_.begin(), this->weapons_.end(), weapon) );
    98100        weapon->setWeaponPack(0);
    99101    }
     
    103105        unsigned int i = 0;
    104106
    105         for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     107        for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    106108        {
    107109            if (i == index)
     
    142144    void WeaponPack::notifyWeapons()
    143145    {
    144         for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     146        for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    145147            (*it)->setWeaponPack(this);
    146148    }
  • code/branches/particles2/src/orxonox/weaponsystem/WeaponPack.h

    r5781 r6076  
    6969            void notifyWeapons();
    7070
    71             std::set<Weapon *> weapons_;
     71            std::vector<Weapon *> weapons_;
    7272            std::set<DefaultWeaponmodeLink *> links_;
    7373            WeaponSystem * weaponSystem_;
  • code/branches/particles2/src/orxonox/weaponsystem/WeaponSystem.cc

    r5929 r6076  
    202202        }
    203203
    204         this->weaponPacks_.insert(wPack);
     204        this->weaponPacks_.push_back(wPack);
    205205        wPack->setWeaponSystem(this);
    206206
     
    221221
    222222        // Remove the WeaponPack from the WeaponSystem
    223         this->weaponPacks_.erase(wPack);
     223        assert( std::find(this->weaponPacks_.begin(),this->weaponPacks_.end(),wPack)!=this->weaponPacks_.end() );
     224        this->weaponPacks_.erase( std::find(this->weaponPacks_.begin(),this->weaponPacks_.end(),wPack) );
    224225    }
    225226
     
    227228    {
    228229        unsigned int i = 0;
    229         for (std::set<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
     230        for (std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
    230231        {
    231232            ++i;
     
    258259
    259260        // Check if the WeaponPack belongs to this WeaponSystem
    260         std::set<WeaponPack *>::iterator it1 = this->weaponPacks_.find(wPack);
     261        std::vector<WeaponPack *>::iterator it1 = std::find( this->weaponPacks_.begin(), this->weaponPacks_.end(), wPack );
    261262        if (it1 == this->weaponPacks_.end())
    262263            return;
  • code/branches/particles2/src/orxonox/weaponsystem/WeaponSystem.h

    r5781 r6076  
    9292            std::map<unsigned int, WeaponSet *> weaponSets_;
    9393            std::vector<WeaponSlot *> weaponSlots_;
    94             std::set<WeaponPack *> weaponPacks_;
     94            std::vector<WeaponPack *> weaponPacks_;
    9595            std::map<Identifier *, Munition *> munitions_;
    9696            Pawn * pawn_;
Note: See TracChangeset for help on using the changeset viewer.