summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-20 18:43:00 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-20 18:43:00 +0300
commita9877525597aa94f1d974b8f45567b4168cf6c8e (patch)
tree56673d8e770302a2846f1d1db0db1a890bba95cd
parent2ce675592a1a96cc9960082485797045a921676d (diff)
downloadmv-a9877525597aa94f1d974b8f45567b4168cf6c8e.tar.gz
mv-a9877525597aa94f1d974b8f45567b4168cf6c8e.tar.bz2
mv-a9877525597aa94f1d974b8f45567b4168cf6c8e.tar.xz
mv-a9877525597aa94f1d974b8f45567b4168cf6c8e.zip
Remove item default parameters.
-rw-r--r--src/being/playerinfo.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp5
-rw-r--r--src/gui/windows/itemamountwindow.cpp2
-rw-r--r--src/gui/windows/npcdialog.cpp5
-rw-r--r--src/gui/windows/tradewindow.cpp13
-rw-r--r--src/inventory.cpp10
-rw-r--r--src/inventory.h5
-rw-r--r--src/item.h14
-rw-r--r--src/net/ea/inventoryhandler.cpp2
-rw-r--r--src/net/eathena/inventoryhandler.cpp8
-rw-r--r--src/net/tmwa/inventoryhandler.cpp8
-rw-r--r--src/shopitem.cpp4
12 files changed, 46 insertions, 32 deletions
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index 0000825fe..d76de03fc 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -216,7 +216,7 @@ void setInventoryItem(const int index, const int id,
if (itemType != ItemType::UNUSABLE && itemType != ItemType::USABLE)
equipment = true;
if (mInventory)
- mInventory->setItem(index, id, amount, refine, equipment);
+ mInventory->setItem(index, id, amount, refine, 1, equipment, false);
}
Equipment *getEquipment()
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 0ea19ea59..784fc56db 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -551,7 +551,10 @@ void ItemContainer::mouseReleased(MouseEvent &event)
inventory = PlayerInfo::getInventory();
const Item *const item = inventory->getItem(dragDrop.getTag());
if (item && !PlayerInfo::isItemProtected(item->getId()))
- mInventory->addItem(item->getId(), 1, 1, item->getColor());
+ {
+ mInventory->addItem(item->getId(), 1, 1, item->getColor(),
+ false, false);
+ }
return;
}
else if (src == DRAGDROP_SOURCE_NPC)
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index 03bb4feb1..975cbbd20 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -319,7 +319,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
const int id = ItemDB::get(mItemsModal->getElementAt(
mItemDropDown->getSelected())).getId();
- mItem = new Item(id, 10000);
+ mItem = new Item(id, 10000, 0, 1, false, false);
if (mUsage == ShopBuyAdd)
mMax = 10000;
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index cca950a66..c0551299b 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -466,7 +466,10 @@ void NpcDialog::action(const ActionEvent &event)
{
const Item *const item = inventoryWindow->getSelectedItem();
if (item)
- mInventory->addItem(item->getId(), 1, 1, item->getColor());
+ {
+ mInventory->addItem(item->getId(), 1, 1, item->getColor(),
+ false, false);
+ }
}
}
}
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index a3a6781ef..1f4325413 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -197,9 +197,9 @@ void TradeWindow::addItem(const int id,
const unsigned char color) const
{
if (own)
- mMyInventory->addItem(id, quantity, refine, color);
+ mMyInventory->addItem(id, quantity, refine, color, false, false);
else
- mPartnerInventory->addItem(id, quantity, refine, color);
+ mPartnerInventory->addItem(id, quantity, refine, color, false, false);
}
void TradeWindow::addItem2(const int id, const bool own, const int quantity,
@@ -207,9 +207,14 @@ void TradeWindow::addItem2(const int id, const bool own, const int quantity,
const bool equipment) const
{
if (own)
- mMyInventory->addItem(id, quantity, refine, color, equipment);
+ {
+ mMyInventory->addItem(id, quantity, refine, color, equipment, false);
+ }
else
- mPartnerInventory->addItem(id, quantity, refine, color, equipment);
+ {
+ mPartnerInventory->addItem(id, quantity, refine, color,
+ equipment, false);
+ }
}
void TradeWindow::changeQuantity(const int index, const bool own,
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 6656f2266..245927ce9 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -104,14 +104,15 @@ Item *Inventory::findItem(const int itemId, const unsigned char color) const
}
void Inventory::addItem(const int id, const int quantity, const uint8_t refine,
- const uint8_t color, const bool equipment)
+ const uint8_t color, const bool equipment,
+ const bool equipped)
{
- setItem(getFreeSlot(), id, quantity, refine, color, equipment);
+ setItem(getFreeSlot(), id, quantity, refine, color, equipment, equipped);
}
void Inventory::setItem(const int index, const int id, const int quantity,
const uint8_t refine, const unsigned char color,
- const bool equipment)
+ const bool equipment, const bool equipped)
{
if (index < 0 || index >= static_cast<int>(mSize))
{
@@ -122,7 +123,8 @@ void Inventory::setItem(const int index, const int id, const int quantity,
Item *const item1 = mItems[index];
if (!item1 && id > 0)
{
- Item *const item = new Item(id, quantity, refine, color, equipment);
+ Item *const item = new Item(id, quantity, refine, color,
+ equipment, equipped);
item->setInvIndex(index);
mItems[index] = item;
mUsed++;
diff --git a/src/inventory.h b/src/inventory.h
index 793c21286..702f6c4dd 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -88,14 +88,15 @@ class Inventory final
* Adds a new item in a free slot.
*/
void addItem(const int id, const int quantity, const uint8_t refine,
- const unsigned char color, const bool equipment = false);
+ const unsigned char color, const bool equipment,
+ const bool equipped);
/**
* Sets the item at the given position.
*/
void setItem(const int index, const int id, const int quantity,
const uint8_t refine, const unsigned char color,
- const bool equipment = false);
+ const bool equipment, const bool equipped);
/**
* Remove a item from the inventory.
diff --git a/src/item.h b/src/item.h
index 208be2cc6..be6820d2a 100644
--- a/src/item.h
+++ b/src/item.h
@@ -40,12 +40,12 @@ class Item notfinal
/**
* Constructor.
*/
- explicit Item(const int id = -1,
- const int quantity = 0,
- const uint8_t refine = 0,
- const uint8_t color = 1,
- const bool equipment = false,
- const bool equipped = false);
+ Item(const int id,
+ const int quantity,
+ const uint8_t refine,
+ const uint8_t color,
+ const bool equipment,
+ const bool equipped);
A_DELETE_COPY(Item)
@@ -55,7 +55,7 @@ class Item notfinal
virtual ~Item();
/**
- * Sets the item id, identifying the item type.
+ * Sets the item id, color the item type.
*/
void setId(const int id, const unsigned char color);
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index f4250efc5..dbfcf2b98 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -279,7 +279,7 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg)
FOR_EACH (Ea::InventoryItems::const_iterator, it, mInventoryItems)
{
mStorage->setItem((*it).slot, (*it).id, (*it).quantity,
- (*it).refine, (*it).color, (*it).equip);
+ (*it).refine, (*it).color, (*it).equip, false);
}
mInventoryItems.clear();
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index cf46a95d8..1e0ccd072 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -326,7 +326,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
if (inventory)
{
inventory->setItem(index, itemId, 1, refine,
- 1, true);
+ 1, true, false);
}
if (equipType)
@@ -422,7 +422,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
amount += item->getQuantity();
inventory->setItem(index, itemId, amount, refine,
- 1, equipType != 0);
+ 1, equipType != 0, false);
}
ArrowsListener::distributeEvent();
}
@@ -466,7 +466,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
if (inventory)
{
inventory->setItem(index, itemId, amount,
- 0, 1, false);
+ 0, 1, false, false);
}
}
BLOCK_END("InventoryHandler::processPlayerInventory")
@@ -627,7 +627,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
if (mStorage)
{
mStorage->setItem(index, itemId, amount,
- refine, 1, false);
+ refine, 1, false, false);
}
}
BLOCK_END("InventoryHandler::processPlayerStorageAdd")
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 6cd74da5a..2620fd1cc 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -272,7 +272,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
if (inventory)
{
inventory->setItem(index, itemId, 1, refine,
- identified, true);
+ identified, true, false);
}
if (equipType)
@@ -367,7 +367,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
identified = 1;
inventory->setItem(index, itemId, amount, refine,
- identified, equipType != 0);
+ identified, equipType != 0, false);
}
ArrowsListener::distributeEvent();
}
@@ -422,7 +422,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
if (inventory)
{
inventory->setItem(index, itemId, amount,
- 0, identified, isEquipment);
+ 0, identified, isEquipment, false);
}
}
BLOCK_END("InventoryHandler::processPlayerInventory")
@@ -559,7 +559,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
identified = 1;
mStorage->setItem(index, itemId, amount,
- refine, identified, false);
+ refine, identified, false, false);
}
}
BLOCK_END("InventoryHandler::processPlayerStorageAdd")
diff --git a/src/shopitem.cpp b/src/shopitem.cpp
index 383f96a03..814b99330 100644
--- a/src/shopitem.cpp
+++ b/src/shopitem.cpp
@@ -35,7 +35,7 @@
ShopItem::ShopItem(const int inventoryIndex, const int id,
const unsigned char color,
const int quantity, const int price) :
- Item(id, 0, 0, color),
+ Item(id, 0, 0, color, false, false),
mDisplayName(),
mDuplicates(),
mPrice(price),
@@ -47,7 +47,7 @@ ShopItem::ShopItem(const int inventoryIndex, const int id,
}
ShopItem::ShopItem(const int id, const unsigned char color, const int price) :
- Item(id, 0, 0, color),
+ Item(id, 0, 0, color, false, false),
mDisplayName(),
mDuplicates(),
mPrice(price),