Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2308 for code/branches/weapon2


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
Files:
6 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
  • code/branches/weapon2/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2288 r2308  
    7777
    7878        XMLPortObject(Pawn, WeaponSlot, "weaponslots", setWeaponSlot, getWeaponSlot, xmlelement, mode);
     79        XMLPortObject(Pawn, WeaponSet, "weaponsets", setWeaponSet, getWeaponSet, xmlelement, mode);
    7980        //XMLPortObject(Pawn, WeaponPack, "weapons", setWeaponPack, getWeaponPack, xmlelement, mode);
    8081
     
    153154    }
    154155
     156
    155157    void Pawn::setWeaponSlot(WeaponSlot * wSlot)
    156     {
    157         this->weaponSystem_->attachWeaponSlot(wSlot);
    158     }
     158    {   this->weaponSystem_->attachWeaponSlot(wSlot);   }
     159    WeaponSlot * Pawn::getWeaponSlot(unsigned int index) const
     160    {   return this->weaponSystem_->getWeaponSlotPointer(index);    }
    159161
    160     WeaponSlot * Pawn::getWeaponSlot(unsigned int index) const
    161     {
    162         return this->weaponSystem_->getWeaponSlotPointer(index);
    163     }
     162    /*
     163    void Pawn::setWeaponPack(WeaponPack * wPack)
     164    {   this->weaponSystem_->attachWeaponPack(wPack);   }
     165    WeaponPack * Pawn::getWeaponPack(unsigned int index) const
     166    {   return this->weaponSystem_->getWeaponPackPointer(index);
     167    */
     168
     169    void Pawn::setWeaponSet(WeaponSet * wSet)
     170    {   this->weaponSystem_->attachWeaponSet(wSet);   }
     171    WeaponSet * Pawn::getWeaponSet(unsigned int index) const
     172    {   return this->weaponSystem_->getWeaponSetPointer(index);    }
    164173
    165174}
  • code/branches/weapon2/src/orxonox/objects/worldentities/pawns/Pawn.h

    r2288 r2308  
    8181            void setWeaponSlot(WeaponSlot * wSlot);
    8282            WeaponSlot * getWeaponSlot(unsigned int index) const;
     83         //   void setWeaponPack(WeaponPack * wPack);
     84         //   WeaponPack * getWeaponPack(unsigned int index) const;
     85            void setWeaponSet(WeaponSet * wSet);
     86            WeaponSet * getWeaponSet(unsigned int index) const;
    8387
    8488        protected:
Note: See TracChangeset for help on using the changeset viewer.