diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-04-01 11:09:41 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-04-01 11:09:41 -0600 |
commit | 2a11fd111231a7e40c560e0240578a2b4a2126c2 (patch) | |
tree | e6024c5e40fc96ad4ec85b8e4136a4982a35eb02 /src/gui | |
parent | 33048e36c1fdc642459b0101ad0ab9c63807a3e7 (diff) | |
download | mana-2a11fd111231a7e40c560e0240578a2b4a2126c2.tar.gz mana-2a11fd111231a7e40c560e0240578a2b4a2126c2.tar.bz2 mana-2a11fd111231a7e40c560e0240578a2b4a2126c2.tar.xz mana-2a11fd111231a7e40c560e0240578a2b4a2126c2.zip |
Make eAthena's inventory handler
Also cleanup some related #ifdefs in LocalPlayer.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/inventorywindow.cpp | 10 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 4 | ||||
-rw-r--r-- | src/gui/storagewindow.cpp | 27 | ||||
-rw-r--r-- | src/gui/storagewindow.h | 4 |
4 files changed, 18 insertions, 27 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 51c1372c..0b130581 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -164,24 +164,18 @@ void InventoryWindow::action(const gcn::ActionEvent &event) if (event.getId() == "use") { -#ifdef TMWSERV_SUPPORT if (item->isEquipment()) { +#ifdef TMWSERV_SUPPORT player_node->equipItem(item); - } - else { - player_node->useItem(item->getInvIndex()); - } #else - if (item->isEquipment()) - { if (item->isEquipped()) player_node->unequipItem(item); else player_node->equipItem(item); +#endif } else player_node->useItem(item); -#endif } else if (event.getId() == "drop") { diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index d0281c1f..41e266a5 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -268,11 +268,7 @@ void PopupMenu::handleLink(const std::string &link) } else { -#ifdef TMWSERV_SUPPORT - player_node->useItem(mItem->getInvIndex()); -#else player_node->useItem(mItem); -#endif } } diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp index 8c25401d..59b6de7a 100644 --- a/src/gui/storagewindow.cpp +++ b/src/gui/storagewindow.cpp @@ -41,10 +41,8 @@ #include "../localplayer.h" #include "../units.h" -#include "../net/messageout.h" -#ifdef EATHENA_SUPPORT -#include "../net/ea/protocol.h" -#endif +#include "../net/net.h" +#include "../net/ea/inventoryhandler.h" #include "../resources/iteminfo.h" @@ -187,21 +185,24 @@ Item* StorageWindow::getSelectedItem() const return mItems->getSelectedItem(); } -void StorageWindow::addStore(Item *item, int ammount) +void StorageWindow::addStore(Item *item, int amount) { - MessageOut outMsg(CMSG_MOVE_TO_STORAGE); - outMsg.writeInt16(item->getInvIndex() + INVENTORY_OFFSET); - outMsg.writeInt32(ammount); + // Net::getInvyHandler()->moveItem(Net::InvyHandler::INVENTORY, + invyHandler->moveItem(Net::InvyHandler::INVENTORY, + item->getInvIndex(), amount, + Net::InvyHandler::STORAGE); } -void StorageWindow::removeStore(Item *item, int ammount) +void StorageWindow::removeStore(Item *item, int amount) { - MessageOut outMsg(CSMG_MOVE_FROM_STORAGE); - outMsg.writeInt16(item->getInvIndex() + STORAGE_OFFSET); - outMsg.writeInt32(ammount); + // Net::getInvyHandler()->moveItem(Net::InvyHandler::STORAGE, + invyHandler->moveItem(Net::InvyHandler::STORAGE, + item->getInvIndex(), amount, + Net::InvyHandler::INVENTORY); } void StorageWindow::close() { - MessageOut outMsg(CMSG_CLOSE_STORAGE); + // Net::getInvyHandler()->closeStorage(); + invyHandler->closeStorage(); } diff --git a/src/gui/storagewindow.h b/src/gui/storagewindow.h index de0937b5..a4db14bf 100644 --- a/src/gui/storagewindow.h +++ b/src/gui/storagewindow.h @@ -73,12 +73,12 @@ class StorageWindow : public Window, gcn::ActionListener, /** * Add the specified ammount of the specified item to storage */ - void addStore(Item* item, int ammount); + void addStore(Item* item, int amount); /** * Remove the specified ammount of the specified item from storage */ - void removeStore(Item* item, int ammount); + void removeStore(Item* item, int amount); /** * Closes the Storage Window, as well as telling the server that the |