summaryrefslogtreecommitdiff
path: root/src/spellmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-16 20:02:04 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-16 20:02:04 +0300
commit18bd0722a9cebc3ba80bfb74a5b5ba0dd9e53c75 (patch)
tree179d12121a4e588efa53c67a207e2ab5392d99eb /src/spellmanager.cpp
parent44cdf80268135a21ddb09710fc029e808fb3f519 (diff)
downloadManaVerse-18bd0722a9cebc3ba80bfb74a5b5ba0dd9e53c75.tar.gz
ManaVerse-18bd0722a9cebc3ba80bfb74a5b5ba0dd9e53c75.tar.bz2
ManaVerse-18bd0722a9cebc3ba80bfb74a5b5ba0dd9e53c75.tar.xz
ManaVerse-18bd0722a9cebc3ba80bfb74a5b5ba0dd9e53c75.zip
Rename SpellTarget into CommandTarget enum and convert it to strong typed.
Diffstat (limited to 'src/spellmanager.cpp')
-rw-r--r--src/spellmanager.cpp17
1 files changed, 9 insertions, 8 deletions
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<TextCommandType>(commandType) == TEXT_COMMAND_MAGIC)
{
addSpell(new TextCommand(i, symbol, cmd, comment,
- static_cast<SpellTarget>(targetType), icon, basicLvl,
+ static_cast<CommandTargetT>(targetType), icon, basicLvl,
static_cast<MagicSchool>(school), schoolLvl, mana));
}
else
{
addSpell(new TextCommand(i, symbol, cmd, comment,
- static_cast<SpellTarget>(targetType), icon));
+ static_cast<CommandTargetT>(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(" ");
}