diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-15 12:22:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-15 12:22:49 +0300 |
commit | a970bdd2d4d7e695f82f854c1efc81881dfebb30 (patch) | |
tree | 765948705d8cff6eef316e2dc862360985416ffb | |
parent | 6a396b89dba22004820fe1089705b2a182de8412 (diff) | |
download | manaplus-a970bdd2d4d7e695f82f854c1efc81881dfebb30.tar.gz manaplus-a970bdd2d4d7e695f82f854c1efc81881dfebb30.tar.bz2 manaplus-a970bdd2d4d7e695f82f854c1efc81881dfebb30.tar.xz manaplus-a970bdd2d4d7e695f82f854c1efc81881dfebb30.zip |
improve emotedb file.
-rw-r--r-- | src/resources/emotedb.cpp | 30 | ||||
-rw-r--r-- | src/resources/emotedb.h | 2 |
2 files changed, 15 insertions, 17 deletions
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index 8dc401716..9142b7c0e 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -90,10 +90,10 @@ void EmoteDB::load() if (xmlNameEqual(spriteNode, "sprite")) { EmoteSprite *const currentSprite = new EmoteSprite; - std::string file = paths.getStringValue("sprites") - .append(std::string(reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content))); - currentSprite->sprite = AnimatedSprite::load(file, + currentSprite->sprite = AnimatedSprite::load( + paths.getStringValue("sprites").append(std::string( + reinterpret_cast<const char*>( + spriteNode->xmlChildrenNode->content))), XML::getProperty(spriteNode, "variant", 0)); currentSprite->name = XML::langProperty( spriteNode, "name", ""); @@ -101,9 +101,8 @@ void EmoteDB::load() } else if (xmlNameEqual(spriteNode, "particlefx")) { - std::string particlefx = reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content); - currentInfo->particles.push_back(particlefx); + currentInfo->particles.push_back(reinterpret_cast<const char*>( + spriteNode->xmlChildrenNode->content)); } } mEmoteInfos[id] = currentInfo; @@ -146,20 +145,19 @@ void EmoteDB::load() if (xmlNameEqual(spriteNode, "sprite")) { EmoteSprite *const currentSprite = new EmoteSprite; - std::string file = paths.getStringValue("sprites") - .append(std::string(reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content))); - currentSprite->sprite = AnimatedSprite::load(file, - XML::getProperty(spriteNode, "variant", 0)); + currentSprite->sprite = AnimatedSprite::load( + paths.getStringValue("sprites").append(std::string( + reinterpret_cast<const char*>( + spriteNode->xmlChildrenNode->content))), + XML::getProperty(spriteNode, "variant", 0)); currentSprite->name = XML::langProperty( spriteNode, "name", ""); currentInfo->sprites.push_back(currentSprite); } else if (xmlNameEqual(spriteNode, "particlefx")) { - std::string particlefx = reinterpret_cast<const char*>( - spriteNode->xmlChildrenNode->content); - currentInfo->particles.push_back(particlefx); + currentInfo->particles.push_back(reinterpret_cast<const char*>( + spriteNode->xmlChildrenNode->content)); } } mEmoteInfos[id] = currentInfo; @@ -237,7 +235,7 @@ const AnimatedSprite *EmoteDB::getAnimation2(int id, const bool allowNull) return getAnimation(id, allowNull); } -AnimatedSprite *EmoteDB::getClone(int id, const bool allowNull) +AnimatedSprite *EmoteDB::getClone(const int id, const bool allowNull) { const AnimatedSprite *const sprite = getAnimation2(id, allowNull); if (sprite) diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h index d105794b3..b8f163adb 100644 --- a/src/resources/emotedb.h +++ b/src/resources/emotedb.h @@ -77,7 +77,7 @@ namespace EmoteDB const bool allowNull = false) A_WARN_UNUSED; - AnimatedSprite *getClone(int id, const bool allowNull); + AnimatedSprite *getClone(const int id, const bool allowNull); const EmoteSprite *getSprite(const int id, const bool allowNull = false) A_WARN_UNUSED; |