diff options
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/beinginfo.cpp | 13 | ||||
-rw-r--r-- | src/resources/beinginfo.h | 5 | ||||
-rw-r--r-- | src/resources/monsterdb.cpp | 2 | ||||
-rw-r--r-- | src/resources/npcdb.cpp | 2 |
4 files changed, 16 insertions, 6 deletions
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 80f416b91..d6865449e 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -29,7 +29,8 @@ #include "debug.h" -BeingInfo *BeingInfo::Unknown = new BeingInfo; +BeingInfo *BeingInfo::unknown = new BeingInfo; +Attack *BeingInfo::empty = new Attack(SpriteAction::ATTACK, "", ""); BeingInfo::BeingInfo(): mName(_("unnamed")), @@ -102,8 +103,6 @@ const std::string &BeingInfo::getSound(SoundEvent event) const const Attack *BeingInfo::getAttack(int type) const { - // need remove in destructor? - static Attack *empty = new Attack(SpriteAction::ATTACK, "", ""); Attacks::const_iterator i = mAttacks.find(type); return (i == mAttacks.end()) ? empty : (*i).second; @@ -118,3 +117,11 @@ void BeingInfo::addAttack(int id, std::string action, mAttacks[id] = new Attack(action, particleEffect, missileParticle); } + +void BeingInfo::clear() +{ + delete unknown; + unknown = 0; + delete empty; + empty = 0; +} diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h index 192a4c3b5..a61483940 100644 --- a/src/resources/beinginfo.h +++ b/src/resources/beinginfo.h @@ -72,7 +72,8 @@ typedef std::map<SoundEvent, std::vector<std::string>* > SoundEvents; class BeingInfo { public: - static BeingInfo *Unknown; + static BeingInfo *unknown; + static Attack *empty; BeingInfo(); @@ -146,6 +147,8 @@ class BeingInfo void setStaticMaxHP(bool n) { mStaticMaxHP = n; } + static void clear(); + private: SpriteDisplay mDisplay; std::string mName; diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index f0739296a..7a0494fc9 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -220,7 +220,7 @@ BeingInfo *MonsterDB::get(int id) { logger->log("MonsterDB: Warning, unknown monster ID %d requested", id); - return BeingInfo::Unknown; + return BeingInfo::unknown; } else { diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index 6f539e17b..49eab5bf2 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -124,7 +124,7 @@ BeingInfo *NPCDB::get(int id) if (i == mNPCInfos.end()) { logger->log("NPCDB: Warning, unknown NPC ID %d requested", id); - return BeingInfo::Unknown; + return BeingInfo::unknown; } else { |