Tools/Extractors: Mmap extractors no longer depend on shared and MySQL libraries
This commit is contained in:
1 parent
864a85b8fc
commit
259a29c093
25 files changed
+220
-176
No files matched your search
@@ -21,29 +21,34 @@
|
||||
|
||||
#include "MapTree.h"
|
||||
#include "ModelInstance.h"
|
||||
#include "LoginDatabase.h"
|
||||
|
||||
#include "DetourNavMeshBuilder.h"
|
||||
#include "DetourNavMesh.h"
|
||||
#include "DetourCommon.h"
|
||||
|
||||
// These make the linker happy.
|
||||
LoginDatabaseWorkerPool LoginDatabase;
|
||||
uint32 GetLiquidFlags(uint32 /*liquidType*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "DisableMgr.h"
|
||||
#include <ace/OS_NS_unistd.h>
|
||||
|
||||
uint32 GetLiquidFlags(uint32 /*liquidType*/) { return 0; }
|
||||
namespace DisableMgr
|
||||
{
|
||||
bool IsDisabledFor(DisableType /*type*/, uint32 /*entry*/, Unit const* /*unit*/, uint8 /*flags*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
bool IsDisabledFor(DisableType /*type*/, uint32 /*entry*/, Unit const* /*unit*/, uint8 /*flags*/ /*= 0*/) { return false; }
|
||||
}
|
||||
|
||||
using namespace VMAP;
|
||||
#define MMAP_MAGIC 0x4d4d4150 // 'MMAP'
|
||||
#define MMAP_VERSION 3
|
||||
|
||||
struct MmapTileHeader
|
||||
{
|
||||
uint32 mmapMagic;
|
||||
uint32 dtVersion;
|
||||
uint32 mmapVersion;
|
||||
uint32 size;
|
||||
bool usesLiquids : 1;
|
||||
|
||||
MmapTileHeader() : mmapMagic(MMAP_MAGIC), dtVersion(DT_NAVMESH_VERSION),
|
||||
mmapVersion(MMAP_VERSION), size(0), usesLiquids(true) {}
|
||||
};
|
||||
|
||||
namespace MMAP
|
||||
{
|
||||
@@ -83,7 +88,7 @@ namespace MMAP
|
||||
/**************************************************************************/
|
||||
void MapBuilder::discoverTiles()
|
||||
{
|
||||
vector<string> files;
|
||||
std::vector<std::string> files;
|
||||
uint32 mapID, tileX, tileY, tileID, count = 0;
|
||||
char filter[12];
|
||||
|
||||
@@ -94,7 +99,7 @@ namespace MMAP
|
||||
mapID = uint32(atoi(files[i].substr(0,3).c_str()));
|
||||
if (m_tiles.find(mapID) == m_tiles.end())
|
||||
{
|
||||
m_tiles.insert(pair<uint32,set<uint32>*>(mapID, new set<uint32>));
|
||||
m_tiles.insert(std::pair<uint32, std::set<uint32>*>(mapID, new std::set<uint32>));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -104,7 +109,7 @@ namespace MMAP
|
||||
for (uint32 i = 0; i < files.size(); ++i)
|
||||
{
|
||||
mapID = uint32(atoi(files[i].substr(0,3).c_str()));
|
||||
m_tiles.insert(pair<uint32,set<uint32>*>(mapID, new set<uint32>));
|
||||
m_tiles.insert(std::pair<uint32, std::set<uint32>*>(mapID, new std::set<uint32>));
|
||||
count++;
|
||||
}
|
||||
printf("found %u.\n", count);
|
||||
@@ -113,7 +118,7 @@ namespace MMAP
|
||||
printf("Discovering tiles... ");
|
||||
for (TileList::iterator itr = m_tiles.begin(); itr != m_tiles.end(); ++itr)
|
||||
{
|
||||
set<uint32>* tiles = (*itr).second;
|
||||
std::set<uint32>* tiles = (*itr).second;
|
||||
mapID = (*itr).first;
|
||||
|
||||
sprintf(filter, "%03u*.vmtile", mapID);
|
||||
@@ -146,14 +151,14 @@ namespace MMAP
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
set<uint32>* MapBuilder::getTileList(uint32 mapID)
|
||||
std::set<uint32>* MapBuilder::getTileList(uint32 mapID)
|
||||
{
|
||||
TileList::iterator itr = m_tiles.find(mapID);
|
||||
if (itr != m_tiles.end())
|
||||
return (*itr).second;
|
||||
|
||||
set<uint32>* tiles = new set<uint32>();
|
||||
m_tiles.insert(pair<uint32, set<uint32>*>(mapID, tiles));
|
||||
std::set<uint32>* tiles = new std::set<uint32>();
|
||||
m_tiles.insert(std::pair<uint32, std::set<uint32>*>(mapID, tiles));
|
||||
return tiles;
|
||||
}
|
||||
|
||||
@@ -318,7 +323,7 @@ namespace MMAP
|
||||
{
|
||||
printf("[Thread %u] Building map %03u:\n", uint32(ACE_Thread::self()), mapID);
|
||||
|
||||
set<uint32>* tiles = getTileList(mapID);
|
||||
std::set<uint32>* tiles = getTileList(mapID);
|
||||
|
||||
// make sure we process maps which don't have tiles
|
||||
if (!tiles->size())
|
||||
@@ -346,7 +351,7 @@ namespace MMAP
|
||||
|
||||
// now start building mmtiles for each tile
|
||||
printf("[Map %i] We have %u tiles. \n", mapID, (unsigned int)tiles->size());
|
||||
for (set<uint32>::iterator it = tiles->begin(); it != tiles->end(); ++it)
|
||||
for (std::set<uint32>::iterator it = tiles->begin(); it != tiles->end(); ++it)
|
||||
{
|
||||
uint32 tileX, tileY;
|
||||
|
||||
@@ -407,7 +412,7 @@ namespace MMAP
|
||||
/**************************************************************************/
|
||||
void MapBuilder::buildNavMesh(uint32 mapID, dtNavMesh* &navMesh)
|
||||
{
|
||||
set<uint32>* tiles = getTileList(mapID);
|
||||
std::set<uint32>* tiles = getTileList(mapID);
|
||||
|
||||
// old code for non-statically assigned bitmask sizes:
|
||||
///*** calculate number of bits needed to store tiles & polys ***/
|
||||
@@ -423,9 +428,9 @@ namespace MMAP
|
||||
/*** calculate bounds of map ***/
|
||||
|
||||
uint32 tileXMin = 64, tileYMin = 64, tileXMax = 0, tileYMax = 0, tileX, tileY;
|
||||
for (set<uint32>::iterator it = tiles->begin(); it != tiles->end(); ++it)
|
||||
for (std::set<uint32>::iterator it = tiles->begin(); it != tiles->end(); ++it)
|
||||
{
|
||||
StaticMapTree::unpackTileID((*it), tileX, tileY);
|
||||
StaticMapTree::unpackTileID(*it, tileX, tileY);
|
||||
|
||||
if (tileX > tileXMax)
|
||||
tileXMax = tileX;
|
||||
|
||||
Reference in new issue
Block a user