Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 3, 2008, 3:11:48 PM (16 years ago)
Author:
polakma
Message:

fixed WeaponPack attaching

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSet.cc

    r2308 r2319  
    5353    void WeaponSet::attachWeaponPack(WeaponPack *wPack)
    5454    {
    55         if (this->parentWeaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->parentWeaponSystem_->getWeaponSlotSize() ) )
     55        if ( this->parentWeaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->parentWeaponSystem_->getWeaponSlotSize() ) )
    5656        {
    5757            this->attachedWeaponPack_ = wPack;
     58            int wPackWeapon = 0;    //WeaponCounter for Attaching
    5859            //should be possible to choose which slot to use
    5960            for (  int i=0; i < wPack->getSize() ; i++  )
    6061            {
    6162                //at the moment this function only works for one weaponPack in the entire WeaponSystem...
    62                 this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(i) );
    63                 this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(i) );
     63                if ( this->parentWeaponSystem_->getWeaponSlotPointer(i)->getAttachedWeapon() != 0 ) //if slot not full
     64                {
     65                    this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(i) );
     66                    this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
     67                    wPackWeapon++;
     68                }
    6469            }
    6570        }
Note: See TracChangeset for help on using the changeset viewer.