summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/equipment.cpp22
-rw-r--r--src/equipment.h5
2 files changed, 8 insertions, 19 deletions
diff --git a/src/equipment.cpp b/src/equipment.cpp
index cdbe387c..6cd4d967 100644
--- a/src/equipment.cpp
+++ b/src/equipment.cpp
@@ -22,29 +22,23 @@
*/
#include "equipment.h"
+
+#include <algorithm>
+
#include "item.h"
Equipment::Equipment():
- mArrows(NULL)
-{
- for (int i = 0; i < EQUIPMENT_SIZE; i++)
- {
- mEquipment[i] = NULL;
- }
-}
-
-Equipment::~Equipment()
+ mArrows(0)
{
+ std::fill_n(mEquipment, EQUIPMENT_SIZE, (Item*)0);
}
void
Equipment::removeEquipment(Item *item)
{
- for (int i = 0; i < EQUIPMENT_SIZE; i++) {
- if (mEquipment[i] == item) {
- mEquipment[i] = 0;
- break;
- }
+ Item **i = std::find(mEquipment, mEquipment+EQUIPMENT_SIZE, item);
+ if (i != mEquipment+EQUIPMENT_SIZE) {
+ *i = 0;
}
}
diff --git a/src/equipment.h b/src/equipment.h
index cc805004..db9cf27d 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -37,11 +37,6 @@ class Equipment
Equipment();
/**
- * Destructor.
- */
- ~Equipment();
-
- /**
* Get equipment at the given slot.
*/
Item*