From a970bdd2d4d7e695f82f854c1efc81881dfebb30 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 15 Apr 2013 12:22:49 +0300 Subject: improve emotedb file. --- src/resources/emotedb.cpp | 30 ++++++++++++++---------------- 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( - spriteNode->xmlChildrenNode->content))); - currentSprite->sprite = AnimatedSprite::load(file, + currentSprite->sprite = AnimatedSprite::load( + paths.getStringValue("sprites").append(std::string( + reinterpret_cast( + 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( - spriteNode->xmlChildrenNode->content); - currentInfo->particles.push_back(particlefx); + currentInfo->particles.push_back(reinterpret_cast( + 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( - 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( + 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( - spriteNode->xmlChildrenNode->content); - currentInfo->particles.push_back(particlefx); + currentInfo->particles.push_back(reinterpret_cast( + 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; -- cgit v1.2.3-70-g09d2