From ae0ade61326aa52df63aeb7742133160b8c78047 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 11 Feb 2015 16:23:03 +0300 Subject: Add typed bool type Equipped. --- src/gui/windows/equipmentwindow.cpp | 6 +++--- src/gui/windows/inventorywindow.cpp | 4 ++-- src/gui/windows/itemamountwindow.cpp | 2 +- src/gui/windows/npcdialog.cpp | 2 +- src/gui/windows/outfitwindow.cpp | 8 +++++--- src/gui/windows/tradewindow.cpp | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src/gui/windows') diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 74bcaaafb..f26a877cf 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -324,7 +324,7 @@ void EquipmentWindow::action(const ActionEvent &event) { if (item->isEquipment() == Equipm_true) { - if (!item->isEquipped()) + if (item->isEquipped() == Equipped_false) PlayerInfo::equipItem(item, true); } } @@ -468,7 +468,7 @@ void EquipmentWindow::mouseReleased(MouseEvent &event) { if (item->isEquipment() == Equipm_true) { - if (!item->isEquipped()) + if (item->isEquipped() == Equipped_false) PlayerInfo::equipItem(item, true); } } @@ -492,7 +492,7 @@ void EquipmentWindow::mouseReleased(MouseEvent &event) return; } - if (item->isEquipped()) + if (item->isEquipped() == Equipped_true) PlayerInfo::unequipItem(item, true); } } diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index b788039a9..0124152ee 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -741,8 +741,8 @@ void InventoryWindow::updateButtons(const Item *item) if (mUseButton) { const ItemInfo &info = item->getInfo(); - const std::string &str - = (item->isEquipment() == Equipm_true && item->isEquipped()) + const std::string &str = (item->isEquipment() == Equipm_true + && item->isEquipped() == Equipped_true) ? info.getUseButton2() : info.getUseButton(); if (str.empty()) { diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 6ffd857bc..1369a0686 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -339,7 +339,7 @@ void ItemAmountWindow::action(const ActionEvent &event) Damaged_true, Favorite_false, Equipm_false, - false); + Equipped_false); if (mUsage == ShopBuyAdd) mMax = 10000; diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 9c93b7474..096ab1c39 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -479,7 +479,7 @@ void NpcDialog::action(const ActionEvent &event) item->getDamaged(), item->getFavorite(), Equipm_false, - false); + Equipped_false); } } } diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index d73f86a05..3a0f26d64 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -281,7 +281,9 @@ void OutfitWindow::wearOutfit(const int outfit, const bool unwearEmpty, { const Item *const item = PlayerInfo::getInventory()->findItem( mItems[outfit][i], mItemColors[outfit][i]); - if (item && !item->isEquipped() && item->getQuantity()) + if (item + && item->isEquipped() == Equipped_false + && item->getQuantity()) { if (item->isEquipment() == Equipm_true) { @@ -516,7 +518,7 @@ void OutfitWindow::unequipNotInOutfit(const int outfit) const for (unsigned i = 0; i < invSize; i++) { const Item *const item = inventory->getItem(i); - if (item && item->isEquipped()) + if (item && item->isEquipped() == Equipped_true) { bool found = false; for (unsigned f = 0; f < OUTFIT_ITEM_COUNT; f++) @@ -632,7 +634,7 @@ void OutfitWindow::copyFromEquiped(const int dst) for (unsigned i = 0, sz = inventory->getSize(); i < sz; i++) { const Item *const item = inventory->getItem(i); - if (item && item->isEquipped()) + if (item && item->isEquipped() == Equipped_true) { mItems[dst][outfitCell] = item->getId(); mItemColors[dst][outfitCell++] = item->getColor(); diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 1dc1a9882..ef2897ccd 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -214,7 +214,7 @@ void TradeWindow::addItem(const int id, damaged, favorite, Equipm_false, - false); + Equipped_false); } void TradeWindow::addItem2(const int id, @@ -240,7 +240,7 @@ void TradeWindow::addItem2(const int id, damaged, favorite, equipment, - false); + Equipped_false); if (slot >= 0) inv->setCards(slot, cards, sz); } -- cgit v1.2.3-70-g09d2