From f7e822adf0c7f6ee7a8a2851d36c423d94ec4e5a Mon Sep 17 00:00:00 2001 From: Rogier Date: Tue, 10 Mar 2015 12:18:41 +0100 Subject: [PATCH] Change verboseStatistics to int (from bool) --- TileGenerator.cpp | 9 ++++++--- TileGenerator.h | 2 +- mapper.cpp | 7 ++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/TileGenerator.cpp b/TileGenerator.cpp index 644a62c..cfbd9b1 100644 --- a/TileGenerator.cpp +++ b/TileGenerator.cpp @@ -131,7 +131,7 @@ struct HeightMapColor TileGenerator::TileGenerator(): verboseCoordinates(0), verboseReadColors(0), - verboseStatistics(false), + verboseStatistics(0), progressIndicator(false), m_heightMap(false), m_heightMapYScale(1), @@ -1553,7 +1553,9 @@ void TileGenerator::renderMap() pushPixelRows(m_blockPixelAttributes, currentPos.z() - 1); } } + bool eraseProgress = true; if (verboseCoordinates >= 1) { + eraseProgress = false; cout << std::setw(MESSAGE_WIDTH) << std::left << "Mapped Vertical Range:" << std::right @@ -1574,7 +1576,8 @@ void TileGenerator::renderMap() << std::setw(6) << "z" << ")\n"; } - if (verboseStatistics) { + if (verboseStatistics >= 1) { + eraseProgress = false; cout << "Statistics" << ": blocks read/queried: " << m_db->getBlocksReadCount() << " / " << m_db->getBlocksQueriedCount() @@ -1586,7 +1589,7 @@ void TileGenerator::renderMap() cout << " (" << unpackErrors << " errors)"; cout << std::endl; } - else if (progressIndicator) + if (progressIndicator && eraseProgress) cout << std::setw(50) << "" << "\r"; } diff --git a/TileGenerator.h b/TileGenerator.h index 696c867..a289946 100644 --- a/TileGenerator.h +++ b/TileGenerator.h @@ -211,7 +211,7 @@ private: public: int verboseCoordinates; int verboseReadColors; - bool verboseStatistics; + int verboseStatistics; bool progressIndicator; private: diff --git a/mapper.cpp b/mapper.cpp index 2ba79bb..7641aea 100644 --- a/mapper.cpp +++ b/mapper.cpp @@ -828,14 +828,11 @@ int main(int argc, char *argv[]) break; case 'v': if (optarg && isdigit(optarg[0]) && optarg[1] == '\0') { - if (optarg[0] == '0') - generator.verboseStatistics = false; - else - generator.verboseStatistics = true; + generator.verboseStatistics = optarg[0] - '0'; generator.verboseCoordinates = optarg[0] - '0'; } else { - generator.verboseStatistics = true; + generator.verboseStatistics = 1; generator.verboseCoordinates = 1; } break;