Change verboseStatistics to int (from bool)

master
Rogier 2015-03-10 12:18:41 +01:00
parent 46c070070a
commit f7e822adf0
3 changed files with 9 additions and 9 deletions

View File

@ -131,7 +131,7 @@ struct HeightMapColor
TileGenerator::TileGenerator(): TileGenerator::TileGenerator():
verboseCoordinates(0), verboseCoordinates(0),
verboseReadColors(0), verboseReadColors(0),
verboseStatistics(false), verboseStatistics(0),
progressIndicator(false), progressIndicator(false),
m_heightMap(false), m_heightMap(false),
m_heightMapYScale(1), m_heightMapYScale(1),
@ -1553,7 +1553,9 @@ void TileGenerator::renderMap()
pushPixelRows(m_blockPixelAttributes, currentPos.z() - 1); pushPixelRows(m_blockPixelAttributes, currentPos.z() - 1);
} }
} }
bool eraseProgress = true;
if (verboseCoordinates >= 1) { if (verboseCoordinates >= 1) {
eraseProgress = false;
cout cout
<< std::setw(MESSAGE_WIDTH) << std::left << std::setw(MESSAGE_WIDTH) << std::left
<< "Mapped Vertical Range:" << std::right << "Mapped Vertical Range:" << std::right
@ -1574,7 +1576,8 @@ void TileGenerator::renderMap()
<< std::setw(6) << "z" << std::setw(6) << "z"
<< ")\n"; << ")\n";
} }
if (verboseStatistics) { if (verboseStatistics >= 1) {
eraseProgress = false;
cout << "Statistics" cout << "Statistics"
<< ": blocks read/queried: " << m_db->getBlocksReadCount() << ": blocks read/queried: " << m_db->getBlocksReadCount()
<< " / " << m_db->getBlocksQueriedCount() << " / " << m_db->getBlocksQueriedCount()
@ -1586,7 +1589,7 @@ void TileGenerator::renderMap()
cout << " (" << unpackErrors << " errors)"; cout << " (" << unpackErrors << " errors)";
cout << std::endl; cout << std::endl;
} }
else if (progressIndicator) if (progressIndicator && eraseProgress)
cout << std::setw(50) << "" << "\r"; cout << std::setw(50) << "" << "\r";
} }

View File

@ -211,7 +211,7 @@ private:
public: public:
int verboseCoordinates; int verboseCoordinates;
int verboseReadColors; int verboseReadColors;
bool verboseStatistics; int verboseStatistics;
bool progressIndicator; bool progressIndicator;
private: private:

View File

@ -828,14 +828,11 @@ int main(int argc, char *argv[])
break; break;
case 'v': case 'v':
if (optarg && isdigit(optarg[0]) && optarg[1] == '\0') { if (optarg && isdigit(optarg[0]) && optarg[1] == '\0') {
if (optarg[0] == '0') generator.verboseStatistics = optarg[0] - '0';
generator.verboseStatistics = false;
else
generator.verboseStatistics = true;
generator.verboseCoordinates = optarg[0] - '0'; generator.verboseCoordinates = optarg[0] - '0';
} }
else { else {
generator.verboseStatistics = true; generator.verboseStatistics = 1;
generator.verboseCoordinates = 1; generator.verboseCoordinates = 1;
} }
break; break;