Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2009, 5:20:11 PM (15 years ago)
Author:
rgrieder
Message:

Merged particles2 branch to presentation2.

Location:
code/branches/presentation2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2

  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.cc

    r5929 r6107  
    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        std::vector<Weapon*>::iterator it = std::find(this->weapons_.begin(), this->weapons_.end(), weapon);
     99        assert(it != this->weapons_.end());
     100        this->weapons_.erase(it);
    98101        weapon->setWeaponPack(0);
    99102    }
     
    103106        unsigned int i = 0;
    104107
    105         for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     108        for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    106109        {
    107110            if (i == index)
     
    142145    void WeaponPack::notifyWeapons()
    143146    {
    144         for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     147        for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    145148            (*it)->setWeaponPack(this);
    146149    }
  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponPack.h

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

    r5929 r6107  
    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        std::vector<WeaponPack*>::iterator it = std::find(this->weaponPacks_.begin(),this->weaponPacks_.end(), wPack);
     224        assert(it !=this->weaponPacks_.end());
     225        this->weaponPacks_.erase(it);
    224226    }
    225227
     
    227229    {
    228230        unsigned int i = 0;
    229         for (std::set<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
     231        for (std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
    230232        {
    231233            ++i;
     
    258260
    259261        // Check if the WeaponPack belongs to this WeaponSystem
    260         std::set<WeaponPack *>::iterator it1 = this->weaponPacks_.find(wPack);
     262        std::vector<WeaponPack *>::iterator it1 = std::find( this->weaponPacks_.begin(), this->weaponPacks_.end(), wPack );
    261263        if (it1 == this->weaponPacks_.end())
    262264            return;
  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponSystem.h

    r5781 r6107  
    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.