From 06dcd62d8c36a0e1bce2bf115f8d87f91e3d3a1f Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Fri, 24 Jan 2025 13:09:39 -0600 Subject: [PATCH] Reduce GetCorrectBotSpellType branching slightly This is still an ugly ass function but my brain is melted --- common/spdat_bot.cpp | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/common/spdat_bot.cpp b/common/spdat_bot.cpp index da634ca0c..e6e6a68c2 100644 --- a/common/spdat_bot.cpp +++ b/common/spdat_bot.cpp @@ -644,38 +644,38 @@ uint16 GetCorrectBotSpellType(uint16 spell_type, uint16 spell_id) { else if (IsRegularGroupHealSpell(spell_id)) { correct_type = BotSpellTypes::GroupHeals; } + + return correct_type; } - else { - if (IsVeryFastHealSpell(spell_id)) { - correct_type = BotSpellTypes::VeryFastHeals; - } - else if (IsFastHealSpell(spell_id)) { - correct_type = BotSpellTypes::FastHeals; - } - else if (IsCompleteHealSpell(spell_id)) { - correct_type = BotSpellTypes::CompleteHeal; - } - else if (IsHealOverTimeSpell(spell_id)) { - correct_type = BotSpellTypes::HoTHeals; - } - else if (IsRegularSingleTargetHealSpell(spell_id)) { - correct_type = BotSpellTypes::RegularHeal; - } - else if (IsRegularPetHealSpell(spell_id)) { - correct_type = BotSpellTypes::RegularHeal; - } + + if (IsVeryFastHealSpell(spell_id)) { + correct_type = BotSpellTypes::VeryFastHeals; + } + else if (IsFastHealSpell(spell_id)) { + correct_type = BotSpellTypes::FastHeals; + } + else if (IsCompleteHealSpell(spell_id)) { + correct_type = BotSpellTypes::CompleteHeal; + } + else if (IsHealOverTimeSpell(spell_id)) { + correct_type = BotSpellTypes::HoTHeals; + } + else if (IsRegularSingleTargetHealSpell(spell_id)) { + correct_type = BotSpellTypes::RegularHeal; + } + else if (IsRegularPetHealSpell(spell_id)) { + correct_type = BotSpellTypes::RegularHeal; } } else if (IsAnyBuffSpell(spell_id)) { + correct_type = BotSpellTypes::Buff; + if (IsResistanceOnlySpell(spell_id)) { correct_type = BotSpellTypes::ResistBuffs; } else if (IsDamageShieldOnlySpell(spell_id)) { correct_type = BotSpellTypes::DamageShields; } - else { - correct_type = BotSpellTypes::Buff; - } } }