Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2015, 2:45:58 PM (9 years ago)
Author:
maxima
Message:

Merged presentation and fabiens branch. Had to modify hoverHUD and invaderHUD, because the text of the healthbar wasn't correctly displayed and the weapon settings of the hovership.

Location:
code/branches/presentationHS15
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS15

  • code/branches/presentationHS15/src/orxonox/weaponsystem/Munition.h

    r9667 r10961  
    2424 *      Fabian 'x3n' Landau
    2525 *   Co-authors:
    26  *      ...
     26 *      Fabien Vultier
    2727 *
    2828 */
     
    3939namespace orxonox
    4040{
     41    namespace MunitionDeployment
     42    {
     43        enum Value
     44        {
     45            Separate, // Every comsuming weapon mode has its own magazine. It is possible that one weapon mode is out of ammo while another still has some.
     46            Share, // All comsuming weapon modes take their munition from the same magazine. If this magazine is empty a new one is loaded.
     47            Stack // There is only one magazine where all the munition is stored. Use this deployment mode for heavy weapons loke rockets, bombs, ...
     48        };
     49    }
     50
    4151    class _OrxonoxExport Munition : public BaseObject
    42     {
     52    {       
    4353        struct Magazine
    4454        {
     
    5969            virtual ~Munition();
    6070
     71            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     72
    6173            unsigned int getNumMunition(WeaponMode* user) const;
    6274            unsigned int getNumMunitionInCurrentMagazine(WeaponMode* user) const;
     
    6880            inline unsigned int getMaxMunitionPerMagazine() const
    6981                { return this->maxMunitionPerMagazine_; }
     82            inline MunitionDeployment::Value getMunitionDeployment() const
     83                { return deployment_; }
     84
    7085
    7186            bool canTakeMunition(unsigned int amount, WeaponMode* user) const;
     
    8297
    8398            bool canAddMagazines(unsigned int amount) const;
    84             bool addMagazines(unsigned int amount);
     99            /**
     100            @brief Try to add magazines.
     101            @param amount The amount of magazines tried to add.
     102            @return The amount of magazines sucessfully added.
     103            */
     104            unsigned int addMagazines(unsigned int amount);
    85105
    86106            bool canRemoveMagazines(unsigned int amount) const;
     
    92112            unsigned int maxMunitionPerMagazine_;
    93113            unsigned int maxMagazines_;
    94             unsigned int magazines_;
    95             std::map<WeaponMode*, Magazine*> currentMagazines_;
     114            unsigned int unassignedMagazines_; // Number of magazines that are not assigned to a weapon mode. These are alway treated as full.
     115            std::map<WeaponMode*, Magazine*> assignedMagazines_; // Maps weapon modes to magazines that are currently used.
    96116
    97             bool bUseSeparateMagazines_;
    98             bool bStackMunition_;
     117            MunitionDeployment::Value deployment_; // Defines the behaviour how munition and magazines are distributed to the consuming weapon modes.
     118
    99119            bool bAllowMunitionRefilling_;
    100120            bool bAllowMultiMunitionRemovementUnderflow_;
    101121
    102             float reloadTime_;
     122            float reloadTime_; // The time needed to replace a magazine by a new one.
     123            WeaponMode* lastFilledWeaponMode_; // Pointer to the weapon mode that got the last munition during the last call of addMunition.
    103124
    104125        private:
    105126            Magazine* getMagazine(WeaponMode* user) const;
     127            inline void setMaxMagazines(unsigned int maxMagazines)
     128                { this->maxMagazines_ = maxMagazines; }
     129            inline void setMaxMunitionPerMagazine(unsigned int maxMunitionPerMagazine)
     130                { this->maxMunitionPerMagazine_ = maxMunitionPerMagazine; }
     131            void setNumMagazines(unsigned int numMagazines);
    106132    };
    107133}
Note: See TracChangeset for help on using the changeset viewer.