diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/mmaps_generator/MapBuilder.cpp | 51 | ||||
-rw-r--r-- | src/tools/mmaps_generator/MapBuilder.h | 3 | ||||
-rw-r--r-- | src/tools/mmaps_generator/PathGenerator.cpp | 2 |
3 files changed, 31 insertions, 25 deletions
diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index 4da48ab0a5a..88651765933 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -57,7 +57,7 @@ namespace MMAP { MapBuilder::MapBuilder(float maxWalkableAngle, bool skipLiquid, bool skipContinents, bool skipJunkMaps, bool skipBattlegrounds, - bool debugOutput, bool bigBaseUnit, const char* offMeshFilePath) : + bool debugOutput, bool bigBaseUnit, int mapid, const char* offMeshFilePath) : m_terrainBuilder (NULL), m_debugOutput (debugOutput), m_offMeshFilePath (offMeshFilePath), @@ -66,6 +66,7 @@ namespace MMAP m_skipBattlegrounds (skipBattlegrounds), m_maxWalkableAngle (maxWalkableAngle), m_bigBaseUnit (bigBaseUnit), + m_mapid (mapid), m_totalTiles (0u), m_totalTilesProcessed(0u), m_rcContext (NULL), @@ -152,10 +153,29 @@ namespace MMAP if (tiles->insert(tileID).second) count++; } + + // make sure we process maps which don't have tiles + if (tiles->empty()) + { + // convert coord bounds to grid bounds + uint32 minX, minY, maxX, maxY; + getGridBounds(mapID, minX, minY, maxX, maxY); + + // add all tiles within bounds to tile list. + for (uint32 i = minX; i <= maxX; ++i) + for (uint32 j = minY; j <= maxY; ++j) + if (tiles->insert(StaticMapTree::packTileID(i, j)).second) + count++; + } } printf("found %u.\n\n", count); - m_totalTiles.store(count, std::memory_order_relaxed); + // Calculate tiles to process in total + for (TileList::iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) + { + if (!shouldSkipMap(it->m_mapId)) + m_totalTiles += it->m_tiles->size(); + } } /**************************************************************************/ @@ -374,26 +394,8 @@ namespace MMAP /**************************************************************************/ void MapBuilder::buildMap(uint32 mapID) { -#ifndef __APPLE__ - //printf("[Thread %u] Building map %04u:\n", uint32(ACE_Thread::self()), mapID); -#endif - std::set<uint32>* tiles = getTileList(mapID); - // make sure we process maps which don't have tiles - if (!tiles->size()) - { - // convert coord bounds to grid bounds - uint32 minX, minY, maxX, maxY; - getGridBounds(mapID, minX, minY, maxX, maxY); - - // add all tiles within bounds to tile list. - for (uint32 i = minX; i <= maxX; ++i) - for (uint32 j = minY; j <= maxY; ++j) - if (tiles->insert(StaticMapTree::packTileID(i, j)).second) - ++m_totalTiles; - } - if (!tiles->empty()) { // build navMesh @@ -415,11 +417,9 @@ namespace MMAP // unpack tile coords StaticMapTree::unpackTileID((*it), tileX, tileY); + if (!shouldSkipTile(mapID, tileX, tileY)) + buildTile(mapID, tileX, tileY, navMesh); ++m_totalTilesProcessed; - if (shouldSkipTile(mapID, tileX, tileY)) - continue; - - buildTile(mapID, tileX, tileY, navMesh); } dtFreeNavMesh(navMesh); @@ -907,6 +907,9 @@ namespace MMAP /**************************************************************************/ bool MapBuilder::shouldSkipMap(uint32 mapID) { + if (m_mapid >= 0) + return static_cast<uint32>(m_mapid) != mapID; + if (m_skipContinents) switch (mapID) { diff --git a/src/tools/mmaps_generator/MapBuilder.h b/src/tools/mmaps_generator/MapBuilder.h index 316217f8c2b..0b69964028c 100644 --- a/src/tools/mmaps_generator/MapBuilder.h +++ b/src/tools/mmaps_generator/MapBuilder.h @@ -83,6 +83,7 @@ namespace MMAP bool skipBattlegrounds = false, bool debugOutput = false, bool bigBaseUnit = false, + int mapid = -1, const char* offMeshFilePath = NULL); ~MapBuilder(); @@ -141,6 +142,8 @@ namespace MMAP float m_maxWalkableAngle; bool m_bigBaseUnit; + int32 m_mapid; + std::atomic<uint32> m_totalTiles; std::atomic<uint32> m_totalTilesProcessed; diff --git a/src/tools/mmaps_generator/PathGenerator.cpp b/src/tools/mmaps_generator/PathGenerator.cpp index 9684f75d099..83d9b334b56 100644 --- a/src/tools/mmaps_generator/PathGenerator.cpp +++ b/src/tools/mmaps_generator/PathGenerator.cpp @@ -281,7 +281,7 @@ int main(int argc, char** argv) return silent ? -3 : finish("Press ENTER to close...", -3); MapBuilder builder(maxAngle, skipLiquid, skipContinents, skipJunkMaps, - skipBattlegrounds, debugOutput, bigBaseUnit, offMeshInputPath); + skipBattlegrounds, debugOutput, bigBaseUnit, mapnum, offMeshInputPath); uint32 start = getMSTime(); if (file) |