Add option --silence-suggestions, to disable certain messages

Specific message types will be in a later commit
This commit is contained in:
Rogier 2015-03-10 13:23:44 +01:00
parent 8349d41283
commit 0a5e24b7d7
4 changed files with 49 additions and 0 deletions

View File

@ -137,6 +137,7 @@ TileGenerator::TileGenerator():
verboseReadColors(0),
verboseStatistics(0),
progressIndicator(false),
m_silenceSuggestions(0),
m_heightMap(false),
m_heightMapYScale(1),
m_seaLevel(0),
@ -208,6 +209,11 @@ TileGenerator::~TileGenerator()
{
}
void TileGenerator::setSilenceSuggestion(unsigned flags)
{
m_silenceSuggestions |= flags;
}
void TileGenerator::setGenerateNoPrefetch(int enable)
{
m_generateNoPrefetch = enable;

View File

@ -54,6 +54,8 @@
#define SCALESIZE_VERT 50
#define HEIGHTSCALESIZE 60
#define SUGGESTION_ALL 0xffffffff
class TileGenerator
{
private:
@ -109,6 +111,7 @@ public:
TileGenerator();
~TileGenerator();
void setSilenceSuggestion(unsigned flags);
void setGenerateNoPrefetch(int enable);
void setDBFormat(BlockPos::StrFormat format, bool query);
void setHeightMap(bool enable);
@ -217,6 +220,7 @@ public:
bool progressIndicator;
private:
unsigned m_silenceSuggestions;
bool m_heightMap;
float m_heightMapYScale;
int m_seaLevel;

View File

@ -282,6 +282,7 @@ Feedback / information options:
* ``--version`` : Print version ID of minetestmapper
* ``--verbose[=<n>]`` : Report world and map statistics (size, dimensions, number of blocks)
* ``--verbose-search-colors[=n]`` : Report which colors files are used and/or which locations are searched
* ``--silence-suggestions all`` : Do not bother doing suggestions
* ``--progress`` : Show a progress indicator while generating the map
Miscellaneous options
@ -1055,6 +1056,15 @@ Detailed Description of Options
.. image:: images/drawscale-both.png
.. image:: images/sidescale-interval.png
``--silence-suggestions all``
......................................
Do not print usage suggestions of the specified types.
If applicable, minetestmapper may suggest using or adjusting certain options
if that may be advantageous. This option disables such messages.
:all: Silence all existing (and future) suggestions there may be.
``--sqlite-cacheworldrow``
..........................
This option is no longer supported, as minetestmapper performed
@ -1765,6 +1775,7 @@ More information is available:
.. _--origincolor: `--origincolor <color>`_
.. _--output: `--output <output_image.png>`_
.. _--playercolor: `--playercolor <color>`_
.. _--silence-suggestions: `--silence-suggestions all`_
.. _--scalecolor: `--scalecolor <color>`_
.. _--scalefactor: `--scalefactor 1:<n>`_
.. _--height-level-0: `--height-level-0 <level>`_

View File

@ -41,6 +41,7 @@ using namespace std;
#define OPT_SCALEINTERVAL 0x8f
#define OPT_NO_BLOCKLIST_PREFETCH 0x90
#define OPT_DATABASE_FORMAT 0x91
#define OPT_SILENCE_SUGGESTIONS 0x92
// Will be replaced with the actual name and location of the executable (if found)
string executableName = "minetestmapper";
@ -124,6 +125,7 @@ void usage()
" --tilecenter <x>,<y>|world|map\n"
" --scalefactor 1:<n>\n"
" --chunksize <size>\n"
" --silence-suggestions all\n"
" --verbose[=n]\n"
" --verbose-search-colors[=n]\n"
" --progress\n"
@ -631,6 +633,7 @@ int main(int argc, char *argv[])
{"tilebordercolor", required_argument, 0, 'B'},
{"scalefactor", required_argument, 0, OPT_SCALEFACTOR},
{"chunksize", required_argument, 0, OPT_CHUNKSIZE},
{"silence-suggestions", required_argument, 0, OPT_SILENCE_SUGGESTIONS},
{"verbose", optional_argument, 0, 'v'},
{"verbose-search-colors", optional_argument, 0, OPT_VERBOSE_SEARCH_COLORS},
{"progress", no_argument, 0, OPT_PROGRESS_INDICATOR},
@ -863,6 +866,31 @@ int main(int argc, char *argv[])
}
}
break;
case OPT_SILENCE_SUGGESTIONS: {
for (size_t i = 0; i < strlen(optarg); i++) {
optarg[i] = tolower(optarg[i]);
if (optarg[i] == ',')
optarg[i] = ' ';
}
std::istringstream iss(optarg);
std::string flag;
do {
iss >> flag >> std::ws;
if (iss.fail()) {
std::cerr << "Invalid flag(s) to '" << long_options[option_index].name << "': '" << optarg << "'" << std::endl;
usage();
exit(1);
}
else if (flag == "all")
generator.setSilenceSuggestion(SUGGESTION_ALL);
else {
std::cerr << "Invalid flag to '" << long_options[option_index].name << "': '" << flag << "'" << std::endl;
usage();
exit(1);
}
} while (!iss.eof());
}
break;
case 'v':
if (optarg && isdigit(optarg[0]) && optarg[1] == '\0') {
generator.verboseStatistics = optarg[0] - '0';