mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Crash] Fix crash issue when dividing by zero in CalcHPRegen (#4320)
* [Crash] Fix crash issue when dividing by zero in CalcHPRegen * Update zone.cpp
This commit is contained in:
parent
66af3d2f63
commit
3a51f04291
@ -289,7 +289,7 @@ int64 Client::CalcHPRegen(bool bCombat)
|
|||||||
|
|
||||||
if (!bCombat && CanFastRegen() && (IsSitting() || CanMedOnHorse())) {
|
if (!bCombat && CanFastRegen() && (IsSitting() || CanMedOnHorse())) {
|
||||||
auto max_hp = GetMaxHP();
|
auto max_hp = GetMaxHP();
|
||||||
int64 fast_regen = 6 * (max_hp / (zone ? zone->newzone_data.fast_regen_hp : 180));
|
int64 fast_regen = 6 * (max_hp / (zone && zone->newzone_data.fast_regen_hp > 0 ? zone->newzone_data.fast_regen_hp : 180));
|
||||||
if (base < fast_regen) // weird, but what the client is doing
|
if (base < fast_regen) // weird, but what the client is doing
|
||||||
base = fast_regen;
|
base = fast_regen;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1366,9 +1366,9 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_version)
|
|||||||
newzone_data.maxclip = z->maxclip;
|
newzone_data.maxclip = z->maxclip;
|
||||||
newzone_data.time_type = z->time_type;
|
newzone_data.time_type = z->time_type;
|
||||||
newzone_data.gravity = z->gravity;
|
newzone_data.gravity = z->gravity;
|
||||||
newzone_data.fast_regen_hp = z->fast_regen_hp;
|
newzone_data.fast_regen_hp = z->fast_regen_hp > 0 ? z->fast_regen_hp : 180;
|
||||||
newzone_data.fast_regen_mana = z->fast_regen_mana;
|
newzone_data.fast_regen_mana = z->fast_regen_mana > 0 ? z->fast_regen_mana : 180;
|
||||||
newzone_data.fast_regen_endurance = z->fast_regen_endurance;
|
newzone_data.fast_regen_endurance = z->fast_regen_endurance > 0 ? z->fast_regen_endurance : 180;
|
||||||
newzone_data.npc_aggro_max_dist = z->npc_max_aggro_dist;
|
newzone_data.npc_aggro_max_dist = z->npc_max_aggro_dist;
|
||||||
newzone_data.underworld_teleport_index = z->underworld_teleport_index;
|
newzone_data.underworld_teleport_index = z->underworld_teleport_index;
|
||||||
newzone_data.lava_damage = z->lava_damage;
|
newzone_data.lava_damage = z->lava_damage;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user