summaryrefslogtreecommitdiff
path: root/src/equipment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/equipment.cpp')
-rw-r--r--src/equipment.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/equipment.cpp b/src/equipment.cpp
index b54988a7..a8910d14 100644
--- a/src/equipment.cpp
+++ b/src/equipment.cpp
@@ -25,24 +25,20 @@
#include "equipment.h"
#include "item.h"
+#include "inventory.h"
+#include "localplayer.h"
Equipment::Equipment():
mArrows(0)
{
- std::fill_n(mEquipment, EQUIPMENT_SIZE, (Item*) 0);
+ std::fill_n(mEquipment, EQUIPMENT_SIZE, 0);
}
void
-Equipment::removeEquipment(Item *item)
+Equipment::setEquipment(int index, int inventoryIndex)
{
- Item **i = std::find(mEquipment, mEquipment + EQUIPMENT_SIZE, item);
- if (i != mEquipment + EQUIPMENT_SIZE) {
- *i = 0;
- }
-}
-
-void Equipment::setEquipment(int index, Item *item)
-{
- mEquipment[index] = item;
- item->setEquipped(true);
+ mEquipment[index] = inventoryIndex;
+ Item* item = player_node->getInventory()->getItem(inventoryIndex);
+ if (item)
+ item->setEquipped(true);
}