From 4660b6776e21f61444a2396e680c6e41f5cf12a6 Mon Sep 17 00:00:00 2001 From: Lyberta Date: Sat, 26 Aug 2017 19:37:14 +0300 Subject: [PATCH] Moved HARD_LIMIT check a bit. --- qcsrc/common/t_items.qc | 2 +- qcsrc/server/client.qc | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 9a6d4e397..14a8f14bf 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -686,7 +686,7 @@ void GivePlayerArmor(entity player, float amount) void GivePlayerAmmo(entity player, .float ammotype, float amount) { - float maxvalue = 999; + float maxvalue = ITEM_COUNT_HARD_LIMIT; switch (ammotype) { case ammo_shells: diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 143514c2e..9357e1b7d 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1622,13 +1622,6 @@ void player_regen(entity this) regen_health_stable = M_ARGV(9, float); regen_health_rotstable = M_ARGV(10, float); - // 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); - // End hack. - if(!mutator_returnvalue) if(!STAT(FROZEN, this)) { @@ -1667,6 +1660,12 @@ void player_regen(entity this) this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf); } + // 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); + // End hack. } bool zoomstate_set; -- 2.39.2