Revert "It's never ogre with these hatelist crashes.."

This reverts commit dffee38dc6.
This commit is contained in:
SecretsOTheP
2014-04-23 12:50:25 -04:00
parent 6aa0c9d694
commit 9502f0aadf
9 changed files with 7 additions and 34 deletions
-1
View File
@@ -223,7 +223,6 @@ Bot::~Bot() {
GetPet()->Depop();
entity_list.RemoveBot(GetID());
entity_list.RemoveFromTargets(this, true);
}
void Bot::SetBotID(uint32 botID) {
+1 -2
View File
@@ -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();
}
-27
View File
@@ -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();
-1
View File
@@ -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);
+3
View File
@@ -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();
-1
View File
@@ -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();
}
+2
View File
@@ -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()) {
-2
View File
@@ -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();
}