diff options
author | Giacomo Pozzoni <giacomopoz@gmail.com> | 2021-12-17 14:16:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-17 14:16:18 +0100 |
commit | 8c80f28581646af110c4d2b316209ef291a95587 (patch) | |
tree | 2db70a8f72aa38222ce55b38a650cdb031d9e003 /src | |
parent | 81da3d947cfab9356bfbe4bbd68267efb10192b5 (diff) |
Tools/MMAPs: Show an error when running mmaps_generator built in Debug mode (#27412)
* Tools/MMAPs: Show an error when running mmaps_generator built in Debug mode
* Fix GCC build
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/mmaps_generator/PathGenerator.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/tools/mmaps_generator/PathGenerator.cpp b/src/tools/mmaps_generator/PathGenerator.cpp index 6010a690c4f..590177dc8e5 100644 --- a/src/tools/mmaps_generator/PathGenerator.cpp +++ b/src/tools/mmaps_generator/PathGenerator.cpp @@ -71,6 +71,13 @@ bool checkDirectories(bool debugOutput) return true; } +int finish(char const* message, int returnValue) +{ + printf("%s", message); + getchar(); // Wait for user input + return returnValue; +} + bool handleArgs(int argc, char** argv, int &mapnum, int &tileX, @@ -89,6 +96,7 @@ bool handleArgs(int argc, char** argv, unsigned int& threads) { char* param = nullptr; + [[maybe_unused]] bool allowDebug = false; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "--maxAngle") == 0) @@ -241,6 +249,10 @@ bool handleArgs(int argc, char** argv, offMeshInputPath = param; } + else if (strcmp(argv[i], "--allowDebug") == 0) + { + allowDebug = true; + } else { int map = atoi(argv[i]); @@ -254,14 +266,16 @@ bool handleArgs(int argc, char** argv, } } - return true; -} +#ifndef NDEBUG + if (!allowDebug) + { + finish("Build mmaps_generator in RelWithDebInfo or Release mode or it will take hours to complete!!!\nUse '--allowDebug' argument if you really want to run this tool in Debug.\n", -2); + silent = true; + return false; + } +#endif -int finish(char const* message, int returnValue) -{ - printf("%s", message); - getchar(); // Wait for user input - return returnValue; + return true; } std::unordered_map<uint32, uint8> LoadLiquid() |