34 std::vector<Emote> mEmotes;
44 mUnknown.name =
"unknown";
45 mUnknown.effectId = -1;
54 Log::info(
"Emote Database: Emote with missing ID in %s!", filename.c_str());
66 Log::info(
"Emote Database: Warning: Emote %s has no attached effect in %s!",
67 emote.
name.c_str(), filename.c_str());
71 const std::string imageName = node.
getProperty(
"image",
"");
75 if (imageName.empty() || width <= 0 || height <= 0)
77 Log::info(
"Emote Database: Warning: Emote %s has bad imageset values in %s",
78 emote.
name.c_str(), filename.c_str());
86 if (!emote.
is || emote.
is->
size() == 0)
88 Log::info(
"Emote Database: Error loading imageset for emote %s in %s",
89 emote.
name.c_str(), filename.c_str());
96 mEmotes.push_back(std::move(emote));
107 for (
auto &emote : mEmotes)
108 emote.image.release();
111 mUnknown.image =
nullptr;
117 auto i = std::find_if(mEmotes.begin(), mEmotes.end(),
118 [
id](
const Emote &e) { return e.id == id; });
120 if (i == mEmotes.end())
122 Log::info(
"EmoteDB: Warning, unknown emote ID %d requested",
id);
131 return mEmotes.at(index);
136 return mEmotes.size();
Image * get(size_t i) const
static ResourceManager * getInstance()
Returns an instance of the class, creating one if it does not already exist.
ResourceRef< Image > getImage(const std::string &idPath)
Loads the Image resource found at the given identifier path.
ResourceRef< ImageSet > getImageSet(const std::string &imagePath, int w, int h)
Loads a image set based on the image referenced by the given path and the supplied sprite sizes.
int getProperty(const char *name, int def) const
const Emote & getByIndex(int index)
const Emote & get(int id)
void readEmoteNode(XML::Node node, const std::string &filename)
void info(const char *log_text,...) LOG_PRINTF_ATTR
ResourceRef< ImageSet > is
ResourceRef< Image > image