Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2354


Ignore:
Timestamp:
Dec 8, 2008, 2:36:47 PM (15 years ago)
Author:
polakma
Message:

made some changes to munition attaching

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

Legend:

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

    r2347 r2354  
    111111this->munitionType_ = munitionType; }
    112112
    113     std::string Weapon::getMunitionType()
     113    const std::string Weapon::getMunitionType()
    114114    {   return this->munitionType_;  }
    115115
    116116    Munition * Weapon::getAttachedMunition(std::string munitionType)
    117117    {   
    118 COUT(0) << "Weapon::getAttachedMunition, parentWeaponSystem_="<< this->parentWeaponSystem_ << std::endl;   
    119         this->parentWeaponSystem_->getMunitionType(munitionType);
     118COUT(0) << "Weapon::getAttachedMunition, parentWeaponSystem_="<< this->parentWeaponSystem_ << std::endl;
     119        this->munition_ = this->parentWeaponSystem_->getMunitionType(munitionType);
    120120COUT(0) << "Weapon::getAttachedMunition, munition_="<< this->munition_ << std::endl;
    121121return this->munition_; }
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.h

    r2337 r2354  
    7171
    7272            void setMunitionType(std::string munitionType);
    73             std::string getMunitionType();
     73            const std::string getMunitionType();
    7474
    7575            inline void setParentWeaponSlot(WeaponSlot *parentWeaponSlot)
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponPack.cc

    r2347 r2354  
    5959    }
    6060
    61     void WeaponPack::attachWeapon(Weapon *weapon)
    62     {
    63         this->weapons_.push_back(weapon);
    64     }
    65 
    6661    void WeaponPack::fire()
    6762    {
     
    8681    void WeaponPack::setFireMode(unsigned int firemode)
    8782    {
     83COUT(0) << "WeaponPack::setFireMode " << std::endl;
    8884        this->firemode_ = firemode;
    8985    }
     
    9793    {
    9894        weapon->setParentWeaponSystem(this->parentWeaponSystem_);
    99 COUT(0) << "WeaponPack::addWeapon " << weapon->getMunitionType() << std::endl;
     95COUT(0) << "WeaponPack::addWeapon " << weapon << "   munition " << weapon->getMunitionType() << std::endl;
    10096        this->weapons_.push_back(weapon);
    10197    }
    10298
    103     Weapon * WeaponPack::getWeapon(unsigned int index)
     99    const Weapon * WeaponPack::getWeapon(unsigned int index)
    104100    {
    105101        return weapons_[index];
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponPack.h

    r2337 r2354  
    5252            Weapon * getWeaponPointer(unsigned int n);
    5353            int getSize();
    54             void attachWeapon(Weapon *weapon);
    5554
    5655            void setFireMode(unsigned int firemode);
     
    5857
    5958            void addWeapon(Weapon * weapon);
    60             Weapon * getWeapon(unsigned int index);
     59            const Weapon * getWeapon(unsigned int index);
    6160
    6261            void setWeaponSystemToAllWeapons(WeaponSystem * weaponSystem);
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc

    r2347 r2354  
    8383    void LaserGun::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    8484    {
    85 
     85        SUPER(LaserGun, XMLPort, xmlelement, mode);
     86        XMLPortParam(LaserGun, "munitionType", setMunitionType, getMunitionType, xmlelement, mode);
    8687    }
    8788
     89    void LaserGun::setMunitionType(std::string munitionType)
     90    {   
     91COUT(0) << "LaserGun::setMunitionType (XMLPort) "<< munitionType << std::endl;
     92        this->munitionType_ = munitionType; }
    8893
     94    const std::string LaserGun::getMunitionType()
     95    {   return this->munitionType_;  }
    8996
    9097}
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.h

    r2331 r2354  
    5252            void fire();
    5353
     54            void setMunitionType(std::string munitionType);
     55            const std::string getMunitionType();
     56
    5457        private:
    5558            float speed_;
Note: See TracChangeset for help on using the changeset viewer.