Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2912


Ignore:
Timestamp:
Apr 9, 2009, 3:18:11 AM (15 years ago)
Author:
landauf
Message:

Several small adjustments in the weaponsystem (like additional const keyword, includes moved from .h to .cc where possible, …)

Firemode is now an unsigned int instead of an Enum. Instead of "fire" and "altFire" use "fire 0" and "fire 1"

Location:
code/branches/weapons/src/orxonox
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapons/src/orxonox/OrxonoxPrereqs.h

    r2896 r2912  
    7373        };
    7474    }
    75 
    76     //put here all existing munitionTypes
    77     namespace MunitionType
    78     {
    79         enum Enum
    80         { laserGunMunition };
    81     }
    82 
    83     //put here all weapon fire modes.
    84     //they have to be added to Pawn and HumanController, too.
    85     namespace WeaponMode
    86     {
    87         enum Enum
    88         {
    89             fire     = 0x1,
    90             altFire  = 0x2,
    91             altFire2 = 0x4
    92         };
    93     }
    94 
    9575
    9676    class GraphicsManager;
  • code/branches/weapons/src/orxonox/objects/controllers/AIController.cc

    r2896 r2912  
    111111
    112112        if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(500) && this->isLookingAtTarget(Ogre::Math::PI / 20.0))
    113             this->getControllableEntity()->fire(WeaponMode::fire);
     113            this->getControllableEntity()->fire(0);
    114114
    115115        SUPER(AIController, tick, dt);
  • code/branches/weapons/src/orxonox/objects/controllers/HumanController.cc

    r2872 r2912  
    4646    SetConsoleCommand(HumanController, rotateRoll,    true).setAsInputCommand();
    4747    SetConsoleCommand(HumanController, fire,          true).keybindMode(KeybindMode::OnHold);
    48     SetConsoleCommand(HumanController, altFire,       true).keybindMode(KeybindMode::OnHold);
    4948    SetConsoleCommand(HumanController, boost,         true).keybindMode(KeybindMode::OnHold);
    5049    SetConsoleCommand(HumanController, greet,         true);
     
    109108    }
    110109
    111     void HumanController::fire()
     110    void HumanController::fire(unsigned int firemode)
    112111    {
    113112        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    114             HumanController::localController_s->controllableEntity_->fire(WeaponMode::fire);
    115     }
    116 
    117     void HumanController::altFire()
    118     {
    119         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    120             HumanController::localController_s->controllableEntity_->fire(WeaponMode::altFire);
     113            HumanController::localController_s->controllableEntity_->fire(firemode);
    121114    }
    122115
  • code/branches/weapons/src/orxonox/objects/controllers/HumanController.h

    r2662 r2912  
    5151            static void rotateRoll(const Vector2& value);
    5252
    53             static void fire();
    54             static void altFire();
     53            static void fire(unsigned int firemode);
    5554
    5655            static void boost();
  • code/branches/weapons/src/orxonox/objects/weaponSystem/Munition.cc

    r2893 r2912  
    2828
    2929#include "OrxonoxStableHeaders.h"
     30#include "Munition.h"
    3031
    3132#include "core/CoreIncludes.h"
    32 #include "core/XMLPort.h"
    33 #include "util/Debug.h"
    34 
    35 #include "Munition.h"
    3633
    3734namespace orxonox
     
    4239    {
    4340        RegisterObject(Munition);
     41
     42COUT(0) << "+Munition" << std::endl;
    4443    }
    4544
    4645    Munition::~Munition()
    4746    {
     47COUT(0) << "~Munition" << std::endl;
    4848    }
    4949
     
    112112        this->magazines_ = this->maxMagazines_;
    113113    }
    114 
    115     void Munition::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    116     {
    117         SUPER(Munition, XMLPort, xmlelement, mode);
    118     }
    119 
    120114}
  • code/branches/weapons/src/orxonox/objects/weaponSystem/Munition.h

    r2662 r2912  
    3131
    3232#include "OrxonoxPrereqs.h"
    33 
    3433#include "core/BaseObject.h"
    35 
    36 #include "Weapon.h"
    37 
    3834
    3935namespace orxonox
     
    4440            Munition(BaseObject* creator);
    4541            virtual ~Munition();
    46 
    47             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4842
    4943            void setMaxBullets(unsigned int amount);
  • code/branches/weapons/src/orxonox/objects/weaponSystem/Weapon.cc

    r2893 r2912  
    2828
    2929#include "OrxonoxStableHeaders.h"
     30#include "Weapon.h"
    3031
    3132#include "core/CoreIncludes.h"
    3233#include "core/XMLPort.h"
    33 #include "util/Debug.h"
    34 
    35 #include "Weapon.h"
     34
     35#include "Munition.h"
     36#include "WeaponSystem.h"
    3637
    3738namespace orxonox
     
    4546        this->bulletReadyToShoot_ = true;
    4647        this->magazineReadyToShoot_ = true;
    47         this->parentWeaponSystem_ = 0;
     48        this->weaponSystem_ = 0;
    4849        this->attachedToWeaponSlot_ = 0;
    4950        this->bulletLoadingTime_ = 0;
     
    5556        this->unlimitedMunition_ = false;
    5657        this->setObjectMode(0x0);
     58
     59COUT(0) << "+Weapon" << std::endl;
    5760    }
    5861
    5962    Weapon::~Weapon()
    6063    {
    61     }
    62 
     64COUT(0) << "~Weapon" << std::endl;
     65    }
    6366
    6467    void Weapon::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    152155
    153156
    154     void Weapon::attachNeededMunition(std::string munitionName)
     157    void Weapon::attachNeededMunition(const std::string& munitionName)
    155158    {
    156159        /*  if munition type already exists attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem
    157160        */
    158         if (this->parentWeaponSystem_)
     161        if (this->weaponSystem_)
    159162        {
    160163            //getMunitionType returns 0 if there is no such munitionType
    161             Munition* munition = this->parentWeaponSystem_->getMunitionType(munitionName);
     164            Munition* munition = this->weaponSystem_->getMunitionType(munitionName);
    162165            if ( munition )
    163166            {
     
    170173                this->munitionIdentifier_ = ClassByString(munitionName);
    171174                this->munition_ = this->munitionIdentifier_.fabricate(this);
    172                 this->parentWeaponSystem_->setNewMunition(munitionName, this->munition_);
     175                this->weaponSystem_->setNewMunition(munitionName, this->munition_);
    173176                this->setMunition();
    174177            }
     
    177180
    178181
    179     Munition * Weapon::getAttachedMunition(std::string munitionType)
    180     {
    181         this->munition_ = this->parentWeaponSystem_->getMunitionType(munitionType);
     182    Munition * Weapon::getAttachedMunition(const std::string& munitionType)
     183    {
     184        this->munition_ = this->weaponSystem_->getMunitionType(munitionType);
    182185        return this->munition_;
    183186    }
     
    193196
    194197    //get and set functions for XMLPort
    195     void Weapon::setMunitionType(std::string munitionType)
     198    void Weapon::setMunitionType(const std::string& munitionType)
    196199    {   this->munitionType_ = munitionType; }
    197200
    198     const std::string Weapon::getMunitionType()
     201    const std::string& Weapon::getMunitionType() const
    199202    {   return this->munitionType_;  }
    200203
     
    202205    {   this->bulletLoadingTime_ = loadingTime; }
    203206
    204     const float Weapon::getBulletLoadingTime()
     207    const float Weapon::getBulletLoadingTime() const
    205208    {   return this->bulletLoadingTime_;  }
    206209
     
    208211    {   this->magazineLoadingTime_ = loadingTime; }
    209212
    210     const float Weapon::getMagazineLoadingTime()
     213    const float Weapon::getMagazineLoadingTime() const
    211214    {   return this->magazineLoadingTime_;  }
    212215
     
    214217    {   this->bulletAmount_ = amount; }
    215218
    216     const unsigned int Weapon::getBulletAmount()
     219    const unsigned int Weapon::getBulletAmount() const
    217220    {   return this->bulletAmount_;  }
    218221
     
    220223    {   this->magazineAmount_ = amount; }
    221224
    222     const unsigned int Weapon::getMagazineAmount()
     225    const unsigned int Weapon::getMagazineAmount() const
    223226    {   return this->magazineAmount_;   }
    224227
     
    226229    {   this->unlimitedMunition_ = unlimitedMunition;   }
    227230
    228     const bool Weapon::getUnlimitedMunition()
     231    const bool Weapon::getUnlimitedMunition() const
    229232    {   return this->unlimitedMunition_;    }
    230233
  • code/branches/weapons/src/orxonox/objects/weaponSystem/Weapon.h

    r2893 r2912  
    3131
    3232#include "OrxonoxPrereqs.h"
     33#include "objects/worldentities/StaticEntity.h"
    3334
    34 #include "core/BaseObject.h"
    35 #include "tools/BillboardSet.h"
    3635#include "tools/Timer.h"
    3736#include "core/Identifier.h"
    38 
    39 #include "WeaponSystem.h"
    40 #include "Munition.h"
    41 
    42 #include "objects/worldentities/StaticEntity.h"
    4337
    4438namespace orxonox
     
    5347
    5448            virtual void fire();
    55             void attachNeededMunition(std::string munitionType);
    56             Munition * getAttachedMunition(std::string munitiontype);
     49            void attachNeededMunition(const std::string& munitionType);
     50            Munition * getAttachedMunition(const std::string& munitiontype);
    5751
    5852            //reloading
     
    6357
    6458            //XMLPort functions
    65             virtual void setMunitionType(std::string munitionType);
    66             virtual const std::string getMunitionType();
     59            virtual void setMunitionType(const std::string& munitionType);
     60            virtual const std::string& getMunitionType() const;
    6761            virtual void setBulletLoadingTime(float loadingTime);
    68             virtual const float getBulletLoadingTime();
     62            virtual const float getBulletLoadingTime() const;
    6963            virtual void setMagazineLoadingTime(float loadingTime);
    70             virtual const float getMagazineLoadingTime();
     64            virtual const float getMagazineLoadingTime() const;
    7165            virtual void setBulletAmount(unsigned int amount);
    72             virtual const unsigned int getBulletAmount();
     66            virtual const unsigned int getBulletAmount() const;
    7367            virtual void setMagazineAmount(unsigned int amount);
    74             virtual const unsigned int getMagazineAmount();
     68            virtual const unsigned int getMagazineAmount() const;
    7569            virtual void setUnlimitedMunition(bool unlimitedMunition);
    76             virtual const bool getUnlimitedMunition();
     70            virtual const bool getUnlimitedMunition() const;
    7771
    7872            //weapon actions
     
    8680            virtual void setWeapon();
    8781            virtual void setMunition();
    88            
    89             inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
    90                 { this->parentWeaponSystem_=parentWeaponSystem; };
    91             inline WeaponSystem * getParentWeaponSystem()
    92                 { return this->parentWeaponSystem_; };
     82
     83            inline void setWeaponSystem(WeaponSystem *weaponSystem)
     84                { this->weaponSystem_ = weaponSystem; };
     85            inline WeaponSystem * getWeaponSystem() const
     86                { return this->weaponSystem_; };
    9387
    9488            inline void setAttachedToWeaponSlot(WeaponSlot * wSlot)
    9589                { this->attachedToWeaponSlot_ = wSlot; }
    96             inline WeaponSlot * getAttachedToWeaponSlot()
     90            inline WeaponSlot * getAttachedToWeaponSlot() const
    9791                { return this->attachedToWeaponSlot_; }
    98 
    99 
    100         private:
    10192
    10293        protected:
     
    113104            WeaponSlot * attachedToWeaponSlot_;
    114105            Munition * munition_;
    115             WeaponSystem * parentWeaponSystem_;
     106            WeaponSystem * weaponSystem_;
    116107
    117108            SubclassIdentifier<Munition> munitionIdentifier_;
  • code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.cc

    r2893 r2912  
    2727
    2828#include "OrxonoxStableHeaders.h"
    29 
    30 #include <vector>
     29#include "WeaponPack.h"
    3130
    3231#include "core/CoreIncludes.h"
    3332#include "core/XMLPort.h"
    34 #include "util/Debug.h"
     33#include "objects/worldentities/pawns/Pawn.h"
    3534
    36 #include "WeaponPack.h"
    37 #include "objects/worldentities/pawns/Pawn.h"
     35#include "Weapon.h"
     36#include "WeaponSlot.h"
    3837
    3938namespace orxonox
     
    4544        RegisterObject(WeaponPack);
    4645
    47         this->parentWeaponSystem_ = 0;
     46        this->weaponSystem_ = 0;
    4847        this->firemode_ = 0;
    4948
     49COUT(0) << "+WeaponPack" << std::endl;
    5050    }
    5151
    5252    WeaponPack::~WeaponPack()
    5353    {
     54COUT(0) << "~WeaponPack" << std::endl;
    5455    }
    5556
    56     int WeaponPack::getSize()
     57    void WeaponPack::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     58    {
     59        SUPER(WeaponPack, XMLPort, xmlelement, mode);
     60
     61        XMLPortObject(WeaponPack, Weapon, "", addWeapon, getWeapon, xmlelement, mode);
     62        XMLPortParam(WeaponPack, "firemode", setFireMode, getFireMode, xmlelement, mode);
     63    }
     64
     65    int WeaponPack::getSize() const
    5766    {
    5867        return this->weapons_.size();
     
    6776    }
    6877
    69     Weapon * WeaponPack::getWeaponPointer(unsigned int n)
     78    Weapon * WeaponPack::getWeaponPointer(unsigned int n) const
    7079    {
    7180        return this->weapons_[n];
    72     }
    73 
    74     void WeaponPack::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    75     {
    76         SUPER(WeaponPack, XMLPort, xmlelement, mode);
    77 
    78         XMLPortObject(WeaponPack, Weapon, "", addWeapon, getWeapon, xmlelement, mode);
    79         XMLPortParam(WeaponPack, "firemode", setFireMode, getFireMode, xmlelement, mode);
    8081    }
    8182
     
    8586    }
    8687
    87     unsigned int WeaponPack::getFireMode()
     88    unsigned int WeaponPack::getFireMode() const
    8889    {
    8990        return this->firemode_;
     
    9596    }
    9697
    97     const Weapon * WeaponPack::getWeapon(unsigned int index)
     98    const Weapon * WeaponPack::getWeapon(unsigned int index) const
    9899    {
    99100        return weapons_[index];
    100101    }
    101102
    102     void WeaponPack::setParentWeaponSystemToAllWeapons(WeaponSystem * weaponSystem)
     103    void WeaponPack::setWeaponSystemToAllWeapons(WeaponSystem * weaponSystem)
    103104    {
    104         for (int i=0; i < (int) this->weapons_.size(); i++)
    105         {
    106             this->weapons_[i]->setParentWeaponSystem(weaponSystem);
    107         }
    108 
     105        for (size_t i = 0; i < this->weapons_.size(); i++)
     106            this->weapons_[i]->setWeaponSystem(weaponSystem);
    109107    }
    110108
    111109    void WeaponPack::attachNeededMunitionToAllWeapons()
    112110    {
    113         for (int i=0; i < (int) this->weapons_.size(); i++)
     111        for (size_t i = 0; i < this->weapons_.size(); i++)
    114112        {
    115113            this->weapons_[i]->attachNeededMunition(weapons_[i]->getMunitionType());
    116114            this->weapons_[i]->setWeapon();
    117115        }
    118 
    119116    }
    120 
    121117}
  • code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.h

    r2893 r2912  
    3333#include "OrxonoxPrereqs.h"
    3434
     35#include <vector>
     36
    3537#include "core/BaseObject.h"
    36 
    37 #include "Weapon.h"
    38 
    3938
    4039namespace orxonox
     
    5049            void fire();
    5150
    52             Weapon * getWeaponPointer(unsigned int n);
    53             int getSize();
     51            Weapon * getWeaponPointer(unsigned int n) const;
     52            int getSize() const;
    5453
    5554            void setFireMode(unsigned int firemode);
    56             unsigned int getFireMode();
     55            unsigned int getFireMode() const;
    5756
    5857            void addWeapon(Weapon * weapon);
    59             const Weapon * getWeapon(unsigned int index);
     58            const Weapon * getWeapon(unsigned int index) const;
     59
     60            void attachNeededMunitionToAllWeapons();
    6061
    6162            //functions with effect to all weapons of the weaponPack
    6263            //functions needed for creating Pointer to the right objects (-->Pawn.cc)
    63             void setParentWeaponSystemToAllWeapons(WeaponSystem * weaponSystem);
    64             void attachNeededMunitionToAllWeapons();
    65 
    66             inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
    67                 { parentWeaponSystem_=parentWeaponSystem; }
    68             inline WeaponSystem * getParentWeaponSystem()
    69                 { return parentWeaponSystem_; }
     64            inline void setWeaponSystem(WeaponSystem *weaponSystem)
     65                { this->weaponSystem_ = weaponSystem; this->setWeaponSystemToAllWeapons(weaponSystem); }
     66            inline WeaponSystem * getWeaponSystem() const
     67                { return this->weaponSystem_; }
    7068
    7169        private:
     70            void setWeaponSystemToAllWeapons(WeaponSystem * weaponSystem);
     71
    7272            std::vector<Weapon *> weapons_;
    73             WeaponSystem *parentWeaponSystem_;
     73            WeaponSystem *weaponSystem_;
    7474            unsigned int firemode_;
    7575    };
  • code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.cc

    r2893 r2912  
    2727
    2828#include "OrxonoxStableHeaders.h"
    29 
    30 #include <vector>
     29#include "WeaponSet.h"
    3130
    3231#include "core/CoreIncludes.h"
    3332#include "core/XMLPort.h"
    34 #include "util/Debug.h"
    3533#include "objects/worldentities/pawns/Pawn.h"
    3634
    37 #include "WeaponSet.h"
     35#include "Weapon.h"
     36#include "WeaponSlot.h"
    3837#include "WeaponPack.h"
     38#include "WeaponSystem.h"
    3939
    4040namespace orxonox
     
    4646        RegisterObject(WeaponSet);
    4747
    48         this->parentWeaponSystem_ = 0;
     48        this->weaponSystem_ = 0;
    4949        this->attachedWeaponPack_ = 0;
     50
     51COUT(0) << "+WeaponSet" << std::endl;
    5052    }
    5153
    5254    WeaponSet::~WeaponSet()
    5355    {
     56COUT(0) << "~WeaponSet" << std::endl;
     57    }
     58
     59    void WeaponSet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     60    {
     61        SUPER(WeaponSet, XMLPort, xmlelement, mode);
     62
     63        XMLPortParam(WeaponSet, "firemode", setFireMode, getFireMode, xmlelement, mode);
    5464    }
    5565
    5666    void WeaponSet::attachWeaponPack(WeaponPack *wPack)
    5767    {
    58         if ( this->parentWeaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->parentWeaponSystem_->getWeaponSlotSize() ) )
     68        if ( this->weaponSystem_->getWeaponSlotSize()>0 && wPack->getSize()>0 && ( wPack->getSize() <= this->weaponSystem_->getWeaponSlotSize() ) )
    5969        {
    6070            this->attachedWeaponPack_ = wPack;
    6171            int wPackWeapon = 0;    //WeaponCounter for Attaching
    62            
     72
    6373            //should be possible to choose which slot to use
    6474            //attach every weapon of the weaponPack to a weaponSlot
     
    6777                //at the moment this function only works for one weaponPack in the entire WeaponSystem...
    6878                //it also takes the first free weaponSlot...
    69                 if ( this->parentWeaponSystem_->getWeaponSlotPointer(i)->getAttachedWeapon() == 0 && this->parentWeaponSystem_->getWeaponSlotPointer(i) != 0) //if slot not full
     79                if ( this->weaponSystem_->getWeaponSlot(i)->getAttachedWeapon() == 0 && this->weaponSystem_->getWeaponSlot(i) != 0) //if slot not full
    7080                {
    71                     this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(i) );
    72                     this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
    73                     this->parentWeaponSystem_->getParentPawn()->attach( wPack->getWeaponPointer(wPackWeapon) );
     81                    this->setWeaponSlots_.push_back( this->weaponSystem_->getWeaponSlot(i) );
     82                    this->weaponSystem_->getWeaponSlot(i)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
     83                    this->weaponSystem_->getPawn()->attach( wPack->getWeaponPointer(wPackWeapon) );
    7484                    wPackWeapon++;
    7585                }
    7686                else
    7787                {
    78                     for (int k=0; k < this->parentWeaponSystem_->getWeaponSlotSize(); k++)
     88                    for (int k=0; k < this->weaponSystem_->getWeaponSlotSize(); k++)
    7989                    {
    80                         if ( this->parentWeaponSystem_->getWeaponSlotPointer(k)->getAttachedWeapon() == 0 )
     90                        if ( this->weaponSystem_->getWeaponSlot(k)->getAttachedWeapon() == 0 )
    8191                        {
    82                             this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(k) );
    83                             this->parentWeaponSystem_->getWeaponSlotPointer(k)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
    84                             this->parentWeaponSystem_->getParentPawn()->attach( wPack->getWeaponPointer(wPackWeapon) );
     92                            this->setWeaponSlots_.push_back( this->weaponSystem_->getWeaponSlot(k) );
     93                            this->weaponSystem_->getWeaponSlot(k)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
     94                            this->weaponSystem_->getPawn()->attach( wPack->getWeaponPointer(wPackWeapon) );
    8595                            wPackWeapon++;
    8696                        }
     
    98108            this->attachedWeaponPack_->fire();
    99109    }
    100 
    101     void WeaponSet::setFireMode(const unsigned int firemode)
    102     {   this->firemode_ = firemode; }
    103 
    104     const unsigned int WeaponSet::getFireMode() const
    105     {   return this->firemode_; }
    106 
    107     void WeaponSet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    108     {
    109         SUPER(WeaponSet, XMLPort, xmlelement, mode);
    110         XMLPortParam(WeaponSet, "firemode", setFireMode, getFireMode, xmlelement, mode);
    111     }
    112 
    113110}
  • code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.h

    r2662 r2912  
    3333#include "OrxonoxPrereqs.h"
    3434
     35#include <vector>
     36
    3537#include "core/BaseObject.h"
    36 
    37 #include "WeaponSlot.h"
    38 
    3938
    4039namespace orxonox
     
    5150            void fire();
    5251
    53             void setFireMode(const unsigned int firemode);
    54             const unsigned int getFireMode() const;
     52            inline void setFireMode(const unsigned int firemode)
     53                { this->firemode_ = firemode; }
     54            inline unsigned int getFireMode() const
     55                { return this->firemode_; }
    5556
    56             inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
    57                 { parentWeaponSystem_=parentWeaponSystem; }
    58             inline WeaponSystem * getParentWeaponSystem()
    59                 { return parentWeaponSystem_; }
     57            inline void setWeaponSystem(WeaponSystem *weaponSystem)
     58                { this->weaponSystem_ = weaponSystem; }
     59            inline WeaponSystem * getWeaponSystem() const
     60                { return this->weaponSystem_; }
    6061
    6162        private:
    62             WeaponSystem *parentWeaponSystem_;
     63            WeaponSystem *weaponSystem_;
    6364            std::vector<WeaponSlot *> setWeaponSlots_;
    6465            unsigned int firemode_;
  • code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.cc

    r2662 r2912  
    2828
    2929#include "OrxonoxStableHeaders.h"
     30#include "WeaponSlot.h"
    3031
    3132#include "core/CoreIncludes.h"
    3233#include "core/XMLPort.h"
    33 #include "util/Debug.h"
    3434
    35 #include "WeaponSlot.h"
    36 
     35#include "Weapon.h"
    3736
    3837namespace orxonox
     
    4746        this->attachedWeapon_ = 0;
    4847        this->setObjectMode(0x0);
     48
     49COUT(0) << "+WeaponSlot" << std::endl;
    4950    }
    5051
    5152    WeaponSlot::~WeaponSlot()
    5253    {
     54COUT(0) << "~WeaponSlot" << std::endl;
    5355    }
    5456
     57    void WeaponSlot::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     58    {
     59        SUPER(WeaponSlot, XMLPort, xmlelement, mode);
     60    }
    5561
    5662    /*sets the munition type
     
    7177    }
    7278
    73 
    74     void WeaponSlot::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    75     {
    76         SUPER(WeaponSlot, XMLPort, xmlelement, mode);
    77     }
    78 
    7979    void WeaponSlot::attachWeapon(Weapon *weapon)
    8080    {
  • code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.h

    r2662 r2912  
    3131
    3232#include "OrxonoxPrereqs.h"
    33 
    34 #include "Weapon.h"
    3533#include "objects/worldentities/StaticEntity.h"
    3634
     
    5048            void fire();
    5149
    52             inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
    53                 { parentWeaponSystem_=parentWeaponSystem; }
    54             inline WeaponSystem * getParentWeaponSystem()
    55                 { return parentWeaponSystem_; }
     50            inline void setWeaponSystem(WeaponSystem *weaponSystem)
     51                { this->weaponSystem_ = weaponSystem; }
     52            inline WeaponSystem * getWeaponSystem() const
     53                { return this->weaponSystem_; }
    5654
    5755
     
    6058            bool unlimitedAmmo_;
    6159
    62             WeaponSystem *parentWeaponSystem_;
     60            WeaponSystem *weaponSystem_;
    6361    };
    6462}
  • code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.cc

    r2896 r2912  
    2828
    2929#include "OrxonoxStableHeaders.h"
    30 
    31 #include <vector>
     30#include "WeaponSystem.h"
    3231
    3332#include "core/CoreIncludes.h"
    34 #include "core/XMLPort.h"
    35 #include "util/Debug.h"
     33#include "objects/worldentities/pawns/Pawn.h"
    3634
    37 #include "WeaponSystem.h"
    38 
     35#include "WeaponSlot.h"
     36#include "WeaponPack.h"
     37#include "WeaponSet.h"
    3938
    4039/* WeaponSystem
     
    5150        RegisterObject(WeaponSystem);
    5251
    53         this->parentPawn_ = 0;
     52        this->pawn_ = 0;
     53COUT(0) << "+WeaponSystem" << std::endl;
    5454    }
    5555
    5656    WeaponSystem::~WeaponSystem()
    5757    {
     58COUT(0) << "~WeaponSystem" << std::endl;
     59        if (this->isInitialized())
     60        {
     61            if (this->pawn_)
     62                this->pawn_->setWeaponSystem(0);
     63        }
    5864    }
    5965
    60     void WeaponSystem::attachWeaponPack(WeaponPack *wPack, unsigned int firemode)
     66    void WeaponSystem::attachWeaponSet(WeaponSet *wSet)
    6167    {
    62         if (firemode < this->weaponSets_.size())
    63             this->weaponSets_[firemode]->attachWeaponPack(wPack);
    64         this->weaponPacks_.push_back(wPack);
     68        if (!wSet)
     69            return;
     70
     71        this->weaponSets_[wSet->getFireMode()] = wSet;
     72        wSet->setWeaponSystem(this);
     73    }
     74
     75    WeaponSet * WeaponSystem::getWeaponSet(unsigned int index) const
     76    {
     77        unsigned int i = 0;
     78        for (std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
     79        {
     80            ++i;
     81            if (i > index)
     82                return it->second;
     83        }
     84        return 0;
    6585    }
    6686
    6787    void WeaponSystem::attachWeaponSlot(WeaponSlot *wSlot)
    6888    {
    69         wSlot->setParentWeaponSystem(this);
    70         this->weaponSlots_.push_back(wSlot);
     89        if (!wSlot)
     90            return;
     91
     92        this->weaponSlots_.insert(wSlot);
     93        wSlot->setWeaponSystem(this);
    7194    }
    7295
    73     void WeaponSystem::attachWeaponSet(WeaponSet *wSet)
     96    WeaponSlot * WeaponSystem::getWeaponSlot(unsigned int index) const
    7497    {
    75         wSet->setParentWeaponSystem(this);
    76         this->weaponSets_.push_back(wSet);
     98        unsigned int i = 0;
     99        for (std::set<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
     100        {
     101            ++i;
     102            if (i > index)
     103                return (*it);
     104        }
     105        return 0;
    77106    }
    78107
    79     void WeaponSystem::setNewMunition(std::string munitionType, Munition * munitionToAdd)
     108    void WeaponSystem::attachWeaponPack(WeaponPack *wPack, unsigned int wSetNumber)
     109    {
     110        if (!wPack)
     111            return;
     112
     113        std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(wSetNumber);
     114        if (it != this->weaponSets_.end() && it->second)
     115            it->second->attachWeaponPack(wPack);
     116
     117        this->weaponPacks_.insert(wPack);
     118        wPack->setWeaponSystem(this);
     119        wPack->attachNeededMunitionToAllWeapons(); // TODO - what is this?
     120    }
     121
     122    WeaponPack * WeaponSystem::getWeaponPack(unsigned int index) const
     123    {
     124        unsigned int i = 0;
     125        for (std::set<WeaponPack*>::iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
     126        {
     127            ++i;
     128            if (i > index)
     129                return (*it);
     130        }
     131        return 0;
     132   }
     133
     134    void WeaponSystem::setNewMunition(const std::string& munitionType, Munition * munitionToAdd)
    80135    {
    81136        this->munitionSet_[munitionType] = munitionToAdd;
     
    84139
    85140    //returns the Pointer to the munitionType, if this munitionType doesn't exist returns 0, see Weapon::attachNeededMunition
    86     Munition * WeaponSystem::getMunitionType(std::string munitionType)
     141    Munition * WeaponSystem::getMunitionType(const std::string& munitionType) const
    87142    {
    88143        std::map<std::string, Munition *>::const_iterator it = this->munitionSet_.find(munitionType);
     
    97152    //SpaceShip.cc only needs to have the keybinding to a specific Set-number n (=firemode)
    98153    //in future this could be well defined and not only for 3 different WeaponModes
    99     void WeaponSystem::fire(WeaponMode::Enum n)
     154    void WeaponSystem::fire(unsigned int firemode)
    100155    {
    101         int set = 0;
    102         switch (n)
    103         {
    104             case WeaponMode::fire:
    105                 set = 0;
    106                 break;
    107             case WeaponMode::altFire:
    108                 set = 1;
    109                 break;
    110             case WeaponMode::altFire2:
    111                 set = 2;
    112                 break;
    113         }
    114         if (set < (int)this->weaponSets_.size())
    115             this->weaponSets_[set]->fire();
     156        std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);
     157        if (it != this->weaponSets_.end() && it->second)
     158            it->second->fire();
    116159    }
    117 
    118 
    119     WeaponSet * WeaponSystem::getWeaponSetPointer(unsigned int n)
    120     {
    121         if (n < this->weaponSets_.size())
    122             return this->weaponSets_[n];
    123         else
    124             return 0;
    125     }
    126 
    127     WeaponSlot * WeaponSystem::getWeaponSlotPointer(unsigned int n)
    128     {
    129         if (n < this->weaponSlots_.size())
    130             return this->weaponSlots_[n];
    131         else
    132             return 0;
    133     }
    134 
    135     WeaponPack * WeaponSystem::getWeaponPackPointer(unsigned int n)
    136     {
    137         if (n < this->weaponPacks_.size())
    138             return this->weaponPacks_[n];
    139         else
    140             return 0;
    141     }
    142 
    143     void WeaponSystem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    144     {
    145         SUPER(WeaponSystem, XMLPort, xmlelement, mode);
    146     }
    147 
    148160}
  • code/branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.h

    r2896 r2912  
    3333#include "OrxonoxPrereqs.h"
    3434
     35#include <set>
     36#include <map>
     37
    3538#include "core/BaseObject.h"
    36 
    37 #include "WeaponSet.h"
    38 #include "WeaponPack.h"
    3939
    4040namespace orxonox
    4141{
     42    const unsigned int MAX_FIRE_MODES = 8;
    4243
    4344    class _OrxonoxExport WeaponSystem : public BaseObject
     
    4748            virtual ~WeaponSystem();
    4849
    49             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     50            void attachWeaponSlot(WeaponSlot * wSlot);
     51            WeaponSlot * getWeaponSlot(unsigned int index) const;
    5052
    51             void attachWeaponSlot(WeaponSlot *wSlot);
    52             void attachWeaponSet(WeaponSet *wSet);
    53             //void fire();
    54             void fire(WeaponMode::Enum fireMode);
    55             void attachWeaponPack(WeaponPack * wPack, unsigned int firemode);
    56             WeaponSet * getWeaponSetPointer(unsigned int n);
    57             WeaponSlot * getWeaponSlotPointer(unsigned int n);
    58             WeaponPack * getWeaponPackPointer(unsigned int n);
    59             void setNewMunition(std::string munitionType, Munition * munitionToAdd);
    60             void setNewSharedMunition(std::string munitionType, Munition * munitionToAdd);
    61             Munition * getMunitionType(std::string munitionType);
     53            void attachWeaponSet(WeaponSet * wSet);
     54            WeaponSet * getWeaponSet(unsigned int index) const;
    6255
    63             inline void setParentPawn(Pawn *parentPawn)
    64                 { parentPawn_=parentPawn; }
    65             inline Pawn * getParentPawn()
    66                 { return parentPawn_; }
     56            void attachWeaponPack(WeaponPack * wPack, unsigned int wSetNumber);
     57            WeaponPack * getWeaponPack(unsigned int index) const;
    6758
    68             inline int getWeaponSlotSize()
     59            void fire(unsigned int firemode);
     60
     61            void setNewMunition(const std::string& munitionType, Munition * munitionToAdd);
     62            void setNewSharedMunition(const std::string& munitionType, Munition * munitionToAdd);
     63            Munition * getMunitionType(const std::string& munitionType) const;
     64
     65            inline void setPawn(Pawn * pawn)
     66                { this->pawn_ = pawn; }
     67            inline Pawn * getPawn() const
     68                { return this->pawn_; }
     69
     70            inline int getWeaponSlotSize() const
    6971                { return this->weaponSlots_.size(); }
    7072
     73            static inline unsigned int getMaxFireModes()
     74                { return MAX_FIRE_MODES; }
     75            static inline unsigned int getFireModeMask(unsigned int firemode)
     76                { return (0x1 << firemode); }
     77
    7178        private:
    72             std::vector<WeaponSet *> weaponSets_;
    73             std::vector<WeaponSlot *> weaponSlots_;
    74             std::vector<WeaponPack *> weaponPacks_;
     79            std::map<unsigned int, WeaponSet *> weaponSets_;
     80            std::set<WeaponSlot *> weaponSlots_;
     81            std::set<WeaponPack *> weaponPacks_;
    7582            std::map<std::string, Munition *> munitionSet_;
    76             Pawn *parentPawn_;
     83            Pawn * pawn_;
    7784    };
    7885}
  • code/branches/weapons/src/orxonox/objects/weaponSystem/munitions/FusionMunition.cc

    r2894 r2912  
    2828
    2929#include "OrxonoxStableHeaders.h"
     30#include "FusionMunition.h"
    3031
    3132#include "core/CoreIncludes.h"
    32 #include "core/XMLPort.h"
    33 #include "util/Debug.h"
    34 
    35 #include "FusionMunition.h"
    3633
    3734namespace orxonox
  • code/branches/weapons/src/orxonox/objects/weaponSystem/munitions/FusionMunition.h

    r2894 r2912  
    3131
    3232#include "OrxonoxPrereqs.h"
    33 
    34 #include "core/BaseObject.h"
    35 #include "../Munition.h"
     33#include "objects/weaponSystem/Munition.h"
    3634
    3735namespace orxonox
  • code/branches/weapons/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc

    r2893 r2912  
    2828
    2929#include "OrxonoxStableHeaders.h"
     30#include "LaserGunMunition.h"
    3031
    3132#include "core/CoreIncludes.h"
    32 #include "core/XMLPort.h"
    33 #include "util/Debug.h"
    34 
    35 #include "LaserGunMunition.h"
    3633
    3734namespace orxonox
  • code/branches/weapons/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.h

    r2662 r2912  
    3131
    3232#include "OrxonoxPrereqs.h"
    33 
    34 #include "core/BaseObject.h"
    35 #include "../Munition.h"
     33#include "objects/weaponSystem/Munition.h"
    3634
    3735namespace orxonox
  • code/branches/weapons/src/orxonox/objects/weaponSystem/weapons/Fusion.cc

    r2710 r2912  
    2828
    2929#include "OrxonoxStableHeaders.h"
    30 
     30#include "Fusion.h"
    3131
    3232#include "core/CoreIncludes.h"
    33 #include "core/XMLPort.h"
    34 #include "util/Debug.h"
    3533
    36 #include "Fusion.h"
    37 
     34#include "objects/weaponSystem/Munition.h"
     35#include "objects/weaponSystem/projectiles/ParticleProjectile.h"
     36#include "objects/weaponSystem/WeaponSystem.h"
    3837
    3938namespace orxonox
     
    7372        projectile->setPosition(this->getWorldPosition());
    7473        projectile->setVelocity(this->getWorldOrientation() * WorldEntity::FRONT * this->speed_);
    75         projectile->setOwner(this->getParentWeaponSystem()->getParentPawn());
     74        projectile->setOwner(this->getWeaponSystem()->getPawn());
    7675    }
    7776}
  • code/branches/weapons/src/orxonox/objects/weaponSystem/weapons/Fusion.h

    r2710 r2912  
    3131
    3232#include "OrxonoxPrereqs.h"
    33 
    34 #include "core/BaseObject.h"
    35 
    36 #include "../munitions/LaserGunMunition.h"
    37 #include "util/Math.h"
    38 #include "../Weapon.h"
    39 #include "../projectiles/BillboardProjectile.h"
    40 #include "../projectiles/ParticleProjectile.h"
     33#include "objects/weaponSystem/Weapon.h"
    4134
    4235namespace orxonox
  • code/branches/weapons/src/orxonox/objects/weaponSystem/weapons/HsW01.cc

    r2901 r2912  
    2828
    2929#include "OrxonoxStableHeaders.h"
    30 
     30#include "HsW01.h"
    3131
    3232#include "core/CoreIncludes.h"
    3333#include "core/XMLPort.h"
    34 #include "util/Debug.h"
    35 
    36 #include "HsW01.h"
    37 
    3834
    3935namespace orxonox
     
    7975        projectile->setPosition(this->getWorldPosition());
    8076        projectile->setVelocity(this->getWorldOrientation() * WorldEntity::FRONT * this->speed_);
    81         projectile->setOwner(this->getParentWeaponSystem()->getParentPawn());
     77        projectile->setOwner(this->getWeaponSystem()->getPawn());
    8278    }
    8379}
  • code/branches/weapons/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc

    r2893 r2912  
    2828
    2929#include "OrxonoxStableHeaders.h"
    30 
     30#include "LaserGun.h"
    3131
    3232#include "core/CoreIncludes.h"
    33 #include "core/XMLPort.h"
    34 #include "util/Debug.h"
    3533
    36 #include "LaserGun.h"
    37 
     34#include "objects/weaponSystem/Munition.h"
     35#include "objects/weaponSystem/projectiles/ParticleProjectile.h"
     36#include "objects/weaponSystem/WeaponSystem.h"
    3837
    3938namespace orxonox
     
    7978        projectile->setPosition(this->getWorldPosition());
    8079        projectile->setVelocity(this->getWorldOrientation() * WorldEntity::FRONT * this->speed_);
    81         projectile->setOwner(this->getParentWeaponSystem()->getParentPawn());
     80        projectile->setOwner(this->getWeaponSystem()->getPawn());
    8281    }
    8382}
  • code/branches/weapons/src/orxonox/objects/weaponSystem/weapons/LaserGun.h

    r2893 r2912  
    3131
    3232#include "OrxonoxPrereqs.h"
    33 
    34 #include "core/BaseObject.h"
    35 
    36 #include "../munitions/LaserGunMunition.h"
    37 #include "util/Math.h"
    38 #include "../Weapon.h"
    39 #include "../projectiles/BillboardProjectile.h"
    40 #include "../projectiles/ParticleProjectile.h"
     33#include "objects/weaponSystem/Weapon.h"
    4134
    4235namespace orxonox
  • code/branches/weapons/src/orxonox/objects/weaponSystem/weapons/Missile.cc

    r2097 r2912  
    2828
    2929#include "OrxonoxStableHeaders.h"
    30 
    31 #include <list>
     30#include "Missile.h"
    3231
    3332#include "core/CoreIncludes.h"
    3433#include "core/XMLPort.h"
    35 #include "util/Debug.h"
    36 
    3734
    3835namespace orxonox
  • code/branches/weapons/src/orxonox/objects/weaponSystem/weapons/Missile.h

    r2106 r2912  
    3131
    3232#include "OrxonoxPrereqs.h"
    33 
    3433#include "objects/weaponSystem/Weapon.h"
    35 
    3634
    3735namespace orxonox
  • code/branches/weapons/src/orxonox/objects/worldentities/ControllableEntity.h

    r2851 r2912  
    3131
    3232#include "OrxonoxPrereqs.h"
    33 
    3433#include "MobileEntity.h"
    35 #include "objects/weaponSystem/WeaponSystem.h"
    3634
    3735namespace orxonox
     
    8381                { this->rotateRoll(Vector2(value, 0)); }
    8482
    85             virtual void fire(WeaponMode::Enum fireMode) {}
    86             virtual void altFire(WeaponMode::Enum fireMode) {}
     83            virtual void fire(unsigned int firemode) {}
    8784
    8885            virtual void boost() {}
  • code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2896 r2912  
    3939#include "objects/worldentities/ParticleSpawner.h"
    4040#include "objects/worldentities/ExplosionChunk.h"
     41#include "objects/weaponSystem/WeaponSystem.h"
     42#include "objects/weaponSystem/WeaponSlot.h"
     43#include "objects/weaponSystem/WeaponPack.h"
     44#include "objects/weaponSystem/WeaponSet.h"
    4145
    4246namespace orxonox
     
    6670        {
    6771            this->weaponSystem_ = new WeaponSystem(this);
    68             this->weaponSystem_->setParentPawn(this);
     72            this->weaponSystem_->setPawn(this);
    6973        }
    7074        else
     
    100104        XMLPortParam(Pawn, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7);
    101105
    102         XMLPortObject(Pawn, WeaponSlot, "weaponslots", setWeaponSlot, getWeaponSlot, xmlelement, mode);
    103         XMLPortObject(Pawn, WeaponSet, "weaponsets", setWeaponSet, getWeaponSet, xmlelement, mode);
    104         XMLPortObject(Pawn, WeaponPack, "weapons", setWeaponPack, getWeaponPack, xmlelement, mode);
     106        XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode);
     107        XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
     108        XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPack, getWeaponPack, xmlelement, mode);
    105109    }
    106110
     
    119123        if (this->weaponSystem_)
    120124        {
    121             if (this->fire_ & WeaponMode::fire)
    122                 this->weaponSystem_->fire(WeaponMode::fire);
    123             if (this->fire_ & WeaponMode::altFire)
    124                 this->weaponSystem_->fire(WeaponMode::altFire);
    125             if (this->fire_ & WeaponMode::altFire2)
    126                 this->weaponSystem_->fire(WeaponMode::altFire2);
     125            for (unsigned int firemode = 0; firemode < WeaponSystem::getMaxFireModes(); firemode++)
     126                if (this->fire_ & WeaponSystem::getFireModeMask(firemode))
     127                    this->weaponSystem_->fire(firemode);
    127128        }
    128129        this->fire_ = this->firehack_;
     
    252253    }
    253254
    254     void Pawn::fire(WeaponMode::Enum fireMode)
    255     {
    256         this->firehack_ |= fireMode;
     255    void Pawn::fire(unsigned int firemode)
     256    {
     257        this->firehack_ |= WeaponSystem::getFireModeMask(firemode);
    257258    }
    258259
     
    275276    *       --> e.g. Pickup-Items
    276277    */
    277     void Pawn::setWeaponSlot(WeaponSlot * wSlot)
     278    void Pawn::addWeaponSlot(WeaponSlot * wSlot)
    278279    {
    279280        this->attach(wSlot);
     
    285286    {
    286287        if (this->weaponSystem_)
    287             return this->weaponSystem_->getWeaponSlotPointer(index);
     288            return this->weaponSystem_->getWeaponSlot(index);
    288289        else
    289290            return 0;
    290291    }
    291292
    292     void Pawn::setWeaponPack(WeaponPack * wPack)
    293     {
    294         if (this->weaponSystem_)
    295         {
    296             wPack->setParentWeaponSystem(this->weaponSystem_);
    297             wPack->setParentWeaponSystemToAllWeapons(this->weaponSystem_);
    298             this->weaponSystem_->attachWeaponPack( wPack,wPack->getFireMode() );
    299             wPack->attachNeededMunitionToAllWeapons();
    300         }
     293    void Pawn::addWeaponPack(WeaponPack * wPack)
     294    {
     295        if (this->weaponSystem_)
     296            this->weaponSystem_->attachWeaponPack(wPack, wPack->getFireMode());
    301297    }
    302298
     
    304300    {
    305301        if (this->weaponSystem_)
    306             return this->weaponSystem_->getWeaponPackPointer(firemode);
     302            return this->weaponSystem_->getWeaponPack(firemode);
    307303        else
    308304            return 0;
    309305    }
    310306
    311     void Pawn::setWeaponSet(WeaponSet * wSet)
     307    void Pawn::addWeaponSet(WeaponSet * wSet)
    312308    {
    313309        if (this->weaponSystem_)
     
    318314    {
    319315        if (this->weaponSystem_)
    320             return this->weaponSystem_->getWeaponSetPointer(index);
     316            return this->weaponSystem_->getWeaponSet(index);
    321317        else
    322318            return 0;
  • code/branches/weapons/src/orxonox/objects/worldentities/pawns/Pawn.h

    r2826 r2912  
    3434#include "objects/worldentities/ControllableEntity.h"
    3535#include "objects/RadarViewable.h"
    36 #include "objects/weaponSystem/WeaponSystem.h"
    3736
    3837namespace orxonox
     
    4039    class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable
    4140    {
     41        friend class WeaponSystem;
     42
    4243        public:
    4344            Pawn(BaseObject* creator);
     
    7980            virtual void kill();
    8081
    81             virtual void fire(WeaponMode::Enum fireMode);
     82            virtual void fire(unsigned int firemode);
    8283            virtual void postSpawn();
    8384
    84             void setWeaponSlot(WeaponSlot * wSlot);
     85            void addWeaponSlot(WeaponSlot * wSlot);
    8586            WeaponSlot * getWeaponSlot(unsigned int index) const;
    86             void setWeaponPack(WeaponPack * wPack);
     87            void addWeaponPack(WeaponPack * wPack);
    8788            WeaponPack * getWeaponPack(unsigned int firemode) const;
    88             void setWeaponSet(WeaponSet * wSet);
     89            void addWeaponSet(WeaponSet * wSet);
    8990            WeaponSet * getWeaponSet(unsigned int index) const;
    9091
     
    134135            float spawnparticleduration_;
    135136            unsigned int numexplosionchunks_;
     137
     138        private:
     139            inline void setWeaponSystem(WeaponSystem* weaponsystem)
     140                { this->weaponSystem_ = weaponsystem; }
    136141    };
    137142
  • code/branches/weapons/src/orxonox/objects/worldentities/pawns/Spectator.cc

    r2896 r2912  
    196196    }
    197197
    198     void Spectator::fire(WeaponMode::Enum fireMode)
     198    void Spectator::fire(unsigned int firemode)
    199199    {
    200200        if (this->getPlayer())
  • code/branches/weapons/src/orxonox/objects/worldentities/pawns/Spectator.h

    r2662 r2912  
    5757            virtual void rotateRoll(const Vector2& value);
    5858
    59             virtual void fire(WeaponMode::Enum fireMode);
     59            virtual void fire(unsigned int firemode);
    6060            virtual void greet();
    6161
Note: See TracChangeset for help on using the changeset viewer.