Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6466 for code/branches


Ignore:
Timestamp:
Mar 4, 2010, 11:56:26 AM (15 years ago)
Author:
dafrick
Message:

Lots of things done in pickups module. Compiles, but it seems, that I've also introduced an error preventing steering of the spaceship.

Location:
code/branches/pickup3/src
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/src/libraries/core/OrxonoxClass.h

    r6417 r6466  
    3939
    4040#include "CorePrereqs.h"
     41#include "Super.h"
    4142
    4243#include <set>
     
    107108            bool isParentOf(const OrxonoxClass* object);
    108109            bool isDirectParentOf(const OrxonoxClass* object);
     110           
     111            virtual void clone(OrxonoxClass* item) {}
    109112
    110113            inline unsigned int getReferenceCount() const
     
    169172            std::vector<std::pair<unsigned int, void*> > objectPointers_;
    170173    };
     174   
     175    SUPER_FUNCTION(11, OrxonoxClass, clone, true);
     176   
    171177}
    172178
  • code/branches/pickup3/src/libraries/core/Super.h

    r6419 r6466  
    270270    #define SUPER_changedUsed(classname, functionname, ...) \
    271271        SUPER_NOARGS(classname, functionname)
     272       
     273    #define SUPER_clone(classname, functionname, ...) \
     274        SUPER_ARGS(classname, functionname, __VA_ARGS__)
     275       
     276    #define SUPER_changedCarrier(classname, functionname, ...) \
     277        SUPER_NOARGS(classname, functionname)
     278       
    272279    // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
    273280
     
    524531            ()
    525532        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     533
     534        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, clone, true, OrxonoxClass* item)
     535            (item)
     536        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     537       
     538        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedCarrier, false)
     539            ()
     540        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     541
    526542        // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
    527543
     
    578594    SUPER_INTRUSIVE_DECLARATION(changedGametype);
    579595    SUPER_INTRUSIVE_DECLARATION(changedUsed);
     596    SUPER_INTRUSIVE_DECLARATION(clone);
     597    SUPER_INTRUSIVE_DECLARATION(changedCarrier);
    580598    // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
    581599
  • code/branches/pickup3/src/modules/pickup/CMakeLists.txt

    r6420 r6466  
    11SET_SOURCE_FILES(PICKUP_SRC_FILES
     2  DroppedItem.cc
     3  Pickup.cc
    24  PickupCollection.cc
     5  PickupCollectionIdentifier.cc
     6  PickupManager.cc
     7  PickupRepresentation.cc
    38  PickupSpawner.cc
    49)
     10
     11ADD_SUBDIRECTORY(items)
    512
    613ORXONOX_ADD_LIBRARY(pickup
     
    1623  SOURCE_FILES ${PICKUP_SRC_FILES}
    1724)
    18 
  • code/branches/pickup3/src/modules/pickup/DroppedItem.cc

    r6421 r6466  
    7575    }
    7676   
     77    //TODO; Doesn't seem to be needed anymore, just put setPosition in the constructor.
    7778    void DroppedItem::createDrop(const Vector3& position)
    7879    {
  • code/branches/pickup3/src/modules/pickup/DroppedItem.h

    r6421 r6466  
    3535#define _DroppedItem_H__
    3636
    37 #include "pickup/PickupPrereqs.h"
     37#include "PickupPrereqs.h"
    3838
    3939#include "PickupSpawner.h"
  • code/branches/pickup3/src/modules/pickup/PickupCollection.cc

    r6421 r6466  
    7272        SUPER(PickupCollection, XMLPort, xmlelement, mode);
    7373       
    74         //TODO: Does this work? Problem could be, that Pickupable itself cannot be instantiated through XML...
     74        //TODO: Does this work? Problem could be, that Pickupable itself cannot be instantiated through XML, doubt that, though.
    7575        XMLPortObject(PickupCollection, PickupCollection, "pickupables", addPickupable, getPickupable, xmlelement, mode);
     76       
     77        this->initializeIdentifier();
     78    }
     79   
     80    void PickupCollection::initializeIdentifier(void)
     81    {
     82        this->pickupCollectionIdentifier_.addClass(this->getIdentifier());
     83       
     84        for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
     85        {
     86            this->pickupCollectionIdentifier_.addPickup((*it)->getPickupIdentifier());
     87        }
    7688    }
    7789   
     
    114126        for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
    115127        {
    116             (*it)->changedUsed();
     128            (*it)->setUsed(this->isUsed());
    117129        }
    118130    }
    119131   
    120     /**
    121     @brief
    122         Puts the PickupCollection in use.
    123     @return
    124         Returns true if successful.
    125     */
    126     //TODO: Revert if one fails? (same for unused)
    127     bool PickupCollection::use(void)
     132    void PickupCollection::changedCarrier()
    128133    {
    129         if(this->isUsed())
    130             return false;
     134        SUPER(PickupCollection, changedCarrier);
    131135       
    132         bool success = true;
    133         //! Set all Pickupables to used.
     136        //! Change the carrier for all Pickupables this PickupCollection consists of.
    134137        for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
    135138        {
    136             if(!(*it)->use())
    137             {
    138                 success = false;
    139             }
     139            (*it)->setCarrier(this->getCarrier());
    140140        }
    141        
    142         this->changedUsed();
    143        
    144         return success;
    145     }
    146    
    147     /**
    148     @brief
    149         Puts the PickupCollection out of use.
    150     @return
    151         Returns true if successful.
    152     */
    153     bool PickupCollection::unuse(void)
    154     {
    155         if(!this->isUsed())
    156             return false;
    157        
    158         bool success = true;
    159         //! Set all Pickupables to unused.
    160         for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
    161         {
    162             if(!(*it)->unuse())
    163             {
    164                 success = false;
    165             }
    166         }
    167        
    168         this->changedUsed();
    169        
    170         return success;
    171     }
    172 
    173     /**
    174     @brief
    175         Is invoked when the pickup is picked up.
    176     @param carrier
    177         The PickupCarrier that is picking up this pickup.
    178     @return
    179         Returns true if successful.
    180     */
    181     //TODO: Something should happen in the carrier as well, maybe just in the carrier. Owner might not be correct if the carrier hands the pickup down or up. Maybe even a Pawn as input instead fo a carrier. Or do this in Spawner?
    182     bool PickupCollection::pickup(PickupCarrier* carrier)
    183     {
    184         if(this->getOwner() != NULL)
    185         {
    186             COUT(2) << "Pickup wanted to get picked up by a new carrier, but it already has a carrier." << std::endl;
    187             return false;
    188         }
    189         for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
    190         {
    191             (*it)->setOwner(carrier);
    192         }
    193        
    194         this->setOwner(carrier);
    195        
    196         return true;
    197     }
    198    
    199     /**
    200     @brief
    201         Drop the pickup.
    202     @return
    203         Return true if successful.
    204     */
    205     bool PickupCollection::drop(void)
    206     {
    207         this->unuse();
    208         this->setOwner(NULL);
    209        
    210         //TODO: Create new Pickupspawner/DroppedPickup
    211         return true;
    212141    }
    213142   
    214143    //TODO: Steal description from Pickupable.
    215     Pickupable* PickupCollection::clone()
     144    void PickupCollection::clone(OrxonoxClass* item)
    216145    {
    217         Template* collectionTemplate = Template::getTemplate(this->getIdentifier()->getName());
    218         BaseObject* newObject = collectionTemplate->getBaseclassIdentifier()->fabricate(this);
     146        if(item == NULL)
     147            item = new PickupCollection(this);
    219148       
    220         PickupCollection* newCollection = dynamic_cast<PickupCollection*>(newObject);
     149        SUPER(PickupCollection, clone, item);
     150       
     151        PickupCollection* pickup = dynamic_cast<PickupCollection*>(item);
    221152        for(std::vector<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
    222153        {
    223154            Pickupable* newPickup = (*it)->clone();
    224             newCollection->pickups_.push_back(newPickup);
     155            pickup->addPickupable(newPickup);
    225156        }
    226        
    227         Pickupable* pickup = dynamic_cast<Pickupable*>(newCollection);
    228         return pickup;
     157
     158        pickup->initializeIdentifier();
    229159    }
    230160   
  • code/branches/pickup3/src/modules/pickup/PickupCollection.h

    r6421 r6466  
    3030#define _PickupCollection_H__
    3131
    32 #include "pickup/PickupPrereqs.h"
     32#include "PickupPrereqs.h"
    3333
    3434#include "interfaces/Pickupable.h"
    3535#include "core/BaseObject.h"
    3636#include "core/XMLPort.h"
     37
     38#include "PickupCollectionIdentifier.h"
    3739
    3840#include <list>
     
    6062            virtual void changedUsed(void);
    6163           
    62             virtual bool use(void);
    63             virtual bool unuse(void);
     64            virtual void changedCarrier(void);
    6465           
    65             virtual bool pickup(PickupCarrier* carrier);
    66             virtual bool drop(void);
     66            virtual void clone(OrxonoxClass* item);
    6767           
    68             virtual Pickupable* clone(void);
     68            virtual const PickupIdentifier* getPickupIdentifier(void)
     69                { return &this->pickupCollectionIdentifier_; }
    6970           
    7071            bool addPickupable(Pickupable* pickup);
    7172            const Pickupable* getPickupable(unsigned int index);
     73           
     74        protected:
     75            void initializeIdentifier(void);
     76           
     77            PickupCollectionIdentifier pickupCollectionIdentifier_;
    7278           
    7379        private:
  • code/branches/pickup3/src/modules/pickup/PickupPrereqs.h

    r6421 r6466  
    6767
    6868    class DroppedItem;
     69    class Pickup;
    6970    class PickupCollection;
     71    class PickupCollectionIdentifier;
     72    class PickupManager;
     73    class PickupRepresentation;
    7074    class PickupSpawner;
     75   
     76    //items
     77    class HealthPickup;
    7178   
    7279}
  • code/branches/pickup3/src/modules/pickup/PickupSpawner.cc

    r6421 r6466  
    3939#include "core/XMLPort.h"
    4040#include "worldentities/pawns/Pawn.h"
     41#include "PickupManager.h"
     42#include "PickupRepresentation.h"
    4143//#include "PickupInventory.h"    // HACK; Only for hack, remove later
    4244
     
    5961    PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator)
    6062    {
     63        RegisterObject(PickupSpawner);
     64       
    6165        this->initialize();
     66       
     67        PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(NULL);
     68       
     69        COUT(1) << "MUP4 " << representation << std::endl;
     70        this->attach(representation->getSpawnerRepresentation(this));
     71       
     72        COUT(1) << "MUP6" << std::endl;
    6273    }
    6374
     
    7889    PickupSpawner::PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems) : StaticEntity(creator)
    7990    {
     91        RegisterObject(PickupSpawner);
     92       
    8093        this->initialize();
    8194 
     
    8598        this->respawnTime_ = respawnTime;
    8699        this->setMaxSpawnedItems(maxSpawnedItems);
     100       
     101        PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier());
     102        this->attach(representation->getSpawnerRepresentation(this));
    87103    }
    88104
     
    93109    void PickupSpawner::initialize(void)
    94110    {
    95         RegisterObject(PickupSpawner);
    96 
    97111        this->pickup_ = NULL;
    98112       
     
    215229        Time since last tick.
    216230    */
    217     //TODO: Replace this with a real DistanceTrigger?
     231    //TODO: Replace this with a real DistanceTrigger? Or better with collisions?
    218232    void PickupSpawner::tick(float dt)
    219233    {
     
    259273            if (pickup != NULL) //!< If everything went ok, and pickup is not NULL.
    260274            {
     275                //TODO: Not correct anymore.
    261276                PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);
    262277                if(carrier == NULL)
     
    266281                }
    267282               
    268                 if(pickup->pickup(carrier))
     283                if(carrier->pickup(pickup))
    269284                {
    270285                    COUT(3) << "Pickup got picked up." << std::endl;
  • code/branches/pickup3/src/modules/pickup/PickupSpawner.h

    r6421 r6466  
    3535#define _PickupSpawner_H__
    3636
    37 #include "pickup/PickupPrereqs.h"
     37#include "PickupPrereqs.h"
    3838
    3939#include <string>
  • code/branches/pickup3/src/orxonox/CMakeLists.txt

    r6419 r6466  
    4747ADD_SUBDIRECTORY(items)
    4848ADD_SUBDIRECTORY(overlays)
     49ADD_SUBDIRECTORY(pickup)
    4950ADD_SUBDIRECTORY(sound)
    5051ADD_SUBDIRECTORY(weaponsystem)
  • code/branches/pickup3/src/orxonox/OrxonoxPrereqs.h

    r6419 r6466  
    135135    class OrxonoxOverlay;
    136136    class OverlayGroup;
     137   
     138    // pickup
     139    class PickupIdentifier;
    137140
    138141    //sound
  • code/branches/pickup3/src/orxonox/interfaces/CMakeLists.txt

    r5781 r6466  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    22  InterfaceCompilation.cc
     3  Pickupable.cc
    34  RadarViewable.cc
    45)
  • code/branches/pickup3/src/orxonox/interfaces/InterfaceCompilation.cc

    r6419 r6466  
    3434
    3535#include "GametypeMessageListener.h"
    36 #include "Pickupable.h"
    3736#include "PickupCarrier.h"
    3837#include "PlayerTrigger.h"
     
    5251    {
    5352        RegisterRootObject(GametypeMessageListener);
    54     }
    55    
    56     //----------------------------
    57     // Pickupable
    58     //----------------------------
    59     Pickupable::Pickupable()
    60     {
    61         RegisterRootObject(Pickupable);
    62 
    63         this->used_ = false;
    64         this->owner_ = NULL;
    6553    }
    6654   
  • code/branches/pickup3/src/orxonox/interfaces/PickupCarrier.h

    r6421 r6466  
    3737#include "OrxonoxPrereqs.h"
    3838#include "core/OrxonoxClass.h"
     39#include "Pickupable.h"
    3940
    4041#include <set>
     42#include <list>
    4143
    4244namespace orxonox
    4345{
    4446
    45     class _OrxonoxExport PickupCarrier : public OrxonoxClass
     47    class _OrxonoxExport PickupCarrier : virtual public OrxonoxClass
    4648    {
     49        friend class Pickupable;
    4750       
    4851        public:
    4952            PickupCarrier();
    5053            virtual ~PickupCarrier() {}
     54           
     55            //TODO: Secure uniqueness of each item in the set, if neccessary, check.
     56            inline bool pickup(Pickupable* pickup)
     57                {
     58                    bool pickedUp = this->pickups_.insert(pickup).second;
     59                    if(pickedUp) pickup->pickedUp(this);
     60                    return pickedUp;
     61                }
     62               
     63            inline bool drop(Pickupable* pickup)
     64                {
     65                   bool dropped = this->pickups_.erase(pickup) == 1;
     66                   if(dropped)
     67                   {
     68                       pickup->dropped();
     69                        //TODO: Create Spawner.
     70                   }
     71                   return dropped;
     72                }
     73               
     74            inline bool isTarget(Pickupable* pickup)
     75                {
     76                    if(pickup->isTarget(this))
     77                        return true;
     78                    const std::list<PickupCarrier*>* children = this->getChildren();
     79                    for(std::list<PickupCarrier*>::const_iterator it = children->begin(); it != children->end(); it++)
     80                    {
     81                        if((*it)->isTarget(pickup))
     82                            return true;
     83                    }
     84                   
     85                    return false;
     86                }
     87           
     88        protected:           
     89            //TODO: Good return type?
     90            virtual const std::list<PickupCarrier*>* getChildren(void) = 0;
     91            virtual PickupCarrier* getParent(void) = 0;
    5192       
    5293        private:
     94            std::set<Pickupable*> pickups_;
    5395           
    54             std::set<Pickupable*> pickups_;
    5596       
    5697    };
  • code/branches/pickup3/src/orxonox/interfaces/Pickupable.h

    r6419 r6466  
    3838#include "core/OrxonoxClass.h"
    3939
    40 #include "core/Identifier.h"
    4140#include "core/Super.h"
    42 #include "interfaces/PickupCarrier.h"
    43 #include "worldentities/pawns/Pawn.h"
     41#include "pickup/PickupIdentifier.h"
    4442#include <list>
    4543
    4644namespace orxonox
    4745{
    48 
    49     //! Enum for the activation type.
    50     namespace pickupActivationType
    51     {
    52         enum Value
    53         {
    54             immediate,
    55             onUse,
    56         };
    57     }
    58    
    59     //! Enum for the duration tyoe.
    60     namespace pickupDurationType
    61     {
    62         enum Value
    63         {
    64             once,
    65             continuous,
    66         };
    67     }
    6846   
    6947    /**
    7048    @brief
    71         An Interface (or more precisely an abstract Class) to model and manage different (all kinds of) pickups.
     49        An Interface (or more precisely an abstract Class) to model and represent different (all kinds of) pickups.
    7250    @author
    7351        Damian 'Mozork' Frick
     
    7654    class _OrxonoxExport Pickupable : virtual public OrxonoxClass
    7755    {
     56       
    7857        public:
    7958            Pickupable(); //!< Default constructor.
    8059            virtual ~Pickupable() {} //!< Default destructor.
    81            
    82             /**
    83             @brief Get the activation type of the pickup.
    84             @return Returns the activation type of the pickup.
    85             */
    86             inline pickupActivationType::Value getActivationType(void)
    87                 { return this->activationType_; }
    88             /**
    89             @brief Get the duration type of the pickup.
    90             @return Returns the duration type of the pickup.
    91             */
    92             inline pickupDurationType::Value getDurationType(void)
    93                 { return this->durationType_; }
    9460               
    9561            /**
    96             @brief Get the owner of the pickup.
    97             @return Returns a pointer to the owner of the pickup.
     62            @brief Get the carrier of the pickup.
     63            @return Returns a pointer to the carrier of the pickup.
    9864            */
    99             inline PickupCarrier* getOwner(void)
    100                 { return this->owner_; }
     65            inline PickupCarrier* getCarrier(void)
     66                { return this->carrier_; }
    10167               
    10268            /**
     
    10773                { return this->used_; }
    10874               
    109             /**
    110             @brief Get whether the given pawn is a target of this pickup.
    111             @param pawn The Pawn of which it has to be determinde whether it is a target of this pickup.
    112             @return Retruns true if the given Pawn is a target.
    113             */
    114             //TODO: Determine whether Pawn includes all possible cases and if PickupCarrier wouldn't be better.
    115             inline bool isTarget(Pawn* pawn)
    116                 {
    117                     Identifier* identifier = pawn->getIdentifier();
    118                     for(std::list<Identifier*>::iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
    119                     {
    120                         if(identifier->isA(*it))
    121                             return true;
    122                     }
    123                     return false;
    124                 }
     75            bool isTarget(PickupCarrier* carrier);
     76            bool addTarget(PickupCarrier* target);
     77
     78            bool setUsed(bool used);
     79           
     80            bool pickedUp(PickupCarrier* carrier);
     81            bool dropped(void);
     82           
     83            inline bool isPickedUp(void)
     84                { return this->pickedUp_; }
     85           
     86            Pickupable* clone(void);
     87           
     88            virtual const PickupIdentifier* getPickupIdentifier(void)
     89                { return &this->pickupIdentifier_; }
    12590               
    126             /**
    127             @brief  Should be called when the pickup has transitetd from used to unused or the other way around.
    128                     Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedUsed); to their changeUsed method.
    129             */
    130             virtual inline void changedUsed(void)
    131                 {
    132                     if(this->isUsed())
    133                         this->used_ = false;
    134                     else
    135                         this->used_ = true;
    136                 }
    137 
    138             /**
    139             @brief  Sets the pickup to used and makes sure the effects of the pickup take effect at the right places.
    140                     This method needs to be implemented by any Class inheriting from Pickupable.
    141             @return Returns false if for some reason the method could not take effect, e.g. because it is already in use, or some other circumstance.
    142             */
    143             virtual bool use(void) = 0;
    144             /**
    145             @brief  Sets the pickup to unused and makes sure the effects of the pickup no longer take effect.
    146                     This method needs to be implemented by any Class inheriting from Pickupable.
    147             @return Returns false if for some reason the method could not take effect, e.g. because the pickup is already unused, or some other circumstance.
    148             */
    149             virtual bool unuse(void) = 0;
     91            virtual void clone(OrxonoxClass* item);
    15092           
    15193            /**
    152             @brief  Adds the pickup to the input PickupCarrier.
    153                     This method needs to be implemented by any Class inheriting from Pickupable.
    154             @return Returns false if, for some reason, the pickup could not be picked up.
     94            @brief  Should be called when the pickup has transited from used to unused or the other way around.
     95                    Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedUsed); to their changdeUsed method.
    15596            */
    156             //TODO: Maybe better in PickupCarrier?
    157             virtual bool pickup(PickupCarrier* carrier) = 0;
    158             /**
    159             @brief  Drops the pickup. Creates a PickupSpawner at the place the Pickup has been dropped.
    160                     This method needs to be implemented by any Class inheriting from Pickupable.
    161             @return Returns false if the pickup could not be dropped.
    162             */
    163             //TODO: Probably could be done here?
    164             virtual bool drop(void) = 0;
     97            virtual void changedUsed(void) {}
    16598           
    16699            /**
    167             @brief  Creates a duplicate of the pickup.
    168                     This method needs to e implemented by any Class inheriting from Pickupable.
    169             @return Returns the clone of this pickup as a pointer to a Pickupable.
     100            @brief  Should be called when the pickup has transited from picked up to dropped or the other way around.
     101                    Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedCarrier); to their changedCarrier method.
    170102            */
    171             //TODO: Would be nicer if standard case was implemented here.
    172             virtual Pickupable* clone(void) = 0;
     103            virtual void changedCarrier(void) {}
    173104           
    174             /**
    175             @brief Sets the owner of the pickup.
    176             @param owner Sets the input PickupCarrier as the owner of the pickup.
    177             */
    178             //TODO: Protected? Check for NULL and return true/false?
    179             inline void setOwner(PickupCarrier* owner)
    180                 { this->owner_ = owner; }
     105            bool setCarrier(PickupCarrier* carrier);
     106           
     107        protected:
     108            void initializeIdentifier(void) {}
     109           
     110            PickupIdentifier pickupIdentifier_;
    181111           
    182112        private:
    183            
    184             pickupActivationType::Value activationType_; //!< The activation type of the Pickup.
    185             pickupDurationType::Value durationType_; //!< The duration type of the pickup.
     113            inline void setPickedUp(bool pickedUp)
     114                { this->pickedUp_ = pickedUp; }
    186115           
    187116            bool used_; //!< Whether the pickup is currently in use or not.
     117            bool pickedUp_; //!< Whether the pickup is currently picked up or not.
    188118           
    189             PickupCarrier* owner_; //!< The owner of the pickup.
     119            PickupCarrier* carrier_; //!< The owner of the pickup.
    190120            std::list<Identifier*> targets_; //!< The possible targets of this pickup.
    191121
    192122    };
    193123   
    194     SUPER_FUNCTION(10, Pickupable, changedUsed, true)
     124    SUPER_FUNCTION(10, Pickupable, changedUsed, false);
     125    SUPER_FUNCTION(12, Pickupable, changedCarrier, false);
    195126}
    196127
  • code/branches/pickup3/src/orxonox/pickup/CMakeLists.txt

    r6419 r6466  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    2   BaseItem.cc
    3   EquipmentItem.cc
    4   ModifierPickup.cc
    5   PassiveItem.cc
    6   PickupCollection.cc
    7   PickupInventory.cc
    8   UsableItem.cc
     2  PickupIdentifier.cc
    93)
    104
    11 ADD_SUBDIRECTORY(items)
  • code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.h

    r6419 r6466  
    3333
    3434#include <string>
     35#include "interfaces/PickupCarrier.h"
    3536#include "interfaces/RadarViewable.h"
    3637#include "worldentities/ControllableEntity.h"
    37 //TODO: Remove.
    38 //#include "pickup/PickupCollection.h"
    3938
    4039namespace orxonox
    4140{
    42     class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable
     41    class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable, public PickupCarrier
    4342    {
    4443        friend class WeaponSystem;
     
    139138            //TODO: Remove.
    140139            //PickupCollection pickups_;
     140            virtual const std::list<PickupCarrier*>* getChildren(void)
     141                { return new std::list<PickupCarrier*>(); }
     142            virtual PickupCarrier* getParent(void)
     143                { return NULL; }
    141144
    142145            float health_;
Note: See TracChangeset for help on using the changeset viewer.