Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6419


Ignore:
Timestamp:
Dec 25, 2009, 11:07:09 PM (14 years ago)
Author:
rgrieder
Message:

Merged pickup2 into pickup3.

Location:
code/branches/pickup3
Files:
2 deleted
30 edited
12 copied

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3

  • code/branches/pickup3/src/libraries/core/Super.h

    r5929 r6419  
    267267    #define SUPER_changedGametype(classname, functionname, ...) \
    268268        SUPER_NOARGS(classname, functionname)
     269       
     270    #define SUPER_changedUsed(classname, functionname, ...) \
     271        SUPER_NOARGS(classname, functionname)
    269272    // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
    270273
     
    515518
    516519        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(9, changedGametype, false)
     520            ()
     521        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     522       
     523        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedUsed, false)
    517524            ()
    518525        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     
    570577    SUPER_INTRUSIVE_DECLARATION(changedName);
    571578    SUPER_INTRUSIVE_DECLARATION(changedGametype);
     579    SUPER_INTRUSIVE_DECLARATION(changedUsed);
    572580    // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
    573581
  • code/branches/pickup3/src/modules/CMakeLists.txt

    r5929 r6419  
    2929ADD_SUBDIRECTORY(objects)
    3030ADD_SUBDIRECTORY(overlays)
     31ADD_SUBDIRECTORY(pickup)
    3132ADD_SUBDIRECTORY(pong)
    3233ADD_SUBDIRECTORY(questsystem)
  • code/branches/pickup3/src/modules/pickup/DroppedItem.cc

    r6405 r6419  
    9797        droppedItem->attach(billboard);
    9898
    99         COUT(3) << "Created DroppedItem for '" << item->getPickupIdentifier() << "' at (" << position.x << "," << position.y << "," << position.z << ")." << std::endl;
     99        COUT(3) << "Created DroppedItem for '" << item->getPickupIdentifier() << "' at (" << position.x << ',' << position.y << ',' << position.z << ")." << std::endl;
    100100
    101101        return droppedItem;
  • code/branches/pickup3/src/modules/pickup/PickupSpawner.cc

    r6405 r6419  
    128128        //  & load the GUI itself too, along with some empty windows
    129129        //   = even less delays
    130 //         GUIManager::getInstance().showGUI("PickupInventory");
    131 //         GUIManager::getInstance().executeCode("hideGUI(\"PickupInventory\")");
     130//         GUIManager::showGUI("PickupInventory");
     131//         GUIManager::hideGUI("PickupInventory");
    132132//         PickupInventory::getSingleton();
    133133    }
  • code/branches/pickup3/src/modules/weapons/projectiles/Projectile.cc

    r6417 r6419  
    124124
    125125            float dmg = this->damage_;
    126             if (this->owner_)
    127                 dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
     126            //TODO: Remove.
     127//             if (this->owner_)
     128//                 dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
    128129
    129130            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
  • code/branches/pickup3/src/orxonox/CMakeLists.txt

    r6417 r6419  
    4747ADD_SUBDIRECTORY(items)
    4848ADD_SUBDIRECTORY(overlays)
    49 ADD_SUBDIRECTORY(pickup)
    5049ADD_SUBDIRECTORY(sound)
    5150ADD_SUBDIRECTORY(weaponsystem)
     
    5857    MoodManager.h
    5958    controllers/HumanController.h
    60     pickup/BaseItem.h
    61     pickup/PickupInventory.h
    6259    sound/SoundManager.h
    6360  DEFINE_SYMBOL
  • code/branches/pickup3/src/orxonox/OrxonoxPrereqs.h

    r6417 r6419  
    117117    class GametypeMessageListener;
    118118    class NotificationListener;
     119    class Pickupable;
     120    class PickupCarrier;
    119121    class PlayerTrigger;
    120122    class RadarListener;
     
    133135    class OrxonoxOverlay;
    134136    class OverlayGroup;
    135 
    136     // pickup
    137     class BaseItem;
    138     class DroppedItem;
    139     class EquipmentItem;
    140     class ModifierPickup;
    141     class PassiveItem;
    142     class PickupCollection;
    143     class PickupInventory;
    144     class PickupSpawner;
    145     class UsableItem;
    146     // pickup, items
    147     class HealthImmediate;
    148     class HealthUsable;
    149     class Jump;
    150137
    151138    //sound
  • code/branches/pickup3/src/orxonox/interfaces/InterfaceCompilation.cc

    r5929 r6419  
    3434
    3535#include "GametypeMessageListener.h"
     36#include "Pickupable.h"
     37#include "PickupCarrier.h"
    3638#include "PlayerTrigger.h"
    3739#include "RadarListener.h"
     
    5153        RegisterRootObject(GametypeMessageListener);
    5254    }
     55   
     56    //----------------------------
     57    // Pickupable
     58    //----------------------------
     59    Pickupable::Pickupable()
     60    {
     61        RegisterRootObject(Pickupable);
    5362
     63        this->used_ = false;
     64        this->owner_ = NULL;
     65    }
     66   
     67    //----------------------------
     68    // PickupCarrier
     69    //----------------------------
     70    PickupCarrier::PickupCarrier()
     71    {
     72        RegisterRootObject(PickupCarrier);
     73    }
     74
     75    //----------------------------
     76    // PlayerTrigger
     77    //----------------------------
     78    PlayerTrigger::PlayerTrigger()
     79    {
     80        RegisterRootObject(PlayerTrigger);
     81
     82        this->player_ = NULL;
     83        this->isForPlayer_ = true;
     84    }
     85   
    5486    //----------------------------
    5587    // RadarListener
     
    83115        RegisterRootObject(NotificationListener);
    84116    }
    85 
    86     //----------------------------
    87     // PlayerTrigger
    88     //----------------------------
    89     PlayerTrigger::PlayerTrigger()
    90     {
    91         RegisterRootObject(PlayerTrigger);
    92 
    93         this->player_ = NULL;
    94         this->isForPlayer_ = true;
    95     }
    96117}
  • code/branches/pickup3/src/orxonox/items/Engine.cc

    r5929 r6419  
    3535#include "Scene.h"
    3636#include "worldentities/pawns/SpaceShip.h"
    37 #include "pickup/ModifierType.h"
     37//TODO: Remove.
     38//#include "pickup/ModifierType.h"
    3839#include "tools/Shader.h"
    3940
     
    193194        }
    194195
    195         this->ship_->setAcceleration(this->ship_->getPickups().processModifiers(ModifierType::Acceleration, this->ship_->getOrientation() * acceleration, false));
     196        //TODO: Remove.
     197        //this->ship_->setAcceleration(this->ship_->getPickups().processModifiers(ModifierType::Acceleration, this->ship_->getOrientation() * acceleration, false));
    196198
    197199        if (!this->ship_->getPermanentBoost())
  • code/branches/pickup3/src/orxonox/pickup/BaseItem.cc

    r5781 r6419  
    4141{
    4242    /**
    43         @brief Constructor. Registers the BaseItem.
    44         @param creator Pointer to the object which created this item.
     43    @brief Constructor. Registers the BaseItem.
     44    @param creator Pointer to the object which created this item.
    4545    */
    4646    BaseItem::BaseItem(BaseObject* creator) : BaseObject(creator)
     
    5959
    6060    /**
    61         @brief XMLPort for BaseItem.
    62         @param xmlelement Element of the XML-file.
    63         @param mode XMLPort mode to use.
     61    @brief XMLPort for BaseItem.
     62    @param xmlelement Element of the XML-file.
     63    @param mode XMLPort mode to use.
    6464    */
    6565    void BaseItem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    7272
    7373    /**
    74         @brief Method to add the item to a pawn.
    75         @param pawn Pawn to which the item should get added.
    76         @return Returns whether the pawn's PickupCollection accepted the item.
     74    @brief Method to add the item to a pawn.
     75    @param pawn Pawn to which the item should get added.
     76    @return Returns whether the pawn's PickupCollection accepted the item.
    7777    */
    7878    bool BaseItem::addTo(Pawn* pawn)
     
    8080        this->setOwner(pawn);
    8181
    82         if (pawn->getPickups().add(this))
     82        if (pawn->getPickups().add(this)) //TODO: Does the pawn store his pickups?
    8383        {
    8484            COUT(3) << "Added '" << this->getPickupIdentifier() << "' item." << std::endl;
  • code/branches/pickup3/src/orxonox/pickup/BaseItem.h

    r5781 r6419  
    4444{
    4545    /**
    46         @brief
    47             Base class for all items/pickups.
     46    @brief
     47        Base class for all items/pickups.
    4848
    49             Provides common methods to be used in derived classes.
    50         @author
    51             Daniel 'Huty' Haggenmueller
     49        Provides common methods to be used in derived classes.
     50    @author
     51        Daniel 'Huty' Haggenmueller
    5252    */
    5353    class _OrxonoxExport BaseItem : public BaseObject
    5454    {
    5555// tolua_end
    56     public:
    57         BaseItem(BaseObject* creator);
    58         virtual ~BaseItem();
     56        public:
     57            BaseItem(BaseObject* creator);
     58            virtual ~BaseItem();
    5959
    60         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
     60            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
    6161
    62         /**
     62            /**
    6363            @brief Checks how many instances of this item can be carried at a time.
    6464            @return How many of this item can be carried.
    65         */
    66         virtual int getMaxCarryAmount() const
    67             { return 1; }
     65            */
     66            virtual int getMaxCarryAmount() const //TODO: Maybe, better to just be virtual.
     67                { return BaseItem::MAX_CARRY_AMOUNT; }
    6868
    69         bool addTo(Pawn* pawn);             //!< Add the item to a pawn.
    70         bool removeFrom(Pawn* pawn);        //!< Removes the item from a pawn.
    71         /**
     69            //TODO: Need to be public?
     70            bool addTo(Pawn* pawn);             //!< Add the item to a pawn.
     71            bool removeFrom(Pawn* pawn);        //!< Removes the item from a pawn.
     72            /**
    7273            @brief
    7374                Method invoked when the item gets picked up.
     
    7879            @param pawn Pawn who picks up the item.
    7980            @return Returns whether the pawn was able to pick up the item.
    80         */
    81         virtual bool pickedUp(Pawn* pawn)
    82             { return false; }
    83         /**
     81            */
     82            virtual bool pickedUp(Pawn* pawn) //TODO: Maybe better to be just virtual.
     83                { return false; }
     84            /**
    8485            @brief
    8586                Method invoked when the item is dropped from a player.
     
    9091            @param pawn Pawn which dropped the item.
    9192            @return Returns whether the item was able to get dropped by the pawn.
    92         */
    93         virtual bool dropped(Pawn* pawn)
    94             { return false; }
     93            */
     94            virtual bool dropped(Pawn* pawn)
     95                { return false; }
    9596
    96         /**
     97            /**
    9798            @brief Gets the current owner of the pickup.
    9899            @return Returns the current owner.
    99         */
    100         inline Pawn* getOwner() const
    101             { return this->owner_; }
    102         /**
     100            */
     101            inline Pawn* getOwner() const
     102                { return this->owner_; }
     103            /**
    103104            @brief Sets the owner of the pickup.
    104105            @param owner New owner for the pickup.
    105         */
    106         inline void setOwner(Pawn* owner)
    107             { this->owner_ = owner; }
     106            */
     107            inline void setOwner(Pawn* owner)
     108                { this->owner_ = owner; }
    108109
    109         /**
     110            /**
    110111            @brief Gets the pickupIdentifier of the item.
    111112            @return Returns the pickupIdentifier of the item.
    112113            @see pickupIdentifier_
    113         */
    114         inline const std::string& getPickupIdentifier() const
    115             { return this->pickupIdentifier_; }
    116         /**
     114            */
     115            inline const std::string& getPickupIdentifier() const
     116                { return this->pickupIdentifier_; }
     117            /**
    117118            @brief Sets the pickupIdentifier for the item.
    118119            @param identifier New pickupIdentifier for the item.
    119120            @see pickupIdentifier_
    120         */
    121         inline void setPickupIdentifier(const std::string& identifier)
    122             { this->pickupIdentifier_ = identifier; }
     121            */
     122            //TODO: Needs to be public?
     123            inline void setPickupIdentifier(const std::string& identifier)
     124                { this->pickupIdentifier_ = identifier; }
    123125
    124         // GUI stuff
    125         virtual const std::string& getGUIText() const; // tolua_export
    126         inline void setGUIText(const std::string& text)
    127             { this->guiText_ = text; }
     126            // GUI stuff
     127            //TODO: Comment. Maybe seperate GUI from Pickup, e.g. ItemDescription...
     128            virtual const std::string& getGUIText() const; // tolua_export
     129            inline void setGUIText(const std::string& text)
     130                { this->guiText_ = text; }
    128131
    129         virtual const std::string& getGUIImage() const
    130             { return this->guiImage_; }
    131         inline void setGUIImage(const std::string& image)
    132             { this->guiImage_ = image; }
    133     private:
    134         Pawn* owner_;   //!< The current owner of the item.
     132            virtual const std::string& getGUIImage() const
     133                { return this->guiImage_; }
     134            inline void setGUIImage(const std::string& image)
     135                { this->guiImage_ = image; }
     136        private:
     137            static const int MAX_CARRY_AMOUNT = 1;
    135138
    136         /**
     139            Pawn* owner_;   //!< The current owner of the item.
     140
     141            /**
    137142            @brief
    138143                The pickupIdentifier of the item..
     
    140145                Usually set to the template name used by a PickupSpawner,
    141146                used to index items in the PickupCollection.
    142         */
    143         std::string pickupIdentifier_;
     147            */
     148            std::string pickupIdentifier_; //TODO: Remove, when always just this->getName().
    144149
    145         std::string guiText_;
    146         std::string guiImage_;
     150            //TODO: Comment.
     151            std::string guiText_;
     152            std::string guiImage_;
    147153    }; // tolua_export
    148154} // tolua_export
  • code/branches/pickup3/src/orxonox/pickup/CMakeLists.txt

    r5781 r6419  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    22  BaseItem.cc
    3   DroppedItem.cc
    43  EquipmentItem.cc
    54  ModifierPickup.cc
     
    76  PickupCollection.cc
    87  PickupInventory.cc
    9   PickupSpawner.cc
    108  UsableItem.cc
    119)
  • code/branches/pickup3/src/orxonox/pickup/EquipmentItem.cc

    r5781 r6419  
    3838{
    3939    /**
    40         @brief Constructor. Registers the EquipmentItem.
    41         @param creator Pointer to the object which created this item.
     40    @brief Constructor. Registers the EquipmentItem.
     41    @param creator Pointer to the object which created this item.
    4242    */
    4343    EquipmentItem::EquipmentItem(BaseObject* creator) : BaseItem(creator)
  • code/branches/pickup3/src/orxonox/pickup/EquipmentItem.h

    r5781 r6419  
    4141{
    4242    /**
    43         @brief Base class for all equipment-type items.
    44         @author Daniel 'Huty' Haggenmueller
     43    @brief Base class for all equipment-type items.
     44    @author Daniel 'Huty' Haggenmueller
    4545    */
    4646    class _OrxonoxExport EquipmentItem : public BaseItem
    4747    {
    48     public:
    49         EquipmentItem(BaseObject* creator);
    50         virtual ~EquipmentItem() {}
     48        //TODO: What is this class for?
     49        //Probably falls under UsableItem or PassiveItem
     50        public:
     51            EquipmentItem(BaseObject* creator);
     52            virtual ~EquipmentItem() {}
     53
     54       
     55
    5156    };
    5257}
  • code/branches/pickup3/src/orxonox/pickup/ModifierPickup.cc

    r6417 r6419  
    4343
    4444    /**
    45         @brief Constructor. Registers the ModifierPickup.
    46         @param creator Pointer to the object which created this item.
     45    @brief
     46        Constructor. Registers the ModifierPickup.
     47    @param creator
     48        Pointer to the object which created this item.
    4749    */
    4850    ModifierPickup::ModifierPickup(BaseObject* creator) : PassiveItem(creator)
     
    5254        this->duration_ = 0.0f;
    5355    }
    54     //! Deconstructor.
     56
     57    /**
     58    @brief
     59        Destructor.
     60    */
    5561    ModifierPickup::~ModifierPickup()
    5662    {
    57     }
    58     /**
    59         @brief Method for loading information from a level file.
    60         @param element XMLElement from which to read the data.
    61         @param mode XMLPort mode to use.
    62     */
     63       
     64    }
     65
     66    /**
     67    @brief
     68        Method for loading information from a level file.
     69    @param element
     70        XMLElement from which to read the data.
     71    @param mode
     72        XMLPort mode to use.
     73    */
     74    //TODO: Comments: params can probably be ommitted.
    6375    void ModifierPickup::XMLPort(Element& element, XMLPort::Mode mode)
    6476    {
     
    7385        XMLPortParamTemplate(ModifierPickup, "accelerationMulti", setMultiplicativeAcceleration, getMultiplicativeAcceleration, element, mode, float);
    7486    }
    75     /**
    76         @brief
    77             Invoked when a pawn picks up the pickup.
    78 
    79             Adds the modifiers to the pawn and sets a timer (if effect is limited)
    80             if the pickup could be added to the pawn's PickupCollection.
    81 
    82         @param pawn Pawn which picked up the pickup.
    83         @return Returns whether the pickup was able to be added to the pawn.
     87
     88    /**
     89    @brief
     90        Invoked when a pawn picks up the pickup.
     91
     92        Adds the modifiers to the pawn and sets a timer (if effect is limited)
     93        if the pickup could be added to the pawn's PickupCollection.
     94
     95    @param pawn
     96        Pawn which picked up the pickup.
     97    @return
     98        Returns whether the pickup was able to be added to the pawn.
    8499    */
    85100    bool ModifierPickup::pickedUp(Pawn* pawn)
     
    110125        return false;
    111126    }
    112     /**
    113         @brief
    114             Invoked when a pawn drops the pickup.
    115 
    116             Removes the modifiers from the pawn if the pickup
    117             was successfully removed from it's PickupCollection.
    118 
    119         @param pawn Pawn which dropped the pickup.
    120         @return Returns whether the pickup could be removed.
     127
     128    /**
     129    @brief
     130        Invoked when a pawn drops the pickup.
     131
     132        Removes the modifiers from the pawn if the pickup
     133        was successfully removed from it's PickupCollection.
     134
     135    @param pawn
     136        Pawn which dropped the pickup.
     137    @return
     138        Returns whether the pickup could be removed.
    121139    */
    122140    bool ModifierPickup::dropped(Pawn* pawn)
     
    145163        return false;
    146164    }
    147     /**
    148         @brief Invoked when the timer finished, calls dropped().
    149     */
     165
     166    /**
     167    @brief Invoked when the timer finished, calls dropped().
     168    */
     169    //TODO: Other name for function?
    150170    void ModifierPickup::timerCallback(Pawn* pawn)
    151171    {
     
    153173            COUT(2) << "Failed to remove modifier pickup after the timer ran out!" << std::endl;
    154174    }
    155     /**
    156         @brief Gets the additive modifier of a given type.
    157         @param type ModifierType for which to return the modifier.
    158         @return Returns the additive modifier for type (or 0 if not exists).
     175
     176    /**
     177    @brief
     178        Gets the additive modifier of a given type.
     179    @param type
     180        ModifierType for which to return the modifier.
     181    @return
     182        Returns the additive modifier for type (or 0 if not exists).
    159183    */
    160184    float ModifierPickup::getAdditiveModifier(ModifierType::Value type) const
     
    166190            return 0.0f;
    167191    }
    168     /**
    169         @brief Gets the multiplicative modifier of a given type.
    170         @param type ModifierType for which to return the modifier.
    171         @return Returns the multiplicative modifier for type (or 1 if not exists).
     192
     193    /**
     194    @brief
     195        Gets the multiplicative modifier of a given type.
     196    @param type
     197        ModifierType for which to return the modifier.
     198    @return
     199        Returns the multiplicative modifier for type (or 1 if not exists).
    172200    */
    173201    float ModifierPickup::getMultiplicativeModifier(ModifierType::Value type) const
     
    179207            return 1.0f;
    180208    }
    181     /**
    182         @brief Gets the additive modifier of a given type.
    183         @param type ModifierType for which to return the modifier.
    184         @param value The new additive modifier for type.
     209
     210    /**
     211    @brief
     212        Gets the additive modifier of a given type.
     213    @param type
     214        ModifierType for which to return the modifier.
     215    @param value
     216        The new additive modifier for type.
    185217    */
    186218    void ModifierPickup::setAdditiveModifier(ModifierType::Value type, float value)
     
    191223            this->additiveModifiers_[type] = value;
    192224    }
    193     /**
    194         @brief Gets the multiplicative modifier of a given type.
    195         @param type ModifierType for which to return the modifier.
    196         @param value The new multiplicative modifier for type.
     225
     226    /**
     227    @brief
     228        Gets the multiplicative modifier of a given type.
     229    @param type
     230        ModifierType for which to return the modifier.
     231    @param value
     232        The new multiplicative modifier for type.
    197233    */
    198234    void ModifierPickup::setMultiplicativeModifier(ModifierType::Value type, float value)
     
    203239            this->multiplicativeModifiers_[type] = value;
    204240    }
     241
    205242}
  • code/branches/pickup3/src/orxonox/pickup/ModifierPickup.h

    r6417 r6419  
    4747{
    4848    /**
    49         @brief Class for a (temporary) modifier effect.
    50         @author Daniel 'Huty' Haggenmueller
     49    @brief Class for a (temporary) modifier effect.
     50    @author Daniel 'Huty' Haggenmueller
    5151    */
     52    //TODO: More elaborate comments.
    5253    class _OrxonoxExport ModifierPickup : public PassiveItem
    5354    {
    54     public:
    55         ModifierPickup(BaseObject* creator);
    56         virtual ~ModifierPickup();
     55        //TODO: What does being derived from PassiveItem add exactly? Probably better to kill PassiveItem and just derive from BaseItem.
     56        //Include ModifierType here, no additional header file needed for that, imo.
     57        public:
     58            ModifierPickup(BaseObject* creator);
     59            virtual ~ModifierPickup();
    5760
    58         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< To create a ModifierPickup through the level file.
     61            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< To create a ModifierPickup through the level file.
    5962
    60         virtual bool pickedUp(Pawn* pawn);                              //!< Override of the BaseItem::pickedUp() method.
    61         virtual bool dropped(Pawn* pawn);                              //!< Override of the BaseItem::dropped() method
     63            virtual bool pickedUp(Pawn* pawn); //!< Override of the BaseItem::pickedUp() method.
     64            virtual bool dropped(Pawn* pawn); //!< Override of the BaseItem::dropped() method
    6265
    63         virtual int getMaxCarryAmount(){ return INT_MAX; }              //!< Allow the player to carry infinite ModPickups
     66            //TODO: Where does this INT_MAX come from? Comment.
     67            virtual int getMaxCarryAmount() //!< Allow the player to carry infinite ModPickups
     68                { return INT_MAX; }
    6469
    65         /**
     70            /**
    6671            @brief Get the duration of this pickup.
    6772            @return Returns how long the effect holds on.
    68         */
    69         inline float getDuration() const
    70             { return this->duration_; }
    71         /**
     73            */
     74            inline float getDuration() const
     75                { return this->duration_; }
     76            /**
    7277            @brief Set the duration of this pickup.
    7378            @param duration How long the effect should hold.
    74         */
    75         inline void setDuration(float duration)
    76             { this->duration_ = duration; }
     79            */
     80            //TODO: Better be private?
     81            inline void setDuration(float duration)
     82                { this->duration_ = duration; }
    7783
    78         /**
     84            //TODO: Shouldn't these all be seperate pickup items? But, then, would this class really be needed? What does it actually add?
     85            //Duration! Thus create two virtual functions addEffect() and removeEffect().
     86            //Export the ideas here into seperate, individual subclasses.
     87            //Shouldn't this, as an item be in the items folder? or is it, as merely the equivalent of an abstract class not specific enough?
     88            //Specify what ModifierItem should do exactly. If the limited duration is the core functionality, another name would probably more fitting.
     89            //Perhaps, limited effect duration could also just be another feature of BaseItem...
     90            /**
    7991            @brief Get the amount of damage this pickup adds.
    8092            @return Returns how much damage this pickup adds.
    81         */
    82         inline float getAdditiveDamage() const
    83             { return this->getAdditiveModifier(ModifierType::Damage); }
    84         /**
     93            */
     94            inline float getAdditiveDamage() const
     95                { return this->getAdditiveModifier(ModifierType::Damage); }
     96            /**
    8597            @brief Get the factor by which this pickup multiplies the damage.
    8698            @return Returns the factor by which to multiply damage.
    87         */
    88         inline float getMultiplicativeDamage() const
    89             { return this->getMultiplicativeModifier(ModifierType::Damage); }
     99            */
     100            inline float getMultiplicativeDamage() const
     101                { return this->getMultiplicativeModifier(ModifierType::Damage); }
    90102
    91         /**
     103            /**
    92104            @brief Set the amount of damage this pickup adds.
    93105            @param value How much damage this pickup adds.
    94         */
    95         inline void setAdditiveDamage(float value)
    96             { this->setAdditiveModifier(ModifierType::Damage, value); }
    97         /**
     106            */
     107            inline void setAdditiveDamage(float value)
     108                { this->setAdditiveModifier(ModifierType::Damage, value); }
     109            /**
    98110            @brief Set the factor by which this pickup multiplies the damage.
    99111            @param value Factor by which to multiply damage.
    100         */
    101         inline void setMultiplicativeDamage(float value)
    102             { this->setMultiplicativeModifier(ModifierType::Damage, value); }
     112            */
     113            inline void setMultiplicativeDamage(float value)
     114                { this->setMultiplicativeModifier(ModifierType::Damage, value); }
    103115
    104         /**
     116            /**
    105117            @brief Get the amount of acceleration this pickup adds.
    106118            @return Returns how much acceleration this pickup adds.
    107         */
    108         inline float getAdditiveAcceleration() const
    109             { return this->getAdditiveModifier(ModifierType::Acceleration); }
    110         /**
     119            */
     120            inline float getAdditiveAcceleration() const
     121                { return this->getAdditiveModifier(ModifierType::Acceleration); }
     122            /**
    111123            @brief Get the factor by which this pickup multiplies the acceleration.
    112124            @return Returns the factor by which to multiply acceleration.
    113         */
    114         inline float getMultiplicativeAcceleration() const
    115             { return this->getMultiplicativeModifier(ModifierType::Acceleration); }
     125            */
     126            inline float getMultiplicativeAcceleration() const
     127                { return this->getMultiplicativeModifier(ModifierType::Acceleration); }
    116128
    117         /**
     129            /**
    118130            @brief Set the amount of acceleration this pickup adds.
    119131            @param value How much acceleration this pickup adds.
    120         */
    121         inline void setAdditiveAcceleration(float value)
    122             { this->setAdditiveModifier(ModifierType::Acceleration, value); }
    123         /**
     132            */
     133            inline void setAdditiveAcceleration(float value)
     134                { this->setAdditiveModifier(ModifierType::Acceleration, value); }
     135            /**
    124136            @brief Set the factor by which this pickup multiplies the acceleration.
    125137            @param value Factor by which to multiply acceleration.
    126         */
    127         inline void setMultiplicativeAcceleration(float value)
    128             { this->setMultiplicativeModifier(ModifierType::Acceleration, value); }
     138            */
     139            inline void setMultiplicativeAcceleration(float value)
     140                { this->setMultiplicativeModifier(ModifierType::Acceleration, value); }
    129141
    130         void timerCallback(Pawn* pawn);     //!< Method called when the timer runs out.
     142            //TODO: Make private?
     143            void timerCallback(Pawn* pawn);     //!< Method called when the timer runs out.
    131144
    132     private:
    133         float getAdditiveModifier(ModifierType::Value type) const;               //!< Get the additive modifier for a given ModifierType.
    134         float getMultiplicativeModifier(ModifierType::Value type) const;         //!< Get the multiplicative modifier for a given ModifierType.
    135         void setAdditiveModifier(ModifierType::Value type, float value);         //!< Set the additive modifier for a given ModifierType.
    136         void setMultiplicativeModifier(ModifierType::Value type, float value);   //!< Set the multiplicative modifier for a given ModifierType
     145        private:
     146            float getAdditiveModifier(ModifierType::Value type) const;               //!< Get the additive modifier for a given ModifierType.
     147            float getMultiplicativeModifier(ModifierType::Value type) const;         //!< Get the multiplicative modifier for a given ModifierType.
     148            void setAdditiveModifier(ModifierType::Value type, float value);         //!< Set the additive modifier for a given ModifierType.
     149            void setMultiplicativeModifier(ModifierType::Value type, float value);   //!< Set the multiplicative modifier for a given ModifierType
    137150
    138         std::map<ModifierType::Value, float> additiveModifiers_;                 //!< Map of additive modifiers, indexed by ModifierType.
    139         std::map<ModifierType::Value, float> multiplicativeModifiers_;           //!< Map of multiplicative modifiers, indexed by ModifierType.
     151            std::map<ModifierType::Value, float> additiveModifiers_;                 //!< Map of additive modifiers, indexed by ModifierType.
     152            std::map<ModifierType::Value, float> multiplicativeModifiers_;           //!< Map of multiplicative modifiers, indexed by ModifierType.
    140153
    141         float duration_;                                                         //!< Duration of this pickup's effect (0 for unlimited).
    142         Timer timer_;                                                            //!< Timer used if the pickup's effect has a time limit.
     154            float duration_;                                                         //!< Duration of this pickup's effect (0 for unlimited).
     155            Timer timer_;                                                            //!< Timer used if the pickup's effect has a time limit.
    143156    };
    144157}
  • code/branches/pickup3/src/orxonox/pickup/ModifierType.h

    r5781 r6419  
    3939namespace orxonox
    4040{
     41    //TODO: Merge with ModifierPickup.
    4142    namespace ModifierType
    4243    {
  • code/branches/pickup3/src/orxonox/pickup/PassiveItem.cc

    r5781 r6419  
    3333{
    3434    /**
    35         @brief Constructor. Registers the PassiveItem.
    36         @param creator Pointer to the object which created this item.
     35    @brief Constructor. Registers the PassiveItem.
     36    @param creator Pointer to the object which created this item.
    3737    */
    3838    PassiveItem::PassiveItem(BaseObject* creator) : BaseItem(creator)
  • code/branches/pickup3/src/orxonox/pickup/PassiveItem.h

    r5781 r6419  
    4141{
    4242    /**
    43         @brief Base class for all passive items.
    44         @author Daniel 'Huty' Haggenmueller
     43    @brief Base class for all passive items.
     44    @author Daniel 'Huty' Haggenmueller
    4545    */
    4646    class _OrxonoxExport PassiveItem : public BaseItem
    4747    {
    48     public:
    49         PassiveItem(BaseObject* creator);
    50         virtual ~PassiveItem() {}
     48        //TODO: What is this Class for. Where is ActiveItem?
     49        //Rename it InstantItem?
     50        public:
     51            PassiveItem(BaseObject* creator);
     52            virtual ~PassiveItem() {}
     53
    5154    };
    5255}
  • code/branches/pickup3/src/orxonox/pickup/PickupCollection.cc

    r6417 r6419  
    5252
    5353    /**
    54         @brief
    55             Add an item to the collection.
    56 
    57             Only adds the item if there's a free slot for it.
    58 
    59         @param item Item to add to the collection.
    60         @return Returns whether the item has been added to the collection.
     54    @brief
     55        Add an item to the collection.
     56
     57        Only adds the item if there's a free slot for it.
     58
     59    @param item
     60        Item to add to the collection.
     61    @return
     62        Returns whether the item has been added to the collection.
    6163    */
    6264    bool PickupCollection::add(BaseItem* item)
  • code/branches/pickup3/src/orxonox/pickup/PickupCollection.h

    r5781 r6419  
    4747{
    4848    /**
    49         @brief PickupCollection for organising items.
    50         @author Daniel 'Huty' Haggenmueller
     49    @brief PickupCollection for organising items.
     50    @author Daniel 'Huty' Haggenmueller
    5151    */
    52     class _OrxonoxExport PickupCollection
     52    class _OrxonoxExport PickupCollection : public orxonox::OrxonoxClass
    5353    {
    54     public:
    55         PickupCollection();
     54        public:
     55            PickupCollection();
    5656
    57         bool add(BaseItem* item);       //!< Add an item to the collection.
     57            bool add(BaseItem* item);       //!< Add an item to the collection.
    5858
    59         bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item.
     59            bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item.
    6060
    61         void clear();                   //!< Empty the collection
    62         bool contains(BaseItem* item, bool anyOfType = false);                      //!< Check if the collection contains an item.
     61            void clear();                   //!< Empty the collection
     62            bool contains(BaseItem* item, bool anyOfType = false);                      //!< Check if the collection contains an item.
    6363
    64         void remove(BaseItem* item, bool removeAllOfType = false);                  //!< Remove an item from the collection.
     64            void remove(BaseItem* item, bool removeAllOfType = false);                  //!< Remove an item from the collection.
    6565
    66         void useItem();                                                             //!< Use the first usable item.
    67         void useItem(UsableItem* item);                                             //!< Use a usable item.
     66            //TODO: Hmm... probably should stay...
     67            void useItem();                                                             //!< Use the first usable item.
     68            void useItem(UsableItem* item);                                             //!< Use a usable item.
    6869
    69         void addAdditiveModifier(ModifierType::Value type, float value);             //!< Add an additive modifier.
    70         void addMultiplicativeModifier(ModifierType::Value type, float value);       //!< Add a multiplicative modifier.
     70            /**
     71                @brief Get the owner of the PickupCollection.
     72                @return Returns the pawn which owns the PickupCollection.
     73            */
     74            inline Pawn* getOwner() const
     75                { return this->owner_; }
     76            /**
     77                @brief Set the owner of the PickupCollection.
     78                @param owner The new Pawn which owns the PickupCollection.
     79            */
     80            inline void setOwner(Pawn* owner)
     81                { this->owner_ = owner; }
    7182
    72         float getAdditiveModifier(ModifierType::Value type);                         //!< Get total additive modifier.
    73         float getMultiplicativeModifier(ModifierType::Value type);                   //!< Get total multiplicative modifier.
     83            inline UsableItem* getCurrentUsable()
     84                { return this->currentUsable_; };
     85            inline void setCurrentUsable(UsableItem* usable)
     86                { this->currentUsable_ = usable; }
    7487
    75         void removeAdditiveModifier(ModifierType::Value type, float value);          //!< Remove an additive modifier.
    76         void removeMultiplicativeModifier(ModifierType::Value type, float value);    //!< Remove a multiplicative modifier.
     88            std::deque<EquipmentItem*> getEquipmentItems();   //!< Get a list of equipment-type items.
     89            std::deque<PassiveItem*> getPassiveItems();     //!< Get a list of passive items.
     90            std::deque<UsableItem*> getUsableItems();      //!< Get a list of usable items.
    7791
    78         float processModifiers(ModifierType::Value type, float inputValue, bool addBeforeMultiplication = false);        //!< Apply the modifiers to a float.
    79         Vector3 processModifiers(ModifierType::Value type, Vector3 inputValue, bool addBeforeMultiplication = false);    //!< Apply the modifiers to a Vector3.
     92        private:
     93            Pawn* owner_; //!< The owner of the PickupCollection.
     94            UsableItem* currentUsable_;
     95            int slots_;
    8096
    81         /**
    82             @brief Get the map of contained items.
    83             @return The map of items.
    84         */
    85         std::multimap<std::string, BaseItem*> getItems() const
    86             { return this->items_; }
    87 
    88         /**
    89             @brief Get the owner of the PickupCollection.
    90             @return Returns the pawn which owns the PickupCollection.
    91         */
    92         inline Pawn* getOwner() const
    93             { return this->owner_; }
    94         /**
    95             @brief Set the owner of the PickupCollection.
    96             @param owner The new Pawn which owns the PickupCollection.
    97         */
    98         inline void setOwner(Pawn* owner)
    99             { this->owner_ = owner; }
    100 
    101         inline UsableItem* getCurrentUsable()
    102             { return this->currentUsable_; };
    103         inline void setCurrentUsable(UsableItem* usable)
    104             { this->currentUsable_ = usable; }
    105 
    106         std::deque<EquipmentItem*> getEquipmentItems();   //!< Get a list of equipment-type items.
    107         std::deque<PassiveItem*> getPassiveItems();     //!< Get a list of passive items.
    108         std::deque<UsableItem*> getUsableItems();      //!< Get a list of usable items.
    109     private:
    110         Pawn* owner_;           //!< The owner of the PickupCollection.
    111         UsableItem* currentUsable_;
    112 
    113         bool bBlockRemovals_;   //!< Whether to block direct removals through remove().
    114 
    115         std::multimap<ModifierType::Value, float> additiveModifiers_;        //!< Contains additive modifiers (indexed by ModifierType).
    116         std::multimap<ModifierType::Value, float> multiplicativeModifiers_;  //!< Contains multiplicative modifiers (indexed by ModifierType).
    117 
    118         std::multimap<std::string, BaseItem*> items_;                       //!< Map of items in the collection (indexed by pickupIdentifier of the items).
     97            std::multimap<std::string, BaseItem*> items_;                       //!< Map of items in the collection (indexed by pickupIdentifier of the items).
    11998    };
    12099}
  • code/branches/pickup3/src/orxonox/pickup/PickupInventory.cc

    r6417 r6419  
    5252
    5353    PickupInventory* PickupInventory::pickupInventory_s = NULL;
     54
     55    //TODO: Comment.
     56
     57    /**
     58    @brief
     59        Get a Pointer to the PickupInventory Singleton.
     60    @return
     61        A Pointer to the PickupInventory.
     62    */
     63    //TODO: Make SingeltonPtr?
    5464    PickupInventory* PickupInventory::getSingleton()
    5565    {
     
    6070    }
    6171
     72    /**
     73    @brief
     74        Constructor.
     75    */
    6276    PickupInventory::PickupInventory()
    6377    {
    64         this->bInventoryVisible_ = false;
    65         this->visibleEquipmentWindows_ = this->visibleUsableWIndows_ = 0;
     78        //TODO: Maybe some abstraction for the usableWindows, e.g. push and pop...
     79        //RegisterObject() ? In some other Class, too. Which?
     80        this->bInventoryVisible_ = false; //TODO: If OrxonoxClass, this should already be there...
     81        this->visibleEquipmentWindows_ = this->visibleUsableWindows_ = 0;
    6682
    6783        // Create some windows to avoid creating them while playing
     
    7793        this->createdEquipmentWindows_ = this->createdUsableWindows_ = 10;
    7894    }
     95
     96    /**
     97    @brief
     98        Destructor.
     99    */
     100    //TODO: Destroy something?
    79101    PickupInventory::~PickupInventory()
    80102    {
    81103    }
    82104
    83 
    84 
    85     void PickupInventory::toggleInventory()
     105    /**
     106    @brief
     107        Toggles the visibility of the inventory.
     108    */
     109    /*static*/ void PickupInventory::toggleInventory()
    86110    {
    87111        if(PickupInventory::getSingleton()->isVisible()) {
     
    95119    }
    96120
     121    /**
     122    @brief
     123       
     124    */
    97125    unsigned int PickupInventory::getCurrentUsableIndex()
    98126    {
     
    111139        return 0;
    112140    }
     141
    113142    bool PickupInventory::isCurrentUsable(const BaseItem* item)
    114143    {
     
    119148            return false;
    120149    }
     150
    121151    void PickupInventory::selectUsable(unsigned int i)
    122152    {
     
    138168            return 0;
    139169    }
     170
    140171    unsigned int PickupInventory::getUsableCount()
    141172    {
     
    146177            return 0;
    147178    }
     179
    148180    unsigned int PickupInventory::getPassiveCount()
    149181    {
     
    154186            return 0;
    155187    }
     188
    156189    BaseItem* PickupInventory::getEquipmentItem(unsigned int i)
    157190    {
     
    166199            return NULL;
    167200    }
     201
    168202    BaseItem* PickupInventory::getUsableItem(unsigned int i)
    169203    {
     
    178212            return NULL;
    179213    }
     214
    180215    BaseItem* PickupInventory::getPassiveItem(unsigned int i)
    181216    {
     
    221256            equipPane->removeChildWindow("orxonox/Inventory/Items/equ/" + id.str());*/
    222257        }
    223         for(unsigned int i = 0; i < this->visibleUsableWIndows_; i++)
     258        for(unsigned int i = 0; i < this->visibleUsableWindows_; i++)
    224259        {
    225260            std::ostringstream id;
     
    235270        }
    236271    }
     272
    237273    void PickupInventory::updateTabs(CEGUI::WindowManager *winMgr, CEGUI::Window *equipWindow, CEGUI::Window *usableWindow)
    238274    {
     
    265301        }
    266302    }
     303
    267304    void PickupInventory::updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target)
    268305    {
     
    292329                PickupInventory::setWindowProperties(winMgr, target, id.str(), item, colour);
    293330            }
    294             this->visibleUsableWIndows_ = items.size();
     331            this->visibleUsableWindows_ = items.size();
    295332        }
    296333    }
     
    322359        btn->setVisible(false);
    323360    }
     361
    324362    void PickupInventory::setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour)
    325363    {
     
    346384        target->addChildWindow(btn);
    347385    }
     386
    348387}
  • code/branches/pickup3/src/orxonox/pickup/PickupInventory.h

    r5781 r6419  
    4444{
    4545    /**
    46         @brief Static class for the inventory GUI window.
    47         @author Daniel 'Huty' Haggenmueller
     46    @brief Static class for the inventory GUI window.
     47    @author Daniel 'Huty' Haggenmueller
    4848    */
    4949    class _OrxonoxExport PickupInventory
    5050    {
    5151// tolua_end
    52     public:
    53         PickupInventory();
    54         virtual ~PickupInventory();
     52        public:
     53            //TODO: Be derived from OrxonoxClass and ScopedSingleton.
     54            //Make some methods private?
     55            PickupInventory();
     56            virtual ~PickupInventory();
    5557
    56         static PickupInventory* getSingleton(); // tolua_export
     58            static PickupInventory* getSingleton(); // tolua_export
    5759
    58         static void toggleInventory(); // tolua_export
     60            static void toggleInventory(); // tolua_export
    5961
    60         static unsigned int getEquipmentCount(); // tolua_export
    61         static unsigned int getUsableCount(); // tolua_export
    62         static unsigned int getPassiveCount(); // tolua_export
     62            static unsigned int getEquipmentCount(); // tolua_export
     63            static unsigned int getUsableCount(); // tolua_export
     64            static unsigned int getPassiveCount(); // tolua_export
    6365
    64         static unsigned int getCurrentUsableIndex(); // tolua_export
    65         static bool isCurrentUsable(const BaseItem* item); // tolua_export
    66         static void selectUsable(unsigned int i); // tolua_export
     66            static unsigned int getCurrentUsableIndex(); // tolua_export
     67            static bool isCurrentUsable(const BaseItem* item); // tolua_export
     68            static void selectUsable(unsigned int i); // tolua_export
    6769
    68         static BaseItem* getEquipmentItem(unsigned int i); // tolua_export
    69         static BaseItem* getUsableItem(unsigned int i); // tolua_export
    70         static BaseItem* getPassiveItem(unsigned int i); // tolua_export
     70            static BaseItem* getEquipmentItem(unsigned int i); // tolua_export
     71            static BaseItem* getUsableItem(unsigned int i); // tolua_export
     72            static BaseItem* getPassiveItem(unsigned int i); // tolua_export
    7173
    72         static std::string getImageForItem(const BaseItem* item); // tolua_export
     74            static std::string getImageForItem(const BaseItem* item); // tolua_export
    7375
    74         void clearInventory(CEGUI::WindowManager* winMgr, CEGUI::Window* equipPane, CEGUI::Window* usablePane); // tolua_export
    75         void updateTabs(CEGUI::WindowManager* winMgr, CEGUI::Window* equipWindow, CEGUI::Window* usableWindow); // tolua_export
     76            void clearInventory(CEGUI::WindowManager* winMgr, CEGUI::Window* equipPane, CEGUI::Window* usablePane); // tolua_export
     77            void updateTabs(CEGUI::WindowManager* winMgr, CEGUI::Window* equipWindow, CEGUI::Window* usableWindow); // tolua_export
    7678
    77         void updateEquipment(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
    78         void updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
     79            void updateEquipment(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
     80            void updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
    7981
    80         static void createItemWindows(CEGUI::WindowManager* winMgr, const std::string& id, int x, int y);
    81         static void setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour);
     82            static void createItemWindows(CEGUI::WindowManager* winMgr, const std::string& id, int x, int y);
     83            static void setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour);
    8284
    83         const bool isVisible() const
    84             { return this->bInventoryVisible_; }
    85         void setVisible(bool visible)
    86             { this->bInventoryVisible_ = visible; }
    87     private:
    88         bool bInventoryVisible_;
    89         unsigned int createdEquipmentWindows_;
    90         unsigned int createdUsableWindows_;
    91         unsigned int visibleEquipmentWindows_;
    92         unsigned int visibleUsableWIndows_;
     85            const bool isVisible() const
     86                { return this->bInventoryVisible_; }
     87            void setVisible(bool visible)
     88                { this->bInventoryVisible_ = visible; }
     89        private:
     90            bool bInventoryVisible_;
     91            unsigned int createdEquipmentWindows_;
     92            unsigned int createdUsableWindows_;
     93            unsigned int visibleEquipmentWindows_;
     94            unsigned int visibleUsableWindows_;
    9395
    94         static PickupInventory* pickupInventory_s;
     96            static PickupInventory* pickupInventory_s;
    9597    }; // tolua_export
    9698} // tolua_export
  • code/branches/pickup3/src/orxonox/pickup/UsableItem.cc

    r6417 r6419  
    3838{
    3939    /**
    40         @brief Constructor. Registers the UsableItem.
    41         @param creator Pointer to the object which created this item.
     40    @brief Constructor. Registers the UsableItem.
     41    @param creator Pointer to the object which created this item.
    4242    */
    4343    UsableItem::UsableItem(BaseObject* creator) : BaseItem(creator)
  • code/branches/pickup3/src/orxonox/pickup/UsableItem.h

    r5781 r6419  
    4646    class _OrxonoxExport UsableItem : public BaseItem
    4747    {
    48     public:
    49         UsableItem(BaseObject* creator);
    50         virtual ~UsableItem() { }
     48        //TODO: What is this exactly?
     49        public:
     50            UsableItem(BaseObject* creator);
     51            virtual ~UsableItem() { }
    5152
    52         /**
    53             @brief Method invoked when the item is being used.
    54             @param pawn Pawn which is using the item.
    55         */
    56         virtual void used(Pawn* pawn) { }
     53            /**
     54                @brief Method invoked when the item is being used.
     55                @param pawn Pawn which is using the item.
     56            */
     57            virtual void used(Pawn* pawn) { }
    5758    };
    5859}
  • code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.cc

    r5929 r6419  
    5959    }
    6060
     61    //TODO: Should be destroyed anyways...
    6162    bool HealthImmediate::pickedUp(Pawn* pawn)
    6263    {
  • code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.h

    r5781 r6419  
    4545    class _OrxonoxExport HealthImmediate : public PassiveItem
    4646    {
    47     public:
    48         HealthImmediate(BaseObject* creator);
    49         virtual ~HealthImmediate();
     47        //TODO: Comment.
     48        //Does this get destroyed, when the healt is delivered? It seems to me it doesn't.
     49        public:
     50            HealthImmediate(BaseObject* creator);
     51            virtual ~HealthImmediate();
    5052
    51         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     53            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5254
    53         virtual bool pickedUp(Pawn* pawn);
     55            virtual bool pickedUp(Pawn* pawn);
    5456
    55         inline float getRecoveredHealth() const
    56             { return this->recoveredHealth_; }
    57         inline void setRecoveredHealth(float recovery)
    58             { this->recoveredHealth_ = recovery; }
     57            inline float getRecoveredHealth() const
     58                { return this->recoveredHealth_; }
     59            inline void setRecoveredHealth(float recovery)
     60                { this->recoveredHealth_ = recovery; }
    5961
    60     private:
    61         float recoveredHealth_;
     62        private:
     63            float recoveredHealth_;
    6264    };
    6365}
  • code/branches/pickup3/src/orxonox/pickup/items/HealthUsable.cc

    r5929 r6419  
    4545
    4646    /**
    47         @brief Constructor
    48         @param creator Object that created this item.
     47    @brief Constructor
     48    @param creator Object that created this item.
    4949    */
    5050    HealthUsable::HealthUsable(BaseObject* creator) : UsableItem(creator)
     
    5454        this->recoveredHealth_ = 0;
    5555    }
     56
    5657    //! Deconstructor
    5758    HealthUsable::~HealthUsable()
    5859    {
    5960    }
     61
    6062    /**
    61         @brief XMLPort for Jump.
    62         @param xmlelement Element of the XML-file.
    63         @param mode XMLPort mode to use.
     63    @brief XMLPort for Jump.
     64    @param xmlelement Element of the XML-file.
     65    @param mode XMLPort mode to use.
    6466    */
    6567    void HealthUsable::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    6971        XMLPortParam(HealthUsable, "recoveredHealth", setRecoveredHealth, getRecoveredHealth, xmlelement, mode);
    7072    }
     73
    7174    /**
    72         @brief Called when the item is used, makes the user "jump".
    73         @param pawn Pawn which used te item.
     75    @brief Called when the item is used, makes the user "jump".
     76    @param pawn Pawn which used te item.
    7477    */
     78    //TODO: Jump? Nope! => Comment.
     79    //Should be destroyed anyways.
    7580    void HealthUsable::used(Pawn* pawn)
    7681    {
     
    8590        }
    8691    }
     92
    8793    /**
    88         @brief Called when the item is picked up.
    89         @param pawn Pawn which picked up the item.
     94    @brief Called when the item is picked up.
     95    @param pawn Pawn which picked up the item.
    9096    */
    9197    bool HealthUsable::pickedUp(Pawn* pawn)
     
    9399        return this->addTo(pawn);
    94100    }
     101
    95102    /**
    96         @brief Called when the item is dropped, creates a DroppedItem behind the pawn.
    97         @param pawn Pawn which dropped the item.
     103    @brief Called when the item is dropped, creates a DroppedItem behind the pawn.
     104    @param pawn Pawn which dropped the item.
    98105    */
    99106    bool HealthUsable::dropped(Pawn* pawn)
  • code/branches/pickup3/src/orxonox/pickup/items/Jump.h

    r5781 r6419  
    5050    class _OrxonoxExport Jump : public UsableItem
    5151    {
    52     public:
    53         Jump(BaseObject* creator);      //!< Constructor
    54         virtual ~Jump();                //!< Deconstructor
     52        public:
     53            //TODO: Comment. a.s.o.
     54            Jump(BaseObject* creator);      //!< Constructor
     55            virtual ~Jump();                //!< Deconstructor
    5556
    56         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
     57            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
    5758
    58         virtual int getMaxCarryAmount() const
    59             { return INT_MAX; }
     59            virtual int getMaxCarryAmount() const
     60                { return INT_MAX; }
    6061
    61         virtual void used(Pawn* pawn);          //!< Called when the item is used.
     62            virtual void used(Pawn* pawn);          //!< Called when the item is used.
    6263
    63         virtual bool pickedUp(Pawn* pawn);      //!< Called when the item is picked up.
    64         virtual bool dropped(Pawn* pawn);       //!< Called when the item is dropped.
     64            virtual bool pickedUp(Pawn* pawn);      //!< Called when the item is picked up.
     65            virtual bool dropped(Pawn* pawn);       //!< Called when the item is dropped.
    6566
    66         /**
    67             @brief Get the velocity added when the item is used.
    68             @return Returns the added velocity (relative to the Pawn).
    69         */
    70         inline const Vector3& getVelocity() const
    71             { return this->velocity_; }
    72         /**
    73             @brief Set the velocity added when the item is used.
    74             @param velocity New added velocity (relative to Pawn).
    75         */
    76         inline void setVelocity(const Vector3& velocity)
    77             { this->velocity_ = velocity; }
    78         /**
    79             @brief Get the amount of jumps available.
    80             @return Returns how many times the item can be used.
    81         */
    82         inline int getJumpsAvailable() const
    83             { return this->jumpsAvailable_; }
    84         /**
    85             @brief Set the amount of jumps available.
    86             @param num New number of available jumps.
    87         */
    88         inline void setJumpsAvailable(int num)
    89             { this->jumpsAvailable_ = num; }
    90     private:
    91         Vector3 velocity_;      //!< The velocity added when the item is used.
    92         int jumpsAvailable_;    //!< Amount of jumps still available.
     67            /**
     68                @brief Get the velocity added when the item is used.
     69                @return Returns the added velocity (relative to the Pawn).
     70            */
     71            inline const Vector3& getVelocity() const
     72                { return this->velocity_; }
     73            /**
     74                @brief Set the velocity added when the item is used.
     75                @param velocity New added velocity (relative to Pawn).
     76            */
     77            inline void setVelocity(const Vector3& velocity)
     78                { this->velocity_ = velocity; }
     79            /**
     80                @brief Get the amount of jumps available.
     81                @return Returns how many times the item can be used.
     82            */
     83            inline int getJumpsAvailable() const
     84                { return this->jumpsAvailable_; }
     85            /**
     86                @brief Set the amount of jumps available.
     87                @param num New number of available jumps.
     88            */
     89            inline void setJumpsAvailable(int num)
     90                { this->jumpsAvailable_ = num; }
     91        private:
     92            Vector3 velocity_;      //!< The velocity added when the item is used.
     93            int jumpsAvailable_;    //!< Amount of jumps still available.
    9394    };
    9495}
  • code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.cc

    r6417 r6419  
    7171        this->aimPosition_ = Vector3::ZERO;
    7272
    73         this->getPickups().setOwner(this);
     73        //TODO: Remove.
     74        //this->getPickups().setOwner(this);
    7475
    7576        if (GameMode::isMaster())
     
    296297    }
    297298
    298     void Pawn::dropItems()
    299     {
    300         this->getPickups().clear();
    301     }
     299//TODO: Remove.
     300//     void Pawn::dropItems()
     301//     {
     302//         this->getPickups().clear();
     303//     }
    302304
    303305
  • code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.h

    r6417 r6419  
    3535#include "interfaces/RadarViewable.h"
    3636#include "worldentities/ControllableEntity.h"
    37 #include "pickup/PickupCollection.h"
     37//TODO: Remove.
     38//#include "pickup/PickupCollection.h"
    3839
    3940namespace orxonox
     
    109110                { return this->numexplosionchunks_; }
    110111
    111             virtual void dropItems();
    112             inline PickupCollection& getPickups()
    113                 { return this->pickups_; }
    114             virtual void useItem()
    115                 { this->pickups_.useItem(); }
     112//TODO: Remove.
     113//             virtual void dropItems();
     114//             inline PickupCollection& getPickups()
     115//                 { return this->pickups_; }
     116//             virtual void useItem()
     117//                 { this->pickups_.useItem(); }
    116118
    117119            virtual void startLocalHumanControl();
     
    135137            bool bAlive_;
    136138
    137             PickupCollection pickups_;
     139            //TODO: Remove.
     140            //PickupCollection pickups_;
    138141
    139142            float health_;
Note: See TracChangeset for help on using the changeset viewer.