aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/mmaps_generator/MapBuilder.cpp6
-rw-r--r--src/tools/mmaps_generator/MapBuilder.h2
-rw-r--r--src/tools/mmaps_generator/PathGenerator.cpp8
3 files changed, 9 insertions, 7 deletions
diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp
index 6b277592ff9..b3f3d521d7c 100644
--- a/src/tools/mmaps_generator/MapBuilder.cpp
+++ b/src/tools/mmaps_generator/MapBuilder.cpp
@@ -190,9 +190,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));
}
diff --git a/src/tools/mmaps_generator/MapBuilder.h b/src/tools/mmaps_generator/MapBuilder.h
index 7de56d9e47c..4d0d6444757 100644
--- a/src/tools/mmaps_generator/MapBuilder.h
+++ b/src/tools/mmaps_generator/MapBuilder.h
@@ -95,7 +95,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 f73ff495048..9684f75d099 100644
--- a/src/tools/mmaps_generator/PathGenerator.cpp
+++ b/src/tools/mmaps_generator/PathGenerator.cpp
@@ -73,7 +73,7 @@ bool handleArgs(int argc, char** argv,
bool &bigBaseUnit,
char* &offMeshInputPath,
char* &file,
- int& threads)
+ unsigned int& threads)
{
char* param = NULL;
for (int i = 1; i < argc; ++i)
@@ -95,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)
{
@@ -244,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,