[Orxonox-commit 2014] r6731 - in code/trunk: data/levels src/modules/pickup src/orxonox/interfaces

dafrick at orxonox.net dafrick at orxonox.net
Thu Apr 15 14:47:40 CEST 2010


Author: dafrick
Date: 2010-04-15 14:47:39 +0200 (Thu, 15 Apr 2010)
New Revision: 6731

Modified:
   code/trunk/data/levels/pickup.oxw
   code/trunk/src/modules/pickup/PickupCollection.cc
   code/trunk/src/modules/pickup/PickupCollection.h
   code/trunk/src/orxonox/interfaces/Pickupable.cc
   code/trunk/src/orxonox/interfaces/Pickupable.h
Log:
PickupCollection is broken for now because to make it work drastic changes would have to be made. I wil fix it at a later date, though.


Modified: code/trunk/data/levels/pickup.oxw
===================================================================
--- code/trunk/data/levels/pickup.oxw	2010-04-15 11:57:51 UTC (rev 6730)
+++ code/trunk/data/levels/pickup.oxw	2010-04-15 12:47:39 UTC (rev 6731)
@@ -113,17 +113,11 @@
     
     <!-- Pickup Collection pickups -->
     
-    <PickupSpawner position="0,-25,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
+    <!--PickupSpawner position="0,-25,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
         <pickup>
             <PickupCollection template=triplehealthspeedinvisibilitypickup />
         </pickup>
-    </PickupSpawner>
+    </PickupSpawner-->
     
-    <PickupSpawner position="0,-50,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
-        <pickup>
-            <HealthPickup activationType=immediate durationType=continuous healthRate=10 health=100 />
-        </pickup>
-    </PickupSpawner>
-    
   </Scene>
 </Level>

Modified: code/trunk/src/modules/pickup/PickupCollection.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupCollection.cc	2010-04-15 11:57:51 UTC (rev 6730)
+++ code/trunk/src/modules/pickup/PickupCollection.cc	2010-04-15 12:47:39 UTC (rev 6731)
@@ -175,11 +175,11 @@
     @return
         Returns true if the PickupCarrier identified by the input PickupIdentififer it is a target of this PickupCollection, false if not.
     */
-    bool PickupCollection::isTarget(Identifier* identifier) const
+    bool PickupCollection::isTarget(PickupCarrier* carrier) const
     {
         for(std::vector<WeakPtr<Pickupable> >::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
         {
-            if(!(*it).get()->isTarget(identifier))
+            if(!carrier->isTarget((*it).get()))
                 return false;
         }
         

Modified: code/trunk/src/modules/pickup/PickupCollection.h
===================================================================
--- code/trunk/src/modules/pickup/PickupCollection.h	2010-04-15 11:57:51 UTC (rev 6730)
+++ code/trunk/src/modules/pickup/PickupCollection.h	2010-04-15 12:47:39 UTC (rev 6731)
@@ -66,7 +66,7 @@
             
             virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
             
-            virtual bool isTarget(Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection.
+            virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection.
             
             virtual const PickupIdentifier* getPickupIdentifier(void); //!< Get the PickupIdentifier of this PickupCollection.
             

Modified: code/trunk/src/orxonox/interfaces/Pickupable.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/Pickupable.cc	2010-04-15 11:57:51 UTC (rev 6730)
+++ code/trunk/src/orxonox/interfaces/Pickupable.cc	2010-04-15 12:47:39 UTC (rev 6731)
@@ -103,23 +103,25 @@
     */
     bool Pickupable::isTarget(const PickupCarrier* carrier) const
     {
+        if(carrier == NULL)
+            return false;
         return this->isTarget(carrier->getIdentifier());
     }
     
     /**
     @brief
-        Get whether a given class, represented by the input Identifier, is a target of this Pickupable.
-    @param target
-        The Identifier of which it has to be determinde whether it is a target of this Pickupable.
+        Get whether the given Identififer is a target of this Pickupable.
+    @param identifier
+        The PickupCarrier of which it has to be determinde whether it is a target of this Pickupable.
     @return
-        Returns true if the given Identifier is a target.
+        Returns true if the given PickupCarrier is a target.
     */
-    bool Pickupable::isTarget(Identifier* target) const
+    bool Pickupable::isTarget(const Identifier* identifier) const
     {
         //! Iterate through all targets of this Pickupable.
         for(std::list<Identifier*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
         {
-            if(target->isA(*it))
+            if(identifier->isA(*it))
                 return true;
         }
         return false;

Modified: code/trunk/src/orxonox/interfaces/Pickupable.h
===================================================================
--- code/trunk/src/orxonox/interfaces/Pickupable.h	2010-04-15 11:57:51 UTC (rev 6730)
+++ code/trunk/src/orxonox/interfaces/Pickupable.h	2010-04-15 12:47:39 UTC (rev 6731)
@@ -97,8 +97,8 @@
             bool pickedUp(PickupCarrier* carrier); //!< Sets the Pickupable to picked up.
             bool dropped(void); //!< Sets the Pickupable to not picked up or dropped.
             
-            bool isTarget(const PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup.
-            virtual bool isTarget(Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this Pickupable.
+            virtual bool isTarget(const PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup.
+            bool isTarget(const Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this Pickupable.
             bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this pickup.
             bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this pickup.
             




More information about the Orxonox-commit mailing list