diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-12 15:08:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-12 15:08:15 +0300 |
commit | 7d762d70604d250cb51282161d390cba1ea664c7 (patch) | |
tree | f5341950af8d4649f0d80c3092d5fb9c7c2daa9e | |
parent | 0cda45b8c1775c6a0f1bdf52c8801ccdfd21a8c7 (diff) | |
download | plus-7d762d70604d250cb51282161d390cba1ea664c7.tar.gz plus-7d762d70604d250cb51282161d390cba1ea664c7.tar.bz2 plus-7d762d70604d250cb51282161d390cba1ea664c7.tar.xz plus-7d762d70604d250cb51282161d390cba1ea664c7.zip |
Macro reportAlways also show message in log if asserts disabled in compile time.
-rw-r--r-- | src/resources/sprite/spritedef.cpp | 20 | ||||
-rw-r--r-- | src/utils/checkutils.h | 7 | ||||
-rw-r--r-- | src/utils/xml/libxml.cpp | 7 | ||||
-rw-r--r-- | src/utils/xml/pugixml.cpp | 6 |
4 files changed, 12 insertions, 28 deletions
diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp index 312597789..ae7fb2580 100644 --- a/src/resources/sprite/spritedef.cpp +++ b/src/resources/sprite/spritedef.cpp @@ -100,7 +100,6 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, if (!rootNode || !xmlNameEqual(rootNode, "sprite")) { - logger->log("Error, failed to parse sprite %s", animationFile.c_str()); reportAlways("Error, failed to parse sprite %s", animationFile.c_str()); const std::string errorFile = paths.getStringValue("sprites").append( @@ -245,7 +244,6 @@ void SpriteDef::loadImageSet(const XmlNodePtr node, if (!imageSet) { - logger->log1("Couldn't load imageset!"); reportAlways("Couldn't load imageset!"); return; } @@ -268,8 +266,6 @@ void SpriteDef::loadAction(const XmlNodePtr node, const ImageSetIterator si = mImageSets.find(imageSetName); if (si == mImageSets.end()) { - logger->log("Warning: imageset \"%s\" not defined in %s", - imageSetName.c_str(), getIdPath().c_str()); reportAlways("Warning: imageset \"%s\" not defined in %s", imageSetName.c_str(), getIdPath().c_str()); return; @@ -278,8 +274,6 @@ void SpriteDef::loadAction(const XmlNodePtr node, if (actionName == SpriteAction::INVALID) { - logger->log("Warning: Unknown action \"%s\" defined in %s", - actionName.c_str(), getIdPath().c_str()); reportAlways("Warning: Unknown action \"%s\" defined in %s", actionName.c_str(), getIdPath().c_str()); return; @@ -320,10 +314,9 @@ void SpriteDef::loadAnimation(const XmlNodePtr animationNode, if (directionType == SpriteDirection::INVALID) { - logger->log("Warning: Unknown direction \"%s\" used in %s", - directionName.c_str(), getIdPath().c_str()); reportAlways("Warning: Unknown direction \"%s\" used in %s", - directionName.c_str(), getIdPath().c_str()); + directionName.c_str(), + getIdPath().c_str()); return; } @@ -454,8 +447,6 @@ void SpriteDef::includeSprite(const XmlNodePtr includeNode, const int variant) if (mProcessedFiles.find(filename) != mProcessedFiles.end()) { - logger->log("Error, Tried to include %s which already is included.", - filename.c_str()); reportAlways("Error, Tried to include %s which already is included.", filename.c_str()); return; @@ -467,7 +458,6 @@ void SpriteDef::includeSprite(const XmlNodePtr includeNode, const int variant) if (!rootNode || !xmlNameEqual(rootNode, "sprite")) { - logger->log("Error, no sprite root node in %s", filename.c_str()); reportAlways("Error, no sprite root node in %s", filename.c_str()); return; } @@ -553,7 +543,6 @@ bool SpriteDef::addSequence(const int start, if (start < 0 || end < 0) { - logger->log1("No valid value for 'start' or 'end'"); reportAlways("No valid value for 'start' or 'end'"); return true; } @@ -569,9 +558,6 @@ bool SpriteDef::addSequence(const int start, if (!img) { - logger->log("%s: No image at index %d", - mSource.c_str(), - pos + variant_offset); reportAlways("%s: No image at index %d", mSource.c_str(), pos + variant_offset); @@ -597,8 +583,6 @@ bool SpriteDef::addSequence(const int start, if (!img) { - logger->log("No image at index %d", - pos + variant_offset); reportAlways("No image at index %d", pos + variant_offset); pos ++; diff --git a/src/utils/checkutils.h b/src/utils/checkutils.h index b67c5d566..0423a0925 100644 --- a/src/utils/checkutils.h +++ b/src/utils/checkutils.h @@ -171,7 +171,12 @@ void reportStack(); #define reportFalseReal(val) (val) #define reportTrueReal(val) (val) -#define reportAlwaysReal(...) ; +#define reportAlwaysReal(...) \ + { \ + logger->log("Error:"); \ + logger->log( \ + __VA_ARGS__); \ + } #define returnFalseVReal(val) \ if (!val) \ diff --git a/src/utils/xml/libxml.cpp b/src/utils/xml/libxml.cpp index b03a32211..247d5cc9d 100644 --- a/src/utils/xml/libxml.cpp +++ b/src/utils/xml/libxml.cpp @@ -112,8 +112,8 @@ namespace XML size = CAST_S32(file.tellg()); if (size < 0) { - logger->log("Error loading XML file %s", filename.c_str()); - reportAlways("Error loading XML file %s", filename.c_str()); + reportAlways("Error loading XML file %s", + filename.c_str()); } else { @@ -125,7 +125,6 @@ namespace XML } else { - logger->log("Error loading XML file %s", filename.c_str()); reportAlways("Error loading XML file %s", filename.c_str()); } } @@ -137,13 +136,11 @@ namespace XML if (!mDoc) { - logger->log("Error parsing XML file %s", filename.c_str()); reportAlways("Error parsing XML file %s", filename.c_str()); } } else if (skipError == SkipError_false) { - logger->log("Error loading %s", filename.c_str()); reportAlways("Error loading XML file %s", filename.c_str()); } mIsValid = valid; diff --git a/src/utils/xml/pugixml.cpp b/src/utils/xml/pugixml.cpp index 62aa68cba..fe1564f2b 100644 --- a/src/utils/xml/pugixml.cpp +++ b/src/utils/xml/pugixml.cpp @@ -88,7 +88,6 @@ namespace XML size = CAST_S32(file.tellg()); if (size < 0) { - logger->log("Error loading XML file %s", filename.c_str()); reportAlways("Error loading XML file %s", filename.c_str()); } @@ -102,8 +101,8 @@ namespace XML } else { - logger->log("Error loading XML file %s", filename.c_str()); - reportAlways("Error loading XML file %s", filename.c_str()); + reportAlways("Error loading XML file %s", + filename.c_str()); } } @@ -129,7 +128,6 @@ namespace XML } else if (skipError == SkipError_false) { - logger->log("Error loading %s", filename.c_str()); reportAlways("Error loading %s", filename.c_str()); } mIsValid = valid; |