summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-22 19:46:08 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-22 19:46:08 +0300
commit51583912458f8eb0b080edabf3af5f384a205055 (patch)
tree9116b5fa5cb5b3a98dc0bd1b80b35c5a996534bc /src
parentaf026c1d1e1d574cfc403064a3c9f6b10288d55e (diff)
downloadmanaplus-51583912458f8eb0b080edabf3af5f384a205055.tar.gz
manaplus-51583912458f8eb0b080edabf3af5f384a205055.tar.bz2
manaplus-51583912458f8eb0b080edabf3af5f384a205055.tar.xz
manaplus-51583912458f8eb0b080edabf3af5f384a205055.zip
Use selected skill level in button "use" in skill dialog.
Diffstat (limited to 'src')
-rw-r--r--src/gui/windows/skilldialog.cpp29
-rw-r--r--src/gui/windows/skilldialog.h3
2 files changed, 20 insertions, 12 deletions
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 49b89c951..9949ba859 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -171,7 +171,8 @@ void SkillDialog::action(const ActionEvent &event)
{
const SkillInfo *const info = tab->getSelectedInfo();
useSkill(info,
- fromBool(config.getBoolValue("skillAutotarget"), AutoTarget));
+ fromBool(config.getBoolValue("skillAutotarget"), AutoTarget),
+ info->selectedLevel);
}
}
else if (eventId == "close")
@@ -569,7 +570,8 @@ void SkillDialog::useItem(const int itemId,
return;
const SkillInfo *const info = (*it).second;
- useSkill(info, autoTarget);
+ // +++ need add skill level here
+ useSkill(info, autoTarget, 0);
}
void SkillDialog::updateTabSelection()
@@ -702,13 +704,15 @@ void SkillDialog::playCastingDstTileEffect(const int id,
}
void SkillDialog::useSkill(const SkillInfo *const info,
- const AutoTarget autoTarget)
+ const AutoTarget autoTarget,
+ int level)
{
if (!info || !localPlayer)
return;
- const SkillData *data = info->data;
- if (!data)
- data = info->getData1(info->level);
+ if (!level)
+ level = info->level;
+
+ const SkillData *data = info->getData1(level);
if (data)
{
const std::string cmd = data->invokeCmd;
@@ -730,7 +734,8 @@ void SkillDialog::useSkill(const SkillInfo *const info,
if (being)
{
skillHandler->useBeing(info->id,
- info->level, being->getId());
+ level,
+ being->getId());
}
break;
}
@@ -742,13 +747,15 @@ void SkillDialog::useSkill(const SkillInfo *const info,
if (being)
{
skillHandler->useBeing(info->id,
- info->level, being->getId());
+ level,
+ being->getId());
}
break;
}
case SkillType::Self:
skillHandler->useBeing(info->id,
- info->level, localPlayer->getId());
+ level,
+ localPlayer->getId());
break;
case SkillType::Ground:
@@ -761,7 +768,7 @@ void SkillDialog::useSkill(const SkillInfo *const info,
textSkillListener.setSkill(info->id,
x,
y,
- info->level);
+ level);
TextDialog *const dialog = CREATEWIDGETR(TextDialog,
// TRANSLATORS: text skill dialog header
strprintf(_("Add text to skill %s"),
@@ -776,7 +783,7 @@ void SkillDialog::useSkill(const SkillInfo *const info,
else
{
skillHandler->usePos(info->id,
- info->level,
+ level,
x, y);
}
break;
diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h
index 47458e2db..1cf92b586 100644
--- a/src/gui/windows/skilldialog.h
+++ b/src/gui/windows/skilldialog.h
@@ -140,7 +140,8 @@ class SkillDialog final : public Window,
void removeSkill(const int id);
static void useSkill(const SkillInfo *const info,
- const AutoTarget autoTarget);
+ const AutoTarget autoTarget,
+ int level);
SkillData *getSkillData(const int id) const;