mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Bots] IsValidTarget Crash Fix (#4187)
* [Bots] IsValidTarget crash fix This addresses crashes related to IsValidTarget on multiple servers. Unsure of the exact reason if anyone can explain why changing from const bool to bool in this situation fixes the problem. Is it because the const is somehow crashing on a bad pointer or is it attempting to be force changed? * Update bot.cpp --------- Co-authored-by: Alex King <89047260+Kinglykrab@users.noreply.github.com>
This commit is contained in:
parent
d94493468c
commit
6ca11256c6
15
zone/bot.cpp
15
zone/bot.cpp
@ -2684,16 +2684,19 @@ bool Bot::IsValidTarget(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool valid_target_state = (
|
bool invalid_target_state = false;
|
||||||
HOLDING ||
|
if (HOLDING ||
|
||||||
!tar->IsNPC() ||
|
!tar->IsNPC() ||
|
||||||
tar->IsMezzed() ||
|
tar->IsMezzed() ||
|
||||||
lo_distance > leash_distance ||
|
lo_distance > leash_distance ||
|
||||||
tar_distance > leash_distance
|
tar_distance > leash_distance ||
|
||||||
);
|
(!GetAttackingFlag() && !CheckLosFN(tar) && !leash_owner->CheckLosFN(tar)) ||
|
||||||
const bool valid_target = !GetAttackingFlag() && !CheckLosFN(tar) && !leash_owner->CheckLosFN(tar);
|
!IsAttackAllowed(tar)
|
||||||
|
) {
|
||||||
|
invalid_target_state = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (valid_target_state || valid_target || !IsAttackAllowed(tar)) {
|
if (invalid_target_state) {
|
||||||
// Normally, we wouldn't want to do this without class checks..but, too many issues can arise if we let enchanter animation pets run rampant
|
// Normally, we wouldn't want to do this without class checks..but, too many issues can arise if we let enchanter animation pets run rampant
|
||||||
if (HasPet()) {
|
if (HasPet()) {
|
||||||
GetPet()->RemoveFromHateList(tar);
|
GetPet()->RemoveFromHateList(tar);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user