Tools/mapextractor: Don't print updating progress % when sending output to file instead of console

This commit is contained in:
Shauren
2021-03-10 23:19:27 +01:00
parent 0aa3a0b0b9
commit f4ff0489ca

View File

@@ -36,6 +36,11 @@
#include <unordered_map>
#include <cstdlib>
#include <cstring>
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
#include <io.h>
#else
#include <unistd.h>
#endif
std::shared_ptr<CASC::Storage> CascStorage;
@@ -68,6 +73,7 @@ std::unordered_map<uint32, LiquidMaterialEntry> LiquidMaterials;
std::unordered_map<uint32, LiquidObjectEntry> LiquidObjects;
std::unordered_map<uint32, LiquidTypeEntry> LiquidTypes;
std::set<uint32> CameraFileDataIds;
bool PrintProgress = true;
boost::filesystem::path input_path;
boost::filesystem::path output_path;
@@ -1149,7 +1155,8 @@ void ExtractMaps(uint32 build)
}
// draw progress bar
printf("Processing........................%d%%\r", (100 * (y + 1)) / WDT_MAP_SIZE);
if (PrintProgress)
printf("Processing........................%d%%\r", (100 * (y + 1)) / WDT_MAP_SIZE);
}
}
@@ -1483,6 +1490,7 @@ int main(int argc, char * arg[])
{
Trinity::Banner::Show("Map & DBC Extractor", [](char const* text) { printf("%s\n", text); }, nullptr);
PrintProgress = isatty(fileno(stdout));
input_path = boost::filesystem::current_path();
output_path = boost::filesystem::current_path();