aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/mmaps_generator/MapBuilder.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp
index a29502535e6..94b5f3607cf 100644
--- a/src/tools/mmaps_generator/MapBuilder.cpp
+++ b/src/tools/mmaps_generator/MapBuilder.cpp
@@ -171,13 +171,16 @@ namespace MMAP
{
while (1)
{
- uint32* mapId;
+ uint32* mapId = nullptr;
_queue.WaitAndPop(mapId);
if (_cancelationToken)
return;
+ if (!mapId) // shouldn't happen?
+ continue;
+
buildMap(*mapId);
delete mapId;
@@ -186,7 +189,7 @@ namespace MMAP
void MapBuilder::buildAllMaps(int threads)
{
- for (size_t i = 0; i < threads; ++i)
+ for (int i = 0; i < threads; ++i)
{
_workerThreads.push_back(std::thread(&MapBuilder::WorkerThread, this));
}
@@ -198,13 +201,13 @@ namespace MMAP
for (TileList::iterator it = m_tiles.begin(); it != m_tiles.end(); ++it)
{
- uint32* mapID = new uint32(it->m_mapId);
- if (!shouldSkipMap(*mapID))
+ uint32 mapId = it->m_mapId;
+ if (!shouldSkipMap(mapId))
{
if (threads > 0)
- _queue.Push(mapID);
+ _queue.Push(new uint32(mapId));
else
- buildMap(*mapID);
+ buildMap(mapId);
}
}