diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-06-04 17:00:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-06-04 17:00:09 +0300 |
commit | e668ab141d6b006b790d2b0a8fc515d13b78317e (patch) | |
tree | b4aa71e9a4af62c948183328bbf74c2e1bf4eb84 /src/resources | |
parent | 98cc93d2321b9be0a2a5ae6bf67aecf6adcdd2fb (diff) | |
download | manaplus-e668ab141d6b006b790d2b0a8fc515d13b78317e.tar.gz manaplus-e668ab141d6b006b790d2b0a8fc515d13b78317e.tar.bz2 manaplus-e668ab141d6b006b790d2b0a8fc515d13b78317e.tar.xz manaplus-e668ab141d6b006b790d2b0a8fc515d13b78317e.zip |
Cleanup part list and beinginfo.
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 { |