diff --git a/README.rst b/README.rst index cdc0454..9c571da 100644 --- a/README.rst +++ b/README.rst @@ -339,3 +339,8 @@ verbose: * database access statistics. +verbose-search-colors: + report the location of the colors file that was used. + + With `--verbose-search-colors=2`, report all locations that are being + searched as well. diff --git a/TileGenerator.cpp b/TileGenerator.cpp index ddd3c8f..ce2e3e9 100644 --- a/TileGenerator.cpp +++ b/TileGenerator.cpp @@ -118,6 +118,7 @@ static inline int readBlockContent(const unsigned char *mapData, int version, in TileGenerator::TileGenerator(): verboseCoordinates(0), + verboseReadColors(0), verboseStatistics(false), progressIndicator(false), m_bgColor(255, 255, 255), @@ -326,12 +327,16 @@ void TileGenerator::setMaxY(int y) void TileGenerator::parseColorsFile(const std::string &fileName) { + if (verboseReadColors >= 2) + cout << "Checking for colors file: " << fileName << std::endl; ifstream in; in.open(fileName.c_str(), ifstream::in); if (!in.is_open()) { throw std::runtime_error(std::string("Failed to open colors file '") + fileName + "'"); return; } + if (verboseReadColors >= 1) + cout << "Reading colors file: " << fileName << std::endl; parseColorsStream(in, fileName.c_str()); in.close(); } diff --git a/TileGenerator.h b/TileGenerator.h index 0afe360..23b8584 100644 --- a/TileGenerator.h +++ b/TileGenerator.h @@ -153,6 +153,7 @@ private: public: int verboseCoordinates; + int verboseReadColors; bool verboseStatistics; bool progressIndicator; diff --git a/mapper.cpp b/mapper.cpp index a4508b1..b260716 100644 --- a/mapper.cpp +++ b/mapper.cpp @@ -25,6 +25,7 @@ using namespace std; #define OPT_SQLITE_CACHEWORLDROW 0x81 #define OPT_PROGRESS_INDICATOR 0x82 #define OPT_DRAW_OBJECT 0x83 +#define OPT_VERBOSE_SEARCH_COLORS 0x86 // Will be replaced with the actual name and location of the executable (if found) string executableName = "minetestmapper"; @@ -94,6 +95,7 @@ void usage() " --tileorigin ,|world|map\n" " --tilecenter ,|world|map\n" " --verbose[=n]\n" + " --verbose-search-colors[=n]\n" " --progress\n" "Color formats:\n" "\t'#000' or '#000000' (RGB)\n" @@ -548,6 +550,7 @@ int main(int argc, char *argv[]) {"tilecenter", required_argument, 0, 'T'}, {"tilebordercolor", required_argument, 0, 'B'}, {"verbose", optional_argument, 0, 'v'}, + {"verbose-search-colors", optional_argument, 0, OPT_VERBOSE_SEARCH_COLORS}, {"progress", no_argument, 0, OPT_PROGRESS_INDICATOR}, {NULL, 0, 0, 0} }; @@ -627,6 +630,14 @@ int main(int argc, char *argv[]) generator.verboseCoordinates = 1; } break; + case OPT_VERBOSE_SEARCH_COLORS: + if (optarg && isdigit(optarg[0]) && optarg[1] == '\0') { + generator.verboseReadColors = optarg[0] - '0'; + } + else { + generator.verboseReadColors++; + } + break; case 'e': generator.setDrawAlpha(true); break;