diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-06-03 14:12:42 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-06-03 14:23:08 -0600 |
commit | 8615f1bbad630602009c04a317cd83e03aaa620c (patch) | |
tree | 6f1aaade0f9d745536ec1bda73314cb0841a89e4 /src/statuseffect.cpp | |
parent | 24802c19b0c3ee287898a81a0257d27843d5d09d (diff) | |
download | mana-8615f1bbad630602009c04a317cd83e03aaa620c.tar.gz mana-8615f1bbad630602009c04a317cd83e03aaa620c.tar.bz2 mana-8615f1bbad630602009c04a317cd83e03aaa620c.tar.xz mana-8615f1bbad630602009c04a317cd83e03aaa620c.zip |
Unload loaded DBs before loading them again
This greatly simplifies handling DBs when changing states. No more
need to manage unloading in Client (except when exiting).
Reviewed-by: Thorbjørn Lindeijer
Diffstat (limited to 'src/statuseffect.cpp')
-rw-r--r-- | src/statuseffect.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 49619f8a..6ab0b8fa 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -32,6 +32,8 @@ #define STATUS_EFFECTS_FILE "status-effects.xml" +bool StatusEffect::mLoaded = false; + StatusEffect::StatusEffect() : mPersistentParticleEffect(false) {} @@ -113,6 +115,9 @@ StatusEffect *StatusEffect::getStunEffect(int index, bool enabling) void StatusEffect::load() { + if (mLoaded) + unload(); + XML::Document doc(STATUS_EFFECTS_FILE); xmlNodePtr rootNode = doc.rootNode(); @@ -175,8 +180,13 @@ void unloadMap(std::map<int, StatusEffect *> map) void StatusEffect::unload() { + if (!mLoaded) + return; + unloadMap(statusEffects[0]); unloadMap(statusEffects[1]); unloadMap(stunEffects[0]); unloadMap(stunEffects[1]); + + mLoaded = false; } |