summaryrefslogtreecommitdiff
path: root/src/equipment.h
diff options
context:
space:
mode:
authorDennis Friis <peavey@placid.dk>2008-11-06 16:46:18 +0000
committerDennis Friis <peavey@placid.dk>2008-11-06 16:46:18 +0000
commit87f43f7621dda3071ba189df6975cd0a0595165a (patch)
treefa5cf0603bbcc4ecb4506dd357124975a8534503 /src/equipment.h
parent9475a009e95a3f379a0e97bc66d1aab93ca24b34 (diff)
downloadmana-87f43f7621dda3071ba189df6975cd0a0595165a.tar.gz
mana-87f43f7621dda3071ba189df6975cd0a0595165a.tar.bz2
mana-87f43f7621dda3071ba189df6975cd0a0595165a.tar.xz
mana-87f43f7621dda3071ba189df6975cd0a0595165a.zip
Have equipment tied into player inventory instead of keeping its own list of pointers to items. This ensures the ressource is up-to-date and avoids crashes on stale item pointers.
Diffstat (limited to 'src/equipment.h')
-rw-r--r--src/equipment.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/equipment.h b/src/equipment.h
index 80a2ae49..e3b10514 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -39,14 +39,14 @@ class Equipment
/**
* Get equipment at the given slot.
*/
- Item* getEquipment(int index) const
+ int getEquipment(int index) const
{ return mEquipment[index]; }
/**
* Set equipment at the given slot.
*/
void
- setEquipment(int index, Item *item);
+ setEquipment(int index, int inventoryIndex);
/**
* Remove equipment from the given slot.
@@ -55,25 +55,20 @@ class Equipment
removeEquipment(int index) { mEquipment[index] = 0; }
/**
- * Remove the given item from equipment.
- */
- void removeEquipment(Item *item);
-
- /**
* Get the item used in the arrow slot.
*/
- Item*
+ int
getArrows() { return mArrows; }
/**
* Set the item used in the arrow slot.
*/
void
- setArrows(Item *arrows) { mArrows = arrows; }
+ setArrows(int arrows) { mArrows = arrows; }
private:
- Item *mEquipment[EQUIPMENT_SIZE];
- Item *mArrows;
+ int mEquipment[EQUIPMENT_SIZE];
+ int mArrows;
};
#endif