Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 30, 2012, 11:08:17 PM (12 years ago)
Author:
landauf
Message:

merged branch presentation2012merge back to trunk

Location:
code/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/interfaces/Pickupable.cc

    r8866 r9348  
    3939
    4040#include "infos/PlayerInfo.h"
    41 #include "pickup/PickupIdentifier.h"
    4241#include "worldentities/pawns/Pawn.h"
    4342
     
    5251        Constructor. Registers the objects and initializes its member variables.
    5352    */
    54     Pickupable::Pickupable() : pickupIdentifier_(NULL), used_(false), pickedUp_(false)
     53    Pickupable::Pickupable() : used_(false), pickedUp_(false)
    5554    {
    5655        RegisterRootObject(Pickupable);
     
    5857        this->carrier_ = NULL;
    5958
    60         this->pickupIdentifier_ = new PickupIdentifier(this);
    6159        this->beingDestroyed_ = false;
    6260        this->enabled_ = true;
     
    6967    Pickupable::~Pickupable()
    7068    {
    71         if(this->pickupIdentifier_ != NULL)
    72         {
    73             orxout(verbose, context::pickups) << "Pickupable (&" << this << ") destroyed." << endl;
    74             this->pickupIdentifier_->destroy();
    75         }
    7669    }
    7770
     
    10497    void Pickupable::destroyPickup(void)
    10598    {
    106         if(!this->beingDestroyed_)
     99        if(!this->isBeingDestroyed())
    107100            this->OrxonoxClass::destroy();
    108101        else
     
    329322    /**
    330323    @brief
    331         Creates a duplicate of the Pickupable.
    332     @return
    333         Returns the clone of this pickup as a pointer to a Pickupable.
    334     */
    335     Pickupable* Pickupable::clone(void)
    336     {
    337         OrxonoxClass* item = NULL;
    338         this->clone(item);
    339 
    340         Pickupable* pickup = dynamic_cast<Pickupable*>(item);
    341 
    342         orxout(verbose, context::pickups) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << endl;
    343         return pickup;
    344     }
    345 
    346     /**
    347     @brief
    348324        Method to transcribe a Pickupable as a Rewardable to the player.
    349325    @param player
  • code/trunk/src/orxonox/interfaces/Pickupable.h

    r8866 r9348  
    5353        Pickups (@ref orxonox::Pickupable "Pickupables") are objects that (quite unsurprisingly) can be picked up. Additionally they can be used and unused (transition from used to not used), and also dropped.
    5454
    55         A class of Pickups can incorporate many different types of pickups (see @ref orxonox::PickupIdentifier "PickupIdentifier"), each type is uniquely defined by a @ref orxonox::PickupIdentifier "PickupIdentifier". Each pickup has such an identifier identiying its type. This means that two pickups of the same type have identifiers which are equal.
    56 
    5755    @author
    5856        Damian 'Mozork' Frick
     
    6967        public:
    7068            virtual ~Pickupable(); //!< Default destructor.
     69
     70            //! @brief Returns the representation name which refers to the name of the PickupRepresentation that is used to represent this pickup.
     71            virtual const std::string& getRepresentationName() const = 0;
    7172
    7273            /**
     
    136137            bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this Pickupable.
    137138
    138             Pickupable* clone(void); //!< Creates a duplicate of the Pickupable.
    139             /**
    140             @brief Creates a duplicate of the input OrxonoxClass.
    141                    This method needs to be implemented by any Class inheriting from Pickupable.
    142             @param item A reference to a pointer to the OrxonoxClass that is to be duplicated.
    143             */
    144             virtual void clone(OrxonoxClass*& item) {}
    145 
    146             /**
    147             @brief Get the PickupIdentifier of this Pickupable.
    148             @return Returns a pointer to the PickupIdentifier of this Pickupable.
    149             */
    150             virtual const PickupIdentifier* getPickupIdentifier(void) const
    151                 { return this->pickupIdentifier_; }
    152 
    153139            bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input.
    154140            bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up.
     
    158144
    159145        protected:
    160             /**
    161             @brief Helper method to initialize the PickupIdentifier.
    162             */
    163             void initializeIdentifier(void) {}
    164 
    165146            virtual void preDestroy(void); //!< A method that is called by OrxonoxClass::destroy() before the object is actually destroyed.
    166147            virtual void destroyPickup(void); //!< Destroys a Pickupable.
     
    174155
    175156            /**
     157            @brief Check whether the Pickupable is in the process of being destroyed.
     158            @return Returns true if so.
     159            */
     160            inline bool isBeingDestroyed(void)
     161                { return this->beingDestroyed_; }
     162
     163            /**
    176164            @brief Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
    177                    This method must be implemented by any class directly inheriting from Pickupable. It is most easily done by just creating a new DroppedPickup, e.g.:
    178                    DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance);
     165                   This method must be implemented by any class directly inheriting from Pickupable.
    179166            @return Returns true if a spawner was created, false if not.
    180167            */
    181168            virtual bool createSpawner(void) = 0;
    182 
    183             PickupIdentifier* pickupIdentifier_; //!< The PickupIdentifier of this Pickupable.
    184169
    185170        private:
     
    203188    //! SUPER functions.
    204189    SUPER_FUNCTION(10, Pickupable, changedUsed, false);
    205     SUPER_FUNCTION(12, Pickupable, changedCarrier, false);
    206     SUPER_FUNCTION(13, Pickupable, changedPickedUp, false);
    207     SUPER_FUNCTION(11, Pickupable, clone, false);
     190    SUPER_FUNCTION(11, Pickupable, changedCarrier, false);
     191    SUPER_FUNCTION(12, Pickupable, changedPickedUp, false);
    208192}
    209193
  • code/trunk/src/orxonox/interfaces/RadarViewable.h

    r9257 r9348  
    6161        virtual ~RadarViewable();
    6262
    63                 virtual void setRadarName(const std::string& name)
    64                         {
    65                                 if (this->radarName_ != name)
    66                                 {
    67                                         this->radarName_ = name;
    68                                         this->settingsChanged();
    69                                 }
    70                         }
    71                 const std::string& getRadarName() const
    72                         { return this->radarName_; }
     63        virtual void setRadarName(const std::string& name)
     64            {
     65                if (this->radarName_ != name)
     66                {
     67                    this->radarName_ = name;
     68                    this->settingsChanged();
     69                }
     70            }
     71        const std::string& getRadarName() const
     72            { return this->radarName_; }
    7373
    7474        inline void setRadarObjectCamouflage(float camouflage)
     
    163163        ColourValue radarObjectColour_;
    164164        float scale_;
    165                 std::string radarName_;
     165        std::string radarName_;
    166166    };
    167167}
Note: See TracChangeset for help on using the changeset viewer.