Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2008, 7:51:46 PM (16 years ago)
Author:
polakma
Message:

made some changes

Location:
code/branches/weapon2/src/orxonox/objects/weaponSystem
Files:
4 edited

Legend:

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

    r2288 r2308  
    5555        if (this->parentWeaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->parentWeaponSystem_->getWeaponSlotSize() ) )
    5656        {
     57            this->attachedWeaponPack_ = wPack;
    5758            //should be possible to choose which slot to use
    5859            for (  int i=0; i < wPack->getSize() ; i++  )
    5960            {
     61                //at the moment this function only works for one weaponPack in the entire WeaponSystem...
     62                this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(i) );
    6063                this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(i) );
    6164            }
     
    6366    }
    6467
    65     /* this function will be in WeaponPack
     68
    6669    void WeaponSet::fire()
    6770    {
    68         for (int i=0; i < (int) this->weaponSlots_.size(); i++)
    69         {
    70 COUT(0) << "WeaponSlot::fire"<< i << std::endl;
    71             this->weaponSlots_[i]->fire();
    72         }
     71        //fires all WeaponSlots available for this weaponSet attached from the WeaponPack
     72        this->attachedWeaponPack_->fire();
    7373    }
    74     */
     74
     75    void WeaponSet::setFireMode(const unsigned int firemode)
     76    {   this->firemode_ = firemode; }
     77
     78    const unsigned int WeaponSet::getFireMode() const
     79    {   return this->firemode_; }
    7580
    7681    void WeaponSet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    7782    {
    78 
     83        SUPER(WeaponSet, XMLPort, xmlelement, mode);
     84        XMLPortParam(WeaponSet, "firemode", setFireMode, getFireMode, xmlelement, mode);
    7985    }
    8086
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSet.h

    r2288 r2308  
    5151            void fire();
    5252
     53            void setFireMode(const unsigned int firemode);
     54            const unsigned int getFireMode() const;
     55
    5356            inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
    5457                { parentWeaponSystem_=parentWeaponSystem; }
     
    5861        private:
    5962            WeaponSystem *parentWeaponSystem_;
     63            std::vector<WeaponSlot *> setWeaponSlots_;
     64            unsigned int firemode_;
     65            WeaponPack * attachedWeaponPack_;
    6066    };
    6167}
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSlot.cc

    r2288 r2308  
    7272    void WeaponSlot::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    7373    {
    74         SUPER(WeaponSlot, XMLPort, xmlelement, mode);
    75         XMLPortObject(WeaponSlot, Weapon, "attached-weapon", attachWeapon, getAttachedWeapon, xmlelement, mode);
     74
    7675    }
    7776
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSystem.cc

    r2288 r2308  
    105105        if (n < (int)this->weaponSets_.size())
    106106COUT(0) << "WeaponSystem::fire - after if" << std::endl;
    107             //this->weaponSets_[n]->fire();
     107            this->weaponSets_[n]->fire();
    108108    }
    109109
Note: See TracChangeset for help on using the changeset viewer.