Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 9:12:21 PM (9 years ago)
Author:
landauf
Message:

merged branch core7 back to trunk

Location:
code/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/items/ShipPart.cc

    r10262 r10624  
    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->eventExecution_ = true;
    5756        this->healthMem_ = 100;
    5857    }
     
    6059    ShipPart::~ShipPart()
    6160    {
    62 
     61        if (this->parent_)
     62        {
     63            // Remove this ShipPart from the parent.
     64            this->parent_->removeShipPart(this);
     65        }
    6366    }
    6467
     
    8689    void ShipPart::death()
    8790    {
    88         //if (!(this->isAlive()))
    89             //return;
    90 
    9191        this->explode();
    92         this->setAlive(false);
    9392
    9493        if(eventExecution_)
     
    101100        }
    102101
    103         // Remove this ShipPart from the parent.
    104         this->parent_->removeShipPart(this);
    105         delete this;
     102        this->destroyLater();
    106103    }
    107104
     
    203200    {
    204201        this->health_ = health;
    205     }
    206 
    207     void ShipPart::setAlive(bool var)
    208     {
    209         this->alive_ = var;
    210         orxout() << "ShipPart " << this->getName() << " alive_: " << this->alive_ << endl;
    211202    }
    212203
     
    240231        }
    241232        if (this->health_ < 0)
    242             this->alive_ = false;
    243             //this->death();
     233            this->death();
    244234
    245235        // (Ugly) Chatoutput of health, until a GUI for modularspaceships-shipparts is implemented.
  • code/trunk/src/orxonox/items/ShipPart.h

    r10262 r10624  
    7272                { return this->parent_; }
    7373
    74             void setAlive(bool var);
    75             inline bool isAlive()
    76                 { return this->alive_; }
    77 
    7874            inline void setEventExecution(bool var)
    7975                { this->eventExecution_ = var; }
     
    121117            std::vector<PartDestructionEvent*> eventList_;  // The list of all PartDestructionEvent assigned to this ShipPart.
    122118
    123             bool alive_;
    124119            bool eventExecution_;
    125120
Note: See TracChangeset for help on using the changeset viewer.