Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 2, 2009, 8:41:33 PM (15 years ago)
Author:
landauf
Message:

using a WeakPtr in Projectile instead of inheriting from PawnListener
fixed another small inaccuracy in TeamDeathmatch

Location:
code/branches/core5/src/modules/weapons/projectiles
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/modules/weapons/projectiles/Projectile.cc

    r5831 r5860  
    133133    }
    134134
    135     void Projectile::destroyedPawn(Pawn* pawn)
     135    void Projectile::setOwner(Pawn* owner)
    136136    {
    137         if (this->owner_ == pawn)
    138             this->owner_ = 0;
     137        this->owner_ = owner;
    139138    }
    140139}
  • code/branches/core5/src/modules/weapons/projectiles/Projectile.h

    r5831 r5860  
    3333
    3434#include "tools/Timer.h"
    35 #include "interfaces/PawnListener.h"
    3635#include "worldentities/MovableEntity.h"
    3736
    3837namespace orxonox
    3938{
    40     class _WeaponsExport Projectile : public MovableEntity, public PawnListener
     39    class _WeaponsExport Projectile : public MovableEntity
    4140    {
    4241        public:
     
    4948            virtual void tick(float dt);
    5049            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    51             virtual void destroyedPawn(Pawn* pawn);
    5250
    5351            inline void setDamage(float damage)
     
    5654                { return this->damage_; }
    5755
    58             inline void setOwner(Pawn* owner)
    59                 { this->owner_ = owner; }
     56            void setOwner(Pawn* owner);
    6057            inline Pawn* getOwner() const
    6158                { return this->owner_; }
    6259
    6360        private:
    64             Pawn* owner_;
     61            WeakPtr<Pawn> owner_;
    6562            float lifetime_;
    6663            float damage_;
Note: See TracChangeset for help on using the changeset viewer.