From: Mario Date: Sun, 17 Jun 2018 07:59:30 +0000 (+1000) Subject: Allow 0 as a valid limit (use -1 as the non-player limit) X-Git-Tag: xonotic-v0.8.5~2026 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bd99e814760d140992890d53465adb9f36e500c0;p=xonotic%2Fxonotic-data.pk3dir.git Allow 0 as a valid limit (use -1 as the non-player limit) --- diff --git a/qcsrc/server/resources.qc b/qcsrc/server/resources.qc index 0fb40cf6e..20587da9e 100644 --- a/qcsrc/server/resources.qc +++ b/qcsrc/server/resources.qc @@ -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;