diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-06-04 22:08:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-06-04 22:08:04 +0300 |
commit | a865b10749df829ef46a14e244bc88ac52bc10b4 (patch) | |
tree | 244f283ab8ba6cfcc9683eafe51be7a9d7bbabbe /src/gui | |
parent | 9b3e13d4246930f0aa4dfb86e735466032d283dd (diff) | |
download | plus-a865b10749df829ef46a14e244bc88ac52bc10b4.tar.gz plus-a865b10749df829ef46a14e244bc88ac52bc10b4.tar.bz2 plus-a865b10749df829ef46a14e244bc88ac52bc10b4.tar.xz plus-a865b10749df829ef46a14e244bc88ac52bc10b4.zip |
Add colors support for drops panel.
Delete search item function without colors support.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/popupmenu.cpp | 12 | ||||
-rw-r--r-- | src/gui/popupmenu.h | 1 | ||||
-rw-r--r-- | src/gui/shopwindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/tradewindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/dropshortcutcontainer.cpp | 15 | ||||
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 2 |
6 files changed, 33 insertions, 12 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index d6004bb27..c3f28744c 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -88,6 +88,7 @@ PopupMenu::PopupMenu(): mFloorItem(0), mItem(0), mItemId(0), + mItemColor(1), mMapItem(0), mTab(0), mSpell(0), @@ -889,7 +890,7 @@ void PopupMenu::handleLink(const std::string &link, Inventory *inv = PlayerInfo::getInventory(); if (inv) { - Item *item = inv->findItem(mItemId); + Item *item = inv->findItem(mItemId, mItemColor); if (item) { if (item->isEquipment()) @@ -1473,6 +1474,7 @@ void PopupMenu::handleLink(const std::string &link, mFloorItem = 0; mItem = 0; mItemId = 0; + mItemColor = 1; mMapItem = 0; mNick = ""; } @@ -1586,6 +1588,7 @@ void PopupMenu::showItemPopup(int x, int y, int itemId, unsigned char color) { mItem = 0; mItemId = itemId; + mItemColor = color; mBrowserBox->clearRows(); mBrowserBox->addRow(strprintf("@@use|%s@@", _("Use"))); @@ -1603,9 +1606,15 @@ void PopupMenu::showItemPopup(int x, int y, Item *item) { mItem = item; if (item) + { mItemId = item->getId(); + mItemColor = item->getColor(); + } else + { mItemId = 0; + mItemColor = 1; + } mBrowserBox->clearRows(); if (item) @@ -1827,6 +1836,7 @@ void PopupMenu::showUndressPopup(int x, int y, Being *being, Item *item) mBeingId = being->getId(); mItem = item; mItemId = item->getId(); + mItemColor = item->getColor(); mBrowserBox->clearRows(); diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index f23dc0f87..976e3e5d2 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.h @@ -143,6 +143,7 @@ class PopupMenu : public Popup, public LinkHandler FloorItem* mFloorItem; Item *mItem; int mItemId; + unsigned char mItemColor; MapItem *mMapItem; ChatTab *mTab; TextCommand *mSpell; diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 549979905..46a3351c5 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -215,7 +215,8 @@ void ShopWindow::action(const gcn::ActionEvent &event) if (!inv) return; - Item *item = inv->findItem(mSelectedItem); + //+++ need support for colors + Item *item = inv->findItem(mSelectedItem, 1); if (item) { if (event.getId() == "add buy") @@ -513,7 +514,8 @@ void ShopWindow::giveList(const std::string &nick, int mode) if (mode == SELL) { - Item *item2 = inv->findItem(item->getId()); + //+++ need support for colors + Item *item2 = inv->findItem(item->getId(), 1); if (item2) { int amount = item->getQuantity(); @@ -609,7 +611,8 @@ void ShopWindow::showList(const std::string &nick, std::string data) buyDialog->addItem(id, 1, amount, price); if (sellDialog) { - Item *item = inv->findItem(id); + //+++ need support for colors + Item *item = inv->findItem(id, 1); if (item) { if (item->getQuantity() < amount) @@ -681,7 +684,8 @@ void ShopWindow::processRequest(std::string nick, std::string data, int mode) if (mode == BUY) { - Item *item2 = inv->findItem(mTradeItem->getId()); + //+++ need support for colors + Item *item2 = inv->findItem(mTradeItem->getId(), 1); if (!item2 || item2->getQuantity() < amount || !findShopItem(mTradeItem, SELL)) { diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index e7e74fdbb..e3fb323e6 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -430,7 +430,8 @@ void TradeWindow::initTrade(std::string nick) Inventory *inv = PlayerInfo::getInventory(); if (inv) { - Item *item = inv->findItem(mAutoAddItem->getId()); + Item *item = inv->findItem(mAutoAddItem->getId(), + mAutoAddItem->getColor()); if (item) tradeItem(item, mAutoAddItem->getQuantity()); } diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 0125558dc..224830d8f 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -119,7 +119,8 @@ void DropShortcutContainer::draw(gcn::Graphics *graphics) if (!inv) return; - Item *item = inv->findItem(dropShortcut->getItem(i)); + Item *item = inv->findItem(dropShortcut->getItem(i), + dropShortcut->getItemColor(i)); if (item) { @@ -178,6 +179,7 @@ void DropShortcutContainer::mouseDragged(gcn::MouseEvent &event) return; const int itemId = dropShortcut->getItem(index); + const int itemColor = dropShortcut->getItemColor(index); if (itemId < 0) return; @@ -186,7 +188,7 @@ void DropShortcutContainer::mouseDragged(gcn::MouseEvent &event) if (!inv) return; - Item *item = inv->findItem(itemId); + Item *item = inv->findItem(itemId, itemColor); if (item) { @@ -231,7 +233,8 @@ void DropShortcutContainer::mousePressed(gcn::MouseEvent &event) if (!inv) return; - Item *item = inv->findItem(dropShortcut->getItem(index)); + Item *item = inv->findItem(dropShortcut->getItem(index), + dropShortcut->getItemColor(index)); if (viewport) viewport->showDropPopup(item); @@ -256,7 +259,8 @@ void DropShortcutContainer::mouseReleased(gcn::MouseEvent &event) } if (mItemMoved) { - dropShortcut->setItems(index, mItemMoved->getId()); + dropShortcut->setItems(index, mItemMoved->getId(), + mItemMoved->getColor()); mItemMoved = NULL; } @@ -277,6 +281,7 @@ void DropShortcutContainer::mouseMoved(gcn::MouseEvent &event) return; const int itemId = dropShortcut->getItem(index); + const int itemColor = dropShortcut->getItemColor(index); if (itemId < 0) return; @@ -285,7 +290,7 @@ void DropShortcutContainer::mouseMoved(gcn::MouseEvent &event) if (!inv) return; - Item *item = inv->findItem(itemId); + Item *item = inv->findItem(itemId, itemColor); if (item && viewport) { diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 1650c386e..a9d1f5279 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -342,7 +342,7 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event) itemShortcut[num]->setItemSelected(item); } if (dropShortcut) - dropShortcut->setItemSelected(item->getId()); + dropShortcut->setItemSelected(item); if (item->isEquipment() && outfitWindow) outfitWindow->setItemSelected(item); if (shopWindow) |