Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 11, 2018, 7:19:57 PM (6 years ago)
Author:
landauf
Message:

[AsteroidMining_HS17] fixed a bunch of memory leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Presentation_HS17_merge/src/modules/asteroidmining/AsteroidMinable.cc

    r11734 r11735  
    177177        reborn->setVelocity(this->getVelocity());
    178178        // reborn->setAngularVelocity(this->getAngularVelocity()); // Add all other stuff, too?
    179         (void)reborn; // avoid compiler warning
    180179
    181180        this->bAlive_ = false;
     
    361360    for(int fisch = 0; fisch<num; ++fisch){
    362361
    363         Vector3* pos = new Vector3(0,0,0); // Position offset
     362        Vector3 pos = Vector3::ZERO; // Position offset
    364363        if(num > 1){// not required if there-s just one child
    365364            float r = masses[fisch]/rScaling;
    366             pos = new Vector3(r*sin(theta[fisch])*cos(phi[fisch]), r*sin(theta[fisch])*sin(phi[fisch]), r*cos(theta[fisch])); // convert spheric coordinates to vector
     365            pos = Vector3(r*sin(theta[fisch])*cos(phi[fisch]), r*sin(theta[fisch])*sin(phi[fisch]), r*cos(theta[fisch])); // convert spheric coordinates to vector
    367366        }
    368367       
    369         AsteroidMinable* child = new AsteroidMinable(this->context, masses[fisch], this->getPosition() + *pos, this->dropStuff);
     368        AsteroidMinable* child = new AsteroidMinable(this->context, masses[fisch], this->getPosition() + pos, this->dropStuff);
    370369        child->setVelocity(this->getVelocity());
    371 
    372         if(child == nullptr){
    373             orxout(internal_error, context::pickups) << "Weird, can't create new AsteroidMinable." << endl;
    374         }
    375370
    376371    }
Note: See TracChangeset for help on using the changeset viewer.