From b6dd604de23b6f0298b022bc39521028b3c955ee Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 18 Feb 2015 02:46:13 -0500 Subject: [PATCH] Fix for taunt. Added additional check to prevent recourse spells from recoursing themselves and crashing. --- zone/hate_list.cpp | 10 +++++----- zone/spells.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index dbc24296a..421e44304 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -282,14 +282,14 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center) return nullptr; Mob* top_hate = nullptr; - int32 hate = -1; + uint32 hate = 0; if (center == nullptr) return nullptr; if (RuleB(Aggro, SmartAggroList)){ Mob* top_client_type_in_range = nullptr; - int32 hate_client_type_in_range = -1; + uint32 hate_client_type_in_range = 0; int skipped_count = 0; auto iterator = list.begin(); @@ -337,7 +337,7 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center) continue; } - int32 current_hate = cur->stored_hate_amount; + uint32 current_hate = cur->stored_hate_amount; if (cur->entity_on_hatelist->IsClient()){ @@ -459,13 +459,13 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center) Mob *HateList::GetEntWithMostHateOnList(){ Mob* top = nullptr; - int32 hate = -1; + uint32 hate = 0; auto iterator = list.begin(); while (iterator != list.end()) { struct_HateList *cur = (*iterator); - if (cur->entity_on_hatelist != nullptr && (cur->stored_hate_amount > hate)) + if (cur && cur->entity_on_hatelist != nullptr && (cur->stored_hate_amount > hate)) { top = cur->entity_on_hatelist; hate = cur->stored_hate_amount; diff --git a/zone/spells.cpp b/zone/spells.cpp index 849dacfbe..b0ed519d9 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3742,7 +3742,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r return false; } - if (IsValidSpell(spells[spell_id].RecourseLink)) + if (IsValidSpell(spells[spell_id].RecourseLink) && spells[spell_id].RecourseLink != spell_id) SpellFinished(spells[spell_id].RecourseLink, this, 10, 0, -1, spells[spells[spell_id].RecourseLink].ResistDiff); if (IsDetrimentalSpell(spell_id)) {