summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-08 01:48:08 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-08 01:48:08 +0000
commitd9db81d03e979028c5e0b9eac1ae951499b776a3 (patch)
treedc9458133e8e1815ccdb9d77953b6e0bb2cba6c8 /src
parentdaa73fee2b89f16c42a05a7ab081699e024fab23 (diff)
downloadmana-client-d9db81d03e979028c5e0b9eac1ae951499b776a3.tar.gz
mana-client-d9db81d03e979028c5e0b9eac1ae951499b776a3.tar.bz2
mana-client-d9db81d03e979028c5e0b9eac1ae951499b776a3.tar.xz
mana-client-d9db81d03e979028c5e0b9eac1ae951499b776a3.zip
Use STL algorithms and make destructor inline.
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*