Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 2, 2010, 5:35:14 PM (15 years ago)
Author:
dafrick
Message:

Lua bugs fixed.
Renamed name and description in PickupRepresentation to pickupName and pickupDescription to avoid problems.
More work on PickupInventory.

Location:
code/branches/pickup4/src/modules/pickup
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup4/src/modules/pickup/PickupManager.cc

    r6669 r6675  
    127127    }
    128128   
    129     unsigned int PickupManager::getNumCarrierChildren(PickupCarrier* carrier)
     129    int PickupManager::getNumCarrierChildren(PickupCarrier* carrier)
    130130    {
    131131        if(carrier == NULL)
     
    134134    }
    135135           
    136     PickupCarrier* PickupManager::getCarrierChild(unsigned int index, PickupCarrier* carrier)
     136    PickupCarrier* PickupManager::getCarrierChild(int index, PickupCarrier* carrier)
    137137    {
     138        if(carrier == NULL)
     139            return NULL;
    138140        return carrier->getCarrierChild(index);
    139141    }
    140142   
    141     PickupRepresentation* PickupManager::getPickupRepresentation(unsigned int index, PickupCarrier* carrier)
     143    const std::string& PickupManager::getCarrierName(orxonox::PickupCarrier* carrier)
     144    {
     145        if(carrier == NULL)
     146            return BLANKSTRING;
     147        return carrier->getCarrierName();
     148    }
     149   
     150    PickupRepresentation* PickupManager::getPickupRepresentation(int index, PickupCarrier* carrier)
    142151    {
    143152        Pickupable* pickup = carrier->getPickup(index);
     
    149158   
    150159
    151     unsigned int PickupManager::getNumPickups(PickupCarrier* carrier)
     160    int PickupManager::getNumPickups(PickupCarrier* carrier)
    152161    {
     162        if(carrier == NULL)
     163            return 0;
    153164        return carrier->getNumPickups();
    154165    }
    155166   
    156     void PickupManager::dropPickup(unsigned int index, PickupCarrier* carrier)
     167    void PickupManager::dropPickup(int index, PickupCarrier* carrier)
    157168    {
    158169        Pickupable* pickup = carrier->getPickup(index);
     
    160171    }
    161172   
    162     void PickupManager::usePickup(unsigned int index, PickupCarrier* carrier, bool use)
     173    void PickupManager::usePickup(int index, PickupCarrier* carrier, bool use)
    163174    {
    164175        Pickupable* pickup = carrier->getPickup(index);
  • code/branches/pickup4/src/modules/pickup/PickupManager.h

    r6669 r6675  
    7272            orxonox::PickupCarrier* getPawn(void);
    7373           
    74             unsigned int getNumCarrierChildren(orxonox::PickupCarrier* carrier);
    75             orxonox::PickupCarrier* getCarrierChild(unsigned int index, orxonox::PickupCarrier* carrier);
     74            int getNumCarrierChildren(orxonox::PickupCarrier* carrier);
     75            orxonox::PickupCarrier* getCarrierChild(int index, orxonox::PickupCarrier* carrier);
    7676           
    77             unsigned int getNumPickups(orxonox::PickupCarrier* carrier);
    78             PickupRepresentation* getPickupRepresentation(unsigned int index, orxonox::PickupCarrier* carrier);
    79             void dropPickup(unsigned int index, orxonox::PickupCarrier* carrier);
    80             void usePickup(unsigned int index, orxonox::PickupCarrier* carrier, bool use);
     77            const std::string& getCarrierName(orxonox::PickupCarrier* carrier);
     78           
     79            int getNumPickups(orxonox::PickupCarrier* carrier);
     80            PickupRepresentation* getPickupRepresentation(int index, orxonox::PickupCarrier* carrier);
     81            void dropPickup(int index, orxonox::PickupCarrier* carrier);
     82            void usePickup(int index, orxonox::PickupCarrier* carrier, bool use);
    8183            // tolua_end
    8284           
  • code/branches/pickup4/src/modules/pickup/PickupRepresentation.cc

    r6632 r6675  
    8686        this->name_ = "Pickup";
    8787        this->spawnerTemplate_ = "";
    88         this->inventoryRepresentation_ = "";
     88        this->inventoryRepresentation_ = "Default";
    8989        this->pickup_ = NULL;
    9090    }
     
    9898        SUPER(PickupRepresentation, XMLPort, xmlelement, mode);
    9999       
    100         XMLPortParam(PickupRepresentation, "name", setName, getName, xmlelement, mode);
    101         XMLPortParam(PickupRepresentation, "description", setDescription, getDescription, xmlelement, mode);
     100        XMLPortParam(PickupRepresentation, "pickupName", setPickupName, getPickupName, xmlelement, mode);
     101        XMLPortParam(PickupRepresentation, "pickupDescription", setPickupDescription, getPickupDescription, xmlelement, mode);
    102102        XMLPortParam(PickupRepresentation, "spawnerTemplate", setSpawnerTemplate, getSpawnerTemplate, xmlelement, mode);
    103103        XMLPortParam(PickupRepresentation, "inventoryRepresentation", setInventoryRepresentation, getInventoryRepresentation, xmlelement, mode);
  • code/branches/pickup4/src/modules/pickup/PickupRepresentation.h

    r6632 r6675  
    6868            @param name The name.
    6969            */
    70             inline void setName(const std::string& name)
     70            inline void setPickupName(const std::string& name)
    7171                { this->name_ = name; }
    7272            /**
     
    7474            @param description The Description.
    7575            */
    76             inline void setDescription(const std::string& description)
     76            inline void setPickupDescription(const std::string& description)
    7777                { this->description_ = description; }
    7878            /**
     
    107107            @return Returns the name.
    108108            */
    109             inline const std::string& getName(void) { return this->name_; } // tolua_export
     109            inline const std::string& getPickupName(void) { return this->name_; } // tolua_export
    110110            /**
    111111            @brief Get the description of the Pickupable represented by this PickupRepresentation.
    112112            @return Returns the description.
    113113            */
    114             inline const std::string& getDescription(void) { return this->description_; } // tolua_export
     114            inline const std::string& getPickupDescription(void) { return this->description_; } // tolua_export
    115115            /**
    116116            @brief Get the name of spawnerTemplate the Pickupable represented by this PickupRepresentation.
Note: See TracChangeset for help on using the changeset viewer.