Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9320


Ignore:
Timestamp:
Jul 21, 2012, 3:51:06 PM (12 years ago)
Author:
landauf
Message:

removed Pickupable::clone() because it is not needed anymore

Location:
code/branches/presentation2012merge/src
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2012merge/src/libraries/core/Super.h

    r9279 r9320  
    280280        SUPER_NOARGS(classname, functionname)
    281281
    282     #define SUPER_clone(classname, functionname, ...) \
    283         SUPER_ARGS(classname, functionname, __VA_ARGS__)
    284 
    285282    #define SUPER_changedCarrier(classname, functionname, ...) \
    286283        SUPER_NOARGS(classname, functionname)
     
    566563        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
    567564
    568         SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, clone, true, OrxonoxClass*& item)
    569             (item)
    570         SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
    571 
    572         SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedCarrier, false)
    573             ()
    574         SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
    575 
    576         SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(13, changedPickedUp, false)
     565        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, changedCarrier, false)
     566            ()
     567        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     568
     569        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedPickedUp, false)
    577570            ()
    578571        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     
    632625    SUPER_INTRUSIVE_DECLARATION(changedGametype);
    633626    SUPER_INTRUSIVE_DECLARATION(changedUsed);
    634     SUPER_INTRUSIVE_DECLARATION(clone);
    635627    SUPER_INTRUSIVE_DECLARATION(changedCarrier);
    636628    SUPER_INTRUSIVE_DECLARATION(changedPickedUp);
  • code/branches/presentation2012merge/src/modules/pickup/Pickup.cc

    r9319 r9320  
    181181    /**
    182182    @brief
    183         Creates a duplicate of the OrxonoxClass.
    184     @param item
    185         A reference to the pointer of the item that we're duplicating.
    186     */
    187     void Pickup::clone(OrxonoxClass*& item)
    188     {
    189         if(item == NULL)
    190             item = new Pickup(this);
    191 
    192         SUPER(Pickup, clone, item);
    193 
    194         Pickup* pickup = orxonox_cast<Pickup*>(item);
    195         pickup->setRepresentationName(this->getRepresentationName());
    196         pickup->setActivationType(this->getActivationType());
    197         pickup->setDurationType(this->getDurationType());
    198     }
    199 
    200     /**
    201     @brief
    202183        Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
    203184    @return
  • code/branches/presentation2012merge/src/modules/pickup/Pickup.h

    r9318 r9320  
    150150
    151151            virtual void changedPickedUp(void); //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
    152             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the OrxonoxClass.
    153152
    154153        protected:
  • code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc

    r9319 r9320  
    196196        if(!isOnePickupEnabledAndPickedUp && this->isPickedUp())
    197197            this->Pickupable::destroy();
    198     }
    199 
    200     /**
    201     @brief
    202         Creates a duplicate of the input Pickupable.
    203         This method needs to be implemented by any Class inheriting from Pickupable.
    204     @param item
    205         A reference to a pointer to the OrxonoxClass that is to be duplicated.
    206     */
    207     void PickupCollection::clone(OrxonoxClass*& item)
    208     {
    209         if(item == NULL)
    210             item = new PickupCollection(this);
    211 
    212         SUPER(PickupCollection, clone, item);
    213 
    214         PickupCollection* pickup = orxonox_cast<PickupCollection*>(item);
    215         pickup->setRepresentationName(this->getRepresentationName());
    216         // Clone all Pickupables this PickupCollection consist of.
    217         for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)
    218         {
    219             Pickupable* newPickup = (*it)->clone();
    220             CollectiblePickup* collectible = static_cast<CollectiblePickup*>(newPickup);
    221             pickup->addPickupable(collectible);
    222         }
    223198    }
    224199
  • code/branches/presentation2012merge/src/modules/pickup/PickupCollection.h

    r9318 r9320  
    7979            virtual void changedPickedUp(void); //!< Is called when the pickup has transited from picked up to dropped or the other way around.
    8080
    81             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input pickup.
    82 
    8381            virtual bool isTarget(const PickupCarrier* carrier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection.
    8482
  • code/branches/presentation2012merge/src/modules/pickup/items/DamageBoostPickup.cc

    r9318 r9320  
    169169    /**
    170170    @brief
    171         Creates a duplicate of the input OrxonoxClass.
    172     @param item
    173         A pointer to the Orxonox class.
    174     */
    175     void DamageBoostPickup::clone(OrxonoxClass*& item)
    176     {
    177         if(item == NULL)
    178             item = new DamageBoostPickup(this);
    179 
    180         SUPER(DamageBoostPickup, clone, item);
    181 
    182         DamageBoostPickup* pickup = orxonox_cast<DamageBoostPickup*>(item);
    183         pickup->setDuration(this->getDuration());
    184         pickup->setDamageMultiplier(this->getDamageMultiplier());
    185     }
    186 
    187     /**
    188     @brief
    189171        Sets the duration for which the DamageBoostPickup stays active.
    190172    @param duration
  • code/branches/presentation2012merge/src/modules/pickup/items/DamageBoostPickup.h

    r9318 r9320  
    5555
    5656            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    57             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    5857
    5958            /**
  • code/branches/presentation2012merge/src/modules/pickup/items/DronePickup.cc

    r9318 r9320  
    170170        return pawn;
    171171    }
    172 
    173     /**
    174     @brief
    175         Creates a duplicate of the input OrxonoxClass.
    176     @param item
    177         A pointer to the Orxonox class.
    178     */
    179     void DronePickup::clone(OrxonoxClass*& item)
    180     {
    181         if(item == NULL)
    182             item = new DronePickup(this);
    183 
    184         SUPER(DronePickup, clone, item);
    185 
    186         DronePickup* pickup = orxonox_cast<DronePickup*>(item);
    187         pickup->setDroneTemplate(this->getDroneTemplate());
    188     }
    189172}
  • code/branches/presentation2012merge/src/modules/pickup/items/DronePickup.h

    r9318 r9320  
    7070
    7171            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    72             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    7372
    7473            const std::string& getDroneTemplate() const; //!< Get the name of the droneTemplate.
  • code/branches/presentation2012merge/src/modules/pickup/items/HealthPickup.cc

    r9318 r9320  
    248248    /**
    249249    @brief
    250         Creates a duplicate of the input OrxonoxClass.
    251     @param item
    252         A pointer to the Orxonox class.
    253     */
    254     void HealthPickup::clone(OrxonoxClass*& item)
    255     {
    256         if(item == NULL)
    257             item = new HealthPickup(this);
    258 
    259         SUPER(HealthPickup, clone, item);
    260 
    261         HealthPickup* pickup = orxonox_cast<HealthPickup*>(item);
    262         pickup->setHealth(this->getHealth());
    263         pickup->setHealthRate(this->getHealthRate());
    264         pickup->setHealthType(this->getHealthType());
    265     }
    266 
    267     /**
    268     @brief
    269250        Get the health type of this pickup.
    270251    @return
  • code/branches/presentation2012merge/src/modules/pickup/items/HealthPickup.h

    r9318 r9320  
    9797
    9898            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    99             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    10099
    101100            /**
  • code/branches/presentation2012merge/src/modules/pickup/items/InvisiblePickup.cc

    r9318 r9320  
    132132    /**
    133133    @brief
    134         Creates a duplicate of the input OrxonoxClass.
    135     @param item
    136         A pointer to the Orxonox class.
    137     */
    138     void InvisiblePickup::clone(OrxonoxClass*& item)
    139     {
    140         if(item == NULL)
    141             item = new InvisiblePickup(this);
    142 
    143         SUPER(InvisiblePickup, clone, item);
    144 
    145         InvisiblePickup* pickup = orxonox_cast<InvisiblePickup*>(item);
    146         pickup->setDuration(this->getDuration());
    147     }
    148 
    149     /**
    150     @brief
    151134        Sets the invisibility.
    152135    @param invisibility
  • code/branches/presentation2012merge/src/modules/pickup/items/InvisiblePickup.h

    r9318 r9320  
    7575            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
    7676            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    77             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    7877
    7978            /**
  • code/branches/presentation2012merge/src/modules/pickup/items/MetaPickup.cc

    r9318 r9320  
    147147    /**
    148148    @brief
    149         Creates a duplicate of the input OrxonoxClass.
    150     @param item
    151         A pointer to the Orxonox class.
    152     */
    153     void MetaPickup::clone(OrxonoxClass*& item)
    154     {
    155         if(item == NULL)
    156             item = new MetaPickup(this);
    157 
    158         SUPER(MetaPickup, clone, item);
    159 
    160         MetaPickup* pickup = orxonox_cast<MetaPickup*>(item);
    161         pickup->setMetaType(this->getMetaType());
    162     }
    163 
    164     /**
    165     @brief
    166149        Get the meta type of this MetaPickup.
    167150    @return
  • code/branches/presentation2012merge/src/modules/pickup/items/MetaPickup.h

    r9318 r9320  
    9595
    9696            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    97             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    9897
    9998            /**
  • code/branches/presentation2012merge/src/modules/pickup/items/ShieldPickup.cc

    r9318 r9320  
    159159    /**
    160160    @brief
    161         Creates a duplicate of the input OrxonoxClass.
    162     @param item
    163         A pointer to the Orxonox class.
    164     */
    165     void ShieldPickup::clone(OrxonoxClass*& item)
    166     {
    167         if(item == NULL)
    168             item = new ShieldPickup(this);
    169 
    170         SUPER(ShieldPickup, clone, item);
    171 
    172         ShieldPickup* pickup = orxonox_cast<ShieldPickup*>(item);
    173         pickup->setDuration(this->getDuration());
    174         pickup->setShieldAbsorption(this->getShieldAbsorption());
    175         pickup->setShieldHealth(this->getShieldHealth());
    176     }
    177 
    178     /**
    179     @brief
    180161        Sets the duration.
    181162    @param duration
  • code/branches/presentation2012merge/src/modules/pickup/items/ShieldPickup.h

    r9318 r9320  
    8282
    8383            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    84             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    8584
    8685            /**
  • code/branches/presentation2012merge/src/modules/pickup/items/ShrinkPickup.cc

    r9318 r9320  
    294294        return pawn;
    295295    }
    296 
    297     /**
    298     @brief
    299         Creates a duplicate of the input OrxonoxClass.
    300     @param item
    301         A pointer to the Orxonox class.
    302     */
    303     void ShrinkPickup::clone(OrxonoxClass*& item)
    304     {
    305         if(item == NULL)
    306             item = new ShrinkPickup(this);
    307 
    308         SUPER(ShrinkPickup, clone, item);
    309         ShrinkPickup* pickup = orxonox_cast<ShrinkPickup*>(item);
    310         pickup->setShrinkFactor(this->getShrinkFactor());
    311         pickup->setDuration(this->getDuration());
    312         pickup->setShrinkDuration(this->getShrinkDuration());
    313     }
    314296}
  • code/branches/presentation2012merge/src/modules/pickup/items/ShrinkPickup.h

    r9318 r9320  
    8080            virtual void changedUsed(void); // Is called when the pickup has transited from used to unused or the other way around.
    8181            virtual void changedPickedUp(void);
    82             virtual void clone(OrxonoxClass*& item); // Creates a duplicate of the input OrxonoxClass.
    8382
    8483            /**
  • code/branches/presentation2012merge/src/modules/pickup/items/SpeedPickup.cc

    r9318 r9320  
    160160    /**
    161161    @brief
    162         Creates a duplicate of the input OrxonoxClass.
    163     @param item
    164         A pointer to the Orxonox class.
    165     */
    166     void SpeedPickup::clone(OrxonoxClass*& item)
    167     {
    168         if(item == NULL)
    169             item = new SpeedPickup(this);
    170 
    171         SUPER(SpeedPickup, clone, item);
    172 
    173         SpeedPickup* pickup = orxonox_cast<SpeedPickup*>(item);
    174         pickup->setDuration(this->getDuration());
    175         pickup->setSpeedAdd(this->getSpeedAdd());
    176         pickup->setSpeedMultiply(this->getSpeedMultiply());
    177     }
    178 
    179     /**
    180     @brief
    181162        Sets the duration for which the SpeedPickup stays active.
    182163    @param duration
  • code/branches/presentation2012merge/src/modules/pickup/items/SpeedPickup.h

    r9318 r9320  
    8181
    8282            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
    83             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
    8483
    8584            /**
  • code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.cc

    r9318 r9320  
    322322    /**
    323323    @brief
    324         Creates a duplicate of the Pickupable.
    325     @return
    326         Returns the clone of this pickup as a pointer to a Pickupable.
    327     */
    328     Pickupable* Pickupable::clone(void)
    329     {
    330         OrxonoxClass* item = NULL;
    331         this->clone(item);
    332 
    333         Pickupable* pickup = orxonox_cast<Pickupable*>(item);
    334 
    335         orxout(verbose, context::pickups) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << endl;
    336         return pickup;
    337     }
    338 
    339     /**
    340     @brief
    341324        Method to transcribe a Pickupable as a Rewardable to the player.
    342325    @param player
  • code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.h

    r9319 r9320  
    137137            bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this Pickupable.
    138138
    139             Pickupable* clone(void); //!< Creates a duplicate of the Pickupable.
    140             /**
    141             @brief Creates a duplicate of the input OrxonoxClass.
    142                    This method needs to be implemented by any Class inheriting from Pickupable.
    143             @param item A reference to a pointer to the OrxonoxClass that is to be duplicated.
    144             */
    145             virtual void clone(OrxonoxClass*& item) {}
    146 
    147139            bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input.
    148140            bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up.
     
    196188    //! SUPER functions.
    197189    SUPER_FUNCTION(10, Pickupable, changedUsed, false);
    198     SUPER_FUNCTION(12, Pickupable, changedCarrier, false);
    199     SUPER_FUNCTION(13, Pickupable, changedPickedUp, false);
    200     SUPER_FUNCTION(11, Pickupable, clone, false);
     190    SUPER_FUNCTION(11, Pickupable, changedCarrier, false);
     191    SUPER_FUNCTION(12, Pickupable, changedPickedUp, false);
    201192}
    202193
Note: See TracChangeset for help on using the changeset viewer.