diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-04-09 15:48:51 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-06-02 16:41:35 +0200 |
commit | c2eab288ecc7d7c5e26d02ccecf285cbc0c218ed (patch) | |
tree | 37b755bc559a40209291e5ed4961de36fc7788dd /src/net/manaserv/inventoryhandler.h | |
parent | c5390a30868f7eb3b5337963dba20911ea7dc6ea (diff) | |
download | mana-c2eab288ecc7d7c5e26d02ccecf285cbc0c218ed.tar.gz mana-c2eab288ecc7d7c5e26d02ccecf285cbc0c218ed.tar.bz2 mana-c2eab288ecc7d7c5e26d02ccecf285cbc0c218ed.tar.xz mana-c2eab288ecc7d7c5e26d02ccecf285cbc0c218ed.zip |
Some work on the manaserv equipment backend
Currently the same equipment window is used as for tmwAthena so that at
least something is visible. This means the location of equipped items is
currently illogical.
It is now possible to equip and unequip items.
Mantis-issue: 164
Reviewed-by: Stefan Dombrowski
Diffstat (limited to 'src/net/manaserv/inventoryhandler.h')
-rw-r--r-- | src/net/manaserv/inventoryhandler.h | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h index 2733f3da..255f601c 100644 --- a/src/net/manaserv/inventoryhandler.h +++ b/src/net/manaserv/inventoryhandler.h @@ -29,33 +29,35 @@ #include "net/manaserv/messagehandler.h" +#include <vector> + namespace ManaServ { -class EquipBackend : public Equipment::Backend +class EquipBackend : public Equipment::Backend, public EventListener { public: - EquipBackend() - { memset(mEquipment, 0, sizeof(mEquipment)); } - - Item *getEquipment(int index) const - { return 0; } + EquipBackend(); - void clear() - { - } + Item *getEquipment(int index) const; + void clear(); - void setEquipment(unsigned int slot, unsigned int used, int reference) - { - printf("Equip: %d at %dx%d\n", reference, slot, used); - } + void equip(int inventorySlot, int equipSlot, int amountUsed = 1); + void unequip(int inventorySlot); - void addEquipment(unsigned int slot, int reference) - { - printf("Equip: %d at %d\n", reference, slot); - } + void event(Event::Channel channel, const Event &event); private: - Item *mEquipment[EQUIPMENT_SIZE]; + void readEquipFile(); + + struct SlotType { + std::string name; + int count; + bool visible; + int firstIndex; + }; + + std::vector<Item*> mSlots; + std::vector<SlotType> mSlotTypes; }; class InventoryHandler : public MessageHandler, Net::InventoryHandler, @@ -73,7 +75,7 @@ class InventoryHandler : public MessageHandler, Net::InventoryHandler, size_t getSize(int type) const; private: - EquipBackend mEquips; + EquipBackend mEquipBackend; }; } // namespace ManaServ |