Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 9, 2010, 9:32:58 PM (14 years ago)
Author:
rgrieder
Message:

Removed excess white space at the end of lines.

Location:
code/branches/presentation3/src/modules/pickup
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/modules/pickup/DroppedPickup.cc

    r6540 r7127  
    4141namespace orxonox
    4242{
    43    
     43
    4444    CreateFactory(DroppedPickup);
    45    
     45
    4646    /**
    4747    @brief
     
    5151    {
    5252        RegisterObject(DroppedPickup);
    53        
     53
    5454    }
    5555
     
    6767    */
    6868    DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 5, 1)
    69     {   
     69    {
    7070        RegisterObject(DroppedPickup);
    7171
    7272        this->setPosition(carrier->getCarrierPosition());
    7373        this->setActive(false);
    74        
     74
    7575        //TODO: Do more elegantly.
    7676        this->startRespawnTimer();
  • code/branches/presentation3/src/modules/pickup/DroppedPickup.h

    r6540 r7127  
    4141namespace orxonox
    4242{
    43    
     43
    4444    /**
    4545    @brief
  • code/branches/presentation3/src/modules/pickup/Pickup.h

    r7008 r7127  
    165165        private:
    166166            void initialize(void); //!< Initializes the member variables.
    167            
     167
    168168            //TODO: Problems, when there are more Timers needed? Solutions?
    169169            Timer durationTimer_; //!< Timer at the disposal of each Class implementing Pickup.
  • code/branches/presentation3/src/modules/pickup/PickupCollection.cc

    r7094 r7127  
    4242namespace orxonox
    4343{
    44  
     44
    4545    CreateFactory(PickupCollection);
    4646
     
    5252    {
    5353        RegisterObject(PickupCollection);
    54        
     54
    5555        this->pickupCollectionIdentifier_ = new PickupCollectionIdentifier(this);
    5656    }
    57    
     57
    5858    /**
    5959    @brief
     
    6969        }
    7070    }
    71    
     71
    7272    /**
    7373    @brief
     
    7777    {
    7878        SUPER(PickupCollection, XMLPort, xmlelement, mode);
    79        
     79
    8080        XMLPortObject(PickupCollection, Pickupable, "pickupables", addPickupable, getPickupable, xmlelement, mode);
    81        
     81
    8282        this->initializeIdentifier();
    8383    }
    84    
     84
    8585    /**
    8686    @brief
     
    9494        }
    9595    }
    96    
     96
    9797    /**
    9898    @brief
     
    103103    {
    104104        SUPER(PickupCollection, changedUsed);
    105        
     105
    106106        //! Change used for all Pickupables this PickupCollection consists of.
    107107        for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
     
    110110        }
    111111    }
    112    
     112
    113113    /**
    114114    @brief
     
    119119    {
    120120        SUPER(PickupCollection, changedCarrier);
    121        
     121
    122122        //! Change the PickupCarrier for all Pickupables this PickupCollection consists of.
    123123        for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
     
    126126        }
    127127    }
    128    
     128
    129129    /**
    130130    @brief
     
    135135    {
    136136        SUPER(PickupCollection, changedPickedUp);
    137        
     137
    138138        //! Change the pickedUp status for all Pickupables this PickupCollection consists of.
    139139        for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
     
    142142        }
    143143    }
    144    
     144
    145145    /**
    146146    @brief
     
    154154        if(item == NULL)
    155155            item = new PickupCollection(this);
    156        
     156
    157157        SUPER(PickupCollection, clone, item);
    158        
     158
    159159        PickupCollection* pickup = dynamic_cast<PickupCollection*>(item);
    160160        //! Clone all Pickupables this PickupCollection consist of.
     
    167167        pickup->initializeIdentifier();
    168168    }
    169    
     169
    170170    /**
    171171    @brief
     
    183183                return false;
    184184        }
    185        
     185
    186186        return true;
    187187    }
    188    
     188
    189189    /**
    190190    @brief
     
    198198        return this->pickupCollectionIdentifier_;
    199199    }
    200    
     200
    201201    /**
    202202    @brief
     
    211211        if(pickup == NULL)
    212212            return false;
    213        
     213
    214214        WeakPtr<Pickupable> ptr = pickup; //!< Create a weak pointer to be able to test in the constructor if the Pointer is still valid.
    215215        this->pickups_.push_back(ptr);
    216216        return true;
    217217    }
    218    
     218
    219219    /**
    220220    @brief
     
    229229        return this->pickups_[index].get();
    230230    }
    231        
     231
    232232    /**
    233233    @brief
     
    245245        return true;
    246246    }
    247    
     247
    248248}
  • code/branches/presentation3/src/modules/pickup/PickupCollection.h

    r6731 r7127  
    5353    class _PickupExport PickupCollection : public Pickupable, public BaseObject
    5454    {
    55        
     55
    5656        public:
    57            
     57
    5858            PickupCollection(BaseObject* creator); //!< Default Constructor.
    5959            virtual ~PickupCollection(); //!< Destructor.
    60            
     60
    6161            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates an instance of this Class through XML.
    6262
     
    6464            virtual void changedCarrier(void); //!< Is called when the pickup has changed its PickupCarrier.
    6565            virtual void changedPickedUp(void); //!< Is called when the pickup has transited from picked up to dropped or the other way around.
    66            
     66
    6767            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    68            
     68
    6969            virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection.
    70            
     70
    7171            virtual const PickupIdentifier* getPickupIdentifier(void); //!< Get the PickupIdentifier of this PickupCollection.
    72            
     72
    7373            bool addPickupable(Pickupable* pickup); //!< Add the input Pickupable to list of Pickupables combined by this PickupCollection.
    7474            const Pickupable* getPickupable(unsigned int index); //!< Get the Pickupable at the given index.
    75            
     75
    7676        protected:
    7777            void initializeIdentifier(void); //!< Initializes the PickupIdentifier for this pickup.
    78            
     78
    7979            virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
    80            
     80
    8181            PickupCollectionIdentifier* pickupCollectionIdentifier_; //!< The PickupCollectionIdentifier of this PickupCollection. Is used to distinguish different PickupCollections amongst themselves.
    82            
     82
    8383        private:
    84            
     84
    8585            std::vector<WeakPtr<Pickupable> > pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid.
    86        
     86
    8787    };
    88    
     88
    8989}
    9090
  • code/branches/presentation3/src/modules/pickup/PickupCollectionIdentifier.cc

    r6538 r7127  
    3838namespace orxonox
    3939{
    40    
     40
    4141    /**
    4242    @brief
     
    4747        RegisterObject(PickupCollectionIdentifier);
    4848    }
    49    
     49
    5050    /**
    5151    @brief
     
    5454    PickupCollectionIdentifier::~PickupCollectionIdentifier()
    5555    {
    56        
     56
    5757    }
    5858
     
    7070        PickupIdentifier* temp = const_cast<PickupIdentifier*>(identifier);
    7171        const PickupCollectionIdentifier* collectionIdentifier = dynamic_cast<PickupCollectionIdentifier*>(temp);
    72        
     72
    7373        //! If the input PickupIdentifier 'identifier' is no PickupCollectionIdentifier then just the two PickupIdentifiers are compared.
    7474        if(collectionIdentifier == NULL)
     
    7676            return this->PickupIdentifier::compare(identifier);
    7777        }
    78        
     78
    7979        //! If the number of Pickupables each of the two PickupCollectionIdentifiers contain differ, the one with less is considered smaller.
    8080        if(this->identifiers_.size() != collectionIdentifier->identifiers_.size())
    8181            return this->identifiers_.size()-collectionIdentifier->identifiers_.size();
    82        
     82
    8383        //! Compare the Pickupables of the two PickupCollectionIdentifiers one after the other. the one with the first 'smaller' one is considered smaller.
    8484        std::set<const PickupIdentifier*, PickupIdentifierCompare>::const_iterator it2 = collectionIdentifier->identifiers_.begin();
    8585        for(std::set<const PickupIdentifier*, PickupIdentifierCompare>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); it++)
    8686        {
    87            
     87
    8888            if((*it)->compare(*it2) < 0)
    8989                return -1;
     
    9191                return 1;
    9292        }
    93        
     93
    9494        //! Means they are equal.
    9595        return 0;
    9696    }
    97    
     97
    9898    /**
    9999    @brief
     
    106106        this->identifiers_.insert(identifier);
    107107    }
    108    
     108
    109109}
    110110
  • code/branches/presentation3/src/modules/pickup/PickupCollectionIdentifier.h

    r6538 r7127  
    5454    class _PickupExport PickupCollectionIdentifier : public PickupIdentifier
    5555    {
    56        
     56
    5757        public:
    5858            PickupCollectionIdentifier(Pickupable* pickup); //!< Constructor.
    5959            ~PickupCollectionIdentifier(); //!< Destructor.
    60            
     60
    6161            virtual int compare(const PickupIdentifier* identifier) const; //!< Compares a PickupCollectionIdentifier with a PickupIdentifier.
    62            
     62
    6363            void addPickup(const PickupIdentifier* identifier); //!< Add a Pickupable to the PickupCollectionIdentifier.
    64            
     64
    6565        private:
    6666            std::set<const PickupIdentifier*, PickupIdentifierCompare> identifiers_; //!< The set of PickupIdentifiers of the Pickupables the PickupCollection with this PickupCollectionIdentifier consists of, ordered by the rule set by PickupIdentifierCompare.
    67            
     67
    6868    };
    69    
     69
    7070}
    7171
  • code/branches/presentation3/src/modules/pickup/PickupManager.cc

    r7110 r7127  
    5151    // Register tolua_open function when loading the library
    5252    DeclareToluaInterface(Pickup);
    53    
     53
    5454    ManageScopedSingleton(PickupManager, ScopeID::Root, false);
    55    
     55
    5656    /*static*/ const std::string PickupManager::guiName_s = "PickupInventory";
    57    
     57
    5858    /**
    5959    @brief
     
    6969        }
    7070        this->defaultRepresentation_ = new PickupRepresentation();
    71        
     71
    7272        COUT(3) << "PickupManager created." << std::endl;
    7373    }
    74    
     74
    7575    /**
    7676    @brief
     
    8282        if(this->defaultRepresentation_ != NULL)
    8383            this->defaultRepresentation_->destroy();
    84        
     84
    8585        this->representations_.clear();
    86        
     86
    8787        COUT(3) << "PickupManager destroyed." << std::endl;
    8888    }
    89    
     89
    9090    /**
    9191    @brief
     
    100100    */
    101101    bool PickupManager::registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation)
    102     {       
     102    {
    103103        if(identifier == NULL || representation == NULL || this->representations_.find(identifier) != this->representations_.end()) //!< If the Pickupable already has a Representation registered.
    104104            return false;
    105        
     105
    106106        this->representations_[identifier] = representation;
    107        
     107
    108108        COUT(4) << "PickupRepresentation " << representation << " registered with the PickupManager." << std::endl;
    109109        return true;
    110110    }
    111    
     111
    112112    /**
    113113    @brief
     
    121121    */
    122122    bool PickupManager::unregisterRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation)
    123     {       
     123    {
    124124        if(identifier == NULL || representation == NULL)
    125125            return false;
    126        
     126
    127127        std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare>::iterator it = this->representations_.find(identifier);
    128128        if(it == this->representations_.end()) //!< If the Pickupable is not registered in the first place.
    129129            return false;
    130        
     130
    131131        this->representations_.erase(it);
    132        
     132
    133133        COUT(4) << "PickupRepresentation " << representation << " unregistered with the PickupManager." << std::endl;
    134134        return true;
    135135    }
    136    
     136
    137137    /**
    138138    @brief
     
    151151            return this->defaultRepresentation_;
    152152        }
    153        
     153
    154154        return it->second;
    155155    }
     
    158158    {
    159159        this->pickupsList_.clear();
    160        
     160
    161161        PlayerInfo* player = GUIManager::getInstance().getPlayer(PickupManager::guiName_s);
    162162        PickupCarrier* carrier = NULL;
     
    221221        if(pickup == NULL || it == this->pickupsList_.end() || it->second.get() == NULL)
    222222            return;
    223        
     223
    224224        if(!pickup->isPickedUp())
    225225            return;
     
    229229            pickup->setUsed(use);
    230230    }
    231    
     231
    232232}
  • code/branches/presentation3/src/modules/pickup/PickupManager.h

    r6996 r7127  
    6060    { // tolua_export
    6161        friend class Singleton<PickupManager>;
    62        
     62
    6363        public:
    6464            PickupManager();
    6565            virtual ~PickupManager();
    66            
     66
    6767            static PickupManager& getInstance() { return Singleton<PickupManager>::getInstance(); } // tolua_export
    68            
     68
    6969            bool registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Registers a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.
    7070            bool unregisterRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Unegisters a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.
    7171            PickupRepresentation* getRepresentation(const PickupIdentifier* identifier); //!< Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier.
    72            
     72
    7373            // tolua_begin
    7474            int getNumPickups(void);
     
    8080            bool isValidPickup(orxonox::Pickupable* pickup) { std::map<Pickupable*, WeakPtr<Pickupable> >::iterator it = this->pickupsList_.find(pickup); if(it == this->pickupsList_.end()) return false; return it->second.get() != NULL; }
    8181            // tolua_end
    82            
     82
    8383        private:
    8484            static PickupManager* singletonPtr_s;
    8585            static const std::string guiName_s;
    86            
     86
    8787            PickupRepresentation* defaultRepresentation_; //!< The default PickupRepresentation.
    8888            std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types if Pickupables) and PickupRepresentations.
     
    9292
    9393            std::vector<PickupCarrier*>* getAllCarriers(PickupCarrier* carrier);
    94        
     94
    9595    }; // tolua_export
    96    
     96
    9797} // tolua_export
    9898
  • code/branches/presentation3/src/modules/pickup/PickupPrereqs.h

    r7034 r7127  
    6565namespace orxonox
    6666{
    67    
     67
    6868    class DroppedPickup;
    6969    class Pickup;
  • code/branches/presentation3/src/modules/pickup/PickupRepresentation.cc

    r6725 r7127  
    4141namespace orxonox
    4242{
    43    
     43
    4444    CreateFactory(PickupRepresentation);
    45    
     45
    4646    /**
    4747    @brief
     
    5252    {
    5353        RegisterObject(PickupRepresentation);
    54        
     54
    5555        this->initialize();
    5656    }
    57    
     57
    5858    /**
    5959    @brief
     
    6363    {
    6464        RegisterObject(PickupRepresentation);
    65        
     65
    6666        this->initialize();
    6767    }
    68    
     68
    6969    /**
    7070    @brief
     
    7575        if(this->spawnerRepresentation_ != NULL)
    7676            this->spawnerRepresentation_->destroy();
    77        
     77
    7878        if(this->pickup_ != NULL)
    7979            PickupManager::getInstance().unregisterRepresentation(this->pickup_->getPickupIdentifier(), this);
    8080    }
    81    
     81
    8282    /**
    8383    @brief
     
    9191        this->inventoryRepresentation_ = "Default";
    9292    }
    93    
     93
    9494    /**
    9595    @brief
     
    9999    {
    100100        SUPER(PickupRepresentation, XMLPort, xmlelement, mode);
    101        
     101
    102102        XMLPortParam(PickupRepresentation, "pickupName", setPickupName, getPickupName, xmlelement, mode);
    103103        XMLPortParam(PickupRepresentation, "pickupDescription", setPickupDescription, getPickupDescription, xmlelement, mode);
     
    106106        XMLPortObject(PickupRepresentation, Pickupable, "pickup", setPickup, getPickup, xmlelement, mode);
    107107        XMLPortObject(PickupRepresentation, StaticEntity, "spawner-representation", setSpawnerRepresentation, getSpawnerRepresentationIndex, xmlelement, mode);
    108        
     108
    109109        PickupManager::getInstance().registerRepresentation(this->pickup_->getPickupIdentifier(), this); //!< Registers the PickupRepresentation with the PickupManager through the PickupIdentifier of the Pickupable it represents.
    110        
     110
    111111        if(this->spawnerRepresentation_ != NULL)
    112112            this->spawnerRepresentation_->setVisible(false);
    113        
     113
    114114        COUT(4) << "PickupRepresentation created: name: '" << this->name_ << "', description: '" << this->description_ << "', spawnerTemplate: '" << this->spawnerTemplate_ << "'." << std::endl;
    115115    }
    116    
     116
    117117    /**
    118118    @brief
     
    136136            this->addTemplate(this->spawnerTemplate_);
    137137        }
    138        
     138
    139139        StaticEntity* representation = this->spawnerRepresentation_;
    140140        representation->setVisible(true);
    141        
     141
    142142        this->addTemplate(this->spawnerTemplate_);
    143143        this->spawnerRepresentation_->setVisible(false);
    144        
     144
    145145        return representation;
    146146    }
    147    
     147
    148148    /**
    149149    @brief
     
    171171        return representation;
    172172    }
    173    
     173
    174174}
  • code/branches/presentation3/src/modules/pickup/PickupRepresentation.h

    r6711 r7127  
    5656        : public BaseObject
    5757    { // tolua_export
    58        
     58
    5959        public:
    6060            PickupRepresentation(); //!< Constructor
    6161            PickupRepresentation(BaseObject* creator); //!< Default constructor.
    6262            virtual ~PickupRepresentation(); //!< Destructor.
    63            
     63
    6464            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    65            
     65
    6666            /**
    6767            @brief Set the name of the Pickupable represented by this PickupRepresentation.
     
    102102            inline void setPickup(Pickupable* pickup)
    103103                { this->pickup_ = pickup; }
    104                
     104
    105105            /**
    106106            @brief Get the name of the Pickupable represented by this PickupRepresentation.
     
    138138            inline const Pickupable* getPickup(unsigned int index)
    139139                { if(index == 0) return this->pickup_; return NULL; }
    140                
     140
    141141            StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner); //!< Get a spawnerRepresentation for a specific PickupSpawner.
    142        
     142
    143143        private:
    144144            void initialize(void); //!< Initializes the member variables of this PickupRepresentation.
    145145            StaticEntity* getDefaultSpawnerRepresentation(PickupSpawner* spawner); //!< Get the default spawnerRepresentation for a specific PickupSpawner.
    146            
     146
    147147            std::string name_; //!< The name of the Pickupable represented by this PickupRepresentation.
    148148            std::string description_; //!< The description of the Pickupable represented by this PickupRepresentation.
     
    150150            StaticEntity* spawnerRepresentation_; //!< The spawnerRepresentation of this PickupRepresentation.
    151151            std::string inventoryRepresentation_; //!< The name of an image representing the pickup in the PickupInventory. TODO: Exact format and placement of image?
    152            
     152
    153153            Pickupable* pickup_; //!< The Pickupable that is represented by this PickupRepresentation.
    154            
     154
    155155    }; // tolua_export
    156156
    157157} // tolua_export
    158    
     158
    159159#endif // _PickupRepresentation_H__
  • code/branches/presentation3/src/modules/pickup/PickupSpawner.cc

    r7086 r7127  
    5555    {
    5656        RegisterObject(PickupSpawner);
    57        
     57
    5858        this->initialize();
    5959    }
     
    7676    {
    7777        RegisterObject(PickupSpawner);
    78        
     78
    7979        this->initialize();
    80  
     80
    8181        this->pickup_ = pickup;
    8282
     
    8484        this->respawnTime_ = respawnTime;
    8585        this->setMaxSpawnedItems(maxSpawnedItems);
    86        
     86
    8787        if(this->pickup_ == NULL)
    8888        {
     
    132132
    133133        XMLPortObject(PickupSpawner, Pickupable, "pickup", setPickupable, getPickupable, xmlelement, mode);
    134        
     134
    135135        XMLPortParam(PickupSpawner, "triggerDistance", setTriggerDistance, getTriggerDistance, xmlelement, mode);
    136136        XMLPortParam(PickupSpawner, "respawnTime", setRespawnTime, getRespawnTime, xmlelement, mode);
    137137        XMLPortParam(PickupSpawner, "maxSpawnedItems", setMaxSpawnedItems, getMaxSpawnedItems, xmlelement, mode);
    138        
     138
    139139        if(this->pickup_ == NULL)
    140140        {
     
    150150        }
    151151    }
    152    
     152
    153153    /**
    154154    @brief
     
    161161        this->setVisible(this->isActive());
    162162    }
    163      
     163
    164164    /**
    165165    @brief
     
    172172    {
    173173        SUPER(PickupSpawner, tick, dt);
    174        
     174
    175175        //! If the PickupSpawner is active.
    176176        if (this->isActive())
    177177        {
    178178            SmartPtr<PickupSpawner> temp = this; // create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup)
    179            
     179
    180180            //! Iterate trough all Pawns.
    181181            for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
     
    191191        }
    192192    }
    193    
     193
    194194    /**
    195195    @brief
     
    203203        this->spawnsRemaining_ = items;
    204204    }
    205    
     205
    206206    /**
    207207    @brief
     
    230230        }
    231231    }
    232    
     232
    233233    /**
    234234    @brief
     
    239239        this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this)));
    240240    }
    241    
     241
    242242    /**
    243243    @brief
     
    258258            return;
    259259        }
    260        
     260
    261261        this->pickup_ = pickup;
    262262    }
    263    
     263
    264264    /**
    265265    @brief
     
    285285        {
    286286            COUT(4) << "PickupSpawner (&" << this << ") triggered and active." << std::endl;
    287            
     287
    288288            PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);
    289289            if(carrier == NULL)
     
    292292                return;
    293293            }
    294            
     294
    295295            if(!carrier->isTarget(this->pickup_))
    296296            {
     
    298298                return;
    299299            }
    300            
     300
    301301            PickupCarrier* target = carrier->getTarget(this->pickup_);
    302302            Pickupable* pickup = this->getPickup();
    303            
     303
    304304            if(target != NULL && pickup != NULL)
    305305            {
     
    317317                if(target == NULL)
    318318                    COUT(1) << "PickupSpawner (&" << this << "): Pickupable has no target." << std::endl;
    319                
     319
    320320                if(pickup == NULL)
    321321                {
     
    335335    @return
    336336        The Pickupable created.
    337     */   
     337    */
    338338    Pickupable* PickupSpawner::getPickup(void)
    339339    {
     
    343343            return NULL;
    344344        }
    345        
     345
    346346        Pickupable* pickup = this->pickup_->clone();
    347347        return pickup;
  • code/branches/presentation3/src/modules/pickup/PickupSpawner.h

    r6540 r7127  
    101101        protected:
    102102            void decrementSpawnsRemaining(void); //!< Decrements the number of remaining spawns.
    103                        
     103
    104104            void startRespawnTimer(void);
    105            
     105
    106106            virtual Pickupable* getPickup(void); //!< Creates a new Pickupable.
    107            
     107
    108108            void setPickupable(Pickupable* pickup); //!< Sets a Pickupable for the PickupSpawner to spawn.
    109109            const Pickupable* getPickupable(void); //!< Get the Pickupable that is spawned by this PickupSpawner.
    110            
     110
    111111            Pickupable* pickup_; //!< The pickup to be spawned.
    112112
    113113        private:
    114114            void initialize(void);
    115            
     115
    116116            void trigger(Pawn* pawn); //!< Method called when a Pawn is close enough.
    117117            void respawnTimerCallback(); //!< Method called when the timer runs out.
  • code/branches/presentation3/src/modules/pickup/items/DronePickup.cc

    r7034 r7127  
    4949
    5050    CreateFactory(DronePickup);
    51    
     51
    5252    /**
    5353    @brief
     
    5757    {
    5858        RegisterObject(DronePickup);
    59        
     59
    6060        this->initialize();
    6161    }
    62    
     62
    6363    /**
    6464    @brief
     
    6767    DronePickup::~DronePickup()
    6868    {
    69        
     69
    7070    }
    71    
     71
    7272    /**
    73     @brief 
     73    @brief
    7474        Initializes the member variables.
    7575    */
     
    8080        this->droneTemplate_ = "";
    8181    }
    82    
     82
    8383    /**
    8484    @brief
     
    9191        this->pickupIdentifier_->addParameter(type, val);
    9292    }
    93    
     93
    9494    /**
    9595    @brief
     
    100100        SUPER(DronePickup, XMLPort, xmlelement, mode);
    101101        XMLPortParam(DronePickup, "droneTemplate", setDroneTemplate, getDroneTemplate, xmlelement, mode);
    102        
     102
    103103        this->initializeIdentifier();
    104104    }
    105    
     105
    106106    void DronePickup::setDroneTemplate(std::string templatename){
    107107        droneTemplate_ = templatename;
    108     } 
    109    
     108    }
     109
    110110    const std::string& DronePickup::getDroneTemplate() const
    111111    {
     
    120120    {
    121121        SUPER(DronePickup, changedUsed);
    122        
     122
    123123        //! If the pickup is not picked up nothing must be done.
    124124        if(!this->isPickedUp())
    125125            return;
    126        
     126
    127127        //! If the pickup has transited to used.
    128128        if(this->isUsed())
     
    132132                if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    133133                    this->destroy();
    134                
     134
    135135                //Attach to pawn
    136136                Drone* drone = new Drone(pawn->getCreator()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
     
    143143                    droneController->setOwner(pawn);
    144144                }
    145                
     145
    146146                Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30);
    147147                drone->setPosition(spawnPosition);
    148                
     148
    149149                //! The pickup has been used up.
    150150                this->setUsed(false);
     
    159159        }
    160160    }
    161    
     161
    162162    /**
    163163    @brief
     
    170170        PickupCarrier* carrier = this->getCarrier();
    171171        Pawn* pawn = dynamic_cast<Pawn*>(carrier);
    172        
     172
    173173        if(pawn == NULL)
    174174        {
    175175            COUT(1) << "Invalid PickupCarrier in DronePickup." << std::endl;
    176176        }
    177        
     177
    178178        return pawn;
    179179    }
    180    
     180
    181181    /**
    182182    @brief
     
    189189        if(item == NULL)
    190190            item = new DronePickup(this);
    191        
     191
    192192        SUPER(DronePickup, clone, item);
    193        
     193
    194194        DronePickup* pickup = dynamic_cast<DronePickup*>(item);
    195195        pickup->setDroneTemplate(this->getDroneTemplate());
    196        
     196
    197197        pickup->initializeIdentifier();
    198198    }
  • code/branches/presentation3/src/modules/pickup/items/DronePickup.h

    r7034 r7127  
    4747
    4848namespace orxonox {
    49    
     49
    5050
    5151    class _PickupExport DronePickup : public Pickup, public Tickable
    5252    {
    5353        public:
    54        
     54
    5555            DronePickup(BaseObject* creator); //!< Constructor.
    5656            virtual ~DronePickup(); //!< Destructor.
    57            
     57
    5858            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a DronePickup object through XML.
    59            
     59
    6060            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    6161            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    6262
    6363            void setDroneTemplate(std::string templatename);
    64             const std::string& getDroneTemplate() const; 
    65            
     64            const std::string& getDroneTemplate() const;
     65
    6666        protected:
    6767            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    68        
     68
    6969        private:
    7070            void initialize(void); //!< Initializes the member variables.
    7171            std::string droneTemplate_;
    7272            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    73            
    7473
    75        
     74
     75
    7676    };
    7777}
  • code/branches/presentation3/src/modules/pickup/items/HealthPickup.cc

    r7008 r7127  
    4545namespace orxonox
    4646{
    47    
     47
    4848    /*static*/ const std::string HealthPickup::healthTypeLimited_s = "limited";
    4949    /*static*/ const std::string HealthPickup::healthTypeTemporary_s = "temporary";
    5050    /*static*/ const std::string HealthPickup::healthTypePermanent_s = "permanent";
    51    
     51
    5252    CreateFactory(HealthPickup);
    53    
     53
    5454    /**
    5555    @brief
     
    5959    {
    6060        RegisterObject(HealthPickup);
    61        
     61
    6262        this->initialize();
    6363    }
    64    
     64
    6565    /**
    6666    @brief
     
    6969    HealthPickup::~HealthPickup()
    7070    {
    71        
    72     }
    73    
    74     /**
    75     @brief 
     71
     72    }
     73
     74    /**
     75    @brief
    7676        Initializes the member variables.
    7777    */
    7878    void HealthPickup::initialize(void)
    79     {       
     79    {
    8080        this->health_ = 0;
    8181        this->healthRate_ = 0;
     
    8383        this->maxHealthSave_ = 0;
    8484        this->maxHealthOverwrite_ = 0;
    85        
     85
    8686        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
    8787    }
    88    
     88
    8989    /**
    9090    @brief
     
    9898        std::string val1 = stream.str();
    9999        this->pickupIdentifier_->addParameter(type1, val1);
    100        
     100
    101101        std::string val2 = this->getHealthType();
    102102        std::string type2 = "healthType";
    103103        this->pickupIdentifier_->addParameter(type2, val2);
    104        
     104
    105105        stream.clear();
    106106        stream << this->getHealthRate();
     
    109109        this->pickupIdentifier_->addParameter(type3, val3);
    110110    }
    111    
     111
    112112    /**
    113113    @brief
     
    117117    {
    118118        SUPER(HealthPickup, XMLPort, xmlelement, mode);
    119        
     119
    120120        XMLPortParam(HealthPickup, "health", setHealth, getHealth, xmlelement, mode);
    121121        XMLPortParam(HealthPickup, "healthRate", setHealthRate, getHealthRate, xmlelement, mode);
    122122        XMLPortParam(HealthPickup, "healthType", setHealthType, getHealthType, xmlelement, mode);
    123        
     123
    124124        if(!this->isContinuous())
    125125            this->healthRate_ = 0.0;
    126        
     126
    127127        this->initializeIdentifier();
    128128    }
    129    
     129
    130130    /**
    131131    @brief
     
    138138    {
    139139        SUPER(HealthPickup, tick, dt);
    140        
     140
    141141        if(this->isContinuous() && this->isUsed())
    142142        {
     
    144144            if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    145145                this->destroy();
    146            
     146
    147147            //! Calculate the health that is added this tick.
    148148            float health = dt*this->getHealthRate();
     
    152152            float fullHealth = pawn->getHealth() + health;
    153153            this->setHealth(this->getHealth()-health);
    154                    
     154
    155155            switch(this->getHealthTypeDirect())
    156156            {
     
    173173                    COUT(1) << "Invalid healthType in HealthPickup." << std::endl;
    174174            }
    175            
     175
    176176            //! If all health has been transfered.
    177177            if(this->getHealth() == 0)
     
    181181        }
    182182    }
    183    
     183
    184184    /**
    185185    @brief
     
    193193        if(!this->isPickedUp())
    194194            return;
    195        
     195
    196196        //! If the pickup has transited to used.
    197197        if(this->isUsed())
     
    202202                if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    203203                    this->destroy();
    204                
     204
    205205                float health = 0;
    206206                switch(this->getHealthTypeDirect())
     
    226226                        COUT(1) << "Invalid healthType in HealthPickup." << std::endl;
    227227                }
    228                
     228
    229229                //! The pickup has been used up.
    230230                this->setUsed(false);
     
    237237                PickupCarrier* carrier = this->getCarrier();
    238238                Pawn* pawn = dynamic_cast<Pawn*>(carrier);
    239                
     239
    240240                if(pawn == NULL)
    241241                {
     
    244244                    return;
    245245                }
    246                
     246
    247247                if(pawn->getMaxHealth() == this->maxHealthOverwrite_)
    248248                {
     
    252252                }
    253253            }
    254            
     254
    255255            //! If either the pickup can only be used once or it is continuous and used up, it is destroyed upon setting it to unused.
    256256            if(this->isOnce() || (this->isContinuous() && this->getHealth() == 0))
     
    260260        }
    261261    }
    262    
     262
    263263    /**
    264264    @brief
     
    271271        PickupCarrier* carrier = this->getCarrier();
    272272        Pawn* pawn = dynamic_cast<Pawn*>(carrier);
    273        
     273
    274274        if(pawn == NULL)
    275275        {
    276276            COUT(1) << "Invalid PickupCarrier in HealthPickup." << std::endl;
    277277        }
    278        
     278
    279279        return pawn;
    280280    }
    281    
     281
    282282    /**
    283283    @brief
     
    297297        pickup->setHealthRate(this->getHealthRate());
    298298        pickup->setHealthTypeDirect(this->getHealthTypeDirect());
    299        
     299
    300300        pickup->initializeIdentifier();
    301301    }
    302    
     302
    303303    /**
    304304    @brief
     
    322322        }
    323323    }
    324    
     324
    325325    /**
    326326    @brief
     
    341341        }
    342342    }
    343    
     343
    344344    /**
    345345    @brief
     
    356356        else
    357357        {
    358             COUT(1) << "Invalid healthSpeed in HealthPickup." << std::endl; 
    359         }
    360     }
    361    
     358            COUT(1) << "Invalid healthSpeed in HealthPickup." << std::endl;
     359        }
     360    }
     361
    362362    /**
    363363    @brief
  • code/branches/presentation3/src/modules/pickup/items/HealthPickup.h

    r6709 r7127  
    4545
    4646namespace orxonox {
    47    
     47
    4848    //! Enum for the type of the HealthPickup
    4949    namespace pickupHealthType
     
    5656        };
    5757    }
    58    
     58
    5959    /**
    6060    @brief
     
    7171    {
    7272        public:
    73        
     73
    7474            HealthPickup(BaseObject* creator); //!< Constructor.
    7575            virtual ~HealthPickup(); //!< Destructor.
    76            
     76
    7777            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
    7878            virtual void tick(float dt); //!< Is called every tick.
    79            
     79
    8080            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    8181            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    82            
     82
    8383            /**
    8484            @brief Get the health that is transfered to the Pawn upon usage of this pickup.
     
    9393            inline float getHealthRate(void)
    9494                { return this->healthRate_; }
    95                
     95
    9696            /**
    9797            @brief Get the type of HealthPickup, this pickup is.
    98             @return Returns the health type as an enum. 
     98            @return Returns the health type as an enum.
    9999            */
    100100            inline pickupHealthType::Value getHealthTypeDirect(void)
    101101                { return this->healthType_; }
    102102            const std::string& getHealthType(void); //!< Get the health type of this pickup.
    103            
     103
    104104        protected:
    105105            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
     
    107107            void setHealth(float health); //!< Sets the health.
    108108            void setHealthRate(float speed); //!< Set the rate at which health is transferred if the pickup is continuous.
    109            
     109
    110110            /**
    111111            @brief Set the health type of this pickup.
     
    115115                { this->healthType_ = type; }
    116116            void setHealthType(std::string type); //!< Set the type of the HealthPickup.
    117        
     117
    118118        private:
    119119            void initialize(void); //!< Initializes the member variables.
    120120            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
    121            
     121
    122122            float health_; //!< The health that is transferred to the Pawn.
    123123            float healthRate_; //!< The rate at which the health is transferred.
     
    125125            float maxHealthOverwrite_; //!< Helper to remember with which value we overwrote the maxHealh, to detect if someone else changed it as well.
    126126            pickupHealthType::Value healthType_; //!< The type of the HealthPickup.
    127            
     127
    128128            //! Strings for the health types.
    129129            static const std::string healthTypeLimited_s;
    130130            static const std::string healthTypeTemporary_s;
    131131            static const std::string healthTypePermanent_s;
    132        
     132
    133133    };
    134134}
  • code/branches/presentation3/src/modules/pickup/items/InvisiblePickup.h

    r7112 r7127  
    4444
    4545namespace orxonox {
    46        
     46
    4747    /**
    4848    @brief
     
    5757    {
    5858        public:
    59        
     59
    6060            InvisiblePickup(BaseObject* creator); //!< Constructor.
    6161            virtual ~InvisiblePickup(); //!< Destructor.
     
    6363            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    6464            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    65            
     65
    6666            /**
    6767            @brief Checks whether the Pawn is invisible.
     
    7272            inline float getDuration()
    7373                { return this->duration_; }
    74  
     74
    7575        protected:
    7676            bool setInvisible(bool invisibility); //!< Set the Pawn to be invisible or visible again.
     
    7878            void initializeIdentifier(void);
    7979            virtual void pickupTimerCallback(void); //!< Function that gets called when the timer ends.
    80        
     80
    8181        private:
    8282            void initialize(void); //!< Initializes the member variables.
  • code/branches/presentation3/src/modules/pickup/items/MetaPickup.cc

    r6709 r7127  
    4040
    4141namespace orxonox {
    42  
     42
    4343    CreateFactory(MetaPickup);
    44    
     44
    4545    //! Setting the static variables to their values.
    4646    /*static*/ const std::string MetaPickup::metaTypeNone_s = "none";
    4747    /*static*/ const std::string MetaPickup::metaTypeUse_s = "use";
    4848    /*static*/ const std::string MetaPickup::metaTypeDrop_s = "drop";
    49    
     49
    5050    /**
    5151    @brief
     
    5555    {
    5656        RegisterObject(MetaPickup);
    57        
     57
    5858        this->initialize();
    5959    }
    60    
     60
    6161    /**
    6262    @brief
     
    6565    MetaPickup::~MetaPickup()
    6666    {
    67        
    68     }
    69    
     67
     68    }
     69
    7070    /**
    7171    @brief
     
    7575    {
    7676        this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier());
    77        
     77
    7878        this->setActivationTypeDirect(pickupActivationType::immediate);
    7979        this->setDurationTypeDirect(pickupDurationType::once);
    8080        this->metaType_ = pickupMetaType::none;
    8181    }
    82    
     82
    8383    /**
    8484    @brief
     
    9191        this->pickupIdentifier_->addParameter(type, val);
    9292    }
    93    
     93
    9494    /**
    9595    @brief
     
    9999    {
    100100        SUPER(MetaPickup, XMLPort, xmlelement, mode);
    101        
     101
    102102        XMLPortParam(MetaPickup, "metaType", setMetaType, getMetaType, xmlelement, mode);
    103        
     103
    104104        this->initializeIdentifier();
    105105    }
    106    
     106
    107107    /**
    108108    @brief
     
    113113    {
    114114        SUPER(MetaPickup, changedUsed);
    115        
     115
    116116        //! If the MetaPickup transited to used.
    117117        if(this->isUsed())
     
    144144        }
    145145    }
    146        
     146
    147147    /**
    148148    @brief
     
    155155        if(item == NULL)
    156156            item = new MetaPickup(this);
    157        
     157
    158158        SUPER(MetaPickup, clone, item);
    159        
     159
    160160        MetaPickup* pickup = dynamic_cast<MetaPickup*>(item);
    161161        pickup->setMetaTypeDirect(this->getMetaTypeDirect());
    162        
     162
    163163        pickup->initializeIdentifier();
    164164    }
    165    
     165
    166166    /**
    167167    @brief
     
    184184        }
    185185    }
    186    
     186
    187187    /**
    188188    @brief
     
    206206        }
    207207    }
    208    
     208
    209209}
  • code/branches/presentation3/src/modules/pickup/items/MetaPickup.h

    r6709 r7127  
    5151        };
    5252    }
    53    
     53
    5454    /**
    5555    @brief
     
    6060    class _PickupExport MetaPickup : public Pickup
    6161    {
    62        
     62
    6363        public:
    6464            MetaPickup(BaseObject* creator); //!< Constructor. Registers and initializes the object.
    6565            virtual ~MetaPickup(); //!< Destructor.
    66            
     66
    6767            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a MetaPickup object through XML.
    68            
     68
    6969            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    7070            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    71            
     71
    7272            /**
    7373            @brief Returns the meta type of the MetaPickup.
     
    7777                { return this->metaType_; }
    7878            const std::string& getMetaType(void); //!< Get the meta type of this MetaPickup.
    79            
     79
    8080        protected:
    8181            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    82            
     82
    8383            /**
    8484            @brief Set the meta type of the MetaPickup.
     
    8888                { this->metaType_ =  type; }
    8989            void setMetaType(const std::string& type); //!< Set the meta type of this MetaPickup.
    90            
     90
    9191        private:
    9292            void initialize(void); //!< Initializes the member variables.
    93            
     93
    9494            pickupMetaType::Value metaType_; //!< The meta type of the MetaPickup, determines which actions are taken.
    95            
     95
    9696            //! Static strings for the meta types.
    9797            static const std::string metaTypeNone_s;
    9898            static const std::string metaTypeUse_s;
    9999            static const std::string metaTypeDrop_s;
    100            
    101        
     100
     101
    102102    };
    103103
  • code/branches/presentation3/src/modules/pickup/items/ShieldPickup.cc

    r6998 r7127  
    7979        PickupCarrier* carrier = this->getCarrier();
    8080        Pawn* pawn = dynamic_cast<Pawn*>(carrier);
    81        
     81
    8282        if(pawn == NULL)
    8383        {
     
    8686        return pawn;
    8787    }
    88    
     88
    8989    /**
    9090    @brief
     
    117117        std::string val2 = stream.str();
    118118        this->pickupIdentifier_->addParameter(type2, val2);
    119        
     119
    120120        stream.clear();
    121121        stream << this->getShieldAbsorption();
     
    269269
    270270    void ShieldPickup::pickupTimerCallback(void)
    271     {       
     271    {
    272272        this->setUsed(false);
    273273    }
  • code/branches/presentation3/src/modules/pickup/items/SpeedPickup.cc

    r6755 r7127  
    137137        if(engine == NULL) //!< If the PickupCarrier is no Engine, then this pickup is useless and therefore is destroyed.
    138138            this->destroy();
    139        
     139
    140140        //! If the pickup has transited to used.
    141141        if(this->isUsed())
     
    156156            engine->setSpeedAdd(0.0f);
    157157            engine->setSpeedMultiply(1.0f);
    158            
     158
    159159            if(this->isOnce())
    160160            {
     
    186186            COUT(1) << "Invalid PickupCarrier in SpeedPickup." << std::endl;
    187187        }
    188        
     188
    189189        return engine;
    190190    }
     
    269269
    270270    void SpeedPickup::pickupTimerCallback(void)
    271     {       
     271    {
    272272        this->setUsed(false);
    273273    }
  • code/branches/presentation3/src/modules/pickup/items/SpeedPickup.h

    r6709 r7127  
    7878        protected:
    7979            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
    80            
     80
    8181            virtual void pickupTimerCallback(void); //!< Function that gets called when timer ends.
    8282
Note: See TracChangeset for help on using the changeset viewer.