diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-08 19:13:26 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-08 19:13:26 +0000 |
commit | 405c23831a4e1363f26f848215c8140f6d6d9f78 (patch) | |
tree | edf8b8838f055a1b5d024a3976b49f5cddfa8c50 /src/engine.cpp | |
parent | e645ad2a139c332937813dd2a1e5424ded182e26 (diff) | |
download | mana-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/engine.cpp')
-rw-r--r-- | src/engine.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 6aff0dc9..2cf0fc87 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -50,6 +50,8 @@ #include "resources/mapreader.h" #include "resources/resourcemanager.h" +#include "utils/dtor.h" + extern Minimap *minimap; char itemCurrenyQ[10] = "0"; @@ -103,20 +105,12 @@ Engine::Engine(Network *network): Engine::~Engine() { // Delete sprite sets - std::map<int, Spriteset*>::iterator i; - for (i = monsterset.begin(); i != monsterset.end(); i++) - { - delete i->second; - } + for_each(monsterset.begin(), monsterset.end(), make_dtor(monsterset)); monsterset.clear(); delete npcset; delete emotionset; - //delete weaponset; - for (unsigned int i = 0; i < weaponset.size(); i++) - { - delete weaponset[i]; - } + for_each(weaponset.begin(), weaponset.end(), make_dtor(weaponset)); weaponset.clear(); delete itemset; |