diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-06-09 20:06:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-06-09 20:06:14 +0300 |
commit | 46fe5111cb099c4df5d1494f05c1b5e482e895de (patch) | |
tree | cad5863381859ab7616d3c4121868ecd1cd74405 | |
parent | 3f62c34d3e19c2da8885facfedea2ed613779c53 (diff) | |
download | manaverse-46fe5111cb099c4df5d1494f05c1b5e482e895de.tar.gz manaverse-46fe5111cb099c4df5d1494f05c1b5e482e895de.tar.bz2 manaverse-46fe5111cb099c4df5d1494f05c1b5e482e895de.tar.xz manaverse-46fe5111cb099c4df5d1494f05c1b5e482e895de.zip |
Allow select item with any color in code where colors not supported.
-rw-r--r-- | src/gui/shopwindow.cpp | 8 | ||||
-rw-r--r-- | src/inventory.cpp | 2 | ||||
-rw-r--r-- | src/localplayer.cpp | 16 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 46a3351c5..7578cbf7b 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -216,7 +216,7 @@ void ShopWindow::action(const gcn::ActionEvent &event) return; //+++ need support for colors - Item *item = inv->findItem(mSelectedItem, 1); + Item *item = inv->findItem(mSelectedItem, 0); if (item) { if (event.getId() == "add buy") @@ -515,7 +515,7 @@ void ShopWindow::giveList(const std::string &nick, int mode) if (mode == SELL) { //+++ need support for colors - Item *item2 = inv->findItem(item->getId(), 1); + Item *item2 = inv->findItem(item->getId(), 0); if (item2) { int amount = item->getQuantity(); @@ -612,7 +612,7 @@ void ShopWindow::showList(const std::string &nick, std::string data) if (sellDialog) { //+++ need support for colors - Item *item = inv->findItem(id, 1); + Item *item = inv->findItem(id, 0); if (item) { if (item->getQuantity() < amount) @@ -685,7 +685,7 @@ void ShopWindow::processRequest(std::string nick, std::string data, int mode) if (mode == BUY) { //+++ need support for colors - Item *item2 = inv->findItem(mTradeItem->getId(), 1); + Item *item2 = inv->findItem(mTradeItem->getId(), 0); if (!item2 || item2->getQuantity() < amount || !findShopItem(mTradeItem, SELL)) { diff --git a/src/inventory.cpp b/src/inventory.cpp index 5e600192b..894377884 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -79,7 +79,7 @@ Item *Inventory::findItem(int itemId, unsigned char color) const for (unsigned i = 0; i < mSize; i++) { if (mItems[i] && mItems[i]->getId() == itemId - && mItems[i]->getColor() == color) + && (color == 0 || mItems[i]->getColor() == color)) { return mItems[i]; } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index ea330f0c1..040020001 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -1894,16 +1894,16 @@ void LocalPlayer::changeEquipmentBeforeAttack(Being* target) if (allowSword) { //finding sword - item = PlayerInfo::getInventory()->findItem(571, 1); + item = PlayerInfo::getInventory()->findItem(571, 0); if (!item) - item = PlayerInfo::getInventory()->findItem(570, 1); + item = PlayerInfo::getInventory()->findItem(570, 0); if (!item) - item = PlayerInfo::getInventory()->findItem(579, 1); + item = PlayerInfo::getInventory()->findItem(579, 0); if (!item) - item = PlayerInfo::getInventory()->findItem(536, 1); + item = PlayerInfo::getInventory()->findItem(536, 0); //no swords if (!item) @@ -1919,9 +1919,9 @@ void LocalPlayer::changeEquipmentBeforeAttack(Being* target) if (mAttackWeaponType == 3) { //finding shield - item = PlayerInfo::getInventory()->findItem(601, 1); + item = PlayerInfo::getInventory()->findItem(601, 0); if (!item) - item = PlayerInfo::getInventory()->findItem(602, 1); + item = PlayerInfo::getInventory()->findItem(602, 0); if (item && !item->isEquipped()) { Net::getInventoryHandler()->equipItem(item); @@ -1933,10 +1933,10 @@ void LocalPlayer::changeEquipmentBeforeAttack(Being* target) else { //finding bow - item = PlayerInfo::getInventory()->findItem(545, 1); + item = PlayerInfo::getInventory()->findItem(545, 0); if (!item) - item = PlayerInfo::getInventory()->findItem(530, 1); + item = PlayerInfo::getInventory()->findItem(530, 0); //no bow if (!item) |