diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/mmaps_generator/MapBuilder.cpp | 12 | ||||
-rw-r--r-- | src/tools/mmaps_generator/MapBuilder.h | 2 | ||||
-rw-r--r-- | src/tools/mmaps_generator/PathGenerator.cpp | 15 | ||||
-rw-r--r-- | src/tools/vmap4_assembler/VMapAssembler.cpp | 15 | ||||
-rw-r--r-- | src/tools/vmap4_extractor/vmapexport.cpp | 2 |
5 files changed, 27 insertions, 19 deletions
diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index e7f91507368..bfaa4211569 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -26,7 +26,7 @@ #include <limits.h> #define MMAP_MAGIC 0x4d4d4150 // 'MMAP' -#define MMAP_VERSION 6 +#define MMAP_VERSION 7 struct MmapTileHeader { @@ -207,9 +207,11 @@ namespace MMAP } } - void MapBuilder::buildAllMaps(int threads) + void MapBuilder::buildAllMaps(unsigned int threads) { - for (int i = 0; i < threads; ++i) + printf("Using %u threads to extract mmaps\n", threads); + + for (unsigned int i = 0; i < threads; ++i) { _workerThreads.push_back(std::thread(&MapBuilder::WorkerThread, this)); } @@ -596,8 +598,8 @@ namespace MMAP config.minRegionArea = rcSqr(60); config.mergeRegionArea = rcSqr(50); config.maxSimplificationError = 1.8f; // eliminates most jagged edges (tiny polygons) - config.detailSampleDist = config.cs * 64; - config.detailSampleMaxError = config.ch * 2; + config.detailSampleDist = config.cs * 16; + config.detailSampleMaxError = config.ch * 1; // this sets the dimensions of the heightfield - should maybe happen before border padding rcCalcGridSize(config.bmin, config.bmax, config.cs, &config.width, &config.height); diff --git a/src/tools/mmaps_generator/MapBuilder.h b/src/tools/mmaps_generator/MapBuilder.h index 4b6e0f2795f..19715cbdea6 100644 --- a/src/tools/mmaps_generator/MapBuilder.h +++ b/src/tools/mmaps_generator/MapBuilder.h @@ -94,7 +94,7 @@ namespace MMAP void buildSingleTile(uint32 mapID, uint32 tileX, uint32 tileY); // builds list of maps, then builds all of mmap tiles (based on the skip settings) - void buildAllMaps(int threads); + void buildAllMaps(unsigned int threads); void WorkerThread(); diff --git a/src/tools/mmaps_generator/PathGenerator.cpp b/src/tools/mmaps_generator/PathGenerator.cpp index 60ed18aec99..5970b4de276 100644 --- a/src/tools/mmaps_generator/PathGenerator.cpp +++ b/src/tools/mmaps_generator/PathGenerator.cpp @@ -16,6 +16,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <boost/filesystem.hpp> + #include "PathCommon.h" #include "MapBuilder.h" #include "Timer.h" @@ -42,10 +44,7 @@ bool checkDirectories(bool debugOutput) dirFiles.clear(); if (getDirContents(dirFiles, "mmaps") == LISTFILE_DIRECTORY_NOT_FOUND) - { - printf("'mmaps' directory does not exist\n"); - return false; - } + return boost::filesystem::create_directory("mmaps"); dirFiles.clear(); if (debugOutput) @@ -74,7 +73,7 @@ bool handleArgs(int argc, char** argv, bool &bigBaseUnit, char* &offMeshInputPath, char* &file, - int& threads) + unsigned int& threads) { char* param = nullptr; for (int i = 1; i < argc; ++i) @@ -96,8 +95,7 @@ bool handleArgs(int argc, char** argv, param = argv[++i]; if (!param) return false; - threads = atoi(param); - printf("Using %i threads to extract mmaps\n", threads); + threads = static_cast<unsigned int>(std::max(0, atoi(param))); } else if (strcmp(argv[i], "--file") == 0) { @@ -245,7 +243,8 @@ int main(int argc, char** argv) { Trinity::Banner::Show("MMAP generator", [](char const* text) { printf("%s\n", text); }, nullptr); - int threads = 3, mapnum = -1; + unsigned int threads = std::thread::hardware_concurrency(); + int mapnum = -1; float maxAngle = 70.0f; int tileX = -1, tileY = -1; bool skipLiquid = false, diff --git a/src/tools/vmap4_assembler/VMapAssembler.cpp b/src/tools/vmap4_assembler/VMapAssembler.cpp index 170ce80fcb2..26efb0bb586 100644 --- a/src/tools/vmap4_assembler/VMapAssembler.cpp +++ b/src/tools/vmap4_assembler/VMapAssembler.cpp @@ -26,14 +26,21 @@ int main(int argc, char* argv[]) { Trinity::Banner::Show("VMAP assembler", [](char const* text) { std::cout << text << std::endl; }, nullptr); - if (argc != 3) + std::string src = "Buildings"; + std::string dest = "vmaps"; + + if (argc > 3) { std::cout << "usage: " << argv[0] << " <raw data dir> <vmap dest dir>" << std::endl; return 1; } - - std::string src = argv[1]; - std::string dest = argv[2]; + else + { + if (argc > 1) + src = argv[1]; + if (argc > 2) + dest = argv[2]; + } std::cout << "using " << src << " as source directory and writing output to " << dest << std::endl; diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index ff2dd61cb07..e6340bde553 100644 --- a/src/tools/vmap4_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -25,7 +25,7 @@ #include "Banner.h" #include <sys/stat.h> -#ifdef WIN32 +#ifdef _WIN32 #include <direct.h> #define mkdir _mkdir #endif |