summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-24 23:29:04 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-24 23:29:04 +0300
commit4e97da8e138b21a5f5bea75e6a8d3211e4f28594 (patch)
treec10d3cad963066a908ebd42041723e110a0c9bf0 /src/net/tmwa
parentca0ca278d0c4aed9a6d50bb9a8982f5261151ab8 (diff)
downloadmanaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.gz
manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.bz2
manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.xz
manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.zip
Add enum for item types.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/buysellrecv.cpp2
-rw-r--r--src/net/tmwa/inventoryrecv.cpp30
-rw-r--r--src/net/tmwa/itemrecv.cpp4
-rw-r--r--src/net/tmwa/markethandler.cpp2
-rw-r--r--src/net/tmwa/markethandler.h2
-rw-r--r--src/net/tmwa/traderecv.cpp2
6 files changed, 24 insertions, 18 deletions
diff --git a/src/net/tmwa/buysellrecv.cpp b/src/net/tmwa/buysellrecv.cpp
index 13027d1f2..625cb2a14 100644
--- a/src/net/tmwa/buysellrecv.cpp
+++ b/src/net/tmwa/buysellrecv.cpp
@@ -54,7 +54,7 @@ void BuySellRecv::processNpcBuy(Net::MessageIn &msg)
{
const int value = msg.readInt32("price");
msg.readInt32("dc value?");
- const int type = msg.readUInt8("type");
+ const ItemTypeT type = fromInt(msg.readUInt8("type"), ItemTypeT);
const int itemId = msg.readInt16("item id");
const ItemColor color = ItemColor_one;
Ea::BuySellRecv::mBuyDialog->addItem(itemId, type, color, 0, value);
diff --git a/src/net/tmwa/inventoryrecv.cpp b/src/net/tmwa/inventoryrecv.cpp
index 6e1fe0cfe..605f08bbe 100644
--- a/src/net/tmwa/inventoryrecv.cpp
+++ b/src/net/tmwa/inventoryrecv.cpp
@@ -93,9 +93,10 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
{
const int index = msg.readInt16("index") - INVENTORY_OFFSET;
const int itemId = msg.readInt16("item id");
- const uint8_t itemType = msg.readUInt8("item type");
+ const ItemTypeT itemType = fromInt(
+ msg.readUInt8("item type"),
+ ItemTypeT);
const uint8_t identified = msg.readUInt8("identify");
-
msg.readInt16("equip type?");
const int equipType = msg.readInt16("equip type");
msg.readUInt8("attribute");
@@ -107,7 +108,7 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
if (Ea::InventoryRecv::mDebugInventory)
{
logger->log("Index: %d, ID: %d, Type: %d, Identified: %d",
- index, itemId, itemType, identified);
+ index, itemId, CAST_S32(itemType), identified);
}
if (inventory)
@@ -158,8 +159,7 @@ void InventoryRecv::processPlayerInventoryAdd(Net::MessageIn &msg)
for (int f = 0; f < maxCards; f++)
cards[f] = msg.readInt16("card");
const int equipType = msg.readInt16("equip type");
- const int type = msg.readUInt8("item type");
-
+ const ItemTypeT type = fromInt(msg.readUInt8("item type"), ItemTypeT);
const ItemInfo &itemInfo = ItemDB::get(itemId);
const unsigned char err = msg.readUInt8("status");
BeingId floorId;
@@ -270,7 +270,9 @@ void InventoryRecv::processPlayerInventory(Net::MessageIn &msg)
int cards[maxCards];
const int index = msg.readInt16("index") - INVENTORY_OFFSET;
const int itemId = msg.readInt16("item id");
- const uint8_t itemType = msg.readUInt8("item type");
+ const ItemTypeT itemType = fromInt(
+ msg.readUInt8("item type"),
+ ItemTypeT);
const uint8_t identified = msg.readUInt8("identified");
const int amount = msg.readInt16("amount");
const int arrow = msg.readInt16("arrow");
@@ -281,7 +283,7 @@ void InventoryRecv::processPlayerInventory(Net::MessageIn &msg)
{
logger->log("Index: %d, ID: %d, Type: %d, Identified: %d, "
"Qty: %d, Cards: %d, %d, %d, %d",
- index, itemId, itemType, identified, amount,
+ index, itemId, CAST_S32(itemType), identified, amount,
cards[0], cards[1], cards[2], cards[3]);
}
@@ -320,7 +322,9 @@ void InventoryRecv::processPlayerStorage(Net::MessageIn &msg)
int cards[maxCards];
const int index = msg.readInt16("index") - STORAGE_OFFSET;
const int itemId = msg.readInt16("item id");
- const uint8_t itemType = msg.readUInt8("item type");
+ const ItemTypeT itemType = fromInt(
+ msg.readUInt8("item type"),
+ ItemTypeT);
const uint8_t identified = msg.readUInt8("identified");
const int amount = msg.readInt16("amount");
msg.readInt16("arrow");
@@ -331,7 +335,7 @@ void InventoryRecv::processPlayerStorage(Net::MessageIn &msg)
{
logger->log("Index: %d, ID: %d, Type: %d, Identified: %d, "
"Qty: %d, Cards: %d, %d, %d, %d",
- index, itemId, itemType, identified, amount,
+ index, itemId, CAST_S32(itemType), identified, amount,
cards[0], cards[1], cards[2], cards[3]);
}
@@ -400,7 +404,9 @@ void InventoryRecv::processPlayerStorageEquip(Net::MessageIn &msg)
int cards[maxCards];
const int index = msg.readInt16("index") - STORAGE_OFFSET;
const int itemId = msg.readInt16("item id");
- const uint8_t itemType = msg.readUInt8("item type");
+ const ItemTypeT itemType = fromInt(
+ msg.readUInt8("item type"),
+ ItemTypeT);
const uint8_t identified = msg.readUInt8("identified");
const int amount = 1;
msg.readInt16("equip point?");
@@ -414,7 +420,7 @@ void InventoryRecv::processPlayerStorageEquip(Net::MessageIn &msg)
{
logger->log("Index: %d, ID: %d, Type: %d, Identified: %u, "
"Qty: %d, Cards: %d, %d, %d, %d, Refine: %u",
- index, itemId, itemType,
+ index, itemId, CAST_S32(itemType),
CAST_U32(identified), amount,
cards[0], cards[1], cards[2], cards[3],
CAST_U32(refine));
@@ -461,7 +467,7 @@ void InventoryRecv::processPlayerStorageAdd(Net::MessageIn &msg)
{
Ea::InventoryRecv::mStorage->setItem(index,
itemId,
- 0,
+ ItemType::Unknown,
amount,
refine,
ItemColor_one,
diff --git a/src/net/tmwa/itemrecv.cpp b/src/net/tmwa/itemrecv.cpp
index d7038942d..041bf5af7 100644
--- a/src/net/tmwa/itemrecv.cpp
+++ b/src/net/tmwa/itemrecv.cpp
@@ -47,7 +47,7 @@ void ItemRecv::processItemDropped(Net::MessageIn &msg)
actorManager->createItem(id,
itemId,
x, y,
- 0,
+ ItemType::Unknown,
amount,
0,
ItemColor_one,
@@ -75,7 +75,7 @@ void ItemRecv::processItemVisible(Net::MessageIn &msg)
actorManager->createItem(id,
itemId,
x, y,
- 0,
+ ItemType::Unknown,
amount,
0,
ItemColor_one,
diff --git a/src/net/tmwa/markethandler.cpp b/src/net/tmwa/markethandler.cpp
index ecab3790e..7c29d042d 100644
--- a/src/net/tmwa/markethandler.cpp
+++ b/src/net/tmwa/markethandler.cpp
@@ -37,7 +37,7 @@ void MarketHandler::close() const
}
void MarketHandler::buyItem(const int itemId A_UNUSED,
- const int type A_UNUSED,
+ const ItemTypeT type A_UNUSED,
const ItemColor color A_UNUSED,
const int amount A_UNUSED) const
{
diff --git a/src/net/tmwa/markethandler.h b/src/net/tmwa/markethandler.h
index 7c99bd164..a9dac7519 100644
--- a/src/net/tmwa/markethandler.h
+++ b/src/net/tmwa/markethandler.h
@@ -37,7 +37,7 @@ class MarketHandler final : public Net::MarketHandler
void close() const override final A_CONST;
void buyItem(const int itemId,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int amount) const override final A_CONST;
diff --git a/src/net/tmwa/traderecv.cpp b/src/net/tmwa/traderecv.cpp
index 393502273..f68bee9f5 100644
--- a/src/net/tmwa/traderecv.cpp
+++ b/src/net/tmwa/traderecv.cpp
@@ -77,7 +77,7 @@ void TradeRecv::processTradeItemAdd(Net::MessageIn &msg)
else
{
tradeWindow->addItem2(type,
- 0,
+ ItemType::Unknown,
cards,
4,
false,