summaryrefslogtreecommitdiff
path: root/src/resources
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
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')
-rw-r--r--src/resources/emotedb.cpp33
-rw-r--r--src/resources/emotedb.h11
2 files changed, 17 insertions, 27 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)
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<EmoteSprite*> sprites;
StringVect particles;
+ int time;
};
typedef std::map<int, EmoteInfo*> 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;