Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10557


Ignore:
Timestamp:
Aug 29, 2015, 6:18:30 PM (5 years ago)
Author:
landauf
Message:

cleanup: no need to pass/return WeakPtrs to/from functions. normal pointers are enough.

Location:
code/branches/core7/src
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/modules/dodgerace/DodgeRace.cc

    r10357 r10557  
    7575            for (int i = 0; i < 7; i++)
    7676            {
    77                 WeakPtr<BigExplosion> chunk = new BigExplosion(this->center_->getContext());
     77                BigExplosion* chunk = new BigExplosion(this->center_->getContext());
    7878                chunk->setPosition(Vector3(600, 0, 100.f * i - 300));
    7979                chunk->setVelocity(Vector3(1000, 0, 0));  //player->getVelocity()
     
    9191        if (getPlayer() != NULL)
    9292        {
    93             //WeakPtr<DodgeRaceShip> ship = getPlayer();
    94 
    9593            currentPosition = getPlayer()->getWorldPosition().x;
    9694            counter = counter + (currentPosition - lastPosition);
     
    113111                for(int i = 0; i<6; i++)
    114112                {
    115                     WeakPtr<DodgeRaceCube> cube = new DodgeRaceCube(this->center_->getContext());
     113                    DodgeRaceCube* cube = new DodgeRaceCube(this->center_->getContext());
    116114                    cubeList.push_back(cube);
    117115                    switch(pattern)
     
    138136    }
    139137
    140     WeakPtr<DodgeRaceShip> DodgeRace::getPlayer()
     138    DodgeRaceShip* DodgeRace::getPlayer()
    141139    {
    142140        if (player == NULL)
  • code/branches/core7/src/modules/dodgerace/DodgeRace.h

    r10357 r10557  
    105105            Timer endGameTimer;
    106106
    107             WeakPtr<DodgeRaceShip> getPlayer();
     107            DodgeRaceShip* getPlayer();
    108108            WeakPtr<DodgeRaceShip> player;
    109109            std::vector<DodgeRaceCube*> cubeList;
  • code/branches/core7/src/modules/dodgerace/DodgeRaceShip.cc

    r10357 r10557  
    9090
    9191        // Camera
    92         WeakPtr<Camera> camera = this->getCamera();
     92        Camera* camera = this->getCamera();
    9393        if (camera != NULL)
    9494        {
     
    150150    }
    151151
    152     WeakPtr<DodgeRace> DodgeRaceShip::getGame()
     152    DodgeRace* DodgeRaceShip::getGame()
    153153    {
    154154        if (game == NULL)
  • code/branches/core7/src/modules/dodgerace/DodgeRaceShip.h

    r10357 r10557  
    7878        private:
    7979            virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    80             WeakPtr<DodgeRace> getGame();
     80            DodgeRace* getGame();
    8181            WeakPtr<DodgeRace> game;
    8282            WeakPtr<WorldEntity> lastEntity;
  • code/branches/core7/src/modules/invader/Invader.cc

    r9961 r10557  
    8787            for (int i = 0; i < 7; i++)
    8888            {
    89                 WeakPtr<BigExplosion> chunk = new BigExplosion(this->center_->getContext());
     89                BigExplosion* chunk = new BigExplosion(this->center_->getContext());
    9090                chunk->setPosition(Vector3(600, 0, 100.f * i - 300));
    9191                chunk->setVelocity(Vector3(1000, 0, 0));  //player->getVelocity()
     
    9999    }
    100100
    101     WeakPtr<InvaderShip> Invader::getPlayer()
     101    InvaderShip* Invader::getPlayer()
    102102    {
    103103        if (player == NULL)
     
    116116        for (int i = 0; i < (3*log10(static_cast<double>(level)) + 1); i++)
    117117        {
    118             WeakPtr<InvaderEnemy> newPawn;
     118            InvaderEnemy* newPawn;
    119119            if (rand() % 42/(1 + level*level) == 0)
    120120            {
  • code/branches/core7/src/modules/invader/Invader.h

    r9943 r10557  
    7878        private:
    7979            void toggleShowLevel(){bShowLevel = !bShowLevel;}
    80             WeakPtr<InvaderShip> getPlayer();
     80            InvaderShip* getPlayer();
    8181            WeakPtr<InvaderCenterPoint> center_;
    8282            WeakPtr<InvaderShip> player;
  • code/branches/core7/src/modules/invader/InvaderEnemy.cc

    r9961 r10557  
    6969    }
    7070
    71     WeakPtr<Invader> InvaderEnemy::getGame()
     71    Invader* InvaderEnemy::getGame()
    7272    {
    7373        if (game == NULL)
  • code/branches/core7/src/modules/invader/InvaderEnemy.h

    r9943 r10557  
    4949            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    5050            virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator);
    51             virtual void setPlayer(WeakPtr<InvaderShip> player){this->player = player;}
     51            virtual void setPlayer(InvaderShip* player){this->player = player;}
    5252
    5353            int level;
    5454        protected:
    55             WeakPtr<Invader> getGame();
     55            Invader* getGame();
    5656            WeakPtr<Invader> game;
    5757            WeakPtr<InvaderShip> player;
  • code/branches/core7/src/modules/invader/InvaderShip.cc

    r9943 r10557  
    9191
    9292        // Camera
    93         WeakPtr<Camera> camera = this->getCamera();
     93        Camera* camera = this->getCamera();
    9494        if (camera != NULL)
    9595        {
     
    142142    {
    143143        // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint;
    144         WeakPtr<InvaderEnemy> enemy = orxonox_cast<InvaderEnemy*>(otherObject);
    145         WeakPtr<Projectile> shot = orxonox_cast<Projectile*>(otherObject);
     144        InvaderEnemy* enemy = orxonox_cast<InvaderEnemy*>(otherObject);
     145        Projectile* shot = orxonox_cast<Projectile*>(otherObject);
    146146        // ensure that this gets only called once per enemy.
    147147        if (enemy != NULL && lastEnemy != enemy)
     
    171171    }
    172172
    173     WeakPtr<Invader> InvaderShip::getGame()
     173    Invader* InvaderShip::getGame()
    174174    {
    175175        if (game == NULL)
  • code/branches/core7/src/modules/invader/InvaderShip.h

    r9943 r10557  
    7070            virtual void death();
    7171        private:
    72             WeakPtr<Invader> getGame();
     72            Invader* getGame();
    7373            WeakPtr<Invader> game;
    7474            Camera* camera;
  • code/branches/core7/src/modules/invader/InvaderWeapon.cc

    r10216 r10557  
    6868        // Create the projectile.projectile
    6969        projectile = new Projectile(this->getContext());
    70         WeakPtr<Model> model = new Model(projectile->getContext());
     70        Model* model = new Model(projectile->getContext());
    7171        model->setMeshSource(mesh_);
    7272        model->setCastShadows(false);
  • code/branches/core7/src/modules/jump/JumpEnemy.cc

    r10262 r10557  
    151151        An array (of size 2) of weak pointers, to be set as the new bats.
    152152    */
    153     void JumpEnemy::setFigure(WeakPtr<JumpFigure> newFigure)
     153    void JumpEnemy::setFigure(JumpFigure* newFigure)
    154154    {
    155155        figure_ = newFigure;
  • code/branches/core7/src/modules/jump/JumpEnemy.h

    r10262 r10557  
    6868
    6969            virtual void setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed);
    70             void setFigure(WeakPtr<JumpFigure> bats);
     70            void setFigure(JumpFigure* newFigure);
    7171            virtual void touchFigure();
    7272            bool dead_;
  • code/branches/core7/src/modules/jump/JumpItem.cc

    r10262 r10557  
    109109    }
    110110
    111     void JumpItem::setFigure(WeakPtr<JumpFigure> newFigure)
     111    void JumpItem::setFigure(JumpFigure* newFigure)
    112112    {
    113113        figure_ = newFigure;
  • code/branches/core7/src/modules/jump/JumpItem.h

    r10262 r10557  
    5353            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5454            virtual void setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed);
    55             virtual void setFigure(WeakPtr<JumpFigure> bats);
     55            virtual void setFigure(JumpFigure* newFigure);
    5656            virtual void touchFigure();
    5757
  • code/branches/core7/src/modules/jump/JumpPlatform.cc

    r10262 r10557  
    125125    }
    126126
    127     void JumpPlatform::setFigure(WeakPtr<JumpFigure> newFigure)
     127    void JumpPlatform::setFigure(JumpFigure* newFigure)
    128128    {
    129129        figure_ = newFigure;
  • code/branches/core7/src/modules/jump/JumpPlatform.h

    r10262 r10557  
    4949            virtual void tick(float dt);
    5050            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    51             void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball.
     51            void setFigure(JumpFigure* newFigure);
    5252            virtual void touchFigure();
    5353
  • code/branches/core7/src/modules/jump/JumpProjectile.cc

    r10262 r10557  
    8484    }
    8585
    86     void JumpProjectile::setFigure(WeakPtr<JumpFigure> figure)
     86    void JumpProjectile::setFigure(JumpFigure* figure)
    8787    {
    8888        figure_ = figure;
  • code/branches/core7/src/modules/jump/JumpProjectile.h

    r10262 r10557  
    5656                { return Vector2(this->fieldWidth_, this->fieldHeight_); }
    5757
    58             void setFigure(WeakPtr<JumpFigure> figure);
     58            void setFigure(JumpFigure* figure);
    5959
    6060        protected:
  • code/branches/core7/src/modules/objects/triggers/DistanceTrigger.cc

    r9667 r10557  
    213213               
    214214                // Add the entity to the cache.
    215                 this->cache_ = WeakPtr<WorldEntity>(entity);
     215                this->cache_ = entity;
    216216
    217217                return true;
  • code/branches/core7/src/modules/tetris/Tetris.h

    r10555 r10557  
    6969
    7070            PlayerInfo* getPlayer(void) const; //!< Get the player.
    71             WeakPtr<TetrisCenterpoint> getCenterpoint(void)
     71            TetrisCenterpoint* getCenterpoint(void)
    7272                { return this->center_; }
    7373
  • code/branches/core7/src/modules/towerdefense/TowerDefenseEnemy.cc

    r10258 r10557  
    4949    }
    5050
    51     WeakPtr<TowerDefense> TowerDefenseEnemy::getGame()
     51    TowerDefense* TowerDefenseEnemy::getGame()
    5252    {
    5353        if (game == NULL)
  • code/branches/core7/src/modules/towerdefense/TowerDefenseEnemy.h

    r10258 r10557  
    4747
    4848    private:
    49         WeakPtr<TowerDefense> getGame();
     49        TowerDefense* getGame();
    5050        WeakPtr<TowerDefense> game;
    5151        TowerDefense* td;
  • code/branches/core7/src/orxonox/gametypes/Dynamicmatch.cc

    r9945 r10557  
    310310        if (spaceship)
    311311        {
    312             WeakPtr<SpaceShip>* ptr = new WeakPtr<SpaceShip>(spaceship);
    313             if(ptr == NULL)
    314                 return;
    315312            spaceship->addSpeedFactor(5);
    316313            ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
    317             executor->setDefaultValue(0, ptr);
     314            executor->setDefaultValue(0, spaceship);
    318315            new Timer(10, false, executor, true);
    319316        }
     
    593590    }
    594591
    595     void Dynamicmatch::resetSpeedFactor(WeakPtr<SpaceShip>* ptr)// helper function
    596     {
    597         if (*ptr)
    598         {
    599             (*ptr)->addSpeedFactor(1.0f/5.0f);
    600         }
    601         delete ptr;
     592    void Dynamicmatch::resetSpeedFactor(SpaceShip* spaceship)// helper function
     593    {
     594        if (spaceship)
     595        {
     596            spaceship->addSpeedFactor(1.0f/5.0f);
     597        }
    602598    }
    603599
  • code/branches/core7/src/orxonox/gametypes/Dynamicmatch.h

    r9676 r10557  
    7777            virtual void rewardPig();
    7878            void grantPigBoost(SpaceShip* spaceship); // Grant the piggy a boost.
    79             void resetSpeedFactor(WeakPtr<SpaceShip>* ptr);
     79            void resetSpeedFactor(SpaceShip* spaceship);
    8080            void tick (float dt);// used to end the game
    8181            SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
  • code/branches/core7/src/orxonox/infos/PlayerInfo.cc

    r10362 r10557  
    186186
    187187        this->controllableEntity_->destroyHud(); // HACK-ish
    188         this->previousControllableEntity_.push_back(WeakPtr<ControllableEntity>(this->controllableEntity_));
     188        this->previousControllableEntity_.push_back(this->controllableEntity_);
    189189        this->controllableEntity_ = entity;
    190190        this->controllableEntityID_ = entity->getObjectID();
  • code/branches/core7/src/orxonox/interfaces/InterfaceCompilation.cc

    r10362 r10557  
    7272    {
    7373        assert(pawn);
    74         this->pawn_ = WeakPtr<Pawn>(pawn);
     74        this->pawn_ = pawn;
    7575        if (pawn)
    76             this->player_ = WeakPtr<PlayerInfo>(pawn->getPlayer());
     76            this->player_ = pawn->getPlayer();
    7777    }
    7878
  • code/branches/core7/src/orxonox/sound/SoundManager.cc

    r10555 r10557  
    419419    }
    420420
    421     void SoundManager::fadeIn(const StrongPtr<AmbientSound>& sound)
     421    void SoundManager::fadeIn(AmbientSound* sound)
    422422    {
    423423        // If we're already fading out --> remove that
     
    435435    }
    436436
    437     void SoundManager::fadeOut(const StrongPtr<AmbientSound>& sound)
     437    void SoundManager::fadeOut(AmbientSound* sound)
    438438    {
    439439        // If we're already fading in --> remove that
  • code/branches/core7/src/orxonox/sound/SoundManager.h

    r10555 r10557  
    106106    private:
    107107        void processCrossFading(float dt);
    108         void fadeIn(const StrongPtr<AmbientSound>& sound);
    109         void fadeOut(const StrongPtr<AmbientSound>& sound);
     108        void fadeIn(AmbientSound* sound);
     109        void fadeOut(AmbientSound* sound);
    110110
    111111        void checkFadeStepValidity();
Note: See TracChangeset for help on using the changeset viewer.