summaryrefslogtreecommitdiff
path: root/src/gui/button.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-08 19:13:26 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-08 19:13:26 +0000
commit405c23831a4e1363f26f848215c8140f6d6d9f78 (patch)
treeedf8b8838f055a1b5d024a3976b49f5cddfa8c50 /src/gui/button.cpp
parente645ad2a139c332937813dd2a1e5424ded182e26 (diff)
downloadmana-405c23831a4e1363f26f848215c8140f6d6d9f78.tar.gz
mana-405c23831a4e1363f26f848215c8140f6d6d9f78.tar.bz2
mana-405c23831a4e1363f26f848215c8140f6d6d9f78.tar.xz
mana-405c23831a4e1363f26f848215c8140f6d6d9f78.zip
Added a 'dtor' helper functor to delete objects in arrays and containers using STL algorithms.
Diffstat (limited to 'src/gui/button.cpp')
-rw-r--r--src/gui/button.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/gui/button.cpp b/src/gui/button.cpp
index 78fbf7c7..8e57181e 100644
--- a/src/gui/button.cpp
+++ b/src/gui/button.cpp
@@ -34,6 +34,8 @@
#include "../resources/image.h"
#include "../resources/resourcemanager.h"
+#include "../utils/dtor.h"
+
ImageRect Button::button[4];
int Button::mInstances = 0;
@@ -80,17 +82,9 @@ Button::~Button()
if (mInstances == 0)
{
- int a, x, y, mode;
-
- for (mode = 0; mode < 4; mode++)
+ for (int mode = 0; mode < 4; mode++)
{
- a = 0;
- for (y = 0; y < 3; y++) {
- for (x = 0; x < 3; x++) {
- delete button[mode].grid[a];
- a++;
- }
- }
+ for_each(button[mode].grid, button[mode].grid + 9, dtor<Image*>());
}
}
}