- Timestamp:
- May 13, 2014, 11:45:47 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/modularships/src/orxonox/items/ShipPart.cc
r10052 r10053 51 51 { 52 52 RegisterObject(ShipPart); 53 this->setAlive(true); 53 54 } 54 55 … … 91 92 void ShipPart::death() 92 93 { 94 if (!(this->isAlive())) 95 return; 96 97 this->setAlive(false); 98 99 // Execute all destruction events 100 for (unsigned int i = 0; i < this->eventList_.size(); i++) 101 { 102 orxout() << "executing" << endl; 103 this->getDestructionEvent(i)->execute(); 104 } 105 106 // Remove this ShipPart from the parent. 93 107 this->parent_->removeShipPart(this); 94 108 orxout() << this->getName() << " has died." << endl; … … 105 119 OrxAssert(entity != NULL, "The Entity cannot be NULL."); 106 120 this->entityList_.push_back(entity); 107 //part->addToSpaceShip(this); //FIXME: (noep) add108 121 } 109 122 … … 153 166 A pointer to the PartDestructionEvent to be added. 154 167 */ 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);168 void ShipPart::addDestructionEvent(PartDestructionEvent* event) 169 { 170 OrxAssert(event != NULL, "The PartDestructionEvent cannot be NULL."); 171 event->setParent(this); 172 this->eventList_.push_back(event); 160 173 } 161 174 … … 168 181 PartDestructionEvent* ShipPart::getDestructionEvent(unsigned int index) 169 182 { 170 if(this->eventList_.size() >= index)183 if(this->eventList_.size() <= index) 171 184 return NULL; 172 185 else … … 200 213 { 201 214 orxout() << "ShipPart " <<this->getName() << " is handling a hit!" << endl; 215 202 216 if (parent_->getGametype() && parent_->getGametype()->allowPawnDamage(parent_, originator)) 203 217 {
Note: See TracChangeset
for help on using the changeset viewer.