From 067410031057ffc9bdb36b976bc2a658b23acb1b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 11 Feb 2015 00:20:57 +0300 Subject: Add typed bool type Favorite. --- src/beingequipbackend.cpp | 3 ++- src/enums/simpletypes.h | 1 + src/gui/windows/itemamountwindow.cpp | 3 ++- src/gui/windows/tradewindow.cpp | 4 ++-- src/gui/windows/tradewindow.h | 4 ++-- src/inventory.cpp | 4 ++-- src/inventory.h | 4 ++-- src/item.cpp | 2 +- src/item.h | 8 ++++---- src/net/ea/inventoryitem.h | 4 ++-- src/net/eathena/inventoryhandler.cpp | 21 ++++++++++++--------- src/net/eathena/tradehandler.cpp | 3 ++- src/net/tmwa/inventoryhandler.cpp | 36 ++++++++++++++++++++++++------------ src/net/tmwa/tradehandler.cpp | 6 ++++-- src/shopitem.cpp | 6 ++++-- 15 files changed, 66 insertions(+), 43 deletions(-) diff --git a/src/beingequipbackend.cpp b/src/beingequipbackend.cpp index ecd779cc4..7491eeec8 100644 --- a/src/beingequipbackend.cpp +++ b/src/beingequipbackend.cpp @@ -46,7 +46,8 @@ BeingEquipBackend::BeingEquipBackend(Being *const being) being->mSpriteColorsIds[f], Identified_true, Damaged_false, - false, true, true); + Favorite_false, + true, true); } } } diff --git a/src/enums/simpletypes.h b/src/enums/simpletypes.h index 26851ff0d..818d3e281 100644 --- a/src/enums/simpletypes.h +++ b/src/enums/simpletypes.h @@ -49,5 +49,6 @@ defBoolEnum(Identified); defBoolEnum(Damaged); +defBoolEnum(Favorite); #endif // ENUMS_SIMPLETYPES_H diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index b2f08db98..f4203092f 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -337,7 +337,8 @@ void ItemAmountWindow::action(const ActionEvent &event) mItem = new Item(id, 0, 10000, 0, 1, Identified_true, Damaged_true, - false, false, false); + Favorite_false, + false, false); if (mUsage == ShopBuyAdd) mMax = 10000; diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 042c11b74..41bde7c19 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -202,7 +202,7 @@ void TradeWindow::addItem(const int id, const unsigned char color, const Identified identified, const Damaged damaged, - const bool favorite) const + const Favorite favorite) const { Inventory *inv = own ? mMyInventory : mPartnerInventory; inv->addItem(id, type, quantity, refine, color, @@ -219,7 +219,7 @@ void TradeWindow::addItem2(const int id, const unsigned char color, const Identified identified, const Damaged damaged, - const bool favorite, + const Favorite favorite, const bool equipment) const { Inventory *inv = own ? mMyInventory : mPartnerInventory; diff --git a/src/gui/windows/tradewindow.h b/src/gui/windows/tradewindow.h index 153fb0259..89cf36a6a 100644 --- a/src/gui/windows/tradewindow.h +++ b/src/gui/windows/tradewindow.h @@ -77,7 +77,7 @@ class TradeWindow final : public Window, const unsigned char color, const Identified identified, const Damaged damaged, - const bool favorite) const; + const Favorite favorite) const; /** * Reset both item containers @@ -97,7 +97,7 @@ class TradeWindow final : public Window, const unsigned char color, const Identified identified, const Damaged damaged, - const bool favorite, + const Favorite favorite, const bool equipment) const; /** diff --git a/src/inventory.cpp b/src/inventory.cpp index 47c60bf1c..20731ad10 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -112,7 +112,7 @@ int Inventory::addItem(const int id, const uint8_t color, const Identified identified, const Damaged damaged, - const bool favorite, + const Favorite favorite, const bool equipment, const bool equipped) { @@ -130,7 +130,7 @@ void Inventory::setItem(const int index, const unsigned char color, const Identified identified, const Damaged damaged, - const bool favorite, + const Favorite favorite, const bool equipment, const bool equipped) { diff --git a/src/inventory.h b/src/inventory.h index 4225fc2ae..29cb6ad77 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -87,7 +87,7 @@ class Inventory final const unsigned char color, const Identified identified, const Damaged damaged, - const bool favorite, + const Favorite favorite, const bool equipment, const bool equipped); @@ -102,7 +102,7 @@ class Inventory final const unsigned char color, const Identified identified, const Damaged damaged, - const bool favorite, + const Favorite favorite, const bool equipment, const bool equipped); diff --git a/src/item.cpp b/src/item.cpp index a09b5afc8..07c33dc49 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -44,7 +44,7 @@ Item::Item(const int id, const unsigned char color, const Identified identified, const Damaged damaged, - const bool favorite, + const Favorite favorite, const bool equipment, const bool equipped) : mId(0), diff --git a/src/item.h b/src/item.h index 011a0da39..cd423ccf8 100644 --- a/src/item.h +++ b/src/item.h @@ -51,7 +51,7 @@ class Item notfinal const uint8_t color, const Identified identified, const Damaged damaged, - const bool favorite, + const Favorite favorite, const bool equipment, const bool equipped); @@ -188,10 +188,10 @@ class Item notfinal Damaged getDamaged() const A_WARN_UNUSED { return mDamaged; } - void setFavorite(const bool b) + void setFavorite(const Favorite b) { mFavorite = b; } - bool getFavorite() const A_WARN_UNUSED + Favorite getFavorite() const A_WARN_UNUSED { return mFavorite; } void setCard(const int index, const int id); @@ -226,7 +226,7 @@ class Item notfinal bool mInEquipment; /**< Item is in equipment */ Identified mIdentified; Damaged mDamaged; - bool mFavorite; + Favorite mFavorite; }; #endif // ITEM_H diff --git a/src/net/ea/inventoryitem.h b/src/net/ea/inventoryitem.h index dcd90b336..936e4a4ee 100644 --- a/src/net/ea/inventoryitem.h +++ b/src/net/ea/inventoryitem.h @@ -51,7 +51,7 @@ class InventoryItem final unsigned char color; Identified identified; Damaged damaged; - bool favorite; + Favorite favorite; bool equip; InventoryItem(const int slot0, @@ -63,7 +63,7 @@ class InventoryItem final const unsigned char color0, const Identified identified0, const Damaged damaged0, - const bool favorite0, + const Favorite favorite0, const bool equip0) : slot(slot0), id(id0), diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index f2d22ef14..162b69f2b 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -385,7 +385,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) 1, fromBool(flags.bits.isIdentified, Identified), fromBool(flags.bits.isDamaged, Damaged), - flags.bits.isFavorite, + fromBool(flags.bits.isFavorite, Favorite), true, false); inventory->setCards(index, cards, 4); } @@ -485,7 +485,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) 1, fromBool(identified, Identified), fromBool(damaged, Damaged), - false, + Favorite_false, equipType != 0, false); inventory->setCards(index, cards, 4); } @@ -533,7 +533,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg) 0, 1, fromBool(flags.bits.isIdentified, Identified), fromBool(flags.bits.isDamaged, Damaged), - flags.bits.isFavorite, + fromBool(flags.bits.isFavorite, Favorite), false, false); inventory->setCards(index, cards, 4); } @@ -569,7 +569,8 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg) cards, amount, 0, 1, fromBool(flags.bits.isIdentified, Identified), fromBool(flags.bits.isDamaged, Damaged), - flags.bits.isFavorite, false)); + fromBool(flags.bits.isFavorite, Favorite), + false)); } BLOCK_END("InventoryHandler::processPlayerInventory") } @@ -669,7 +670,7 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) cards, amount, refine, 1, fromBool(flags.bits.isIdentified, Identified), fromBool(flags.bits.isDamaged, Damaged), - flags.bits.isFavorite, + fromBool(flags.bits.isFavorite, Favorite), false)); } BLOCK_END("InventoryHandler::processPlayerStorageEquip") @@ -703,7 +704,8 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) refine, 1, fromBool(identified, Identified), Damaged_false, - false, false, false); + Favorite_false, + false, false); mStorage->setCards(index, cards, 4); } } @@ -845,7 +847,8 @@ void InventoryHandler::processPlayerCartAdd(Net::MessageIn &msg) 1, fromBool(identified, Identified), Damaged_false, - false, false, false); + Favorite_false, + false, false); inventory->setCards(index, cards, 4); } BLOCK_END("InventoryHandler::processPlayerCartAdd") @@ -878,7 +881,7 @@ void InventoryHandler::processPlayerCartEquip(Net::MessageIn &msg) cards, amount, refine, 1, fromBool(flags.bits.isIdentified, Identified), fromBool(flags.bits.isDamaged, Damaged), - flags.bits.isFavorite, + fromBool(flags.bits.isFavorite, Favorite), false)); } BLOCK_END("InventoryHandler::processPlayerCartEquip") @@ -910,7 +913,7 @@ void InventoryHandler::processPlayerCartItems(Net::MessageIn &msg) cards, amount, 0, 1, fromBool(flags.bits.isIdentified, Identified), fromBool(flags.bits.isDamaged, Damaged), - flags.bits.isFavorite, + fromBool(flags.bits.isFavorite, Favorite), false)); } BLOCK_END("InventoryHandler::processPlayerCartItems") diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp index 16819b802..d6240c580 100644 --- a/src/net/eathena/tradehandler.cpp +++ b/src/net/eathena/tradehandler.cpp @@ -209,7 +209,8 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) refine, 1, fromBool(identify, Identified), Damaged_false, - false, false); + Favorite_false, + false); } } } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 7c53612eb..45b9d47eb 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -300,7 +300,8 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) identified, Identified_true, Damaged_false, - false, true, false); + Favorite_false, + true, false); } else { @@ -308,7 +309,8 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) 1, fromBool(identified, Identified), Damaged_false, - false, true, false); + Favorite_false, + true, false); } inventory->setCards(index, cards, 4); } @@ -408,7 +410,8 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) identified, Identified_true, Damaged_false, - false, equipType != 0, false); + Favorite_false, + equipType != 0, false); } else { @@ -416,7 +419,8 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) 1, fromBool(identified, Identified), Damaged_false, - false, equipType != 0, false); + Favorite_false, + equipType != 0, false); } inventory->setCards(index, cards, 4); } @@ -475,7 +479,8 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg) 0, identified, Identified_true, Damaged_false, - false, isEquipment, false); + Favorite_false, + isEquipment, false); } else { @@ -483,7 +488,8 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg) 0, 1, fromBool(identified, Identified), Damaged_false, - false, isEquipment, false); + Favorite_false, + isEquipment, false); } inventory->setCards(index, cards, 4); } @@ -525,7 +531,8 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg) itemType, cards, amount, 0, identified, Identified_true, Damaged_false, - false, false)); + Favorite_false, + false)); } else { @@ -533,7 +540,8 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg) itemType, cards, amount, 0, 1, fromBool(identified, Identified), Damaged_false, - false, false)); + Favorite_false, + false)); } } BLOCK_END("InventoryHandler::processPlayerInventory") @@ -604,7 +612,8 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) itemType, cards, amount, refine, identified, Identified_true, Damaged_false, - false, false)); + Favorite_false, + false)); } else { @@ -612,7 +621,8 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) itemType, cards, amount, refine, 1, fromBool(identified, Identified), Damaged_false, - false, false)); + Favorite_false, + false)); } } BLOCK_END("InventoryHandler::processPlayerStorageEquip") @@ -647,7 +657,8 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) refine, identified, Identified_true, Damaged_false, - false, false, false); + Favorite_false, + false, false); } else { @@ -655,7 +666,8 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) refine, 1, fromBool(identified, Identified), Damaged_false, - false, false, false); + Favorite_false, + false, false); } mStorage->setCards(index, cards, 4); } diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 29575adbc..5411a59f5 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -198,7 +198,8 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) identify, Identified_true, Damaged_false, - false, false); + Favorite_false, + false); } else { @@ -208,7 +209,8 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) refine, 1, fromBool(identify, Identified), Damaged_false, - false, false); + Favorite_false, + false); } } } diff --git a/src/shopitem.cpp b/src/shopitem.cpp index 16df6026a..be7e232eb 100644 --- a/src/shopitem.cpp +++ b/src/shopitem.cpp @@ -41,7 +41,8 @@ ShopItem::ShopItem(const int inventoryIndex, Item(id, type, 0, 0, color, Identified_true, Damaged_false, - false, false, false), + Favorite_false, + false, false), mDisplayName(), mDuplicates(), mPrice(price), @@ -59,7 +60,8 @@ ShopItem::ShopItem(const int id, Item(id, type, 0, 0, color, Identified_true, Damaged_false, - false, false, false), + Favorite_false, + false, false), mDisplayName(), mDuplicates(), mPrice(price), -- cgit v1.2.3-70-g09d2