summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-22 21:30:14 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-22 21:30:14 +0300
commite3f651e65f5a486f47ae81fe3ba5e68e8c48f79e (patch)
tree643ce9eb26f4da078de5afe1d3e8b40eba901f23 /src
parent51583912458f8eb0b080edabf3af5f384a205055 (diff)
downloadplus-e3f651e65f5a486f47ae81fe3ba5e68e8c48f79e.tar.gz
plus-e3f651e65f5a486f47ae81fe3ba5e68e8c48f79e.tar.bz2
plus-e3f651e65f5a486f47ae81fe3ba5e68e8c48f79e.tar.xz
plus-e3f651e65f5a486f47ae81fe3ba5e68e8c48f79e.zip
Allow drag skill with any selected level to shortcuts window.
Diffstat (limited to 'src')
-rw-r--r--src/actions/actions.cpp3
-rw-r--r--src/dragdrop.h9
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp4
-rw-r--r--src/gui/windows/skilldialog.cpp5
-rw-r--r--src/gui/windows/skilldialog.h3
-rw-r--r--src/itemshortcut.cpp3
6 files changed, 19 insertions, 8 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index fc45b440f..9e1d055ac 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -1521,7 +1521,8 @@ impHandler(useItem)
else if (skillDialog)
{
skillDialog->useItem(itemId,
- fromBool(config.getBoolValue("skillAutotarget"), AutoTarget));
+ fromBool(config.getBoolValue("skillAutotarget"), AutoTarget),
+ 0);
}
return true;
}
diff --git a/src/dragdrop.h b/src/dragdrop.h
index ef4c2b844..97f978ee2 100644
--- a/src/dragdrop.h
+++ b/src/dragdrop.h
@@ -68,6 +68,9 @@ class DragDrop final
ItemColor getItemColor() const
{ return mItemColor; }
+ void setItemColor(const ItemColor color)
+ { mItemColor = color; }
+
Image *getItemImage()
{ return mItemImage; }
@@ -144,7 +147,7 @@ class DragDrop final
if (mItemImage)
mItemImage->decRef();
mItem = 0;
- mItemColor = ItemColor_one;
+ mItemColor = ItemColor_zero;
mText.clear();
mItemImage = nullptr;
mSource = DragDropSource::Empty;
@@ -158,10 +161,12 @@ class DragDrop final
mItemImage = data->icon;
if (mItemImage)
mItemImage->incRef();
- mItem = info->id;
mSource = source;
mTag = tag;
}
+ mItem = info->id;
+ mItemColor = fromInt(info->selectedLevel,
+ ItemColor);
}
}
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index dc7c214dd..bfb8fef0d 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -432,8 +432,10 @@ void ItemShortcutContainer::mouseDragged(MouseEvent &event)
{
selShortcut->removeItem(index);
dragDrop.dragSkill(skill,
- DragDropSource::Shortcuts, index);
+ DragDropSource::Shortcuts,
+ index);
dragDrop.setItem(itemId);
+ dragDrop.setItemColor(itemColor);
}
else
{
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 9949ba859..44d02b573 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -562,7 +562,8 @@ void SkillDialog::widgetResized(const Event &event)
}
void SkillDialog::useItem(const int itemId,
- const AutoTarget autoTarget) const
+ const AutoTarget autoTarget,
+ const int level) const
{
const std::map<int, SkillInfo*>::const_iterator
it = mSkills.find(itemId - SKILL_MIN_ID);
@@ -571,7 +572,7 @@ void SkillDialog::useItem(const int itemId,
const SkillInfo *const info = (*it).second;
// +++ need add skill level here
- useSkill(info, autoTarget, 0);
+ useSkill(info, autoTarget, level);
}
void SkillDialog::updateTabSelection()
diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h
index 1cf92b586..2e0125e9c 100644
--- a/src/gui/windows/skilldialog.h
+++ b/src/gui/windows/skilldialog.h
@@ -114,7 +114,8 @@ class SkillDialog final : public Window,
void widgetResized(const Event &event) override final;
void useItem(const int itemId,
- const AutoTarget autoTarget) const;
+ const AutoTarget autoTarget,
+ const int level) const;
void updateTabSelection();
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 681c4c0f5..7c980ad02 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -142,7 +142,8 @@ void ItemShortcut::useItem(const int index) const
else if (skillDialog)
{
skillDialog->useItem(itemId,
- fromBool(config.getBoolValue("skillAutotarget"), AutoTarget));
+ fromBool(config.getBoolValue("skillAutotarget"), AutoTarget),
+ toInt(itemColor, int));
}
}
}