From 87f43f7621dda3071ba189df6975cd0a0595165a Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Thu, 6 Nov 2008 16:46:18 +0000 Subject: 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. --- src/equipment.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/equipment.h') 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. @@ -54,26 +54,21 @@ class Equipment void 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 -- cgit v1.2.3-70-g09d2