Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 26, 2008, 7:42:29 PM (16 years ago)
Author:
polakma
Message:

added WeaponPack

File:
1 edited

Legend:

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

    r2232 r2288  
    3535
    3636#include "WeaponSet.h"
     37#include "WeaponPack.h"
    3738
    3839namespace orxonox
     
    4445        this->parentWeaponSystem_ = 0;
    4546
    46         /* will be made with XML
    47         for (int i=0;i<k;i++)
    48         {
    49             attachWeaponSlot(new WeaponSlot(this));
    50         }
    51         */
    5247    }
    5348
     
    5651    }
    5752
    58     void WeaponSet::attachWeaponSlot(WeaponSlot *wSlot)
     53    void WeaponSet::attachWeaponPack(WeaponPack *wPack)
    5954    {
    60         this->weaponSlots_.push_back(wSlot);
     55        if (this->parentWeaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->parentWeaponSystem_->getWeaponSlotSize() ) )
     56        {
     57            //should be possible to choose which slot to use
     58            for (  int i=0; i < wPack->getSize() ; i++  )
     59            {
     60                this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(i) );
     61            }
     62        }
    6163    }
    6264
     65    /* this function will be in WeaponPack
    6366    void WeaponSet::fire()
    6467    {
    6568        for (int i=0; i < (int) this->weaponSlots_.size(); i++)
    6669        {
     70COUT(0) << "WeaponSlot::fire"<< i << std::endl;
    6771            this->weaponSlots_[i]->fire();
    6872        }
    6973    }
    70 
    71     WeaponSlot * WeaponSet::getWeaponSlotPointer(unsigned int n)
    72     {
    73         if (n < this->weaponSlots_.size())
    74             return this->weaponSlots_[n];
    75         else
    76             return 0;
    77     }
    78 
     74    */
    7975
    8076    void WeaponSet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
Note: See TracChangeset for help on using the changeset viewer.