Changeset 6518 for code/branches/pickup3/src
- Timestamp:
- Mar 12, 2010, 8:56:04 AM (15 years ago)
- Location:
- code/branches/pickup3/src
- Files:
-
- 3 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3/src/modules/pickup/PickupPrereqs.h
r6512 r6518 76 76 //items 77 77 class HealthPickup; 78 class TestPickup;78 class MetaPickup; 79 79 80 80 } -
code/branches/pickup3/src/modules/pickup/items/CMakeLists.txt
r6512 r6518 1 1 ADD_SOURCE_FILES(PICKUP_SRC_FILES 2 2 HealthPickup.cc 3 TestPickup.cc3 MetaPickup.cc 4 4 ) -
code/branches/pickup3/src/modules/pickup/items/MetaPickup.cc
r6517 r6518 32 32 #include "pickup/PickupIdentifier.h" 33 33 34 #include " TestPickup.h"34 #include "MetaPickup.h" 35 35 36 36 namespace orxonox { 37 37 38 CreateFactory( TestPickup);38 CreateFactory(MetaPickup); 39 39 40 /*static*/ const std::string TestPickup::testTypeNone_s = "none";41 /*static*/ const std::string TestPickup::testTypeUse_s = "use";42 /*static*/ const std::string TestPickup::testTypeDrop_s = "drop";40 /*static*/ const std::string MetaPickup::metaTypeNone_s = "none"; 41 /*static*/ const std::string MetaPickup::metaTypeUse_s = "use"; 42 /*static*/ const std::string MetaPickup::metaTypeDrop_s = "drop"; 43 43 44 TestPickup::TestPickup(BaseObject* creator) : Pickup(creator)44 MetaPickup::MetaPickup(BaseObject* creator) : Pickup(creator) 45 45 { 46 RegisterObject( TestPickup);46 RegisterObject(MetaPickup); 47 47 48 48 this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier()); 49 49 this->setActivationTypeDirect(pickupActivationType::immediate); 50 50 this->setDurationTypeDirect(pickupDurationType::once); 51 this-> testType_ = pickupTestType::none;51 this->metaType_ = pickupMetaType::none; 52 52 } 53 53 54 TestPickup::~TestPickup()54 MetaPickup::~MetaPickup() 55 55 { 56 56 57 57 } 58 58 59 void TestPickup::initializeIdentifier(void)59 void MetaPickup::initializeIdentifier(void) 60 60 { 61 std::string val = this->get TestType();62 std::string type = " testType";61 std::string val = this->getMetaType(); 62 std::string type = "metaType"; 63 63 this->pickupIdentifier_->addParameter(type, val); 64 64 } 65 65 66 void TestPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)66 void MetaPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) 67 67 { 68 SUPER( TestPickup, XMLPort, xmlelement, mode);68 SUPER(MetaPickup, XMLPort, xmlelement, mode); 69 69 70 XMLPortParam( TestPickup, "testType", setTestType, getTestType, xmlelement, mode);70 XMLPortParam(MetaPickup, "metaType", setMetaType, getMetaType, xmlelement, mode); 71 71 72 72 this->initializeIdentifier(); 73 73 } 74 74 75 void TestPickup::changedUsed(void)75 void MetaPickup::changedUsed(void) 76 76 { 77 SUPER( TestPickup, changedUsed);77 SUPER(MetaPickup, changedUsed); 78 78 79 79 if(this->isUsed()) 80 80 { 81 81 PickupCarrier* carrier = this->getCarrier(); 82 if(this->get TestTypeDirect() != pickupTestType::none && carrier != NULL)82 if(this->getMetaTypeDirect() != pickupMetaType::none && carrier != NULL) 83 83 { 84 84 std::set<Pickupable*> pickups = carrier->getPickups(); … … 86 86 { 87 87 Pickup* pickup = dynamic_cast<Pickup*>(*it); 88 if(this->get TestTypeDirect() == pickupTestType::use)88 if(this->getMetaTypeDirect() == pickupMetaType::use) 89 89 { 90 90 if(pickup != NULL && pickup != this && pickup->isOnUse() && !pickup->isUsed()) … … 93 93 } 94 94 } 95 if(this->get TestTypeDirect() == pickupTestType::drop)95 if(this->getMetaTypeDirect() == pickupMetaType::drop) 96 96 { 97 97 if(pickup != NULL && pickup != this) … … 106 106 } 107 107 108 const std::string& TestPickup::getTestType(void)108 const std::string& MetaPickup::getMetaType(void) 109 109 { 110 switch(this->get TestTypeDirect())110 switch(this->getMetaTypeDirect()) 111 111 { 112 case pickup TestType::none:113 return TestPickup::testTypeNone_s;114 case pickup TestType::use:115 return TestPickup::testTypeUse_s;116 case pickup TestType::drop:117 return TestPickup::testTypeDrop_s;112 case pickupMetaType::none: 113 return MetaPickup::metaTypeNone_s; 114 case pickupMetaType::use: 115 return MetaPickup::metaTypeUse_s; 116 case pickupMetaType::drop: 117 return MetaPickup::metaTypeDrop_s; 118 118 default: 119 119 return BLANKSTRING; … … 121 121 } 122 122 123 void TestPickup::setTestType(const std::string& type)123 void MetaPickup::setMetaType(const std::string& type) 124 124 { 125 if(type == TestPickup::testTypeNone_s)125 if(type == MetaPickup::metaTypeNone_s) 126 126 { 127 this->set TestTypeDirect(pickupTestType::none);127 this->setMetaTypeDirect(pickupMetaType::none); 128 128 } 129 else if(type == TestPickup::testTypeUse_s)129 else if(type == MetaPickup::metaTypeUse_s) 130 130 { 131 this->set TestTypeDirect(pickupTestType::use);131 this->setMetaTypeDirect(pickupMetaType::use); 132 132 } 133 else if(type == TestPickup::testTypeDrop_s)133 else if(type == MetaPickup::metaTypeDrop_s) 134 134 { 135 this->set TestTypeDirect(pickupTestType::drop);135 this->setMetaTypeDirect(pickupMetaType::drop); 136 136 } 137 137 } 138 138 139 void TestPickup::clone(OrxonoxClass*& item)139 void MetaPickup::clone(OrxonoxClass*& item) 140 140 { 141 141 if(item == NULL) 142 item = new TestPickup(this);142 item = new MetaPickup(this); 143 143 144 SUPER( TestPickup, clone, item);144 SUPER(MetaPickup, clone, item); 145 145 146 TestPickup* pickup = dynamic_cast<TestPickup*>(item);147 pickup->set TestTypeDirect(this->getTestTypeDirect());146 MetaPickup* pickup = dynamic_cast<MetaPickup*>(item); 147 pickup->setMetaTypeDirect(this->getMetaTypeDirect()); 148 148 149 149 pickup->initializeIdentifier(); -
code/branches/pickup3/src/modules/pickup/items/MetaPickup.h
r6515 r6518 27 27 */ 28 28 29 #ifndef _ TestPickup_H__30 #define _ TestPickup_H__29 #ifndef _MetaPickup_H__ 30 #define _MetaPickup_H__ 31 31 32 32 #include "pickup/PickupPrereqs.h" … … 36 36 namespace orxonox { 37 37 38 namespace pickup TestType38 namespace pickupMetaType 39 39 { 40 40 enum Value … … 46 46 } 47 47 48 class _PickupExport TestPickup : public Pickup48 class _PickupExport MetaPickup : public Pickup 49 49 { 50 50 friend class PickupCarrier; 51 51 52 52 public: 53 TestPickup(BaseObject* creator);54 virtual ~ TestPickup();53 MetaPickup(BaseObject* creator); 54 virtual ~MetaPickup(); 55 55 56 56 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML. … … 59 59 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 60 60 61 inline pickup TestType::Value getTestTypeDirect(void)62 { return this-> testType_; }63 const std::string& get TestType(void);61 inline pickupMetaType::Value getMetaTypeDirect(void) 62 { return this->metaType_; } 63 const std::string& getMetaType(void); 64 64 65 65 protected: 66 66 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. 67 67 68 inline void set TestTypeDirect(pickupTestType::Value type)69 { this-> testType_ = type; }70 void set TestType(const std::string& type);68 inline void setMetaTypeDirect(pickupMetaType::Value type) 69 { this->metaType_ = type; } 70 void setMetaType(const std::string& type); 71 71 72 72 private: 73 73 void initialize(void); //!< Initializes the member variables. 74 74 75 pickup TestType::Value testType_;76 static const std::string testTypeNone_s;77 static const std::string testTypeUse_s;78 static const std::string testTypeDrop_s;75 pickupMetaType::Value metaType_; 76 static const std::string metaTypeNone_s; 77 static const std::string metaTypeUse_s; 78 static const std::string metaTypeDrop_s; 79 79 80 80 -
code/branches/pickup3/src/orxonox/interfaces/PickupCarrier.h
r6512 r6518 49 49 class Pickup; 50 50 class HealthPickup; 51 class TestPickup;51 class MetaPickup; 52 52 53 53 /** … … 63 63 friend class Pickup; 64 64 friend class HealthPickup; 65 friend class TestPickup;65 friend class MetaPickup; 66 66 67 67 public:
Note: See TracChangeset
for help on using the changeset viewer.