summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being/localplayer.cpp8
-rw-r--r--src/being/playerinfo.cpp4
-rw-r--r--src/beingequipbackend.cpp2
-rw-r--r--src/enums/simpletypes.h1
-rw-r--r--src/gui/popups/popupmenu.cpp4
-rw-r--r--src/gui/widgets/itemcontainer.cpp6
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp6
-rw-r--r--src/gui/widgets/virtshortcutcontainer.cpp4
-rw-r--r--src/gui/windows/equipmentwindow.cpp6
-rw-r--r--src/gui/windows/inventorywindow.cpp4
-rw-r--r--src/gui/windows/itemamountwindow.cpp2
-rw-r--r--src/gui/windows/npcdialog.cpp2
-rw-r--r--src/gui/windows/outfitwindow.cpp8
-rw-r--r--src/gui/windows/tradewindow.cpp4
-rw-r--r--src/inventory.cpp4
-rw-r--r--src/inventory.h4
-rw-r--r--src/item.cpp2
-rw-r--r--src/item.h8
-rw-r--r--src/itemshortcut.cpp4
-rw-r--r--src/net/ea/buysellhandler.cpp2
-rw-r--r--src/net/ea/equipbackend.h6
-rw-r--r--src/net/ea/inventoryhandler.cpp2
-rw-r--r--src/net/eathena/inventoryhandler.cpp12
-rw-r--r--src/net/tmwa/inventoryhandler.cpp16
-rw-r--r--src/shopitem.cpp4
25 files changed, 64 insertions, 61 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 17ee2d823..02c63bf97 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -1291,7 +1291,7 @@ void LocalPlayer::changeEquipmentBeforeAttack(const Being *const target) const
return;
// if sword not equiped
- if (!item->isEquipped())
+ if (item->isEquipped() == Equipped_false)
PlayerInfo::equipItem(item, true);
// if need equip shield too
@@ -1305,7 +1305,7 @@ void LocalPlayer::changeEquipmentBeforeAttack(const Being *const target) const
if (item)
break;
}
- if (item && !item->isEquipped())
+ if (item && item->isEquipped() == Equipped_false)
PlayerInfo::equipItem(item, true);
}
}
@@ -1325,7 +1325,7 @@ void LocalPlayer::changeEquipmentBeforeAttack(const Being *const target) const
if (!item)
return;
- if (!item->isEquipped())
+ if (item->isEquipped() == Equipped_false)
PlayerInfo::equipItem(item, true);
}
}
@@ -2950,7 +2950,7 @@ void LocalPlayer::imitateOutfit(const Being *const player,
// logger->log("idPath: " + path);
const Item *const item = inv->findItemBySprite(path,
player->getGender(), player->getSubType());
- if (item && !item->isEquipped())
+ if (item && item->isEquipped() == Equipped_false)
PlayerInfo::equipItem(item, false);
}
else
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index 5b2b60433..892c5bba9 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -265,7 +265,7 @@ void useEquipItem(const Item *const item, const bool sfx)
{
if (item->isEquipment() == Equipm_true)
{
- if (item->isEquipped())
+ if (item->isEquipped() == Equipped_true)
{
if (sfx)
ItemSoundManager::playSfx(item, ItemSoundEvent::UNEQUIP);
@@ -296,7 +296,7 @@ void useEquipItem2(const Item *const item, const bool sfx)
{
if (item->isEquipment() == Equipm_false)
{
- if (item->isEquipped())
+ if (item->isEquipped() == Equipped_true)
{
if (sfx)
ItemSoundManager::playSfx(item, ItemSoundEvent::UNEQUIP);
diff --git a/src/beingequipbackend.cpp b/src/beingequipbackend.cpp
index 106f7edb9..0672ba5d3 100644
--- a/src/beingequipbackend.cpp
+++ b/src/beingequipbackend.cpp
@@ -48,7 +48,7 @@ BeingEquipBackend::BeingEquipBackend(Being *const being)
Damaged_false,
Favorite_false,
Equipm_true,
- true);
+ Equipped_true);
}
}
}
diff --git a/src/enums/simpletypes.h b/src/enums/simpletypes.h
index a377ae003..9dfd53eea 100644
--- a/src/enums/simpletypes.h
+++ b/src/enums/simpletypes.h
@@ -51,5 +51,6 @@ defBoolEnum(Identified);
defBoolEnum(Damaged);
defBoolEnum(Favorite);
defBoolEnum(Equipm);
+defBoolEnum(Equipped);
#endif // ENUMS_SIMPLETYPES_H
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 47334c407..188c8ae9a 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2554,8 +2554,8 @@ void PopupMenu::addProtection()
void PopupMenu::addUseDrop(const Item *const item, const bool isProtected)
{
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/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index dfb5a94cf..0bb8c50f3 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -317,13 +317,13 @@ void ItemContainer::draw(Graphics *graphics)
{
caption = toString(item->getQuantity());
}
- else if (item->isEquipped())
+ else if (item->isEquipped() == Equipped_true)
{
// TRANSLATORS: Text under equipped items (should be small)
caption = _("Eq.");
}
- if (item->isEquipped())
+ if (item->isEquipped() == Equipped_true)
graphics->setColorAll(mEquipedColor, mEquipedColor2);
else
graphics->setColorAll(mUnEquipedColor, mUnEquipedColor2);
@@ -600,7 +600,7 @@ void ItemContainer::mouseReleased(MouseEvent &event)
item->getDamaged(),
item->getFavorite(),
Equipm_false,
- false);
+ Equipped_false);
}
return;
}
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 24dbee2aa..c11a83f8c 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -142,12 +142,12 @@ void ItemShortcutContainer::draw(Graphics *graphics)
std::string caption;
if (item->getQuantity() > 1)
caption = toString(item->getQuantity());
- else if (item->isEquipped())
- caption = "Eq.";
+ else if (item->isEquipped() == Equipped_true)
+ caption = "Eq.";
image->setAlpha(1.0F);
graphics->drawImage(image, itemX, itemY);
- if (item->isEquipped())
+ if (item->isEquipped() == Equipped_true)
{
graphics->setColorAll(mEquipedColor, mEquipedColor2);
}
diff --git a/src/gui/widgets/virtshortcutcontainer.cpp b/src/gui/widgets/virtshortcutcontainer.cpp
index 75e3391c7..b735f962e 100644
--- a/src/gui/widgets/virtshortcutcontainer.cpp
+++ b/src/gui/widgets/virtshortcutcontainer.cpp
@@ -117,12 +117,12 @@ void VirtShortcutContainer::draw(Graphics *graphics)
std::string caption;
if (item->getQuantity() > 1)
caption = toString(item->getQuantity());
- else if (item->isEquipped())
+ else if (item->isEquipped() == Equipped_true)
caption = "Eq.";
image->setAlpha(1.0F);
graphics->drawImage(image, itemX, itemY);
- if (item->isEquipped())
+ if (item->isEquipped() == Equipped_true)
graphics->setColorAll(mEquipedColor, mEquipedColor2);
else
graphics->setColorAll(mUnEquipedColor, mUnEquipedColor2);
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);
}
diff --git a/src/inventory.cpp b/src/inventory.cpp
index dc5e59717..79816fae5 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -114,7 +114,7 @@ int Inventory::addItem(const int id,
const Damaged damaged,
const Favorite favorite,
const Equipm equipment,
- const bool equipped)
+ const Equipped equipped)
{
const int slot = getFreeSlot();
setItem(slot, id, type, quantity, refine, color,
@@ -132,7 +132,7 @@ void Inventory::setItem(const int index,
const Damaged damaged,
const Favorite favorite,
const Equipm equipment,
- const bool equipped)
+ const Equipped equipped)
{
if (index < 0 || index >= static_cast<int>(mSize))
{
diff --git a/src/inventory.h b/src/inventory.h
index d5045c941..575ee9f55 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -89,7 +89,7 @@ class Inventory final
const Damaged damaged,
const Favorite favorite,
const Equipm equipment,
- const bool equipped);
+ const Equipped equipped);
/**
* Sets the item at the given position.
@@ -104,7 +104,7 @@ class Inventory final
const Damaged damaged,
const Favorite favorite,
const Equipm equipment,
- const bool equipped);
+ const Equipped equipped);
void setCards(const int index,
const int *const cards,
diff --git a/src/item.cpp b/src/item.cpp
index bd4cb25de..276a2f49a 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -46,7 +46,7 @@ Item::Item(const int id,
const Damaged damaged,
const Favorite favorite,
const Equipm equipment,
- const bool equipped) :
+ const Equipped equipped) :
mId(0),
mColor(0),
mQuantity(quantity),
diff --git a/src/item.h b/src/item.h
index 1581bb993..f5adf31c8 100644
--- a/src/item.h
+++ b/src/item.h
@@ -53,7 +53,7 @@ class Item notfinal
const Damaged damaged,
const Favorite favorite,
const Equipm equipment,
- const bool equipped);
+ const Equipped equipped);
A_DELETE_COPY(Item)
@@ -112,13 +112,13 @@ class Item notfinal
/**
* Sets whether this item is equipped.
*/
- void setEquipped(const bool equipped)
+ void setEquipped(const Equipped equipped)
{ mEquipped = equipped; }
/**
* Returns whether this item is equipped.
*/
- bool isEquipped() const A_WARN_UNUSED
+ Equipped isEquipped() const A_WARN_UNUSED
{ return mEquipped; }
/**
@@ -222,7 +222,7 @@ class Item notfinal
int mInvIndex; /**< Inventory index. */
int mType; /**< Item type. */
Equipm mEquipment; /**< Item is equipment. */
- bool mEquipped; /**< Item is equipped. */
+ Equipped mEquipped; /**< Item is equipped. */
bool mInEquipment; /**< Item is in equipment */
Identified mIdentified;
Damaged mDamaged;
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index f2c5e92c0..4e0e53f36 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -159,7 +159,7 @@ void ItemShortcut::equipItem(const int index) const
{
if (item->isEquipment() == Equipm_true)
{
- if (!item->isEquipped())
+ if (item->isEquipped() == Equipped_false)
PlayerInfo::equipItem(item, true);
}
}
@@ -179,7 +179,7 @@ void ItemShortcut::unequipItem(const int index) const
{
if (item->isEquipment() == Equipm_true)
{
- if (item->isEquipped())
+ if (item->isEquipped() == Equipped_true)
PlayerInfo::unequipItem(item, true);
}
}
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp
index 11785fec0..537a741ea 100644
--- a/src/net/ea/buysellhandler.cpp
+++ b/src/net/ea/buysellhandler.cpp
@@ -162,7 +162,7 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg)
const Item *const item = PlayerInfo::getInventory()
->getItem(index);
- if (item && !(item->isEquipped()))
+ if (item && item->isEquipped() == Equipped_false)
dialog->addItem(item, value);
}
}
diff --git a/src/net/ea/equipbackend.h b/src/net/ea/equipbackend.h
index 6f09e8e9c..3b3297315 100644
--- a/src/net/ea/equipbackend.h
+++ b/src/net/ea/equipbackend.h
@@ -67,7 +67,7 @@ class EquipBackend final : public Equipment::Backend
{
Item* item = inv->getItem(i);
if (item)
- item->setEquipped(false);
+ item->setEquipped(Equipped_false);
}
mEquipment[i] = -1;
@@ -87,14 +87,14 @@ class EquipBackend final : public Equipment::Backend
Item *item = inv->getItem(mEquipment[index]);
if (item)
- item->setEquipped(false);
+ item->setEquipped(Equipped_false);
// not checking index because it must be safe
mEquipment[index] = inventoryIndex;
item = inv->getItem(inventoryIndex);
if (item)
- item->setEquipped(true);
+ item->setEquipped(Equipped_true);
if (inventoryWindow)
inventoryWindow->updateButtons();
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index e81b0a490..026359d76 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -262,7 +262,7 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg)
(*it).damaged,
(*it).favorite,
(*it).equip,
- false);
+ Equipped_false);
}
mInventoryItems.clear();
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index 835b341a8..9f22b34ff 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -387,7 +387,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
Equipm_true,
- false);
+ Equipped_false);
inventory->setCards(index, cards, 4);
}
@@ -488,7 +488,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
fromBool(damaged, Damaged),
Favorite_false,
fromBool(equipType, Equipm),
- false);
+ Equipped_false);
inventory->setCards(index, cards, 4);
}
ArrowsListener::distributeEvent();
@@ -537,7 +537,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
Equipm_false,
- false);
+ Equipped_false);
inventory->setCards(index, cards, 4);
}
}
@@ -709,7 +709,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
Damaged_false,
Favorite_false,
Equipm_false,
- false);
+ Equipped_false);
mStorage->setCards(index, cards, 4);
}
}
@@ -813,7 +813,7 @@ void InventoryHandler::processCartInfo(Net::MessageIn &msg)
(*it).damaged,
(*it).favorite,
(*it).equip,
- false);
+ Equipped_false);
}
mCartItems.clear();
}
@@ -853,7 +853,7 @@ void InventoryHandler::processPlayerCartAdd(Net::MessageIn &msg)
Damaged_false,
Favorite_false,
Equipm_false,
- false);
+ Equipped_false);
inventory->setCards(index, cards, 4);
}
BLOCK_END("InventoryHandler::processPlayerCartAdd")
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 0d0611122..ea8a912b7 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -302,7 +302,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
Damaged_false,
Favorite_false,
Equipm_true,
- false);
+ Equipped_false);
}
else
{
@@ -312,7 +312,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
Damaged_false,
Favorite_false,
Equipm_true,
- false);
+ Equipped_false);
}
inventory->setCards(index, cards, 4);
}
@@ -414,7 +414,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
Damaged_false,
Favorite_false,
fromBool(equipType, Equipm),
- false);
+ Equipped_false);
}
else
{
@@ -424,7 +424,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
Damaged_false,
Favorite_false,
fromBool(equipType, Equipm),
- false);
+ Equipped_false);
}
inventory->setCards(index, cards, 4);
}
@@ -485,7 +485,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
Damaged_false,
Favorite_false,
fromBool(isEquipment, Equipm),
- false);
+ Equipped_false);
}
else
{
@@ -495,7 +495,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
Damaged_false,
Favorite_false,
fromBool(isEquipment, Equipm),
- false);
+ Equipped_false);
}
inventory->setCards(index, cards, 4);
}
@@ -665,7 +665,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
Damaged_false,
Favorite_false,
Equipm_false,
- false);
+ Equipped_false);
}
else
{
@@ -675,7 +675,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
Damaged_false,
Favorite_false,
Equipm_false,
- false);
+ Equipped_false);
}
mStorage->setCards(index, cards, 4);
}
diff --git a/src/shopitem.cpp b/src/shopitem.cpp
index 227d1d1b2..2b9923eb7 100644
--- a/src/shopitem.cpp
+++ b/src/shopitem.cpp
@@ -43,7 +43,7 @@ ShopItem::ShopItem(const int inventoryIndex,
Damaged_false,
Favorite_false,
Equipm_false,
- false),
+ Equipped_false),
mDisplayName(),
mDuplicates(),
mPrice(price),
@@ -63,7 +63,7 @@ ShopItem::ShopItem(const int id,
Damaged_false,
Favorite_false,
Equipm_false,
- false),
+ Equipped_false),
mDisplayName(),
mDuplicates(),
mPrice(price),