Changeset 2497 for code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc
- Timestamp:
- Dec 17, 2008, 5:41:29 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc
r2494 r2497 40 40 #include "objects/worldentities/Model.h" 41 41 #include "objects/worldentities/ParticleSpawner.h" 42 #include "objects/worldentities/pawns/Pawn.h"43 42 #include "objects/collisionshapes/SphereCollisionShape.h" 44 43 #include "core/Core.h" … … 63 62 this->attachCollisionShape(shape); 64 63 65 if( !Core::isClient()) //only if not on client64 if(Core::isMaster()) 66 65 this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject))); 67 66 } … … 91 90 void Projectile::destroyObject() 92 91 { 93 delete this; 92 if (Core::isMaster()) 93 delete this; 94 94 } 95 95 96 96 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 97 97 { 98 if (!this->bDestroy_ )98 if (!this->bDestroy_ && Core::isMaster()) 99 99 { 100 100 this->bDestroy_ = true; 101 Pawn* victim = dynamic_cast<Pawn*>(otherObject);102 if (victim)103 victim->damage(this->damage_, this->owner_);104 105 101 106 102 if (this->owner_) … … 123 119 } 124 120 } 121 122 Pawn* victim = dynamic_cast<Pawn*>(otherObject); 123 if (victim) 124 victim->damage(this->damage_, this->owner_); 125 125 } 126 126 return false; 127 127 } 128 129 void Projectile::destroyedPawn(Pawn* pawn) 130 { 131 if (this->owner_ == pawn) 132 this->owner_ = 0; 133 } 128 134 }
Note: See TracChangeset
for help on using the changeset viewer.