mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
feat(Tools/MMapsGenerator): percentage progress (#10948)
* cherry-pick commit (TrinityCore/TrinityCore@b9f276f) * cherry-pick commit (TrinityCore/TrinityCore@29937aa)
This commit is contained in:
committed by
GitHub
parent
659775548f
commit
7cb9a73ef9
@@ -28,7 +28,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_debugOutput (debugOutput),
|
||||
m_offMeshFilePath (offMeshFilePath),
|
||||
@@ -37,6 +37,9 @@ namespace MMAP
|
||||
m_skipBattlegrounds (skipBattlegrounds),
|
||||
m_maxWalkableAngle (maxWalkableAngle),
|
||||
m_bigBaseUnit (bigBaseUnit),
|
||||
m_mapid (mapid),
|
||||
m_totalTiles (0u),
|
||||
m_totalTilesProcessed(0u),
|
||||
|
||||
_cancelationToken (false)
|
||||
{
|
||||
@@ -44,10 +47,6 @@ namespace MMAP
|
||||
|
||||
m_rcContext = new rcContext(false);
|
||||
|
||||
// percentageDone - Initializing
|
||||
m_totalTiles = 0;
|
||||
m_totalTilesBuilt = 0;
|
||||
|
||||
discoverTiles();
|
||||
}
|
||||
|
||||
@@ -376,19 +375,6 @@ namespace MMAP
|
||||
{
|
||||
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)
|
||||
tiles->insert(StaticMapTree::packTileID(i, j));
|
||||
}
|
||||
|
||||
if (!tiles->empty())
|
||||
{
|
||||
// build navMesh
|
||||
@@ -397,6 +383,7 @@ namespace MMAP
|
||||
if (!navMesh)
|
||||
{
|
||||
printf("[Map %03i] Failed creating navmesh!\n", mapID);
|
||||
m_totalTilesProcessed += tiles->size();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -404,17 +391,15 @@ namespace MMAP
|
||||
printf("[Map %03i] We have %u tiles. \n", mapID, (unsigned int)tiles->size());
|
||||
for (unsigned int tile : *tiles)
|
||||
{
|
||||
// percentageDone - increment tiles built
|
||||
m_totalTilesBuilt++;
|
||||
uint32 tileX, tileY;
|
||||
|
||||
// unpack tile coords
|
||||
StaticMapTree::unpackTileID(tile, tileX, tileY);
|
||||
|
||||
if (shouldSkipTile(mapID, tileX, tileY))
|
||||
continue;
|
||||
if (!shouldSkipTile(mapID, tileX, tileY))
|
||||
buildTile(mapID, tileX, tileY, navMesh);
|
||||
|
||||
buildTile(mapID, tileX, tileY, navMesh);
|
||||
++m_totalTilesProcessed;
|
||||
}
|
||||
|
||||
dtFreeNavMesh(navMesh);
|
||||
@@ -426,8 +411,7 @@ namespace MMAP
|
||||
/**************************************************************************/
|
||||
void MapBuilder::buildTile(uint32 mapID, uint32 tileX, uint32 tileY, dtNavMesh* navMesh)
|
||||
{
|
||||
// percentageDone - added, now it will show addional reference percentage done of the overall process
|
||||
printf("%u%% [Map %03i] Building tile [%02u,%02u]\n", percentageDone(m_totalTiles, m_totalTilesBuilt), mapID, tileX, tileY);
|
||||
printf("%u%% [Map %03i] Building tile [%02u,%02u]\n", percentageDone(m_totalTiles, m_totalTilesProcessed), mapID, tileX, tileY);
|
||||
|
||||
MeshData meshData;
|
||||
|
||||
@@ -902,6 +886,9 @@ namespace MMAP
|
||||
/**************************************************************************/
|
||||
bool MapBuilder::shouldSkipMap(uint32 mapID)
|
||||
{
|
||||
if (m_mapid >= 0)
|
||||
return static_cast<uint32>(m_mapid) != mapID;
|
||||
|
||||
if (m_skipContinents)
|
||||
switch (mapID)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user