You shouldn't get frags by killing yourself anymore.
authorsaiam
Mon, 08 Dec 2008 21:00:50 +0000
changeset 309 05a39422c81e
parent 308 60f4b55d5713
child 310 7e0cfc5f0944
You shouldn't get frags by killing yourself anymore.
src/Player.cc
src/Projectile.cc
src/Projectile.hh
--- a/src/Player.cc	Mon Dec 08 20:57:16 2008 +0000
+++ b/src/Player.cc	Mon Dec 08 21:00:50 2008 +0000
@@ -295,7 +295,9 @@
     health -= source->getDamage();
 
     if (health <= 0) {
-        source->addKillToOwner();
+        if (this != source->getOwner()) { 
+            source->addKillToOwner();
+        }
         die();
     }
 
--- a/src/Projectile.cc	Mon Dec 08 20:57:16 2008 +0000
+++ b/src/Projectile.cc	Mon Dec 08 21:00:50 2008 +0000
@@ -44,6 +44,10 @@
 void Projectile::addKillToOwner () {
     player->addKill();
 } 
+
+const Player* Projectile::getOwner () {
+    return player;
+}
    
 void Projectile::onHitPlayer (Player *player) {
     player->takeDamage(this);
--- a/src/Projectile.hh	Mon Dec 08 20:57:16 2008 +0000
+++ b/src/Projectile.hh	Mon Dec 08 21:00:50 2008 +0000
@@ -63,6 +63,11 @@
      */
     void addKillToOwner ();
 
+    /**
+     * Return the owner of the projectile.
+     */
+    const Player* getOwner (); 
+
 protected:
     /**
      * Removes ground at given position if applicable, and destroys this PhysicsObject.