Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9949 for code/trunk


Ignore:
Timestamp:
Jan 3, 2014, 3:14:19 PM (10 years ago)
Author:
landauf
Message:

removed duplicate code. there is no need for a second constructor. if at all, use a factory method.

Location:
code/trunk/src/orxonox/worldentities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/worldentities/BigExplosion.cc

    r9946 r9949  
    7878    }
    7979
    80     BigExplosion::BigExplosion(Context* context, Vector3 initVelocity) : MobileEntity(context)
    81     {
    82         RegisterObject(BigExplosion);
    83         this->setVelocity(initVelocity);
    84 
    85         if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
    86             ThrowException(AbortLoading, "Can't create BigExplosion, no scene or no scene manager given.");
    87 
    88         this->bStop_ = false;
    89         this->LOD_ = LODParticle::Normal;
    90 
    91         if ( GameMode::showsGraphics() )
    92         {
    93             try
    94             {
    95                 this->init();
    96             }
    97             catch (const std::exception& ex)
    98             {
    99                 orxout(internal_error) << "Couldn't load particle effect in BigExplosion: " << ex.what() << endl;
    100                 this->initZero();
    101             }
    102         }
    103         else
    104         {
    105             this->initZero();
    106         }
    107 
    108         if (GameMode::isMaster())
    109         {
    110             this->destroyTimer_.setTimer(rnd(2, 4), false, createExecutor(createFunctor(&BigExplosion::stop, this)));
    111         }
    112 
    113         this->registerVariables();
    114     }
    115 
    11680    void BigExplosion::init()
    11781    {
  • code/trunk/src/orxonox/worldentities/BigExplosion.h

    r9939 r9949  
    4141        public:
    4242            BigExplosion(Context* context);
    43             BigExplosion(Context* context, Vector3 initVelocity);
    4443            virtual ~BigExplosion();
    4544
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r9947 r9949  
    120120                this->weaponSystem_->destroy();
    121121        }
    122 
    123122    }
    124123
     
    151150        XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode );
    152151    }
    153 
    154152
    155153    void Pawn::registerVariables()
     
    380378        this->setDestroyWhenPlayerLeft(false);
    381379
    382         BigExplosion* chunk = new BigExplosion(this->getContext(), this->getVelocity());
     380        BigExplosion* chunk = new BigExplosion(this->getContext());
    383381        chunk->setPosition(this->getPosition());
    384         // chunk->setVelocity(this->getVelocity());
     382        chunk->setVelocity(this->getVelocity());
    385383
    386384        this->explosionSound_->setPosition(this->getPosition());
Note: See TracChangeset for help on using the changeset viewer.