[Orxonox-commit 1139] r5860 - in code/branches/core5/src: modules/weapons/projectiles orxonox/gametypes
landauf at orxonox.net
landauf at orxonox.net
Fri Oct 2 20:41:33 CEST 2009
Author: landauf
Date: 2009-10-02 20:41:33 +0200 (Fri, 02 Oct 2009)
New Revision: 5860
Modified:
code/branches/core5/src/modules/weapons/projectiles/Projectile.cc
code/branches/core5/src/modules/weapons/projectiles/Projectile.h
code/branches/core5/src/orxonox/gametypes/TeamDeathmatch.cc
Log:
using a WeakPtr in Projectile instead of inheriting from PawnListener
fixed another small inaccuracy in TeamDeathmatch
Modified: code/branches/core5/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- code/branches/core5/src/modules/weapons/projectiles/Projectile.cc 2009-10-02 17:35:52 UTC (rev 5859)
+++ code/branches/core5/src/modules/weapons/projectiles/Projectile.cc 2009-10-02 18:41:33 UTC (rev 5860)
@@ -132,9 +132,8 @@
return false;
}
- void Projectile::destroyedPawn(Pawn* pawn)
+ void Projectile::setOwner(Pawn* owner)
{
- if (this->owner_ == pawn)
- this->owner_ = 0;
+ this->owner_ = owner;
}
}
Modified: code/branches/core5/src/modules/weapons/projectiles/Projectile.h
===================================================================
--- code/branches/core5/src/modules/weapons/projectiles/Projectile.h 2009-10-02 17:35:52 UTC (rev 5859)
+++ code/branches/core5/src/modules/weapons/projectiles/Projectile.h 2009-10-02 18:41:33 UTC (rev 5860)
@@ -32,12 +32,11 @@
#include "weapons/WeaponsPrereqs.h"
#include "tools/Timer.h"
-#include "interfaces/PawnListener.h"
#include "worldentities/MovableEntity.h"
namespace orxonox
{
- class _WeaponsExport Projectile : public MovableEntity, public PawnListener
+ class _WeaponsExport Projectile : public MovableEntity
{
public:
Projectile(BaseObject* creator);
@@ -48,20 +47,18 @@
virtual void tick(float dt);
virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
- virtual void destroyedPawn(Pawn* pawn);
inline void setDamage(float damage)
{ this->damage_ = damage; }
inline float getDamage() const
{ return this->damage_; }
- inline void setOwner(Pawn* owner)
- { this->owner_ = owner; }
+ void setOwner(Pawn* owner);
inline Pawn* getOwner() const
{ return this->owner_; }
private:
- Pawn* owner_;
+ WeakPtr<Pawn> owner_;
float lifetime_;
float damage_;
bool bDestroy_;
Modified: code/branches/core5/src/orxonox/gametypes/TeamDeathmatch.cc
===================================================================
--- code/branches/core5/src/orxonox/gametypes/TeamDeathmatch.cc 2009-10-02 17:35:52 UTC (rev 5859)
+++ code/branches/core5/src/orxonox/gametypes/TeamDeathmatch.cc 2009-10-02 18:41:33 UTC (rev 5860)
@@ -99,17 +99,17 @@
bool TeamDeathmatch::allowPawnHit(Pawn* victim, Pawn* originator)
{
- return (!this->pawnsAreInTheSameTeam(victim, originator));
+ return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
}
bool TeamDeathmatch::allowPawnDamage(Pawn* victim, Pawn* originator)
{
- return (!this->pawnsAreInTheSameTeam(victim, originator));
+ return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
}
bool TeamDeathmatch::allowPawnDeath(Pawn* victim, Pawn* originator)
{
- return (!this->pawnsAreInTheSameTeam(victim, originator));
+ return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator);
}
SpawnPoint* TeamDeathmatch::getBestSpawnPoint(PlayerInfo* player) const
More information about the Orxonox-commit
mailing list