From 97fead85c9249051693f1980a26205c44eb418b3 Mon Sep 17 00:00:00 2001 From: Lyberta Date: Sun, 27 Aug 2017 09:33:25 +0300 Subject: [PATCH] Renamed ITEM_COUNT_HARD_LIMIT to RESOURCE_AMOUNT_HARD_LIMIT. --- qcsrc/common/t_items.qc | 11 ++++++----- qcsrc/common/t_items.qh | 4 ++-- qcsrc/server/client.qc | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 6ee7c1d8b..e47b98a66 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -665,7 +665,8 @@ void GivePlayerResource(entity player, .float resource_type, float amount) autocvar_g_balance_health_limit); // Correct code: //player.health = bound(player.health, player.health + amount, - // min(autocvar_g_balance_health_limit, ITEM_COUNT_HARD_LIMIT)); + // min(autocvar_g_balance_health_limit, + // RESOURCE_AMOUNT_HARD_LIMIT)); player.pauserothealth_finished = max(player.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot); return; @@ -680,7 +681,7 @@ void GivePlayerResource(entity player, .float resource_type, float amount) // Correct code: //player.armorvalue = bound(player.armorvalue, player.armorvalue + // amount, min(autocvar_g_balance_armor_limit, - // ITEM_COUNT_HARD_LIMIT)); + // RESOURCE_AMOUNT_HARD_LIMIT)); player.pauserotarmor_finished = max(player.pauserotarmor_finished, time + autocvar_g_balance_pause_armor_rot); return; @@ -697,7 +698,7 @@ void GivePlayerResource(entity player, .float resource_type, float amount) case ammo_fuel: { player.ammo_fuel = bound(player.ammo_fuel, player.ammo_fuel + - amount, min(g_pickup_fuel_max, ITEM_COUNT_HARD_LIMIT)); + amount, min(g_pickup_fuel_max, RESOURCE_AMOUNT_HARD_LIMIT)); player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + autocvar_g_balance_pause_fuel_rot); return; @@ -721,7 +722,7 @@ void GivePlayerAmmo(entity player, .float ammotype, float amount) { return; } - float maxvalue = ITEM_COUNT_HARD_LIMIT; + float maxvalue = RESOURCE_AMOUNT_HARD_LIMIT; switch (ammotype) { case ammo_shells: @@ -751,7 +752,7 @@ void GivePlayerAmmo(entity player, .float ammotype, float amount) } } player.(ammotype) = min(player.(ammotype) + amount, - min(maxvalue, ITEM_COUNT_HARD_LIMIT)); + min(maxvalue, RESOURCE_AMOUNT_HARD_LIMIT)); } void GivePlayerFuel(entity player, float amount) diff --git a/qcsrc/common/t_items.qh b/qcsrc/common/t_items.qh index 14cbd8e3f..c7287b67a 100644 --- a/qcsrc/common/t_items.qh +++ b/qcsrc/common/t_items.qh @@ -4,8 +4,8 @@ #include #endif -/// \brief Unconditional maximum amount of items the player can have. -const int ITEM_COUNT_HARD_LIMIT = 999; +/// \brief Unconditional maximum amount of resources the player can have. +const int RESOURCE_AMOUNT_HARD_LIMIT = 999; const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 0c12e40f0..4417515cf 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1661,13 +1661,13 @@ 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. - if (this.health > ITEM_COUNT_HARD_LIMIT) + if (this.health > RESOURCE_AMOUNT_HARD_LIMIT) { - this.health = ITEM_COUNT_HARD_LIMIT; + this.health = RESOURCE_AMOUNT_HARD_LIMIT; } - if (this.armorvalue > ITEM_COUNT_HARD_LIMIT) + if (this.armorvalue > RESOURCE_AMOUNT_HARD_LIMIT) { - this.armorvalue = ITEM_COUNT_HARD_LIMIT; + this.armorvalue = RESOURCE_AMOUNT_HARD_LIMIT; } // End hack. } -- 2.39.2