diff --git a/include/llmr/util/constants.hpp b/include/llmr/util/constants.hpp index ba967f994..1419410df 100644 --- a/include/llmr/util/constants.hpp +++ b/include/llmr/util/constants.hpp @@ -11,6 +11,13 @@ namespace util { extern const float tileSize; } + +namespace debug { + +extern const bool styleParseWarnings; + +} + } #endif diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp index f4d94f51a..18ffafe58 100644 --- a/src/style/style_parser.cpp +++ b/src/style/style_parser.cpp @@ -1,4 +1,5 @@ #include +#include #include using namespace llmr; @@ -286,7 +287,9 @@ void StyleParser::parseClass(const std::string &name, JSVal value, ClassDescript auto layer_bucket_it = layerBuckets.find(name); if (layer_bucket_it == layerBuckets.end()) { - fprintf(stderr, "there is no layer associated with style '%s'\n", name.c_str()); + if (debug::styleParseWarnings) { + fprintf(stderr, "[WARNING] there is no layer associated with '%s'\n", name.c_str()); + } return; } @@ -297,6 +300,9 @@ void StyleParser::parseClass(const std::string &name, JSVal value, ClassDescript } else { auto bucket_it = buckets.find(bucket_name); if (bucket_it == buckets.end()) { + if (debug::styleParseWarnings) { + fprintf(stderr, "[WARNING] there is no bucket named '%s'\n", bucket_name.c_str()); + } return; } diff --git a/src/util/constants.cpp b/src/util/constants.cpp index 9fc4a4544..e74f95f24 100644 --- a/src/util/constants.cpp +++ b/src/util/constants.cpp @@ -1,3 +1,6 @@ #include const float llmr::util::tileSize = 512.0f; + +// Debug flags +const bool llmr::debug::styleParseWarnings = true;