Fix crash

Whoever made this using dynamic memory should be fired.
This commit is contained in:
Michael Cook (mackal) 2018-01-19 23:27:29 -05:00
parent 0fa5053ad1
commit 26532c03ac

View File

@ -193,6 +193,7 @@ void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage,
entity->hatelist_damage += (in_damage >= 0) ? in_damage : 0; entity->hatelist_damage += (in_damage >= 0) ? in_damage : 0;
entity->stored_hate_amount += in_hate; entity->stored_hate_amount += in_hate;
entity->is_entity_frenzy = in_is_entity_frenzied; entity->is_entity_frenzy = in_is_entity_frenzied;
entity->last_modified = Timer::GetCurrentTime();
} }
else if (iAddIfNotExist) { else if (iAddIfNotExist) {
entity = new struct_HateList; entity = new struct_HateList;
@ -201,6 +202,7 @@ void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage,
entity->stored_hate_amount = in_hate; entity->stored_hate_amount = in_hate;
entity->is_entity_frenzy = in_is_entity_frenzied; entity->is_entity_frenzy = in_is_entity_frenzied;
entity->oor_count = 0; entity->oor_count = 0;
entity->last_modified = Timer::GetCurrentTime();
list.push_back(entity); list.push_back(entity);
parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), in_entity, "1", 0); parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), in_entity, "1", 0);
@ -210,7 +212,6 @@ void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage,
in_entity->CastToClient()->IncrementAggroCount(); in_entity->CastToClient()->IncrementAggroCount();
} }
} }
entity->last_modified = Timer::GetCurrentTime();
} }
bool HateList::RemoveEntFromHateList(Mob *in_entity) bool HateList::RemoveEntFromHateList(Mob *in_entity)