summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/inventoryitem.h6
-rw-r--r--src/net/eathena/inventoryhandler.cpp35
-rw-r--r--src/net/eathena/tradehandler.cpp5
-rw-r--r--src/net/tmwa/inventoryhandler.cpp45
-rw-r--r--src/net/tmwa/tradehandler.cpp27
5 files changed, 86 insertions, 32 deletions
diff --git a/src/net/ea/inventoryitem.h b/src/net/ea/inventoryitem.h
index 6d059d081..5c0b86658 100644
--- a/src/net/ea/inventoryitem.h
+++ b/src/net/ea/inventoryitem.h
@@ -23,6 +23,8 @@
#ifndef NET_EA_INVENTORYITEM_H
#define NET_EA_INVENTORYITEM_H
+#include "enums/simpletypes.h"
+
#if defined(__GXX_EXPERIMENTAL_CXX0X__)
#include <cstdint>
#else
@@ -47,7 +49,7 @@ class InventoryItem final
int quantity;
uint8_t refine;
unsigned char color;
- bool identified;
+ Identified identified;
bool damaged;
bool favorite;
bool equip;
@@ -59,7 +61,7 @@ class InventoryItem final
const int quantity0,
const uint8_t refine0,
const unsigned char color0,
- const bool identified0,
+ const Identified identified0,
const bool damaged0,
const bool favorite0,
const bool equip0) :
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index bcf5806a5..0c6ef7141 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -25,6 +25,7 @@
#include "notifymanager.h"
#include "enums/equipslot.h"
+#include "enums/simpletypes.h"
#include "enums/being/attributes.h"
@@ -381,7 +382,9 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
if (inventory)
{
inventory->setItem(index, itemId, itemType, 1, refine,
- 1, flags.bits.isIdentified, flags.bits.isDamaged,
+ 1,
+ fromBool(flags.bits.isIdentified, Identified),
+ flags.bits.isDamaged,
flags.bits.isFavorite,
true, false);
inventory->setCards(index, cards, 4);
@@ -479,7 +482,9 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
amount += item->getQuantity();
inventory->setItem(index, itemId, itemType, amount, refine,
- 1, identified != 0, damaged != 0, false,
+ 1,
+ fromBool(identified, Identified),
+ damaged != 0, false,
equipType != 0, false);
inventory->setCards(index, cards, 4);
}
@@ -524,8 +529,10 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
if (inventory)
{
inventory->setItem(index, itemId, itemType, amount,
- 0, 1, flags.bits.isIdentified,
- flags.bits.isDamaged, flags.bits.isFavorite,
+ 0, 1,
+ fromBool(flags.bits.isIdentified, Identified),
+ flags.bits.isDamaged,
+ flags.bits.isFavorite,
false, false);
inventory->setCards(index, cards, 4);
}
@@ -558,7 +565,8 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg)
flags.byte = msg.readUInt8("flags");
mInventoryItems.push_back(Ea::InventoryItem(index, itemId, itemType,
- cards, amount, 0, 1, flags.bits.isIdentified,
+ cards, amount, 0, 1,
+ fromBool(flags.bits.isIdentified, Identified),
flags.bits.isDamaged, flags.bits.isFavorite, false));
}
BLOCK_END("InventoryHandler::processPlayerInventory")
@@ -656,7 +664,8 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
flags.byte = msg.readUInt8("flags");
mInventoryItems.push_back(Ea::InventoryItem(index, itemId, itemType,
- cards, amount, refine, 1, flags.bits.isIdentified,
+ cards, amount, refine, 1,
+ fromBool(flags.bits.isIdentified, Identified),
flags.bits.isDamaged, flags.bits.isFavorite, false));
}
BLOCK_END("InventoryHandler::processPlayerStorageEquip")
@@ -687,7 +696,9 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
if (mStorage)
{
mStorage->setItem(index, itemId, itemType, amount,
- refine, 1, identified != 0, false, false, false, false);
+ refine, 1,
+ fromBool(identified, Identified),
+ false, false, false, false);
mStorage->setCards(index, cards, 4);
}
}
@@ -826,7 +837,9 @@ void InventoryHandler::processPlayerCartAdd(Net::MessageIn &msg)
amount += item->getQuantity();
inventory->setItem(index, itemId, itemType, amount, refine,
- 1, identified != 0, false, false, false, false);
+ 1,
+ fromBool(identified, Identified),
+ false, false, false, false);
inventory->setCards(index, cards, 4);
}
BLOCK_END("InventoryHandler::processPlayerCartAdd")
@@ -856,7 +869,8 @@ void InventoryHandler::processPlayerCartEquip(Net::MessageIn &msg)
flags.byte = msg.readUInt8("flags");
mCartItems.push_back(Ea::InventoryItem(index, itemId, itemType,
- cards, amount, refine, 1, flags.bits.isIdentified,
+ cards, amount, refine, 1,
+ fromBool(flags.bits.isIdentified, Identified),
flags.bits.isDamaged, flags.bits.isFavorite, false));
}
BLOCK_END("InventoryHandler::processPlayerCartEquip")
@@ -885,7 +899,8 @@ void InventoryHandler::processPlayerCartItems(Net::MessageIn &msg)
flags.byte = msg.readUInt8("flags");
mCartItems.push_back(Ea::InventoryItem(index, itemId, itemType,
- cards, amount, 0, 1, flags.bits.isIdentified,
+ cards, amount, 0, 1,
+ fromBool(flags.bits.isIdentified, Identified),
flags.bits.isDamaged, flags.bits.isFavorite, false));
}
BLOCK_END("InventoryHandler::processPlayerCartItems")
diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp
index 5e1a95986..303ebd7c9 100644
--- a/src/net/eathena/tradehandler.cpp
+++ b/src/net/eathena/tradehandler.cpp
@@ -28,6 +28,8 @@
#include "being/playerinfo.h"
+#include "enums/simpletypes.h"
+
#include "gui/windows/tradewindow.h"
#include "net/eathena/messageout.h"
@@ -204,7 +206,8 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
tradeWindow->addItem2(type, itemType,
cards, 4,
false, amount,
- refine, 1, identify != 0,
+ refine, 1,
+ fromBool(identify, Identified),
false, false, false);
}
}
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index b0dcca900..efaff9567 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -25,6 +25,7 @@
#include "notifymanager.h"
#include "enums/equipslot.h"
+#include "enums/simpletypes.h"
#include "being/localplayer.h"
@@ -296,12 +297,16 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
if (serverFeatures->haveItemColors())
{
inventory->setItem(index, itemId, itemType, 1, refine,
- identified, true, false, false, true, false);
+ identified,
+ Identified_True,
+ false, false, true, false);
}
else
{
inventory->setItem(index, itemId, itemType, 1, refine,
- 1, identified != 0, false, false, true, false);
+ 1,
+ fromBool(identified, Identified),
+ false, false, true, false);
}
inventory->setCards(index, cards, 4);
}
@@ -398,12 +403,16 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
if (serverFeatures->haveItemColors())
{
inventory->setItem(index, itemId, type, amount, refine,
- identified, true, false, false, equipType != 0, false);
+ identified,
+ Identified_True,
+ false, false, equipType != 0, false);
}
else
{
inventory->setItem(index, itemId, type, amount, refine,
- 1, identified != 0, false, false, equipType != 0, false);
+ 1,
+ fromBool(identified, Identified),
+ false, false, equipType != 0, false);
}
inventory->setCards(index, cards, 4);
}
@@ -459,12 +468,16 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
if (serverFeatures->haveItemColors())
{
inventory->setItem(index, itemId, itemType, amount,
- 0, identified, true, false, false, isEquipment, false);
+ 0, identified,
+ Identified_True,
+ false, false, isEquipment, false);
}
else
{
inventory->setItem(index, itemId, itemType, amount,
- 0, 1, identified != 0, false, false, isEquipment, false);
+ 0, 1,
+ fromBool(identified, Identified),
+ false, false, isEquipment, false);
}
inventory->setCards(index, cards, 4);
}
@@ -504,13 +517,15 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg)
{
mInventoryItems.push_back(Ea::InventoryItem(index, itemId,
itemType, cards, amount, 0, identified,
- true, false, false, false));
+ Identified_True,
+ false, false, false));
}
else
{
mInventoryItems.push_back(Ea::InventoryItem(index, itemId,
itemType, cards, amount, 0, 1,
- identified != 0, false, false, false));
+ fromBool(identified, Identified),
+ false, false, false));
}
}
BLOCK_END("InventoryHandler::processPlayerInventory")
@@ -578,13 +593,15 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
if (serverFeatures->haveItemColors())
{
mInventoryItems.push_back(Ea::InventoryItem(index, itemId,
- itemType, cards, amount, refine, identified, true,
+ itemType, cards, amount, refine, identified,
+ Identified_True,
false, false, false));
}
else
{
mInventoryItems.push_back(Ea::InventoryItem(index, itemId,
- itemType, cards, amount, refine, 1, identified != 0,
+ itemType, cards, amount, refine, 1,
+ fromBool(identified, Identified),
false, false, false));
}
}
@@ -617,12 +634,16 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
if (serverFeatures->haveItemColors())
{
mStorage->setItem(index, itemId, 0, amount,
- refine, identified, true, false, false, false, false);
+ refine, identified,
+ Identified_True,
+ false, false, false, false);
}
else
{
mStorage->setItem(index, itemId, 0, amount,
- refine, 1, identified != 0, false, false, false, false);
+ refine, 1,
+ fromBool(identified, Identified),
+ false, false, false, false);
}
mStorage->setCards(index, cards, 4);
}
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index f16ee8c1f..53336bb24 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -29,6 +29,8 @@
#include "being/playerinfo.h"
#include "being/playerrelations.h"
+#include "enums/simpletypes.h"
+
#include "gui/windows/confirmdialog.h"
#include "gui/windows/tradewindow.h"
@@ -192,14 +194,18 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
tradeWindow->addItem2(type, 0,
cards, 4,
false, amount,
- refine, identify, true, false, false, false);
+ refine,
+ identify,
+ Identified_True, false, false, false);
}
else
{
tradeWindow->addItem2(type, 0,
cards, 4,
false, amount,
- refine, 1, identify != 0, false, false, false);
+ refine, 1,
+ fromBool(identify, Identified),
+ false, false, false);
}
}
}
@@ -228,11 +234,18 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
// Successfully added item
if (tradeWindow)
{
- tradeWindow->addItem2(item->getId(), item->getType(),
- item->getCards(), 4,
- true, quantity, item->getRefine(), item->getColor(),
- item->getIdentified(), item->getDamaged(),
- item->getFavorite(), item->isEquipment());
+ tradeWindow->addItem2(item->getId(),
+ item->getType(),
+ item->getCards(),
+ 4,
+ true,
+ quantity,
+ item->getRefine(),
+ item->getColor(),
+ item->getIdentified(),
+ item->getDamaged(),
+ item->getFavorite(),
+ item->isEquipment());
}
item->increaseQuantity(-quantity);
break;