]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a safety check on the total damages count, requested by divVerent
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 16 Jan 2012 20:12:58 +0000 (22:12 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 16 Jan 2012 20:12:58 +0000 (22:12 +0200)
qcsrc/client/damage.qc

index 788ef3b8a0a44a1accf8205de728428a4967d8e2..e1c5c888acd889b6bf3b997e1b5f59863ab3ee80 100644 (file)
@@ -9,7 +9,7 @@ void DamageEffect_Think()
        if(time >= self.cnt || !self.owner || !self.owner.modelindex || !self.owner.drawmask)
        {
                // time is up or the player got gibbed / disconnected
-               self.owner.total_damages -= 1;
+               self.owner.total_damages = max(0, self.owner.total_damages - 1);
                remove(self);
                return;
        }
@@ -17,7 +17,7 @@ void DamageEffect_Think()
        {
                // if the player was dead but is now alive, it means he respawned
                // if so, clear his damage effects, or damages from his dead body will be copied back
-               self.owner.total_damages -= 1;
+               self.owner.total_damages = max(0, self.owner.total_damages - 1);
                remove(self);
                return;
        }