diff --git a/include/llmr/util/constants.hpp b/include/llmr/util/constants.hpp index 2b8cc2da2..70befcb37 100644 --- a/include/llmr/util/constants.hpp +++ b/include/llmr/util/constants.hpp @@ -16,6 +16,7 @@ namespace debug { extern const bool tileParseWarnings; extern const bool styleParseWarnings; +extern const bool spriteWarnings; extern const bool renderWarnings; extern const bool renderTree; diff --git a/src/geometry/sprite_atlas.cpp b/src/geometry/sprite_atlas.cpp index eb5de3cfd..35f6f4588 100644 --- a/src/geometry/sprite_atlas.cpp +++ b/src/geometry/sprite_atlas.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include @@ -124,7 +125,9 @@ Rect SpriteAtlas::getIcon(const int size, const std::str Rect rect = allocateImage(size, size); if (rect.w == 0) { - fprintf(stderr, "sprite atlas bitmap overflow\n"); + if (debug::spriteWarnings) { + fprintf(stderr, "[WARNING] sprite atlas bitmap overflow\n"); + } return rect; } @@ -165,7 +168,9 @@ Rect SpriteAtlas::getImage(const std::string &name, cons Rect rect = allocateImage(pos.width / pos.pixelRatio, pos.height / pos.pixelRatio); if (rect.w == 0) { - fprintf(stderr, "sprite atlas bitmap overflow\n"); + if (debug::spriteWarnings) { + fprintf(stderr, "[WARNING] sprite atlas bitmap overflow\n"); + } return rect; } @@ -215,6 +220,9 @@ void SpriteAtlas::update(const Sprite &sprite) { Rect dst = atlas.getImage(name, sprite); const SpritePosition &src = sprite.getSpritePosition(name); if (!src) { + if (debug::spriteWarnings) { + fprintf(stderr, "[WARNING] sprite doesn't have image with name '%s'\n", name.c_str()); + } return true; } @@ -222,7 +230,9 @@ void SpriteAtlas::update(const Sprite &sprite) { atlas.copy(dst, src, sprite); return true; } else { - fprintf(stderr, "sprite icon dimension mismatch\n"); + if (debug::spriteWarnings) { + fprintf(stderr, "[WARNING] sprite icon dimension mismatch\n"); + } return false; } }); diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index 1b1f36dd4..49444428a 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -106,8 +106,9 @@ std::unique_ptr TileParser::createBucket(const BucketDescription& bucket } else { // The layer specified in the bucket does not exist. Do nothing. if (debug::tileParseWarnings) { - fprintf(stderr, "[WARNING] layer '%s' does not exist in source '%s'\n", - bucket_desc.source_layer.c_str(), bucket_desc.source_name.c_str()); + fprintf(stderr, "[WARNING] layer '%s' does not exist in tile %d/%d/%d of source '%s'\n", + bucket_desc.source_layer.c_str(), tile.id.z, tile.id.x, tile.id.y, + bucket_desc.source_name.c_str()); } } diff --git a/src/util/constants.cpp b/src/util/constants.cpp index f6282ab5e..2a4ecd374 100644 --- a/src/util/constants.cpp +++ b/src/util/constants.cpp @@ -2,7 +2,8 @@ const float llmr::util::tileSize = 512.0f; -const bool llmr::debug::tileParseWarnings = true; -const bool llmr::debug::styleParseWarnings = true; -const bool llmr::debug::renderWarnings = true; +const bool llmr::debug::tileParseWarnings = false; +const bool llmr::debug::styleParseWarnings = false; +const bool llmr::debug::spriteWarnings = false; +const bool llmr::debug::renderWarnings = false; const bool llmr::debug::renderTree = false;