From 9d7cf5523f7949c52b8b8b90f82de5c2ba0a5d8e Mon Sep 17 00:00:00 2001 From: Gamemechanic Date: Fri, 1 Dec 2023 22:05:55 +0100 Subject: [PATCH] Very minor refactor of Creature::HasSpell (#2322) --- src/game/Objects/Creature.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/game/Objects/Creature.cpp b/src/game/Objects/Creature.cpp index 7b21622ede9..00d8c9b2af2 100644 --- a/src/game/Objects/Creature.cpp +++ b/src/game/Objects/Creature.cpp @@ -3062,11 +3062,10 @@ bool Creature::IsInEvadeMode() const bool Creature::HasSpell(uint32 spellId) const { - uint8 i; - for (i = 0; i < CREATURE_MAX_SPELLS; ++i) + for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) if (spellId == m_spells[i]) - break; - return i < CREATURE_MAX_SPELLS; // break before end of iteration of known spells + return true; + return false; } void Creature::LockOutSpells(SpellSchoolMask schoolMask, uint32 duration)