diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-08 00:38:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-08 00:38:31 +0300 |
commit | 344efb2009b8c6d329a6d19dd45ed49076252710 (patch) | |
tree | 2e5c1a7d9484e1cc3bfedac7b03c7146be442896 /src/gui | |
parent | fa4c5d79b04a319550996c48448cd799fe7fde56 (diff) | |
download | mv-344efb2009b8c6d329a6d19dd45ed49076252710.tar.gz mv-344efb2009b8c6d329a6d19dd45ed49076252710.tar.bz2 mv-344efb2009b8c6d329a6d19dd45ed49076252710.tar.xz mv-344efb2009b8c6d329a6d19dd45ed49076252710.zip |
Add into skill context menu for add shortcut.
Also add chat command for add skill shortcut by skill id into free slot.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 5 | ||||
-rw-r--r-- | src/gui/shortcut/itemshortcut.cpp | 10 | ||||
-rw-r--r-- | src/gui/shortcut/itemshortcut.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/skilllistbox.h | 5 | ||||
-rw-r--r-- | src/gui/widgets/skillrectanglelistbox.h | 5 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 6 |
6 files changed, 21 insertions, 12 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 27ef1887c..ba71e8d04 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2249,6 +2249,11 @@ void PopupMenu::showSkillPopup(const SkillInfo *const info) // TRANSLATORS: popup menu header mBrowserBox->addRow(_("Skill")); + mBrowserBox->addRow("/addskillshortcut 'ITEMID'", + // TRANSLATORS: popup menu item + // TRANSLATORS: add skill to shortcurs tab + _("Add skill shortcut")); + mBrowserBox->addSeparator("##3---"); mBrowserBox->addRow("/showskilllevels 'ITEMID'", // TRANSLATORS: popup menu item // TRANSLATORS: set skill level diff --git a/src/gui/shortcut/itemshortcut.cpp b/src/gui/shortcut/itemshortcut.cpp index 7b9bab6e6..2f80f6759 100644 --- a/src/gui/shortcut/itemshortcut.cpp +++ b/src/gui/shortcut/itemshortcut.cpp @@ -277,3 +277,13 @@ void ItemShortcut::swap(const int index1, const int index2) mItemData[index2] = tmpData; save(); } + +size_t ItemShortcut::getFreeIndex() const +{ + for (size_t i = 0; i < SHORTCUT_ITEMS; i++) + { + if (mItems[i] < 0) + return i; + } + return -1; +} diff --git a/src/gui/shortcut/itemshortcut.h b/src/gui/shortcut/itemshortcut.h index b7ea160a7..15324d30c 100644 --- a/src/gui/shortcut/itemshortcut.h +++ b/src/gui/shortcut/itemshortcut.h @@ -168,6 +168,8 @@ class ItemShortcut final void clear(); + size_t getFreeIndex() const A_WARN_UNUSED; + private: int mItems[SHORTCUT_ITEMS]; /**< The items. */ ItemColor mItemColors[SHORTCUT_ITEMS]; /**< The item colors. */ diff --git a/src/gui/widgets/skilllistbox.h b/src/gui/widgets/skilllistbox.h index 93c702381..46f116d4c 100644 --- a/src/gui/widgets/skilllistbox.h +++ b/src/gui/widgets/skilllistbox.h @@ -224,10 +224,7 @@ class SkillListBox final : public ListBox return; dragDrop.dragSkill(skill, DragDropSource::Skills); dragDrop.setItem(skill->id + SKILL_MIN_ID); - dragDrop.setItemData(strprintf("%d %d %d", - CAST_S32(skill->customCastType), - skill->customOffsetX, - skill->customOffsetY)); + dragDrop.setItemData(skill->toDataStr()); } ListBox::mouseDragged(event); } diff --git a/src/gui/widgets/skillrectanglelistbox.h b/src/gui/widgets/skillrectanglelistbox.h index 88698de1c..a0775db3c 100644 --- a/src/gui/widgets/skillrectanglelistbox.h +++ b/src/gui/widgets/skillrectanglelistbox.h @@ -306,10 +306,7 @@ class SkillRectangleListBox final : public Widget, return; dragDrop.dragSkill(skill, DragDropSource::Skills); dragDrop.setItem(skill->id + SKILL_MIN_ID); - dragDrop.setItemData(strprintf("%d %d %d", - CAST_S32(skill->customCastType), - skill->customOffsetX, - skill->customOffsetY)); + dragDrop.setItemData(skill->toDataStr()); } } } diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index f48baaf83..b4e277b98 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -268,10 +268,8 @@ void SkillDialog::update() info->id + SKILL_MIN_ID, fromInt(info->customSelectedLevel, ItemColor)); - shortcuts->setItemData(idx, strprintf("%d %d %d", - CAST_S32(info->customCastType), - info->customOffsetX, - info->customOffsetY)); + shortcuts->setItemData(idx, + info->toDataStr()); idx ++; } } |