From cfe4c893ba4ba30379919636d3c508ebf1594e23 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 21 Apr 2013 01:44:57 +0300 Subject: add owned show time to each emote type. --- src/resources/emotedb.cpp | 33 +++++++++++++++------------------ src/resources/emotedb.h | 11 ++--------- 2 files changed, 17 insertions(+), 27 deletions(-) (limited to 'src/resources') diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index 9142b7c0e..09e3551dc 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -81,6 +81,7 @@ void EmoteDB::load() } EmoteInfo *const currentInfo = new EmoteInfo; + currentInfo->time = XML::getProperty(emoteNode, "time", 500); for_each_xml_child_node(spriteNode, emoteNode) { @@ -136,6 +137,7 @@ void EmoteDB::load() const int altId = XML::getProperty(emoteNode, "altid", -1); EmoteInfo *const currentInfo = new EmoteInfo; + currentInfo->time = XML::getProperty(emoteNode, "time", 500); for_each_xml_child_node(spriteNode, emoteNode) { @@ -218,30 +220,25 @@ const EmoteInfo *EmoteDB::get(const int id, const bool allowNull) } } -const AnimatedSprite *EmoteDB::getAnimation(const int id, const bool allowNull) -{ - const EmoteInfo *const info = get(id, allowNull); - if (!info) - return nullptr; - - return info->sprites.front()->sprite; -} - -const AnimatedSprite *EmoteDB::getAnimation2(int id, const bool allowNull) +const EmoteInfo *EmoteDB::get2(int id, const bool allowNull) { const EmoteToEmote::const_iterator it = mEmotesAlt.find(id); if (it != mEmotesAlt.end()) id = (*it).second; - return getAnimation(id, allowNull); -} -AnimatedSprite *EmoteDB::getClone(const int id, const bool allowNull) -{ - const AnimatedSprite *const sprite = getAnimation2(id, allowNull); - if (sprite) - return AnimatedSprite::clone(sprite); + const EmoteInfos::const_iterator i = mEmoteInfos.find(id); - return nullptr; + if (i == mEmoteInfos.end()) + { + if (allowNull) + return nullptr; + logger->log("EmoteDB: Warning, unknown emote ID %d requested", id); + return &mUnknown; + } + else + { + return i->second; + } } const EmoteSprite *EmoteDB::getSprite(const int id, const bool allowNull) diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h index 6a6463dfb..d8edb99ec 100644 --- a/src/resources/emotedb.h +++ b/src/resources/emotedb.h @@ -55,6 +55,7 @@ struct EmoteInfo final std::list sprites; StringVect particles; + int time; }; typedef std::map EmoteInfos; @@ -72,15 +73,7 @@ namespace EmoteDB const EmoteInfo *get(const int id, const bool allowNull = false) A_WARN_UNUSED; - const AnimatedSprite *getAnimation(const int id, - const bool allowNull = false) - A_WARN_UNUSED; - - const AnimatedSprite *getAnimation2(int id, - const bool allowNull = false) - A_WARN_UNUSED; - - AnimatedSprite *getClone(const int id, const bool allowNull); + const EmoteInfo *get2(int id, const bool allowNull = false) A_WARN_UNUSED; const EmoteSprite *getSprite(const int id, const bool allowNull = false) A_WARN_UNUSED; -- cgit v1.2.3-60-g2f50