Changeset 9320 for code/branches/presentation2012merge
- Timestamp:
- Jul 21, 2012, 3:51:06 PM (12 years ago)
- Location:
- code/branches/presentation2012merge/src
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2012merge/src/libraries/core/Super.h
r9279 r9320 280 280 SUPER_NOARGS(classname, functionname) 281 281 282 #define SUPER_clone(classname, functionname, ...) \283 SUPER_ARGS(classname, functionname, __VA_ARGS__)284 285 282 #define SUPER_changedCarrier(classname, functionname, ...) \ 286 283 SUPER_NOARGS(classname, functionname) … … 566 563 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 567 564 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) 577 570 () 578 571 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; … … 632 625 SUPER_INTRUSIVE_DECLARATION(changedGametype); 633 626 SUPER_INTRUSIVE_DECLARATION(changedUsed); 634 SUPER_INTRUSIVE_DECLARATION(clone);635 627 SUPER_INTRUSIVE_DECLARATION(changedCarrier); 636 628 SUPER_INTRUSIVE_DECLARATION(changedPickedUp); -
code/branches/presentation2012merge/src/modules/pickup/Pickup.cc
r9319 r9320 181 181 /** 182 182 @brief 183 Creates a duplicate of the OrxonoxClass.184 @param item185 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 @brief202 183 Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 203 184 @return -
code/branches/presentation2012merge/src/modules/pickup/Pickup.h
r9318 r9320 150 150 151 151 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.153 152 154 153 protected: -
code/branches/presentation2012merge/src/modules/pickup/PickupCollection.cc
r9319 r9320 196 196 if(!isOnePickupEnabledAndPickedUp && this->isPickedUp()) 197 197 this->Pickupable::destroy(); 198 }199 200 /**201 @brief202 Creates a duplicate of the input Pickupable.203 This method needs to be implemented by any Class inheriting from Pickupable.204 @param item205 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 }223 198 } 224 199 -
code/branches/presentation2012merge/src/modules/pickup/PickupCollection.h
r9318 r9320 79 79 virtual void changedPickedUp(void); //!< Is called when the pickup has transited from picked up to dropped or the other way around. 80 80 81 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input pickup.82 83 81 virtual bool isTarget(const PickupCarrier* carrier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection. 84 82 -
code/branches/presentation2012merge/src/modules/pickup/items/DamageBoostPickup.cc
r9318 r9320 169 169 /** 170 170 @brief 171 Creates a duplicate of the input OrxonoxClass.172 @param item173 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 @brief189 171 Sets the duration for which the DamageBoostPickup stays active. 190 172 @param duration -
code/branches/presentation2012merge/src/modules/pickup/items/DamageBoostPickup.h
r9318 r9320 55 55 56 56 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.58 57 59 58 /** -
code/branches/presentation2012merge/src/modules/pickup/items/DronePickup.cc
r9318 r9320 170 170 return pawn; 171 171 } 172 173 /**174 @brief175 Creates a duplicate of the input OrxonoxClass.176 @param item177 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 }189 172 } -
code/branches/presentation2012merge/src/modules/pickup/items/DronePickup.h
r9318 r9320 70 70 71 71 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.73 72 74 73 const std::string& getDroneTemplate() const; //!< Get the name of the droneTemplate. -
code/branches/presentation2012merge/src/modules/pickup/items/HealthPickup.cc
r9318 r9320 248 248 /** 249 249 @brief 250 Creates a duplicate of the input OrxonoxClass.251 @param item252 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 @brief269 250 Get the health type of this pickup. 270 251 @return -
code/branches/presentation2012merge/src/modules/pickup/items/HealthPickup.h
r9318 r9320 97 97 98 98 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.100 99 101 100 /** -
code/branches/presentation2012merge/src/modules/pickup/items/InvisiblePickup.cc
r9318 r9320 132 132 /** 133 133 @brief 134 Creates a duplicate of the input OrxonoxClass.135 @param item136 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 @brief151 134 Sets the invisibility. 152 135 @param invisibility -
code/branches/presentation2012merge/src/modules/pickup/items/InvisiblePickup.h
r9318 r9320 75 75 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML. 76 76 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.78 77 79 78 /** -
code/branches/presentation2012merge/src/modules/pickup/items/MetaPickup.cc
r9318 r9320 147 147 /** 148 148 @brief 149 Creates a duplicate of the input OrxonoxClass.150 @param item151 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 @brief166 149 Get the meta type of this MetaPickup. 167 150 @return -
code/branches/presentation2012merge/src/modules/pickup/items/MetaPickup.h
r9318 r9320 95 95 96 96 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.98 97 99 98 /** -
code/branches/presentation2012merge/src/modules/pickup/items/ShieldPickup.cc
r9318 r9320 159 159 /** 160 160 @brief 161 Creates a duplicate of the input OrxonoxClass.162 @param item163 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 @brief180 161 Sets the duration. 181 162 @param duration -
code/branches/presentation2012merge/src/modules/pickup/items/ShieldPickup.h
r9318 r9320 82 82 83 83 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.85 84 86 85 /** -
code/branches/presentation2012merge/src/modules/pickup/items/ShrinkPickup.cc
r9318 r9320 294 294 return pawn; 295 295 } 296 297 /**298 @brief299 Creates a duplicate of the input OrxonoxClass.300 @param item301 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 }314 296 } -
code/branches/presentation2012merge/src/modules/pickup/items/ShrinkPickup.h
r9318 r9320 80 80 virtual void changedUsed(void); // Is called when the pickup has transited from used to unused or the other way around. 81 81 virtual void changedPickedUp(void); 82 virtual void clone(OrxonoxClass*& item); // Creates a duplicate of the input OrxonoxClass.83 82 84 83 /** -
code/branches/presentation2012merge/src/modules/pickup/items/SpeedPickup.cc
r9318 r9320 160 160 /** 161 161 @brief 162 Creates a duplicate of the input OrxonoxClass.163 @param item164 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 @brief181 162 Sets the duration for which the SpeedPickup stays active. 182 163 @param duration -
code/branches/presentation2012merge/src/modules/pickup/items/SpeedPickup.h
r9318 r9320 81 81 82 82 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.84 83 85 84 /** -
code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.cc
r9318 r9320 322 322 /** 323 323 @brief 324 Creates a duplicate of the Pickupable.325 @return326 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 @brief341 324 Method to transcribe a Pickupable as a Rewardable to the player. 342 325 @param player -
code/branches/presentation2012merge/src/orxonox/interfaces/Pickupable.h
r9319 r9320 137 137 bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this Pickupable. 138 138 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 147 139 bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input. 148 140 bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up. … … 196 188 //! SUPER functions. 197 189 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); 201 192 } 202 193
Note: See TracChangeset
for help on using the changeset viewer.