diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-07-21 20:19:25 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-07-21 20:21:55 -0600 |
commit | 4cc7305cfa08598398123641987cf1fdf2bd7616 (patch) | |
tree | cdf406f0c943201e98a9787fbe1a1f760bb0e22f /src/equipment.cpp | |
parent | ce3d5a56de1309298603c9ce3b95659829f870ef (diff) | |
download | mana-4cc7305cfa08598398123641987cf1fdf2bd7616.tar.gz mana-4cc7305cfa08598398123641987cf1fdf2bd7616.tar.bz2 mana-4cc7305cfa08598398123641987cf1fdf2bd7616.tar.xz mana-4cc7305cfa08598398123641987cf1fdf2bd7616.zip |
Merge equipment handling and fix some bugs
Diffstat (limited to 'src/equipment.cpp')
-rw-r--r-- | src/equipment.cpp | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/src/equipment.cpp b/src/equipment.cpp index f760067c..1b17d66d 100644 --- a/src/equipment.cpp +++ b/src/equipment.cpp @@ -29,19 +29,10 @@ #include <algorithm> Equipment::Equipment() -#ifdef EATHENA_SUPPORT - : mArrows(-1) -#endif { -#ifdef TMWSERV_SUPPORT std::fill_n(mEquipment, EQUIPMENT_SIZE, (Item*) 0); -#else - std::fill_n(mEquipment, EQUIPMENT_SIZE, -1); -#endif } -#ifdef TMWSERV_SUPPORT - Equipment::~Equipment() { clear(); @@ -55,29 +46,14 @@ void Equipment::clear() std::fill_n(mEquipment, EQUIPMENT_SIZE, (Item*) 0); } -void Equipment::setEquipment(int index, int id) +void Equipment::setEquipment(int index, int id, int quantity) { if (mEquipment[index] && mEquipment[index]->getId() == id) return; delete mEquipment[index]; - mEquipment[index] = (id > 0) ? new Item(id) : 0; -} - -#else + mEquipment[index] = (id > 0) ? new Item(id, quantity) : 0; -void Equipment::setEquipment(int index, int inventoryIndex) -{ - mEquipment[index] = inventoryIndex; - Item *item = player_node->getInventory()->getItem(inventoryIndex); - if (item) - item->setEquipped(true); -} - -void Equipment::removeEquipment(int index) -{ - if (index >= 0 && index < EQUIPMENT_SIZE) - mEquipment[index] = -1; + if (mEquipment[index]) + mEquipment[index]->setInvIndex(index); } - -#endif |