Changeset 6711 for code/trunk/src/orxonox
- Timestamp:
- Apr 13, 2010, 10:16:10 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/pickup4 (added) merged: 6632,6669,6675,6679,6700-6701,6707
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/CMakeLists.txt
r6524 r6711 58 58 MoodManager.h 59 59 controllers/HumanController.h 60 interfaces/PickupCarrier.h 60 61 sound/SoundManager.h 61 62 DEFINE_SYMBOL -
code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc
r6534 r6711 60 60 RegisterRootObject(PickupCarrier); 61 61 62 this->setCarrierName("PickupCarrier"); 62 63 } 63 64 -
code/trunk/src/orxonox/interfaces/PickupCarrier.h
r6710 r6711 45 45 #include "core/OrxonoxClass.h" 46 46 47 namespace orxonox 48 { 47 namespace orxonox // tolua_export 48 { // tolua_export 49 49 50 50 //! Forward-declarations. 51 class PickupManager; 51 52 class Pickup; 52 53 class HealthPickup; … … 61 62 Damian 'Mozork' Frick 62 63 */ 63 class _OrxonoxExport PickupCarrier : virtual public OrxonoxClass 64 { 64 class _OrxonoxExport PickupCarrier // tolua_export 65 : virtual public OrxonoxClass 66 { // tolua_export 65 67 //! So that the different Pickupables have full access to their PickupCarrier. 68 friend class Pickupable; 69 friend class PickupManager; 66 70 //! Friends. 67 friend class Pickupable;68 71 friend class Pickup; 69 72 friend class HealthPickup; … … 120 123 121 124 //! Go recursively through all children to check whether they are a target. 122 std:: list<PickupCarrier*>* children = this->getCarrierChildren();123 for(std:: list<PickupCarrier*>::const_iterator it = children->begin(); it != children->end(); it++)125 std::vector<PickupCarrier*>* children = this->getCarrierChildren(); 126 for(std::vector<PickupCarrier*>::const_iterator it = children->begin(); it != children->end(); it++) 124 127 { 125 128 if((*it)->isTarget(pickup)) … … 147 150 148 151 //! Go recursively through all children to check whether they are the target. 149 std:: list<PickupCarrier*>* children = this->getCarrierChildren();150 for(std:: list<PickupCarrier*>::iterator it = children->begin(); it != children->end(); it++)152 std::vector<PickupCarrier*>* children = this->getCarrierChildren(); 153 for(std::vector<PickupCarrier*>::iterator it = children->begin(); it != children->end(); it++) 151 154 { 152 155 if(pickup->isTarget(*it)) … … 166 169 */ 167 170 virtual const Vector3& getCarrierPosition(void) = 0; 168 169 protected: 171 172 /** 173 @brief Get the name of this PickupCarrier. 174 @return Returns the name as a string. 175 */ 176 const std::string& getCarrierName(void) { return this->carrierName_; } // tolua_export 177 178 protected: 170 179 /** 171 180 @brief Get all direct children of this PickupSpawner. … … 174 183 @return Returns a pointer to a list of all direct children. 175 184 */ 176 virtual std:: list<PickupCarrier*>* getCarrierChildren(void) = 0;185 virtual std::vector<PickupCarrier*>* getCarrierChildren(void) = 0; 177 186 /** 178 187 @brief Get the parent of this PickupSpawner … … 188 197 std::set<Pickupable*>& getPickups(void) 189 198 { return this->pickups_; } 190 199 200 /** 201 @brief Set the name of this PickupCarrier. 202 The name needs to be set in the constructor of every class inheriting from PickupCarrier, by calling setCarrierName(). 203 @param name The name to be set. 204 */ 205 void setCarrierName(const std::string& name) 206 { this->carrierName_ = name; } 207 191 208 private: 192 209 std::set<Pickupable*> pickups_; //!< The list of Pickupables carried by this PickupCarrier. 193 194 }; 195 } 210 std::string carrierName_; //!< The name of the PickupCarrier, as displayed in the PickupInventory. 211 212 /** 213 @brief Get the number of carrier children this PickupCarrier has. 214 @return Returns the number of carrier children. 215 */ 216 unsigned int getNumCarrierChildren(void) 217 { 218 std::vector<PickupCarrier*>* list = this->getCarrierChildren(); 219 unsigned int size = list->size(); 220 delete list; 221 return size; 222 } 223 224 /** 225 @brief Get the index-th child of this PickupCarrier. 226 @param index The index of the child to return. 227 @return Returns the index-th child. 228 */ 229 PickupCarrier* getCarrierChild(unsigned int index) 230 { 231 std::vector<PickupCarrier*>* list = this->getCarrierChildren(); 232 if(list->size() < index) 233 return NULL; 234 PickupCarrier* carrier = (*list)[index]; 235 delete list; 236 return carrier; 237 } 238 239 /** 240 @brief Get the number of Pickupables this PickupCarrier carries. 241 @return returns the number of pickups. 242 */ 243 unsigned int getNumPickups(void) 244 { return this->pickups_.size(); } 245 246 /** 247 @brief Get the index-th Pickupable of this PickupCarrier. 248 @param index The index of the Pickupable to return. 249 @return Returns the index-th pickup. 250 */ 251 Pickupable* getPickup(unsigned int index) 252 { 253 std::set<Pickupable*>::iterator it; 254 for(it = this->pickups_.begin(); index != 0 && it != this->pickups_.end(); it++) 255 index--; 256 if(it == this->pickups_.end()) 257 return NULL; 258 return *it; 259 } 260 261 }; // tolua_export 262 } // tolua_export 196 263 197 264 #endif /* _PickupCarrier_H__ */ -
code/trunk/src/orxonox/items/Engine.cc
r6709 r6711 64 64 this->boostBlur_ = 0; 65 65 66 this->setCarrierName("Engine"); 66 67 this->speedAdd_ = 0.0; 67 68 this->speedMultiply_ = 1.0; -
code/trunk/src/orxonox/items/Engine.h
r6709 r6711 122 122 123 123 protected: 124 virtual std:: list<PickupCarrier*>* getCarrierChildren(void)125 { return new std:: list<PickupCarrier*>(); }124 virtual std::vector<PickupCarrier*>* getCarrierChildren(void) 125 { return new std::vector<PickupCarrier*>(); } 126 126 virtual PickupCarrier* getCarrierParent(void); 127 127 -
code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
r6502 r6711 327 327 { 328 328 OrxonoxOverlay* overlay= it->second; 329 COUT(1) << "MUP" << std::endl; 329 330 if(overlay->isVisible()) 331 { 330 332 overlay->hide(); 333 COUT(1) << "HIDE " << name << std::endl; 334 } 331 335 else 336 { 332 337 overlay->show(); 338 COUT(1) << "SHOW " << name << std::endl; 339 } 333 340 } 334 341 } -
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
r6540 r6711 78 78 else 79 79 this->weaponSystem_ = 0; 80 81 this->setCarrierName("Pawn"); 80 82 81 83 this->setRadarObjectColour(ColourValue::Red); -
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
r6540 r6711 37 37 #include "worldentities/ControllableEntity.h" 38 38 39 namespace orxonox 40 { 41 class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable, public PickupCarrier 42 { 39 namespace orxonox // tolua_export 40 { // tolua_export 41 class _OrxonoxExport Pawn // tolua_export 42 : public ControllableEntity, public RadarViewable, public PickupCarrier 43 { // tolua_export 43 44 friend class WeaponSystem; 44 45 … … 132 133 bool bAlive_; 133 134 134 virtual std:: list<PickupCarrier*>* getCarrierChildren(void)135 { return new std:: list<PickupCarrier*>(); }135 virtual std::vector<PickupCarrier*>* getCarrierChildren(void) 136 { return new std::vector<PickupCarrier*>(); } 136 137 virtual PickupCarrier* getCarrierParent(void) 137 138 { return NULL; } … … 155 156 156 157 Vector3 aimPosition_; 157 }; 158 } 158 }; // tolua_export 159 } // tolua_export 159 160 160 161 #endif /* _Pawn_H__ */ -
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
r6709 r6711 221 221 } 222 222 223 std:: list<PickupCarrier*>* SpaceShip::getCarrierChildren(void)224 { 225 std:: list<PickupCarrier*>* list = new std::list<PickupCarrier*>();226 list->push_ front(this->engine_);223 std::vector<PickupCarrier*>* SpaceShip::getCarrierChildren(void) 224 { 225 std::vector<PickupCarrier*>* list = new std::vector<PickupCarrier*>(); 226 list->push_back(this->engine_); 227 227 return list; 228 228 } -
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
r6709 r6711 86 86 87 87 protected: 88 virtual std:: list<PickupCarrier*>* getCarrierChildren(void);88 virtual std::vector<PickupCarrier*>* getCarrierChildren(void); 89 89 bool bInvertYAxis_; 90 90
Note: See TracChangeset
for help on using the changeset viewer.