Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 13, 2010, 3:32:34 PM (15 years ago)
Author:
dafrick
Message:

Started documenting MetaPcikup, resolved some bugs in PickupCollection and PickupCollectionIdentifier.

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

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/src/modules/pickup/PickupCollection.cc

    r6497 r6519  
    4545{
    4646 
     47    CreateFactory(PickupCollection);
     48
    4749    /**
    4850    @brief
     
    7779        SUPER(PickupCollection, XMLPort, xmlelement, mode);
    7880       
    79         //TODO: Does this work? Problem could be, that Pickupable itself cannot be instantiated through XML, doubt that, though.
    80         XMLPortObject(PickupCollection, PickupCollection, "pickupables", addPickupable, getPickupable, xmlelement, mode);
     81        XMLPortObject(PickupCollection, Pickupable, "pickupables", addPickupable, getPickupable, xmlelement, mode);
    8182       
    8283        this->initializeIdentifier();
     
    103104    bool PickupCollection::createSpawner(const Vector3& position)
    104105    {
    105         DroppedPickup::DroppedPickup(this, this, position);
     106        new DroppedPickup(this, this, position);
    106107        return true;
    107108    }
     
    178179    }
    179180   
     181    bool PickupCollection::isTarget(Identifier* identifier) const
     182    {
     183        for(std::vector<Pickupable*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
     184        {
     185            if(!(*it)->isTarget(identifier))
     186                return false;
     187        }
     188       
     189        return true;
     190    }
     191   
    180192    const PickupIdentifier* PickupCollection::getPickupIdentifier(void)
    181193    {
  • code/branches/pickup3/src/modules/pickup/PickupCollection.h

    r6497 r6519  
    4747        Damian 'Mozork' Frick
    4848    */
    49     //TODO: Isn't private inheritance sufficient?
    5049    class _PickupExport PickupCollection : public Pickupable, public BaseObject
    5150    {
     
    6362           
    6463            virtual void clone(OrxonoxClass*& item);
     64           
     65            virtual bool isTarget(Identifier* identifier) const;
    6566           
    6667            virtual const PickupIdentifier* getPickupIdentifier(void);
  • code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.cc

    r6480 r6519  
    5050        if(collectionIdentifier == NULL)
    5151        {
    52             return this->compare(identifier);
     52            return this->PickupIdentifier::compare(identifier);
    5353        }
    5454       
  • code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.h

    r6480 r6519  
    3838{
    3939
    40     class PickupCollectionIdentifier : public PickupIdentifier
     40    class _PickupExport PickupCollectionIdentifier : public PickupIdentifier
    4141    {
    4242       
  • code/branches/pickup3/src/modules/pickup/items/MetaPickup.cc

    r6518 r6519  
    2727*/
    2828
     29/**
     30    @file
     31    @brief Implementation of the MetaPickup class.
     32*/
     33
    2934#include "core/CoreIncludes.h"
    3035#include "core/XMLPort.h"
     
    4247    /*static*/ const std::string MetaPickup::metaTypeDrop_s = "drop";
    4348   
     49    /**
     50    @brief
     51        Constructor.
     52    */
    4453    MetaPickup::MetaPickup(BaseObject* creator) : Pickup(creator)
    4554    {
  • code/branches/pickup3/src/modules/pickup/items/MetaPickup.h

    r6518 r6519  
    2727*/
    2828
     29/**
     30    @file
     31    @brief Definition of the MetaPickup class.
     32*/
     33
    2934#ifndef _MetaPickup_H__
    3035#define _MetaPickup_H__
     
    3641namespace orxonox {
    3742
     43    //! The meta type, deciding what the pickup does exactly.
    3844    namespace pickupMetaType
    3945    {
     
    4652    }
    4753   
     54    /**
     55    @brief
     56        The MetaPickup is a pickup that can, depending on the parameters, either drop all pickups of the PickupCarrier that picks it up, or use all the unused pickups of the PickupCarrier, that picks it up. The parameter to set for this is the metaType and it can be used with the values 'none', 'drop' and 'use'.
     57    @author
     58        Damian 'Mozork' Frick
     59    */
    4860    class _PickupExport MetaPickup : public Pickup
    4961    {
    50         friend class PickupCarrier;
    5162       
    5263        public:
  • code/branches/pickup3/src/orxonox/interfaces/Pickupable.h

    r6497 r6519  
    8383           
    8484            bool isTarget(const PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup.
    85             bool isTarget(Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this pickup.
     85            virtual bool isTarget(Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this pickup.
    8686            bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this pickup.
    8787            bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this pickup.
Note: See TracChangeset for help on using the changeset viewer.