53 logger->
log1(
"Initializing emote database...");
60 unknownSprite->
name =
"unknown";
61 unknownSprite->
id = 0;
78 XmlNodePtrConst rootNode = doc.
rootNode();
80 if ((rootNode ==
nullptr) || !xmlNameEqual(rootNode,
"emotes"))
82 logger->
log(
"Emote Database: Error while loading %s!",
90 if (xmlNameEqual(emoteNode,
"include"))
97 else if (!xmlNameEqual(emoteNode,
"emote"))
109 reportAlways(
"Emote Database: Emote with missing ID in %s!",
118 if (currentInfo ==
nullptr)
125 if (!XmlHaveChildContent(spriteNode))
128 if (xmlNameEqual(spriteNode,
"sprite"))
133 XmlChildContent(spriteNode)),
136 spriteNode,
"name",
"");
137 currentSprite->
id = id;
138 currentInfo->
sprites.push_back(currentSprite);
140 else if (xmlNameEqual(spriteNode,
"particlefx"))
142 currentInfo->
particles.push_back(XmlChildContent(spriteNode));
155 XmlNodePtrConst rootNode = doc.
rootNode();
157 if ((rootNode ==
nullptr) || !xmlNameEqual(rootNode,
"emotes"))
159 logger->
log1(
"Emote Database: Error while loading"
160 " manaplus_emotes.xml!");
167 if (xmlNameEqual(emoteNode,
"include"))
174 else if (!xmlNameEqual(emoteNode,
"emote"))
182 reportAlways(
"Emote Database: Emote with missing ID in "
183 "manaplus_emotes.xml!")
191 if (currentInfo ==
nullptr)
198 if (!XmlHaveChildContent(spriteNode))
201 if (xmlNameEqual(spriteNode,
"sprite"))
206 XmlChildContent(spriteNode)),
209 spriteNode,
"name",
"");
210 currentSprite->
id = id;
211 currentInfo->
sprites.push_back(currentSprite);
213 else if (xmlNameEqual(spriteNode,
"particlefx"))
215 currentInfo->
particles.push_back(XmlChildContent(spriteNode));
232 if (i->second !=
nullptr)
234 std::list<EmoteSprite*> &sprites = i->second->sprites;
235 while (!sprites.empty())
237 delete sprites.front()->sprite;
238 delete sprites.front();
248 while (!sprites.empty())
250 delete sprites.front()->sprite;
251 delete sprites.front();
260 const EmoteInfos::const_iterator i =
mEmoteInfos.find(
id);
266 reportAlways(
"EmoteDB: Warning, unknown emote ID %d requested",
275 const EmoteToEmote::const_iterator it =
mEmotesAlt.find(
id);
279 const EmoteInfos::const_iterator i =
mEmoteInfos.find(
id);
285 reportAlways(
"EmoteDB: Warning, unknown emote ID %d requested",
298 return info->sprites.front();
308 return static_cast<signed int>(
mEmoteInfos.size());
313 if (index < 0 || index >=
static_cast<signed int>(
mEmoteInfos.size()))
315 EmoteInfos::const_iterator it =
mEmoteInfos.begin();
316 for (
int f = 0; f < index; f ++)
static void loadXmlFile(const std::string &file, const std::string &name, BadgesInfos &arr, const SkipError skipError)
#define loadXmlDir(name, function)
#define reportAlways(...)
static AnimatedSprite * load(const std::string &filename, const int variant)
std::string getStringValue(const std::string &key) const
void log(const char *const log_text,...)
void log1(const char *const log_text)
std::map< int, int > EmoteToEmote
std::map< int, EmoteInfo * > EmoteInfos
#define FOR_EACH(type, iter, array)
#define for_each_xml_child_node(var, parent)
bool info(InputEvent &event)
AttributesT get(const std::string &key)
const int & getLast() A_CONST
const EmoteInfo * get2(int id, const bool allowNull)
void loadSpecialXmlFile(const std::string &fileName, const SkipError skipError)
void loadXmlFile(const std::string &fileName, const SkipError skipError)
const EmoteInfo * get(const int id, const bool allowNull)
int getIdByIndex(const int index)
const EmoteSprite * getSprite(const int id, const bool allowNull)
std::string langProperty(const xmlNodePtr node, const char *const name, const std::string &def)
int getProperty(const xmlNodePtr node, const char *const name, int def)
const bool SkipError_false
const bool SkipError_true
std::string pathJoin(std::string str1, const std::string &str2)
std::list< EmoteSprite * > sprites
const AnimatedSprite * sprite
const bool UseVirtFs_true