From 0cda45b8c1775c6a0f1bdf52c8801ccdfd21a8c7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 12 May 2016 14:59:21 +0300 Subject: Improve error messages in SpriteDef. --- src/resources/sprite/spritedef.cpp | 9 ++++++--- src/resources/sprite/spritedef.h | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src/resources/sprite') diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp index 5fde19c17..312597789 100644 --- a/src/resources/sprite/spritedef.cpp +++ b/src/resources/sprite/spritedef.cpp @@ -113,6 +113,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, } SpriteDef *const def = new SpriteDef; + def->mSource = animationFile; def->mProcessedFiles.insert(animationFile); def->loadSprite(rootNode, variant, palettes); def->substituteActions(); @@ -545,7 +546,7 @@ bool SpriteDef::addSequence(const int start, int repeat, const int rand, const ImageSet *const imageSet, - Animation *const animation) + Animation *const animation) const { if (!imageSet || !animation) return true; @@ -568,9 +569,11 @@ bool SpriteDef::addSequence(const int start, if (!img) { - logger->log("No image at index %d", + logger->log("%s: No image at index %d", + mSource.c_str(), pos + variant_offset); - reportAlways("No image at index %d", + reportAlways("%s: No image at index %d", + mSource.c_str(), pos + variant_offset); pos ++; continue; diff --git a/src/resources/sprite/spritedef.h b/src/resources/sprite/spritedef.h index 2fdd1987b..3d56d2d89 100644 --- a/src/resources/sprite/spritedef.h +++ b/src/resources/sprite/spritedef.h @@ -72,16 +72,16 @@ class SpriteDef final : public Resource int calcMemoryChilds(const int level) const override final; - static 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); + 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; private: /** -- cgit v1.2.3-60-g2f50