mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 15:00:25 +00:00
[Hotfix] Check if the mob is already in the close mobs list before inserting
This commit is contained in:
+4
-1
@@ -2972,7 +2972,10 @@ void EntityList::ScanCloseMobs(Mob *scanning_mob)
|
||||
float distance = DistanceSquared(scanning_mob->GetPosition(), mob->GetPosition());
|
||||
if (distance <= scan_range || mob->GetAggroRange() >= scan_range) {
|
||||
// add mob to scanning_mob's close list and vice versa
|
||||
mob->m_close_mobs[scanning_mob->GetID()] = scanning_mob;
|
||||
// check if the mob is already in the close mobs list before inserting
|
||||
if (mob->m_close_mobs.find(scanning_mob->GetID()) == mob->m_close_mobs.end()) {
|
||||
mob->m_close_mobs[scanning_mob->GetID()] = scanning_mob;
|
||||
}
|
||||
scanning_mob->m_close_mobs[mob->GetID()] = mob;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user