summaryrefslogtreecommitdiff
path: root/src/resources/emotedb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-21 01:44:57 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-21 01:44:57 +0300
commitcfe4c893ba4ba30379919636d3c508ebf1594e23 (patch)
tree94abccb0bfbf6ce3675186f80c7243bbf4b6c157 /src/resources/emotedb.cpp
parent52f78717dae3cb02eb1539841dd2a6bd351f74c1 (diff)
downloadmanaplus-cfe4c893ba4ba30379919636d3c508ebf1594e23.tar.gz
manaplus-cfe4c893ba4ba30379919636d3c508ebf1594e23.tar.bz2
manaplus-cfe4c893ba4ba30379919636d3c508ebf1594e23.tar.xz
manaplus-cfe4c893ba4ba30379919636d3c508ebf1594e23.zip
add owned show time to each emote type.
Diffstat (limited to 'src/resources/emotedb.cpp')
-rw-r--r--src/resources/emotedb.cpp33
1 files changed, 15 insertions, 18 deletions
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)