From 18bd0722a9cebc3ba80bfb74a5b5ba0dd9e53c75 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 16 Nov 2015 20:02:04 +0300 Subject: Rename SpellTarget into CommandTarget enum and convert it to strong typed. --- src/spellmanager.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/spellmanager.cpp') diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index bc14f7537..84d05bc12 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -143,18 +143,18 @@ void SpellManager::invoke(const int spellId) const && PlayerInfo::getAttribute(Attributes::MP) >= spell->getMana())) { const Being *const target = localPlayer->getTarget(); - if (spell->getTargetType() == NOTARGET) + if (spell->getTargetType() == CommandTarget::NoTarget) { invokeSpell(spell); } if ((target && (target->getType() != ActorType::Monster || spell->getCommandType() == TEXT_COMMAND_TEXT)) - && (spell->getTargetType() == ALLOWTARGET - || spell->getTargetType() == NEEDTARGET)) + && (spell->getTargetType() == CommandTarget::AllowTarget + || spell->getTargetType() == CommandTarget::NeedTarget)) { invokeSpell(spell, target); } - else if (spell->getTargetType() == ALLOWTARGET) + else if (spell->getTargetType() == CommandTarget::AllowTarget) { invokeSpell(spell); } @@ -287,13 +287,13 @@ void SpellManager::load(const bool oldConfig) if (static_cast(commandType) == TEXT_COMMAND_MAGIC) { addSpell(new TextCommand(i, symbol, cmd, comment, - static_cast(targetType), icon, basicLvl, + static_cast(targetType), icon, basicLvl, static_cast(school), schoolLvl, mana)); } else { addSpell(new TextCommand(i, symbol, cmd, comment, - static_cast(targetType), icon)); + static_cast(targetType), icon)); } } } @@ -368,8 +368,9 @@ std::string SpellManager::autoComplete(const std::string &partName) const } ++i; } - if (!newName.empty() && newCommand - && newCommand->getTargetType() == NEEDTARGET) + if (!newName.empty() && + newCommand && + newCommand->getTargetType() == CommandTarget::NeedTarget) { return newName.append(" "); } -- cgit v1.2.3-70-g09d2