From f4ff0489ca0df27ebca37b8423b8dab61f2978cc Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 10 Mar 2021 23:19:27 +0100 Subject: Tools/mapextractor: Don't print updating progress % when sending output to file instead of console --- src/tools/map_extractor/System.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 8e557095c45..6876b58a7cc 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -36,6 +36,11 @@ #include #include #include +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS +#include +#else +#include +#endif std::shared_ptr CascStorage; @@ -68,6 +73,7 @@ std::unordered_map LiquidMaterials; std::unordered_map LiquidObjects; std::unordered_map LiquidTypes; std::set 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(); -- cgit v1.2.3