Add a command-line option to report which colors file is being used.
This commit is contained in:
parent
b7fe1404fa
commit
224c6b1df7
@ -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.
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -153,6 +153,7 @@ private:
|
||||
|
||||
public:
|
||||
int verboseCoordinates;
|
||||
int verboseReadColors;
|
||||
bool verboseStatistics;
|
||||
bool progressIndicator;
|
||||
|
||||
|
11
mapper.cpp
11
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 <x>,<y>|world|map\n"
|
||||
" --tilecenter <x>,<y>|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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user