From d7005dc6d583c2d2467ce52050e1d932db162b9c Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 18 Jun 2018 08:32:39 +1000 Subject: [PATCH] Use the new unlimited resource constant --- qcsrc/common/gamemodes/gamemode/assault/assault.qc | 2 +- qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc | 4 ++-- qcsrc/common/monsters/monster/mage.qc | 2 +- qcsrc/common/monsters/sv_monsters.qc | 2 +- qcsrc/common/turrets/sv_turrets.qc | 2 +- qcsrc/common/vehicles/sv_vehicles.qc | 2 +- qcsrc/common/vehicles/vehicle/bumblebee.qc | 2 +- qcsrc/common/weapons/weapon/arc.qc | 2 +- qcsrc/server/resources.qc | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/assault/assault.qc b/qcsrc/common/gamemodes/gamemode/assault/assault.qc index b9b5c361ce..9a2d6af1d8 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/assault.qc +++ b/qcsrc/common/gamemodes/gamemode/assault/assault.qc @@ -333,7 +333,7 @@ spawnfunc(target_objective_decrease) // destructible walls that can be used to trigger target_objective_decrease bool destructible_heal(entity targ, entity inflictor, float amount, float limit) { - float true_limit = ((limit >= 0) ? limit : targ.max_health); + float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health); if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= true_limit) return false; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index 90ab772342..fd050df0a0 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -449,7 +449,7 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker bool ons_ControlPoint_Icon_Heal(entity targ, entity inflictor, float amount, float limit) { - float true_limit = ((limit >= 0) ? limit : targ.max_health); + float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health); if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= true_limit) return false; @@ -963,7 +963,7 @@ void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float d bool ons_GeneratorHeal(entity targ, entity inflictor, float amount, float limit) { - float true_limit = ((limit >= 0) ? limit : targ.max_health); + float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health); if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= true_limit) return false; diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index a49430fbc8..88120a0ea7 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -269,7 +269,7 @@ void M_Mage_Defend_Heal(entity this) else { Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1); - Heal(it, this, autocvar_g_monster_mage_heal_allies, -1); + Heal(it, this, autocvar_g_monster_mage_heal_allies, RESOURCE_LIMIT_NONE); if(!(it.spawnflags & MONSTERFLAG_INVINCIBLE) && it.sprite) WaypointSprite_UpdateHealth(it.sprite, GetResourceAmount(it, RESOURCE_HEALTH)); } diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 810732b10a..84355c7f35 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -1061,7 +1061,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage bool Monster_Heal(entity targ, entity inflictor, float amount, float limit) { - float true_limit = ((limit >= 0) ? limit : targ.max_health); + float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health); if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= true_limit) return false; diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index db33ca7cb4..b68aca16fe 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -261,7 +261,7 @@ void turret_damage(entity this, entity inflictor, entity attacker, float damage, bool turret_heal(entity targ, entity inflictor, float amount, float limit) { - float true_limit = ((limit >= 0) ? limit : targ.max_health); + float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health); if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= true_limit) return false; diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 5284664e96..df0f5d9169 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -729,7 +729,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag bool vehicles_heal(entity targ, entity inflictor, float amount, float limit) { - float true_limit = ((limit >= 0) ? limit : targ.max_health); + float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health); //if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= true_limit) if(targ.vehicle_health <= 0 || targ.vehicle_health >= true_limit) return false; diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 32a5a2aded..c340d94703 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -549,7 +549,7 @@ bool bumblebee_pilot_frame(entity this, float dt) { if(autocvar_g_vehicle_bumblebee_healgun_hps) { - float hplimit = ((IS_PLAYER(trace_ent)) ? autocvar_g_vehicle_bumblebee_healgun_hmax : -1); + float hplimit = ((IS_PLAYER(trace_ent)) ? autocvar_g_vehicle_bumblebee_healgun_hmax : RESOURCE_LIMIT_NONE); Heal(trace_ent, this, autocvar_g_vehicle_bumblebee_healgun_hps * dt, hplimit); } diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index fc4b92a55b..40f9ea765a 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -424,7 +424,7 @@ void W_Arc_Beam_Think(entity this) { float roothealth = ((burst) ? WEP_CVAR(arc, burst_healing_hps) : WEP_CVAR(arc, beam_healing_hps)); float rootarmor = ((burst) ? WEP_CVAR(arc, burst_healing_aps) : WEP_CVAR(arc, beam_healing_aps)); - float hplimit = ((IS_PLAYER(trace_ent)) ? WEP_CVAR(arc, beam_healing_hmax) : -1); + float hplimit = ((IS_PLAYER(trace_ent)) ? WEP_CVAR(arc, beam_healing_hmax) : RESOURCE_LIMIT_NONE); Heal(trace_ent, own, (roothealth * coefficient), hplimit); if(IS_PLAYER(trace_ent) && rootarmor) { diff --git a/qcsrc/server/resources.qc b/qcsrc/server/resources.qc index 3614daf49e..b3b19095ae 100644 --- a/qcsrc/server/resources.qc +++ b/qcsrc/server/resources.qc @@ -182,7 +182,7 @@ void GiveResourceWithLimit(entity receiver, int resource_type, float amount, return; } float current_amount = GetResourceAmount(receiver, resource_type); - if (current_amount + amount > limit) + if (current_amount + amount > limit && limit != RESOURCE_LIMIT_NONE) { amount = limit - current_amount; } -- 2.39.2