diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-06 03:42:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-06 03:42:14 +0300 |
commit | c53f4620bdaa1ae3fe0a15aa237ea88d28da0954 (patch) | |
tree | 1d95c01a2fee0d926518c943b6e7eb462f8f231d /src/gui/popupmenu.cpp | |
parent | 21ebc138f263e030df216d2a09cfd3ae9f47c840 (diff) | |
download | manaverse-c53f4620bdaa1ae3fe0a15aa237ea88d28da0954.tar.gz manaverse-c53f4620bdaa1ae3fe0a15aa237ea88d28da0954.tar.bz2 manaverse-c53f4620bdaa1ae3fe0a15aa237ea88d28da0954.tar.xz manaverse-c53f4620bdaa1ae3fe0a15aa237ea88d28da0954.zip |
Fix possible crash in popup menu.
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r-- | src/gui/popupmenu.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index ea324d675..e2009ee28 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -851,20 +851,6 @@ void PopupMenu::handleLink(const std::string &link, else if (link == "look") { } - else if (link == "use" && mItem) - { - if (mItem->isEquipment()) - { - if (mItem->isEquipped()) - Net::getInventoryHandler()->unequipItem(mItem); - else - Net::getInventoryHandler()->equipItem(mItem); - } - else - { - Net::getInventoryHandler()->useItem(mItem); - } - } else if (link == "use" && mItemId) { if (mItemId < SPELL_MIN_ID) @@ -1623,6 +1609,8 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item, return; mItem = item; + mItemId = item->getId(); + mItemColor = item->getColor(); mWindow = parent; mX = x; mY = y; @@ -1818,6 +1806,8 @@ void PopupMenu::showItemPopup(int x, int y, Item *item) void PopupMenu::showDropPopup(int x, int y, Item *item) { mItem = item; + mItemId = item->getId(); + mItemColor = item->getColor(); mX = x; mY = y; mNick = ""; |