Changeset 7127 for code/branches/presentation3/src/orxonox/interfaces
- Timestamp:
- Jun 9, 2010, 9:32:58 PM (14 years ago)
- Location:
- code/branches/presentation3/src/orxonox/interfaces
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/orxonox/interfaces/InterfaceCompilation.cc
r7096 r7127 52 52 RegisterRootObject(GametypeMessageListener); 53 53 } 54 54 55 55 //---------------------------- 56 56 // PickupCarrier … … 59 59 { 60 60 RegisterRootObject(PickupCarrier); 61 61 62 62 this->setCarrierName("PickupCarrier"); 63 63 } 64 64 65 65 PickupCarrier::~PickupCarrier() 66 66 { … … 85 85 this->isForPlayer_ = true; 86 86 } 87 87 88 88 //---------------------------- 89 89 // RadarListener -
code/branches/presentation3/src/orxonox/interfaces/PickupCarrier.h
r7034 r7127 68 68 friend class Pickupable; 69 69 friend class PickupManager; 70 //! Friends. 70 //! Friends. 71 71 friend class Pickup; 72 72 friend class HealthPickup; … … 170 170 */ 171 171 virtual const Vector3& getCarrierPosition(void) = 0; 172 172 173 173 /** 174 174 @brief Get the name of this PickupCarrier. … … 176 176 */ 177 177 const std::string& getCarrierName(void) { return this->carrierName_; } // tolua_export 178 179 protected: 178 179 protected: 180 180 /** 181 181 @brief Get all direct children of this PickupSpawner. … … 198 198 std::set<Pickupable*>& getPickups(void) 199 199 { return this->pickups_; } 200 200 201 201 /** 202 202 @brief Set the name of this PickupCarrier. … … 206 206 void setCarrierName(const std::string& name) 207 207 { this->carrierName_ = name; } 208 208 209 209 private: 210 210 std::set<Pickupable*> pickups_; //!< The list of Pickupables carried by this PickupCarrier. 211 211 std::string carrierName_; //!< The name of the PickupCarrier, as displayed in the PickupInventory. 212 212 213 213 /** 214 214 @brief Get the number of carrier children this PickupCarrier has. … … 222 222 return size; 223 223 } 224 224 225 225 /** 226 226 @brief Get the index-th child of this PickupCarrier. … … 237 237 return carrier; 238 238 } 239 239 240 240 /** 241 241 @brief Get the number of Pickupables this PickupCarrier carries. … … 244 244 unsigned int getNumPickups(void) 245 245 { return this->pickups_.size(); } 246 246 247 247 /** 248 248 @brief Get the index-th Pickupable of this PickupCarrier. … … 259 259 return *it; 260 260 } 261 261 262 262 }; 263 263 } -
code/branches/presentation3/src/orxonox/interfaces/Pickupable.cc
r7094 r7127 46 46 namespace orxonox 47 47 { 48 48 49 49 /** 50 50 @brief … … 52 52 */ 53 53 Pickupable::Pickupable() : pickupIdentifier_(NULL), used_(false), pickedUp_(false) 54 { 54 { 55 55 RegisterRootObject(Pickupable); 56 56 57 57 this->carrier_ = NULL; 58 58 59 59 this->pickupIdentifier_ = new PickupIdentifier(this); 60 60 } 61 62 /** 63 @brief 64 Destructor. 61 62 /** 63 @brief 64 Destructor. 65 65 */ 66 66 Pickupable::~Pickupable() … … 68 68 if(this->isUsed()) 69 69 this->setUsed(false); 70 70 71 71 if(this->isPickedUp() && this->getCarrier() != NULL) 72 72 { … … 74 74 this->setCarrier(NULL); 75 75 } 76 76 77 77 if(this->pickupIdentifier_ != NULL) 78 78 this->pickupIdentifier_->destroy(); 79 79 } 80 80 81 81 /** 82 82 @brief … … 91 91 if(this->used_ == used) 92 92 return false; 93 93 94 94 COUT(4) << "Pickupable (&" << this << ") set to used " << used << "." << std::endl; 95 95 96 96 this->used_ = used; 97 97 this->changedUsed(); … … 100 100 return true; 101 101 } 102 102 103 103 /** 104 104 @brief … … 115 115 return this->isTarget(carrier->getIdentifier()); 116 116 } 117 117 118 118 /** 119 119 @brief … … 134 134 return false; 135 135 } 136 136 137 137 /** 138 138 @brief … … 147 147 return this->addTarget(target->getIdentifier()); 148 148 } 149 149 150 150 /** 151 151 @brief … … 160 160 if(this->isTarget(target)) //!< If the input target is already present in the list of targets. 161 161 return false; 162 162 163 163 COUT(4) << "Target " << target->getName() << " added to Pickupable (&" << this << ")." << std::endl; 164 164 this->targets_.push_back(target); 165 165 return true; 166 166 } 167 168 /** 169 @brief 167 168 /** 169 @brief 170 170 Sets the Pickupable to picked up. 171 171 This method will be called by the PickupCarrier picking the Pickupable up. … … 179 179 if(this->isPickedUp()) //!< If the Pickupable is already picked up. 180 180 return false; 181 181 182 182 COUT(4) << "Pickupable (&" << this << ") got picked up by a PickupCarrier (&" << carrier << ")." << std::endl; 183 183 this->setCarrier(carrier); … … 185 185 return true; 186 186 } 187 187 188 188 /** 189 189 @brief … … 198 198 if(this->pickedUp_ == pickedUp) 199 199 return false; 200 200 201 201 COUT(4) << "Pickupable (&" << this << ") set to pickedUp " << pickedUp << "." << std::endl; 202 202 203 203 this->pickedUp_ = pickedUp; 204 204 this->changedPickedUp(); … … 206 206 return true; 207 207 } 208 208 209 209 /** 210 210 @brief … … 217 217 if(this->carrier_ == carrier) 218 218 return false; 219 219 220 220 COUT(4) << "Pickupable (&" << this << ") changed Carrier (& " << carrier << ")." << std::endl; 221 221 222 222 this->carrier_ = carrier; 223 223 this->changedCarrier(); … … 226 226 return true; 227 227 } 228 229 /** 230 @brief 228 229 /** 230 @brief 231 231 Sets the Pickupable to not picked up or dropped. 232 232 This method will be called by the PickupCarrier dropping the Pickupable. … … 238 238 if(!this->isPickedUp()) //!< If the Pickupable is not picked up. 239 239 return false; 240 240 241 241 COUT(4) << "Pickupable (&" << this << ") got dropped up by a PickupCarrier (&" << this->getCarrier() << ")." << std::endl; 242 242 this->setUsed(false); 243 243 this->setPickedUp(false); 244 244 245 245 bool created = this->createSpawner(); 246 246 247 247 this->setCarrier(NULL); 248 248 249 249 if(!created) 250 250 { 251 251 this->destroy(); 252 252 } 253 254 return true; 255 } 256 253 254 return true; 255 } 256 257 257 /** 258 258 @brief … … 265 265 OrxonoxClass* item = NULL; 266 266 this->clone(item); 267 267 268 268 Pickupable* pickup = dynamic_cast<Pickupable*>(item); 269 269 270 270 COUT(4) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << std::endl; 271 271 return pickup; 272 272 } 273 273 274 274 /** 275 275 @brief … … 299 299 return carrier->pickup(this); 300 300 } 301 301 302 302 } -
code/branches/presentation3/src/orxonox/interfaces/Pickupable.h
r7094 r7127 45 45 namespace orxonox // tolua_export 46 46 { // tolua_export 47 47 48 48 /** 49 49 @brief … … 57 57 protected: 58 58 Pickupable(); //!< Default constructor. 59 59 60 60 public: 61 61 virtual ~Pickupable(); //!< Default destructor. 62 62 63 63 /** 64 64 @brief Get whether the pickup is currently in use or not. … … 71 71 */ 72 72 virtual void changedUsed(void) {} 73 73 74 74 /** 75 75 @brief Get the carrier of the pickup. … … 83 83 */ 84 84 virtual void changedCarrier(void) {} 85 85 86 86 /** 87 87 @brief Returns whether the Pickupable is currently picked up. … … 94 94 */ 95 95 virtual void changedPickedUp(void) {} 96 96 97 97 bool pickedUp(PickupCarrier* carrier); //!< Sets the Pickupable to picked up. 98 98 bool dropped(void); //!< Sets the Pickupable to not picked up or dropped. 99 99 100 100 virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup. 101 101 bool isTarget(const Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this Pickupable. 102 102 bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this pickup. 103 103 bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this pickup. 104 104 105 105 Pickupable* clone(void); //!< Creates a duplicate of the Pickupable. 106 106 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 107 107 108 108 /** 109 109 @brief Get the PickupIdentifier of this Pickupable. … … 112 112 virtual const PickupIdentifier* getPickupIdentifier(void) 113 113 { return this->pickupIdentifier_; } 114 114 115 115 bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input. 116 116 bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up. 117 117 bool setCarrier(PickupCarrier* carrier, bool tell = false); //!< Sets the carrier of the pickup. 118 118 119 119 protected: 120 120 /** … … 122 122 */ 123 123 void initializeIdentifier(void) {} 124 124 125 125 /** 126 126 @brief Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. … … 131 131 */ 132 132 virtual bool createSpawner(void) = 0; 133 133 134 134 PickupIdentifier* pickupIdentifier_; //!< The PickupIdentifier of this Pickupable. 135 135 136 136 private: 137 137 138 138 bool used_; //!< Whether the pickup is currently in use or not. 139 139 bool pickedUp_; //!< Whether the pickup is currently picked up or not. 140 140 141 141 PickupCarrier* carrier_; //!< The carrier of the pickup. 142 142 std::list<Identifier*> targets_; //!< The possible targets of this pickup. … … 147 147 148 148 }; // tolua_export 149 149 150 150 SUPER_FUNCTION(10, Pickupable, changedUsed, false); 151 151 SUPER_FUNCTION(12, Pickupable, changedCarrier, false); -
code/branches/presentation3/src/orxonox/interfaces/RadarViewable.cc
r7045 r7127 65 65 RadarViewable::~RadarViewable() 66 66 { 67 67 68 68 if( this->bInitialized_ ) 69 69 { … … 109 109 } 110 110 } 111 111 112 112 void RadarViewable::settingsChanged() 113 113 { -
code/branches/presentation3/src/orxonox/interfaces/RadarViewable.h
r7045 r7127 88 88 89 89 inline void setRadarVisibility(bool b) 90 { 90 { 91 91 if(b!=this->bVisibility_) 92 92 {
Note: See TracChangeset
for help on using the changeset viewer.