Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 11, 2009, 6:03:40 PM (16 years ago)
Author:
danielh
Message:

Update

  • Minor changes in BaseItem
  • Updated to NotificationQueue from trunk (compile error with old)
  • Added PickupInventory for GUI handling
  • Added basic support for toLua++ methods
Location:
code/branches/pickups2/src/orxonox
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickups2/src/orxonox/CMakeLists.txt

    r2896 r2972  
    3535
    3636GENERATE_SOURCE_GROUPS(${ORXONOX_FILES})
    37 GENERATE_TOLUA_BINDINGS(Orxonox ORXONOX_FILES INPUTFILES gui/GUIManager.h)
     37GENERATE_TOLUA_BINDINGS(Orxonox ORXONOX_FILES INPUTFILES gui/GUIManager.h objects/pickup/PickupInventory.h objects/pickup/BaseItem.h objects/pickup/EquipmentItem.h objects/pickup/UsableItem.h objects/pickup/PassiveItem.h)
    3838
    3939# Not using precompiled header files: Avoid dependencies
  • code/branches/pickups2/src/orxonox/objects/controllers/HumanController.h

    r2917 r2972  
    6666            static void killBots(unsigned int amount = 0);
    6767
     68            static inline HumanController* getLocalControllerSingleton()
     69                { return HumanController::localController_s; }
     70
    6871        private:
    6972            static HumanController* localController_s;
  • code/branches/pickups2/src/orxonox/objects/pickup/BaseItem.cc

    r2917 r2972  
    3535
    3636#include "PickupCollection.h"
     37
     38#include "core/CoreIncludes.h"
     39#include "core/XMLPort.h"
    3740#include "objects/worldentities/pawns/Pawn.h"
    3841
     
    5457    {
    5558    }
     59
     60    /**
     61        @brief XMLPort for BaseItem.
     62        @param xmlelement Element of the XML-file.
     63        @param mode XMLPort mode to use.
     64    */
     65    void BaseItem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     66    {
     67        SUPER(BaseItem, XMLPort, xmlelement, mode);
     68
     69        XMLPortParam(BaseItem, "guiText", setGUIText, getGUIText, xmlelement, mode);
     70        XMLPortParam(BaseItem, "guiTooltip", setGUITooltip, getGUITooltip, xmlelement, mode);
     71        XMLPortParam(BaseItem, "guiImage", setGUIImage, getGUIImage, xmlelement, mode);
     72    }
     73
    5674    /**
    5775        @brief Method to add the item to a pawn.
  • code/branches/pickups2/src/orxonox/objects/pickup/BaseItem.h

    r2917 r2972  
    3939#include "core/BaseObject.h"
    4040
     41// tolua_begin
    4142namespace orxonox
    4243{
     
    5152    class _OrxonoxExport BaseItem : public BaseObject
    5253    {
     54// tolua_end
    5355    public:
    5456        BaseItem(BaseObject* creator);
    5557        virtual ~BaseItem();
     58
     59        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
    5660
    5761        /**
     
    116120        inline void setPickupIdentifier(const std::string& identifier)
    117121            { this->pickupIdentifier_ = identifier; }
     122
     123        // GUI stuff
     124        virtual const std::string& getGUIText()
     125            { return this->guiText_; }
     126        inline void setGUIText(const std::string& text)
     127            { this->guiText_ = text; }
     128
     129        virtual const std::string& getGUITooltip()
     130            { return this->guiTooltip_; }
     131        inline void setGUITooltip(const std::string& tooltip)
     132            { this->guiTooltip_ = tooltip; }
     133
     134        virtual const std::string& getGUIImage()
     135            { return this->guiImage_; }
     136        inline void setGUIImage(const std::string& image)
     137            { this->guiImage_ = image; }
    118138    private:
    119139        Pawn* owner_;   //!< The current owner of the item.
     
    127147        */
    128148        std::string pickupIdentifier_;
     149
     150        std::string guiText_;
     151        std::string guiTooltip_;
     152        std::string guiImage_;
    129153    };
    130154}
  • code/branches/pickups2/src/orxonox/objects/pickup/CMakeLists.txt

    r2917 r2972  
    77  PassiveItem.cc
    88  PickupCollection.cc
     9  PickupInventory.cc
    910  PickupSpawner.cc
    1011  UsableItem.cc
  • code/branches/pickups2/src/orxonox/objects/pickup/DroppedItem.cc

    r2917 r2972  
    5555    {
    5656        if (this->item_)
     57        {
     58            COUT(3) << "Delete DroppedItem with '" << this->item_->getPickupIdentifier() << "'" << std::endl;
    5759            delete this->item_;
     60        }
    5861
    5962        delete this;
  • code/branches/pickups2/src/orxonox/objects/pickup/PickupCollection.cc

    r2917 r2972  
    3838#include "PassiveItem.h"
    3939#include "UsableItem.h"
     40
     41#include "core/CoreIncludes.h"
    4042
    4143#include "objects/worldentities/pawns/Pawn.h"
     
    312314        @return Returns a list of all the equipment-type items in the collection.
    313315    */
    314     std::set<BaseItem*> PickupCollection::getEquipmentItems()
    315     {
    316         std::set<BaseItem*> ret;
     316    std::deque<EquipmentItem*> PickupCollection::getEquipmentItems()
     317    {
     318        std::deque<EquipmentItem*> ret;
    317319        Identifier* ident = Class(EquipmentItem);
    318320
     
    320322        {
    321323            if ((*it).second->isA(ident))
    322                 ret.insert((*it).second);
     324                ret.push_back(dynamic_cast<EquipmentItem*>((*it).second));
    323325        }
    324326
     
    329331        @return Returns a list of all the passive items in the collection.
    330332    */
    331     std::set<BaseItem*> PickupCollection::getPassiveItems()
    332     {
    333         std::set<BaseItem*> ret;
     333    std::deque<PassiveItem*> PickupCollection::getPassiveItems()
     334    {
     335        std::deque<PassiveItem*> ret;
    334336        Identifier* ident = Class(PassiveItem);
    335337
     
    337339        {
    338340            if ((*it).second->isA(ident))
    339                 ret.insert((*it).second);
     341                ret.push_back(dynamic_cast<PassiveItem*>((*it).second));
    340342        }
    341343
     
    346348        @return Returns a list of all the usable items in the collection.
    347349    */
    348     std::set<BaseItem*> PickupCollection::getUsableItems()
    349     {
    350         std::set<BaseItem*> ret;
     350    std::deque<UsableItem*> PickupCollection::getUsableItems()
     351    {
     352        std::deque<UsableItem*> ret;
    351353        Identifier* ident = Class(UsableItem);
    352354
     
    354356        {
    355357            if ((*it).second->isA(ident))
    356                 ret.insert((*it).second);
     358                ret.push_back(dynamic_cast<UsableItem*>((*it).second));
    357359        }
    358360
  • code/branches/pickups2/src/orxonox/objects/pickup/PickupCollection.h

    r2917 r2972  
    3838
    3939#include <map>
    40 #include <set>
     40#include <deque>
    4141#include <string>
    4242
     
    4848{
    4949    class BaseItem;
     50    class EquipmentItem;
     51    class PassiveItem;
    5052    class UsableItem;
    5153    class Pawn;
     
    104106            { this->owner_ = owner; }
    105107
    106         std::set<BaseItem*> getEquipmentItems();   //!< Get a list of equipment-type items.
    107         std::set<BaseItem*> getPassiveItems();     //!< Get a list of passive items.
    108         std::set<BaseItem*> getUsableItems();      //!< Get a list of usable items.
     108        std::deque<EquipmentItem*> getEquipmentItems();   //!< Get a list of equipment-type items.
     109        std::deque<PassiveItem*> getPassiveItems();     //!< Get a list of passive items.
     110        std::deque<UsableItem*> getUsableItems();      //!< Get a list of usable items.
    109111    private:
    110112        Pawn* owner_;           //!< The owner of the PickupCollection.
  • code/branches/pickups2/src/orxonox/objects/pickup/UsableItem.cc

    r2917 r2972  
    2626 *
    2727 */
    28 
     28       
    2929/**
    3030    @file
  • code/branches/pickups2/src/orxonox/overlays/notifications/NotificationQueue.cc

    r2911 r2972  
    5454    const std::string NotificationQueue::DEFAULT_FONT = "VeraMono";
    5555    const Vector2 NotificationQueue::DEFAULT_POSITION = Vector2(0.0,0.0);
     56    const float NotificationQueue::DEFAULT_FONT_SIZE  = 0.025;
    5657
    5758    /**
     
    273274        string->clear();
    274275        bool first = true;
    275         for(std::set<std::string>::iterator it = this->targets_.begin(); it != this->targets_.end(); it++) //!< Iterate through the set of targets.
     276        for(std::set<std::string>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++) //!< Iterate through the set of targets.
    276277        {
    277278            if(!first)
  • code/branches/pickups2/src/orxonox/overlays/notifications/NotificationQueue.h

    r2911 r2972  
    166166            static const int DEFAULT_LENGTH = 64; //!< The default maximum number of Notifications displayed.
    167167            static const int DEFAULT_DISPLAY_TIME = 30; //!< The default display time.
    168             static const float DEFAULT_FONT_SIZE = 0.025; //!< The default font size.
     168            static const float DEFAULT_FONT_SIZE; //!< The default font size.
    169169
    170170            static const std::string DEFAULT_FONT; //!< The default font.
Note: See TracChangeset for help on using the changeset viewer.