Changeset 10052 for code/branches/modularships/src
- Timestamp:
- May 8, 2014, 4:20:26 PM (11 years ago)
- Location:
- code/branches/modularships/src/orxonox
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/modularships/src/orxonox/OrxonoxPrereqs.h
r10023 r10052 143 143 // items 144 144 class ShipPart; 145 class PartDestructionEvent; 145 146 class Engine; 146 147 class Item; -
code/branches/modularships/src/orxonox/items/CMakeLists.txt
r10019 r10052 4 4 MultiStateEngine.cc 5 5 ShipPart.cc 6 PartDestructionEvent.cc 6 7 ) -
code/branches/modularships/src/orxonox/items/ShipPart.cc
r10033 r10052 40 40 #include "gametypes/Gametype.h" 41 41 #include "worldentities/StaticEntity.h" 42 #include "items/PartDestructionEvent.h" 42 43 43 44 … … 66 67 67 68 XMLPortParam(ShipPart, "damageabsorption", setDamageAbsorption, getDamageAbsorption, xmlelement, mode).defaultValues(0.5); 69 70 XMLPortObject(ShipPart, PartDestructionEvent, "destructionevents", addDestructionEvent, getDestructionEvent, xmlelement, mode); 68 71 69 72 /* … … 142 145 orxout() << " " << this->entityList_[j]->getName() << endl; 143 146 } 147 } 148 149 /** 150 @brief 151 Add a PartDestructionEvent to the ShipPart. 152 @param engine 153 A pointer to the PartDestructionEvent to be added. 154 */ 155 void ShipPart::addDestructionEvent(PartDestructionEvent* part) 156 { 157 OrxAssert(part != NULL, "The PartDestructionEvent cannot be NULL."); 158 this->eventList_.push_back(part); 159 //part->setParent(this); 160 } 161 162 /** 163 @brief 164 Get the i-th PartDestructionEvent of the ShipPart. 165 @return 166 Returns a pointer to the i-the PartDestructionEvent. NULL if there is no PartDestructionEvent with that index. 167 */ 168 PartDestructionEvent* ShipPart::getDestructionEvent(unsigned int index) 169 { 170 if(this->eventList_.size() >= index) 171 return NULL; 172 else 173 return this->eventList_[index]; 144 174 } 145 175 -
code/branches/modularships/src/orxonox/items/ShipPart.h
r10023 r10052 32 32 #include "OrxonoxPrereqs.h" 33 33 #include "Item.h" 34 #include "items/PartDestructionEvent.h" 34 35 35 36 #include <string> … … 58 59 StaticEntity* getEntity(unsigned int index); 59 60 bool hasEntity(StaticEntity* entity) const; 61 62 void addDestructionEvent(PartDestructionEvent* event); 63 PartDestructionEvent* getDestructionEvent(unsigned int index); 60 64 61 65 void printEntities(); // FIXME: (noep) remove debug … … 102 106 private: 103 107 std::vector<StaticEntity*> entityList_; // list of all entities which belong to this part 108 std::vector<PartDestructionEvent*> eventList_; // The list of all PartDestructionEvent assigned to this ShipPart. 109 104 110 105 111 }; // tolua_export -
code/branches/modularships/src/orxonox/worldentities/WorldEntity.cc
r10033 r10052 119 119 WorldEntity::~WorldEntity() 120 120 { 121 orxout() << "destroying " << this->getIdentifier()->getName() << endl; 121 122 if (this->isInitialized()) 122 123 { -
code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10036 r10052 303 303 } 304 304 // Remove the part-entity assignment and detach the Entity of this ShipPart 305 for (std::map<StaticEntity*, ShipPart*>::iterator itt = this->partMap_.begin(); itt != this->partMap_.end(); ++itt)305 for (std::map<StaticEntity*, ShipPart*>::iterator itt = this->partMap_.begin(); itt != this->partMap_.end(); ) 306 306 { 307 307 if (itt->second == part) … … 314 314 //itt->first->setCollisionType(None); 315 315 //itt->first->deactivatePhysics(); 316 this->partMap_.erase(itt); 316 this->partMap_.erase(itt++); 317 } else { 318 ++itt; 317 319 } 318 320 }
Note: See TracChangeset
for help on using the changeset viewer.