Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 3, 2015, 11:47:50 AM (9 years ago)
Author:
landauf
Message:

destroy all remaining ship parts if ModularSpaceShip is destroyed.
separate ship part death effects from object deletion. ShipPart.death() creates effects, ShipPartManager destroys the instance.

File:
1 edited

Legend:

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

    r10262 r10414  
    5050
    5151    ShipPart::ShipPart(Context* context)
    52         : Item(context)
     52        : Item(context), parent_(NULL)
    5353    {
    5454        RegisterObject(ShipPart);
    55         this->setAlive(true);
    56         this->setEventExecution(true);
     55        this->alive_ = true;
     56        this->eventExecution_ = true;
    5757        this->healthMem_ = 100;
    5858    }
     
    6060    ShipPart::~ShipPart()
    6161    {
    62 
     62        if (this->parent_)
     63        {
     64            // Remove this ShipPart from the parent.
     65            this->parent_->removeShipPart(this);
     66        }
    6367    }
    6468
     
    100104            }
    101105        }
    102 
    103         // Remove this ShipPart from the parent.
    104         this->parent_->removeShipPart(this);
    105         delete this;
    106106    }
    107107
     
    240240        }
    241241        if (this->health_ < 0)
    242             this->alive_ = false;
    243             //this->death();
     242            this->death();
    244243
    245244        // (Ugly) Chatoutput of health, until a GUI for modularspaceships-shipparts is implemented.
Note: See TracChangeset for help on using the changeset viewer.