]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow 0 as a valid limit (use -1 as the non-player limit)
authorMario <mario@smbclan.net>
Sun, 17 Jun 2018 07:59:30 +0000 (17:59 +1000)
committerMario <mario@smbclan.net>
Sun, 17 Jun 2018 07:59:30 +0000 (17:59 +1000)
qcsrc/server/resources.qc

index 0fb40cf6ec13dc52f098192cddb1d9a65651ee4f..20587da9ec9b576f588af68a19f91f8e4c29baff 100644 (file)
@@ -11,7 +11,7 @@
 float GetResourceLimit(entity e, int resource_type)
 {
        if(!IS_PLAYER(e))
-               return 0; // no limits on non-players
+               return -1; // no limits on non-players
 
        float limit;
        switch (resource_type)
@@ -99,7 +99,7 @@ void SetResourceAmount(entity e, int resource_type, float amount)
        amount = M_ARGV(2, float);
        float max_amount = GetResourceLimit(e, resource_type); // TODO: should allow overriding these limits if cheats are enabled!
        float amount_wasted = 0;
-       if (amount > max_amount && max_amount)
+       if (amount > max_amount && max_amount >= 0)
        {
                amount_wasted = amount - max_amount;
                amount = max_amount;