[Orxonox-commit 1801] r6519 - in code/branches/pickup3: data/levels data/levels/includes data/levels/templates src/modules/pickup src/modules/pickup/items src/orxonox/interfaces
dafrick at orxonox.net
dafrick at orxonox.net
Sat Mar 13 15:32:34 CET 2010
Author: dafrick
Date: 2010-03-13 15:32:34 +0100 (Sat, 13 Mar 2010)
New Revision: 6519
Modified:
code/branches/pickup3/data/levels/includes/pickups.oxi
code/branches/pickup3/data/levels/pickup.oxw
code/branches/pickup3/data/levels/templates/pickup_representation_templates.oxt
code/branches/pickup3/src/modules/pickup/PickupCollection.cc
code/branches/pickup3/src/modules/pickup/PickupCollection.h
code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.cc
code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.h
code/branches/pickup3/src/modules/pickup/items/MetaPickup.cc
code/branches/pickup3/src/modules/pickup/items/MetaPickup.h
code/branches/pickup3/src/orxonox/interfaces/Pickupable.h
Log:
Started documenting MetaPcikup, resolved some bugs in PickupCollection and PickupCollectionIdentifier.
Modified: code/branches/pickup3/data/levels/includes/pickups.oxi
===================================================================
--- code/branches/pickup3/data/levels/includes/pickups.oxi 2010-03-12 07:56:04 UTC (rev 6518)
+++ code/branches/pickup3/data/levels/includes/pickups.oxi 2010-03-13 14:32:34 UTC (rev 6519)
@@ -37,3 +37,13 @@
<HealthPickup template=crazyhealthpickup />
</pickup>
</PickupRepresentation>
+
+<PickupRepresentation
+ name = "Double Pickup"
+ description = "Does stuff."
+ spawnerTemplate = "crazyhealthpickupRepresentation"
+>
+ <pickup>
+ <PickupCollection template=doublepickup />
+ </pickup>
+</PickupRepresentation>
Modified: code/branches/pickup3/data/levels/pickup.oxw
===================================================================
--- code/branches/pickup3/data/levels/pickup.oxw 2010-03-12 07:56:04 UTC (rev 6518)
+++ code/branches/pickup3/data/levels/pickup.oxw 2010-03-13 14:32:34 UTC (rev 6519)
@@ -36,7 +36,7 @@
<PickupSpawner position="-50,0,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
<pickup>
- <HealthPickup health=50 healthRate=5 durationType=continuous activationType=onUse healthType=limited />
+ <HealthPickup health=50 healthRate=5 durationType=continuous activationType=onUse healthType=permanent />
</pickup>
</PickupSpawner>
@@ -63,6 +63,12 @@
<HealthPickup template=crazyhealthpickup />
</pickup>
</PickupSpawner>
+
+ <PickupSpawner position="75,0,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
+ <pickup>
+ <PickupCollection template=doublepickup />
+ </pickup>
+ </PickupSpawner>
<!--PickupSpawner position="100,100,100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
<pickup>
Modified: code/branches/pickup3/data/levels/templates/pickup_representation_templates.oxt
===================================================================
--- code/branches/pickup3/data/levels/templates/pickup_representation_templates.oxt 2010-03-12 07:56:04 UTC (rev 6518)
+++ code/branches/pickup3/data/levels/templates/pickup_representation_templates.oxt 2010-03-13 14:32:34 UTC (rev 6519)
@@ -97,3 +97,13 @@
durationType = "once"
/>
</Template>
+
+<Template name=doublepickup>
+ <PickupCollection>
+ <pickupables>
+ <HealthPickup template=smallhealthpickup />
+ <HealthPickup health=50 healthRate=5 durationType=continuous activationType=immediate healthType=limited />
+ </pickupables>
+ </PickupCollection>
+</Template>
+
\ No newline at end of file
Modified: code/branches/pickup3/src/modules/pickup/PickupCollection.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupCollection.cc 2010-03-12 07:56:04 UTC (rev 6518)
+++ code/branches/pickup3/src/modules/pickup/PickupCollection.cc 2010-03-13 14:32:34 UTC (rev 6519)
@@ -44,6 +44,8 @@
namespace orxonox
{
+ CreateFactory(PickupCollection);
+
/**
@brief
Default Constructor.
@@ -76,8 +78,7 @@
{
SUPER(PickupCollection, XMLPort, xmlelement, mode);
- //TODO: Does this work? Problem could be, that Pickupable itself cannot be instantiated through XML, doubt that, though.
- XMLPortObject(PickupCollection, PickupCollection, "pickupables", addPickupable, getPickupable, xmlelement, mode);
+ XMLPortObject(PickupCollection, Pickupable, "pickupables", addPickupable, getPickupable, xmlelement, mode);
this->initializeIdentifier();
}
@@ -102,7 +103,7 @@
*/
bool PickupCollection::createSpawner(const Vector3& position)
{
- DroppedPickup::DroppedPickup(this, this, position);
+ new DroppedPickup(this, this, position);
return true;
}
@@ -177,6 +178,17 @@
pickup->initializeIdentifier();
}
+ bool PickupCollection::isTarget(Identifier* identifier) const
+ {
+ for(std::vector<Pickupable*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
+ {
+ if(!(*it)->isTarget(identifier))
+ return false;
+ }
+
+ return true;
+ }
+
const PickupIdentifier* PickupCollection::getPickupIdentifier(void)
{
return this->pickupCollectionIdentifier_;
Modified: code/branches/pickup3/src/modules/pickup/PickupCollection.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupCollection.h 2010-03-12 07:56:04 UTC (rev 6518)
+++ code/branches/pickup3/src/modules/pickup/PickupCollection.h 2010-03-13 14:32:34 UTC (rev 6519)
@@ -46,7 +46,6 @@
@author
Damian 'Mozork' Frick
*/
- //TODO: Isn't private inheritance sufficient?
class _PickupExport PickupCollection : public Pickupable, public BaseObject
{
@@ -63,6 +62,8 @@
virtual void clone(OrxonoxClass*& item);
+ virtual bool isTarget(Identifier* identifier) const;
+
virtual const PickupIdentifier* getPickupIdentifier(void);
bool addPickupable(Pickupable* pickup);
Modified: code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.cc 2010-03-12 07:56:04 UTC (rev 6518)
+++ code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.cc 2010-03-13 14:32:34 UTC (rev 6519)
@@ -49,7 +49,7 @@
const PickupCollectionIdentifier* collectionIdentifier = dynamic_cast<PickupCollectionIdentifier*>(temp);
if(collectionIdentifier == NULL)
{
- return this->compare(identifier);
+ return this->PickupIdentifier::compare(identifier);
}
if(this->identifiers_.size() != collectionIdentifier->identifiers_.size())
Modified: code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.h 2010-03-12 07:56:04 UTC (rev 6518)
+++ code/branches/pickup3/src/modules/pickup/PickupCollectionIdentifier.h 2010-03-13 14:32:34 UTC (rev 6519)
@@ -37,7 +37,7 @@
namespace orxonox
{
- class PickupCollectionIdentifier : public PickupIdentifier
+ class _PickupExport PickupCollectionIdentifier : public PickupIdentifier
{
public:
Modified: code/branches/pickup3/src/modules/pickup/items/MetaPickup.cc
===================================================================
--- code/branches/pickup3/src/modules/pickup/items/MetaPickup.cc 2010-03-12 07:56:04 UTC (rev 6518)
+++ code/branches/pickup3/src/modules/pickup/items/MetaPickup.cc 2010-03-13 14:32:34 UTC (rev 6519)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file
+ @brief Implementation of the MetaPickup class.
+*/
+
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
#include "interfaces/PickupCarrier.h"
@@ -41,6 +46,10 @@
/*static*/ const std::string MetaPickup::metaTypeUse_s = "use";
/*static*/ const std::string MetaPickup::metaTypeDrop_s = "drop";
+ /**
+ @brief
+ Constructor.
+ */
MetaPickup::MetaPickup(BaseObject* creator) : Pickup(creator)
{
RegisterObject(MetaPickup);
Modified: code/branches/pickup3/src/modules/pickup/items/MetaPickup.h
===================================================================
--- code/branches/pickup3/src/modules/pickup/items/MetaPickup.h 2010-03-12 07:56:04 UTC (rev 6518)
+++ code/branches/pickup3/src/modules/pickup/items/MetaPickup.h 2010-03-13 14:32:34 UTC (rev 6519)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file
+ @brief Definition of the MetaPickup class.
+*/
+
#ifndef _MetaPickup_H__
#define _MetaPickup_H__
@@ -35,6 +40,7 @@
namespace orxonox {
+ //! The meta type, deciding what the pickup does exactly.
namespace pickupMetaType
{
enum Value
@@ -45,9 +51,14 @@
};
}
+ /**
+ @brief
+ 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'.
+ @author
+ Damian 'Mozork' Frick
+ */
class _PickupExport MetaPickup : public Pickup
{
- friend class PickupCarrier;
public:
MetaPickup(BaseObject* creator);
Modified: code/branches/pickup3/src/orxonox/interfaces/Pickupable.h
===================================================================
--- code/branches/pickup3/src/orxonox/interfaces/Pickupable.h 2010-03-12 07:56:04 UTC (rev 6518)
+++ code/branches/pickup3/src/orxonox/interfaces/Pickupable.h 2010-03-13 14:32:34 UTC (rev 6519)
@@ -82,7 +82,7 @@
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.
- bool isTarget(Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, 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 pickup.
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