diff options
author | Philipp Sehmisch <crush@themanaworld.org> | 2009-03-18 18:37:19 +0100 |
---|---|---|
committer | Philipp Sehmisch <crush@themanaworld.org> | 2009-03-18 18:37:19 +0100 |
commit | 1231406e5c9ac43d60c6ffb0ae664970b0e4eee0 (patch) | |
tree | 45af35e9a6ee56b71f06d76efa7706bf16eaec9a /src/statuseffect.cpp | |
parent | 04c189cf7e3e8a393c81bfb3e11058ceace8802a (diff) | |
parent | 4bd8d3fd96fab681ee4520b6a6f2a6ee73f6eb97 (diff) | |
download | mana-client-1231406e5c9ac43d60c6ffb0ae664970b0e4eee0.tar.gz mana-client-1231406e5c9ac43d60c6ffb0ae664970b0e4eee0.tar.bz2 mana-client-1231406e5c9ac43d60c6ffb0ae664970b0e4eee0.tar.xz mana-client-1231406e5c9ac43d60c6ffb0ae664970b0e4eee0.zip |
Merge branch 'master' of git@gitorious.org:tmw/eathena
Diffstat (limited to 'src/statuseffect.cpp')
-rw-r--r-- | src/statuseffect.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index c0d689f0..70e8d59f 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -92,7 +92,6 @@ static std::map<int, int> blockEffectIndexMap; int StatusEffect::blockEffectIndexToEffectIndex(int blockIndex) { - load(); if (blockEffectIndexMap.find(blockIndex) == blockEffectIndexMap.end()) return -1; return blockEffectIndexMap[blockIndex]; @@ -100,27 +99,16 @@ int StatusEffect::blockEffectIndexToEffectIndex(int blockIndex) StatusEffect *StatusEffect::getStatusEffect(int index, bool enabling) { - load(); return statusEffects[enabling][index]; } StatusEffect *StatusEffect::getStunEffect(int index, bool enabling) { - load(); return stunEffects[enabling][index]; } -static bool status_effects_loaded = false; - - - void StatusEffect::load() { - if (status_effects_loaded) - return; - - status_effects_loaded = true; - XML::Document doc(STATUS_EFFECTS_FILE); xmlNodePtr rootNode = doc.rootNode(); @@ -168,3 +156,19 @@ void StatusEffect::load() } } } + +void unloadMap(std::map<int, StatusEffect *> map) +{ + std::map<int, StatusEffect *>::iterator it; + + for (it = map.begin(); it != map.end(); it++) + delete (*it).second; +} + +void StatusEffect::unload() +{ + unloadMap(statusEffects[0]); + unloadMap(statusEffects[1]); + unloadMap(stunEffects[0]); + unloadMap(stunEffects[1]); +}
\ No newline at end of file |