Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 13, 2014, 11:45:47 AM (10 years ago)
Author:
noep
Message:

Fixed yet another segfault (which we hadn't seen yet).
Cleared emptyLevel, created two testlevels (testing with boxes)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/modularships/src/orxonox/items/ShipPart.cc

    r10052 r10053  
    5151    {
    5252        RegisterObject(ShipPart);
     53        this->setAlive(true);
    5354    }
    5455
     
    9192    void ShipPart::death()
    9293    {
     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.
    93107        this->parent_->removeShipPart(this);
    94108        orxout() << this->getName() << " has died." << endl;
     
    105119        OrxAssert(entity != NULL, "The Entity cannot be NULL.");
    106120        this->entityList_.push_back(entity);
    107         //part->addToSpaceShip(this); //FIXME: (noep) add
    108121    }
    109122
     
    153166        A pointer to the PartDestructionEvent to be added.
    154167    */
    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);
    160173    }
    161174
     
    168181    PartDestructionEvent* ShipPart::getDestructionEvent(unsigned int index)
    169182    {
    170         if(this->eventList_.size() >= index)
     183        if(this->eventList_.size() <= index)
    171184            return NULL;
    172185        else
     
    200213    {
    201214        orxout() << "ShipPart " <<this->getName() << " is handling a hit!" << endl;
     215
    202216        if (parent_->getGametype() && parent_->getGametype()->allowPawnDamage(parent_, originator))
    203217        {
Note: See TracChangeset for help on using the changeset viewer.