Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2008, 5:41:29 AM (16 years ago)
Author:
landauf
Message:
  • some changes, maybe fixed a crash, not sure
  • fixed strange camera behavior
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc

    r2494 r2497  
    4040#include "objects/worldentities/Model.h"
    4141#include "objects/worldentities/ParticleSpawner.h"
    42 #include "objects/worldentities/pawns/Pawn.h"
    4342#include "objects/collisionshapes/SphereCollisionShape.h"
    4443#include "core/Core.h"
     
    6362        this->attachCollisionShape(shape);
    6463
    65         if(!Core::isClient()) //only if not on client
     64        if(Core::isMaster())
    6665          this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));
    6766    }
     
    9190    void Projectile::destroyObject()
    9291    {
    93         delete this;
     92        if (Core::isMaster())
     93            delete this;
    9494    }
    9595
    9696    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    9797    {
    98         if (!this->bDestroy_)
     98        if (!this->bDestroy_ && Core::isMaster())
    9999        {
    100100            this->bDestroy_ = true;
    101             Pawn* victim = dynamic_cast<Pawn*>(otherObject);
    102             if (victim)
    103                 victim->damage(this->damage_, this->owner_);
    104 
    105101
    106102            if (this->owner_)
     
    123119                }
    124120            }
     121
     122            Pawn* victim = dynamic_cast<Pawn*>(otherObject);
     123            if (victim)
     124                victim->damage(this->damage_, this->owner_);
    125125        }
    126126        return false;
    127127    }
     128
     129    void Projectile::destroyedPawn(Pawn* pawn)
     130    {
     131        if (this->owner_ == pawn)
     132            this->owner_ = 0;
     133    }
    128134}
Note: See TracChangeset for help on using the changeset viewer.