mirror of
https://github.com/minetest/minetestmapper.git
synced 2024-11-21 23:13:53 +01:00
Do not require -o to be passed when printing extents
This commit is contained in:
parent
8e8cc3d1f2
commit
f909304e1e
37
mapper.cpp
37
mapper.cpp
@ -95,18 +95,13 @@ int main(int argc, char *argv[])
|
|||||||
std::string colors = "";
|
std::string colors = "";
|
||||||
|
|
||||||
TileGenerator generator;
|
TileGenerator generator;
|
||||||
int option_index = 0;
|
|
||||||
int c = 0;
|
|
||||||
bool onlyPrintExtent = false;
|
bool onlyPrintExtent = false;
|
||||||
while (1) {
|
while (1) {
|
||||||
c = getopt_long(argc, argv, "hi:o:", long_options, &option_index);
|
int option_index;
|
||||||
if (c == -1) {
|
int c = getopt_long(argc, argv, "hi:o:", long_options, &option_index);
|
||||||
if (input.empty() || output.empty()) {
|
if (c == -1)
|
||||||
usage();
|
break; // done
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
usage();
|
usage();
|
||||||
@ -208,14 +203,24 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(colors == "")
|
|
||||||
colors = search_colors(input);
|
if (input.empty() || (!onlyPrintExtent && output.empty())) {
|
||||||
|
usage();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
generator.parseColorsFile(colors);
|
|
||||||
if (onlyPrintExtent)
|
if (onlyPrintExtent) {
|
||||||
generator.printGeometry(input);
|
generator.printGeometry(input);
|
||||||
else
|
return 0;
|
||||||
generator.generate(input, output);
|
}
|
||||||
|
|
||||||
|
if(colors == "")
|
||||||
|
colors = search_colors(input);
|
||||||
|
generator.parseColorsFile(colors);
|
||||||
|
generator.generate(input, output);
|
||||||
|
|
||||||
} catch(std::runtime_error e) {
|
} catch(std::runtime_error e) {
|
||||||
std::cerr << "Exception: " << e.what() << std::endl;
|
std::cerr << "Exception: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user