summaryrefslogtreecommitdiff
path: root/src/net/tmwa/inventoryhandler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa/inventoryhandler.h')
-rw-r--r--src/net/tmwa/inventoryhandler.h33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h
index 0c4ad092..dfbefaa8 100644
--- a/src/net/tmwa/inventoryhandler.h
+++ b/src/net/tmwa/inventoryhandler.h
@@ -24,7 +24,8 @@
#include "equipment.h"
#include "inventory.h"
-#include "localplayer.h"
+#include "listener.h"
+#include "playerinfo.h"
#include "gui/inventorywindow.h"
@@ -51,7 +52,7 @@ class EquipBackend : public Equipment::Backend {
{
return NULL;
}
- return player_node->getInventory()->getItem(invyIndex);
+ return PlayerInfo::getInventory()->getItem(invyIndex);
}
void clear()
@@ -60,7 +61,7 @@ class EquipBackend : public Equipment::Backend {
{
if (mEquipment[i] != -1)
{
- Item* item = player_node->getInventory()->getItem(i);
+ Item* item = PlayerInfo::getInventory()->getItem(i);
if (item)
{
item->setEquipped(false);
@@ -74,7 +75,7 @@ class EquipBackend : public Equipment::Backend {
void setEquipment(int index, int inventoryIndex)
{
// Unequip existing item
- Item* item = player_node->getInventory()->getItem(mEquipment[index]);
+ Item* item = PlayerInfo::getInventory()->getItem(mEquipment[index]);
if (item)
{
item->setEquipped(false);
@@ -82,7 +83,7 @@ class EquipBackend : public Equipment::Backend {
mEquipment[index] = inventoryIndex;
- item = player_node->getInventory()->getItem(inventoryIndex);
+ item = PlayerInfo::getInventory()->getItem(inventoryIndex);
if (item)
{
item->setEquipped(true);
@@ -117,7 +118,8 @@ class InventoryItem
typedef std::list<InventoryItem> InventoryItems;
-class InventoryHandler : public MessageHandler, public Net::InventoryHandler
+class InventoryHandler : public MessageHandler, public Net::InventoryHandler,
+ public Mana::Listener
{
public:
enum {
@@ -131,27 +133,10 @@ class InventoryHandler : public MessageHandler, public Net::InventoryHandler
void handleMessage(Net::MessageIn &msg);
- void equipItem(const Item *item);
-
- void unequipItem(const Item *item);
-
- void useItem(const Item *item);
-
- void dropItem(const Item *item, int amount);
+ void event(Channels channel, const Mana::Event &event);
bool canSplit(const Item *item);
- void splitItem(const Item *item, int amount);
-
- void moveItem(int oldIndex, int newIndex);
-
- void openStorage(int type);
-
- void closeStorage(int type);
-
- void moveItem(int source, int slot, int amount,
- int destination);
-
size_t getSize(int type) const;
private: