44 #define loadSprite(name) \
46 SpriteReference *const currentSprite = new SpriteReference; \
47 currentSprite->sprite = pathJoin(paths.getStringValue("sprites"), \
48 XmlChildContent(spriteNode)); \
49 currentSprite->variant = XML::getProperty( \
50 spriteNode, "variant", 0); \
51 currentInfo->name.push_back(currentSprite); \
65 logger->
log1(
"Initializing horse database...");
93 else if (name ==
"downleft" || name ==
"leftdown")
97 else if (name ==
"left")
101 else if (name ==
"upleft" || name ==
"leftup")
105 else if (name ==
"up")
109 else if (name ==
"upright" || name ==
"rightup")
113 else if (name ==
"right")
117 else if (name ==
"downright" || name ==
"rightdown")
122 else if (name ==
"died")
138 reportAlways(
"Wrong or missing horse rider direcion: %s",
155 XmlNodePtrConst rootNode = doc.
rootNode();
157 if ((rootNode ==
nullptr) || !xmlNameEqual(rootNode,
"horses"))
159 logger->
log(
"Horse Database: Error while loading %s!",
167 if (xmlNameEqual(horseNode,
"include"))
174 else if (!xmlNameEqual(horseNode,
"horse"))
183 reportAlways(
"Horse Database: Horse with missing ID in %s!",
193 if (currentInfo ==
nullptr)
197 if (xmlNameEqual(spriteNode,
"down"))
199 else if (xmlNameEqual(spriteNode,
"up"))
201 else if (xmlNameEqual(spriteNode,
"offset"))
243 if (xmlNameEqual(spriteNode,
"offset"))
245 if (!XmlHaveChildContent(spriteNode))
247 if (xmlNameEqual(spriteNode,
"sprite"))
257 if (xmlNameEqual(spriteNode,
"offset"))
259 if (!XmlHaveChildContent(spriteNode))
261 if (xmlNameEqual(spriteNode,
"sprite"))
287 const HorseInfos::const_iterator i =
mHorseInfos.find(
id);
293 reportAlways(
"HorseDB: Warning, unknown horse ID %d requested",
302 return static_cast<signed int>(
mHorseInfos.size());
static void loadXmlFile(const std::string &file, const std::string &name, BadgesInfos &arr, const SkipError skipError)
#define loadXmlDir(name, function)
#define reportAlways(...)
std::string getStringValue(const std::string &key) const
void log(const char *const log_text,...)
void log1(const char *const log_text)
void delete_all(Container &c)
#define FOR_EACH(type, iter, array)
static void loadRiderOffset(xmlNode *const node, HorseInfo *const currentInfo)
static void loadOffset(xmlNode *const node, HorseInfo *const currentInfo, const bool isUp)
static void loadDownSprites(xmlNode *const parentNode, HorseInfo *const currentInfo)
static void loadUpSprites(xmlNode *const parentNode, HorseInfo *const currentInfo)
static int parseDirectionName(const std::string &name)
std::map< int, HorseInfo * > HorseInfos
#define for_each_xml_child_node(var, parent)
void loadXmlFile(const std::string &fileName, const SkipError skipError)
HorseInfo * get(const int id, const bool allowNull)
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::vector< SpriteReference * > upSprites
std::vector< SpriteReference * > downSprites
const bool UseVirtFs_true