]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Better hard limit check.
authorLyberta <lyberta@lyberta.net>
Sat, 26 Aug 2017 18:10:16 +0000 (21:10 +0300)
committerLyberta <lyberta@lyberta.net>
Sat, 26 Aug 2017 18:10:16 +0000 (21:10 +0300)
qcsrc/server/client.qc

index 9357e1b7dc3bc79ce3867803b41ceae1f1cc9a12..24ed8ffbbdd95646303ac900bf61d6b9abfc8640 100644 (file)
@@ -1663,8 +1663,14 @@ void player_regen(entity this)
        // Ugly hack to make sure the haelth and armor don't go beyond hard limit.
        // TODO: Remove this hack when all code uses GivePlayerHealth and
        // GivePlayerArmor.
-       this.health = bound(0, this.health, ITEM_COUNT_HARD_LIMIT);
-       this.armorvalue = bound(0, this.armorvalue, ITEM_COUNT_HARD_LIMIT);
+       if (this.health > ITEM_COUNT_HARD_LIMIT)
+       {
+               this.health = ITEM_COUNT_HARD_LIMIT;
+       }
+       if (this.armorvalue > ITEM_COUNT_HARD_LIMIT)
+       {
+               this.armorvalue = ITEM_COUNT_HARD_LIMIT;
+       }
        // End hack.
 }