53                                    const unsigned num)
 const 
   55     Actions::const_iterator i = 
mActions.find(num);
 
   56     if (i == 
mActions.end() && num != 100)
 
   59     if (i == 
mActions.end() || ((*i).second == 
nullptr))
 
   62     const ActionMap *
const actMap = (*i).second;
 
   63     if (actMap == 
nullptr)
 
   65     const ActionMap::const_iterator it = actMap->find(action);
 
   67     if (it == actMap->end())
 
   69         logger->
log(
"Warning: no action \"%s\" defined!", action.c_str());
 
   81         const unsigned n = (*it).first;
 
   82         if (n >= num && n < min)
 
   91                            const int variant, 
const bool prot)
 
   94     const size_t pos = animationFile.find(
'|');
 
   96     if (pos != std::string::npos)
 
   97         palettes = animationFile.substr(pos + 1);
 
  104     XmlNodePtrConst rootNode = doc->
rootNode();
 
  106     if ((rootNode == 
nullptr) || !xmlNameEqual(rootNode, 
"sprite"))
 
  109             animationFile.c_str())
 
  114         if (animationFile != errorFile)
 
  115             return load(errorFile, 0, prot);
 
  147             i->second != 
nullptr &&
 
  148             (i2 == d->end() || i->second != i2->second))
 
  150             (i->second)->setLastFrameDelay(0);
 
  163         if (d->find(complete) == d->end())
 
  165             const ActionMap::iterator i = d->find(with);
 
  167                 (*d)[complete] = i->second;
 
  207                            const std::string &palettes)
 
  210     if (spriteNode == 
nullptr)
 
  217     int variant_offset = 0;
 
  219     if (variantCount > 0 && variant < variantCount)
 
  228         if (xmlNameEqual(node, 
"imageset"))
 
  230         else if (xmlNameEqual(node, 
"action"))
 
  232         else if (xmlNameEqual(node, 
"include"))
 
  239                              const std::string &palettes)
 
  256     if (imageSet == 
nullptr)
 
  276             imageSetName.c_str(),
 
  284                            const int variant_offset)
 
  307     if (actionName == 
"attack_stab")
 
  309         reportAlways(
"Found legacy attribute attack_stab in animation")
 
  315     const Actions::const_iterator i = 
mActions.find(hp);
 
  316     if ((*i).second->size() == 1)
 
  322         if (xmlNameEqual(animationNode, 
"animation"))
 
  323             loadAnimation(animationNode, action, imageSet, variant_offset);
 
  330                               const int variant_offset)
 const 
  332     if (action == 
nullptr ||
 
  333         imageSet0 == 
nullptr ||
 
  334         animationNode == 
nullptr)
 
  339     const std::string directionName =
 
  348             directionName.c_str(),
 
  360             frameNode, 
"delay", 0, 0, 100000);
 
  364         const ImageSet *imageSet = imageSet0;
 
  365         if (!imageSetName.empty())
 
  368             if (imageSet == 
nullptr)
 
  369                 imageSet = imageSet0;
 
  378         if (xmlNameEqual(frameNode, 
"frame"))
 
  385                     "%s: No valid value for 'index' at direction '%s'",
 
  387                     directionName.c_str())
 
  391             Image *
const img = imageSet->
get(index + variant_offset);
 
  394                 reportAlways(
"%s: No image at index %d at direction '%s'",
 
  396                     index + variant_offset,
 
  397                     directionName.c_str())
 
  401             animation->
addFrame(img, delay, offsetX, offsetY, rand);
 
  403         else if (xmlNameEqual(frameNode, 
"sequence"))
 
  409                 frameNode, 
"repeat", 1, 0, 100);
 
  413                 reportAlways(
"%s: No valid value for 'repeat' at direction %s",
 
  415                     directionName.c_str())
 
  422                     variant_offset, repeat, rand, imageSet, animation))
 
  433                     const std::string str = *it;
 
  434                     const size_t idx = str.find(
'-');
 
  439                     else if (idx != std::string::npos)
 
  441                         const int v1 = atoi(str.substr(0, idx).c_str());
 
  442                         const int v2 = atoi(str.substr(idx + 1).c_str());
 
  444                             variant_offset, repeat, rand, imageSet, animation);
 
  448                         Image *
const img = imageSet->
get(atoi(
 
  449                             str.c_str()) + variant_offset);
 
  453                                 offsetX, offsetY, rand);
 
  459         else if (xmlNameEqual(frameNode, 
"pause"))
 
  463         else if (xmlNameEqual(frameNode, 
"end"))
 
  467         else if (xmlNameEqual(frameNode, 
"jump"))
 
  470                 frameNode, 
"action", 
""), rand);
 
  472         else if (xmlNameEqual(frameNode, 
"label"))
 
  478         else if (xmlNameEqual(frameNode, 
"goto"))
 
  482                 animation->
addGoto(name, rand);
 
  491     if (filename.empty())
 
  497         reportAlways(
"%s: Tried to include %s which already is included.",
 
  509     XmlNodeConstPtr rootNode = doc->
rootNode();
 
  511     if ((rootNode == 
nullptr) || !xmlNameEqual(rootNode, 
"sprite"))
 
  530         FOR_EACHP (ActionMap::iterator, it, (*i).second)
 
  542         if (i->second != 
nullptr)
 
  554     if (direction.empty() || direction == 
"default")
 
  556     else if (direction == 
"up")
 
  558     else if (direction == 
"left")
 
  560     else if (direction == 
"right")
 
  562     else if (direction == 
"down")
 
  564     else if (direction == 
"upleft")
 
  566     else if (direction == 
"upright")
 
  568     else if (direction == 
"downleft")
 
  570     else if (direction == 
"downright")
 
  579     const Actions::const_iterator i = 
mActions.find(hp);
 
  591                             const int variant_offset,
 
  597     if ((imageSet == 
nullptr) || (animation == 
nullptr))
 
  600     if (
start < 0 || end < 0)
 
  614                 Image *
const img = imageSet->
get(pos + variant_offset);
 
  620                         pos + variant_offset)
 
  626                     offsetX, offsetY, rand);
 
  639                 Image *
const img = imageSet->
get(pos + variant_offset);
 
  645                         pos + variant_offset)
 
  651                     offsetX, offsetY, rand);
 
  662     int sz = 
static_cast<int>(
sizeof(
SpriteDef) +
 
  665         sizeof(std::set<std::string>)) +
 
  669         sz += 
static_cast<int>((*it).capacity());
 
  679         sz += 
static_cast<int>((*it).first.capacity());
 
  680         const ImageSet *
const imageSet = (*it).second;
 
  685         sz += 
sizeof(unsigned);
 
  686         const ActionMap *
const actionMap = (*it).second;
 
  687         FOR_EACHP (ActionMap::const_iterator, it2, actionMap)
 
  689             sz += 
static_cast<int>((*it2).first.capacity());
 
  690             const Action *
const action = (*it2).second;
 
static const BeingActionT actions[]
 
#define reportAlways(...)
 
void setAnimation(const SpriteDirection::Type direction, Animation *const animation)
 
void setNumber(const unsigned n)
 
void addLabel(const std::string &name)
 
void addGoto(const std::string &name, const int rand)
 
void addJump(const std::string &name, const int rand)
 
void addTerminator(const int rand)
 
void addFrame(Image *const image, const int delay, const int offsetX, const int offsetY, const int rand)
 
void addPause(const int delay, const int rand)
 
std::string getStringValue(const std::string &key) const
 
static void instantiate(std::string &target, const std::string &palettes)
 
Image * get(const size_type i) const
 
void setOffsetX(const int n)
 
void setOffsetY(const int n)
 
void log(const char *const log_text,...)
 
int calcMemory(const int level) const
 
int calcMemoryLocal() const
 
void loadSprite(const xmlNodePtr spriteNode, const int variant, const std::string &palettes)
 
const Action * getAction(const std::string &action, const unsigned num) const
 
Actions::const_iterator ActionsCIter
 
static SpriteDirection::Type makeSpriteDirection(const std::string &direction)
 
void includeSprite(const xmlNodePtr includeNode, const int variant)
 
void loadImageSet(const xmlNodePtr node, const std::string &palettes)
 
std::map< std::string, ImageSet * > ImageSets
 
std::set< std::string > mProcessedFiles
 
const ImageSet * getImageSet(const std::string &imageSetName) const
 
ImageSets::const_iterator ImageSetCIterator
 
int calcMemoryLocal() const
 
std::map< std::string, Action * > ActionMap
 
unsigned findNumber(const unsigned num) const
 
std::map< unsigned, ActionMap * > Actions
 
void addAction(const unsigned hp, const std::string &name, Action *const action)
 
int calcMemoryChilds(const int level) const
 
void loadAnimation(const xmlNodePtr animationNode, Action *const action, const ImageSet *const imageSet, const int variant_offset) const
 
static SpriteDef * load(const std::string &file, const int variant, const bool prot)
 
bool addSequence(const int start, const int end, const int delay, const int offsetX, const int offsetY, const int variant_offset, int repeat, const int rand, const ImageSet *const imageSet, Animation *const animation) const
 
Actions::iterator ActionsIter
 
Actions::const_iterator ActionsConstIter
 
void loadAction(const xmlNodePtr node, const int variant_offset)
 
ImageSets::iterator ImageSetIterator
 
void substituteAction(const std::string &complete, const std::string &with)
 
static const int mapTileSize
 
#define FOR_EACHP(type, iter, array)
 
#define FOR_EACH(type, iter, array)
 
#define for_each_xml_child_node(var, parent)
 
XML::Document * getXml(const std::string &idPath, const UseVirtFs useResman, const SkipError skipError)
 
ImageSet * getImageSet(const std::string &imagePath, const int w, const int h)
 
static const std::string ATTACKWATER("attackwater")
 
static const std::string STANDWATER("standwater")
 
static const std::string SPAWNRIDE("spawnride")
 
static const std::string ATTACKSKY("attacksky")
 
static const std::string STANDRIDE("standride")
 
static const std::string RIDE("ride")
 
static const std::string SIT("sit")
 
static const std::string SWIM("swim")
 
static const std::string FLY("fly")
 
static const std::string CASTSKY("castsky")
 
static const std::string STAND("stand")
 
static const std::string DEFAULT("stand")
 
static const std::string SITRIDE("sitride")
 
static const std::string SITSKY("sitsky")
 
static const std::string MOVE("walk")
 
static const std::string CASTWATER("castwater")
 
static const std::string SPAWNWATER("spawnwater")
 
static const std::string DEADRIDE("deadride")
 
static const std::string DEAD("dead")
 
static const std::string SITWATER("sitwater")
 
static const std::string STANDSKY("standsky")
 
static const std::string DEADSKY("deadsky")
 
static const std::string CASTRIDE("castride")
 
static const std::string CAST("cast")
 
static const std::string INVALID
 
static const std::string DEADWATER("deadwater")
 
static const std::string ATTACKRIDE("attackride")
 
static const std::string SITTOP("sittop")
 
static const std::string SPAWN("spawn")
 
static const std::string ATTACK("attack")
 
static const std::string SPAWNSKY("spawnsky")
 
int getProperty(const xmlNodePtr node, const char *const name, int def)
 
int getIntProperty(const xmlNodePtr node, const char *const name, int def, const int min, const int max)
 
#define BLOCK_START(name)
 
const bool SkipError_false
 
void splitToStringVector(StringVect &tokens, const std::string &text, const char separator)
 
std::string pathJoin(std::string str1, const std::string &str2)
 
StringVect::const_iterator StringVectCIter
 
std::vector< std::string > StringVect
 
static SpriteReference * Empty
 
const bool UseVirtFs_true