diff --git a/changelog.txt b/changelog.txt index d9022beda..a96d312e6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 04/21/2014 == Secrets: Crash fix for more hatelist crashes. Secrets: Hate list fixes, again. +Secrets: Revert of hatelist changes. == 04/20/2014 == Secrets: Changed the functionality of EQDEBUG cmake flag. It now suppresses logs, but shows crashes in any scenario when set to 1. It will also now show crashes even if the log system is disabled. diff --git a/zone/bot.cpp b/zone/bot.cpp index 940780715..1526beddc 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -223,7 +223,6 @@ Bot::~Bot() { GetPet()->Depop(); entity_list.RemoveBot(GetID()); - entity_list.RemoveFromTargets(this, true); } void Bot::SetBotID(uint32 botID) { diff --git a/zone/client.cpp b/zone/client.cpp index 20b2b1412..7aa7bd748 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -426,8 +426,7 @@ Client::~Client() { //let the stream factory know were done with this stream eqs->Close(); eqs->ReleaseFromUse(); - //Moved this from ~Mob, because it could cause a crash in some cases where a hate list was still used and that mob was the only one on the hate list. - entity_list.RemoveFromTargets(this, true); + UninitializeBuffSlots(); } diff --git a/zone/entity.cpp b/zone/entity.cpp index c09348384..ed5ee33f0 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1283,33 +1283,6 @@ void EntityList::RemoveFromTargets(Mob *mob, bool RemoveFromXTargets) } } -void EntityList::RemoveFromTargets(uint16 MobID, bool RemoveFromXTargets) -{ - Mob* mob = entity_list.GetMob(MobID); - - if(!mob) - return; - - auto it = mob_list.begin(); - while (it != mob_list.end()) { - Mob *m = it->second; - ++it; - - if (!m) - continue; - - m->RemoveFromHateList(mob); - - if (RemoveFromXTargets) { - if (m->IsClient()) - m->CastToClient()->RemoveXTarget(mob, false); - // FadingMemories calls this function passing the client. - else if (mob->IsClient()) - mob->CastToClient()->RemoveXTarget(m, false); - } - } -} - void EntityList::RemoveFromXTargets(Mob *mob) { auto it = client_list.begin(); diff --git a/zone/entity.h b/zone/entity.h index 9db343921..ede4b3bea 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -290,7 +290,6 @@ public: void ExpeditionWarning(uint32 minutes_left); void RemoveFromTargets(Mob* mob, bool RemoveFromXTargets = false); - void RemoveFromTargets(uint16 mob, bool RemoveFromXTargets = false); void RemoveFromXTargets(Mob* mob); void RemoveFromAutoXTargets(Mob* mob); void ReplaceWithTarget(Mob* pOldMob, Mob*pNewTarget); diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index d7cc9a9e5..d83ed4d12 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -205,6 +205,9 @@ void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAd bool HateList::RemoveEnt(Mob *ent) { + if (!ent) + return false; + bool found = false; auto iterator = list.begin(); diff --git a/zone/merc.cpp b/zone/merc.cpp index a1de41f71..c8c8da6fa 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -76,7 +76,6 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading) Merc::~Merc() { AI_Stop(); entity_list.RemoveMerc(this->GetID()); - entity_list.RemoveFromTargets(this, true); UninitializeBuffSlots(); } diff --git a/zone/mob.cpp b/zone/mob.cpp index 0fa0b1c07..48452f26a 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -401,6 +401,8 @@ Mob::~Mob() if(!corpse || (corpse && !corpse->IsPlayerCorpse())) entity_list.QueueClients(this, &app, true); + entity_list.RemoveFromTargets(this, true); + if(trade) { Mob *with = trade->With(); if(with && with->IsClient()) { diff --git a/zone/npc.cpp b/zone/npc.cpp index 0afee9b51..2611300d8 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -392,8 +392,6 @@ NPC::~NPC() safe_delete(reface_timer); safe_delete(swarmInfoPtr); safe_delete(qGlobals); - //Moved this from ~Mob, because it could cause a crash in some cases where a hate list was still used and that mob was the only one on the hate list. - entity_list.RemoveFromTargets(this, true); UninitializeBuffSlots(); }