AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
MMAP Namespace Reference

Classes

class  Config
 
class  IMMapMgr
 
struct  IntermediateValues
 
class  MapBuilder
 
struct  MapTiles
 
struct  MeshData
 
struct  MMapData
 
class  MMapFactory
 
class  MMapMgr
 
struct  ResolvedMeshConfig
 
class  TerrainBuilder
 
struct  Tile
 
class  TileBuilder
 
struct  TileInfo
 

Typedefs

typedef std::unordered_map< uint32, dtTileRef > MMapTileSet
 
typedef std::unordered_map< uint32, dtNavMeshQuery * > NavMeshQuerySet
 
typedef std::unordered_map< uint32, MMapData * > MMapDataSet
 
typedef std::list< MapTilesTileList
 

Enumerations

enum  MMAP_LOAD_RESULT {
  MMAP_LOAD_RESULT_ERROR ,
  MMAP_LOAD_RESULT_OK ,
  MMAP_LOAD_RESULT_IGNORED ,
  MMAP_LOAD_RESULT_ERROR ,
  MMAP_LOAD_RESULT_OK ,
  MMAP_LOAD_RESULT_IGNORED
}
 
enum  MMAP_LOAD_RESULT {
  MMAP_LOAD_RESULT_ERROR ,
  MMAP_LOAD_RESULT_OK ,
  MMAP_LOAD_RESULT_IGNORED ,
  MMAP_LOAD_RESULT_ERROR ,
  MMAP_LOAD_RESULT_OK ,
  MMAP_LOAD_RESULT_IGNORED
}
 
enum  ListFilesResult {
  LISTFILE_DIRECTORY_NOT_FOUND = 0 ,
  LISTFILE_OK = 1
}
 
enum  Spot {
  TOP = 1 ,
  RIGHT = 2 ,
  LEFT = 3 ,
  BOTTOM = 4 ,
  ENTIRE = 5
}
 
enum  Grid {
  GRID_V8 ,
  GRID_V9
}
 

Functions

float ComputeBaseUnitDim (int vertexPerMapEdge)
 
std::pair< uint32, uint32MakeTileKey (uint32 x, uint32 y)
 
bool isCurrentDirectory (const std::string &pathStr)
 
std::string executableDirectoryPath ()
 
bool matchWildcardFilter (const char *filter, const char *str)
 
ListFilesResult getDirContents (std::vector< std::string > &fileList, std::string dirpath=".", std::string filter="*")
 

Variables

MMapMgrg_MMapMgr = nullptr
 
static char const *const MAP_FILE_NAME_FORMAT = "{}/mmaps/{:03}.mmap"
 
static char const *const TILE_FILE_NAME_FORMAT = "{}/mmaps/{:03}{:02}{:02}.mmtile"
 
static char const *const MAP_FILE_NAME_FORMAT = "{}/{:03}{:02}{:02}.map"
 
uint32 const MAP_VERSION_MAGIC = 9
 
static uint16 holetab_h [4] = {0x1111, 0x2222, 0x4444, 0x8888}
 
static uint16 holetab_v [4] = {0x000F, 0x00F0, 0x0F00, 0xF000}
 
static const int V9_SIZE = 129
 
static const int V9_SIZE_SQ = V9_SIZE * V9_SIZE
 
static const int V8_SIZE = 128
 
static const int V8_SIZE_SQ = V8_SIZE * V8_SIZE
 
static const float GRID_SIZE = 533.3333f
 
static const float GRID_PART_SIZE = GRID_SIZE / V8_SIZE
 
static const float INVALID_MAP_LIQ_HEIGHT = -500.f
 
static const float INVALID_MAP_LIQ_HEIGHT_MAX = 5000.0f
 

Typedef Documentation

◆ MMapDataSet

typedef std::unordered_map<uint32, MMapData*> MMAP::MMapDataSet

◆ MMapTileSet

typedef std::unordered_map<uint32, dtTileRef> MMAP::MMapTileSet

◆ NavMeshQuerySet

typedef std::unordered_map<uint32, dtNavMeshQuery*> MMAP::NavMeshQuerySet

◆ TileList

typedef std::list<MapTiles> MMAP::TileList

Enumeration Type Documentation

◆ Grid

enum MMAP::Grid
Enumerator
GRID_V8 
GRID_V9 
39 {
40 GRID_V8,
42 };
@ GRID_V8
Definition TerrainBuilder.h:40
@ GRID_V9
Definition TerrainBuilder.h:41

◆ ListFilesResult

Enumerator
LISTFILE_DIRECTORY_NOT_FOUND 
LISTFILE_OK 
77 {
79 LISTFILE_OK = 1
80 };
@ LISTFILE_DIRECTORY_NOT_FOUND
Definition PathCommon.h:78
@ LISTFILE_OK
Definition PathCommon.h:79

◆ MMAP_LOAD_RESULT [1/2]

Enumerator
MMAP_LOAD_RESULT_ERROR 
MMAP_LOAD_RESULT_OK 
MMAP_LOAD_RESULT_IGNORED 
MMAP_LOAD_RESULT_ERROR 
MMAP_LOAD_RESULT_OK 
MMAP_LOAD_RESULT_IGNORED 
25 {
29 };
@ MMAP_LOAD_RESULT_ERROR
Definition IMMAPMgr.h:26
@ MMAP_LOAD_RESULT_IGNORED
Definition IMMAPMgr.h:28
@ MMAP_LOAD_RESULT_OK
Definition IMMAPMgr.h:27

◆ MMAP_LOAD_RESULT [2/2]

Enumerator
MMAP_LOAD_RESULT_ERROR 
MMAP_LOAD_RESULT_OK 
MMAP_LOAD_RESULT_IGNORED 
MMAP_LOAD_RESULT_ERROR 
MMAP_LOAD_RESULT_OK 
MMAP_LOAD_RESULT_IGNORED 

◆ Spot

enum MMAP::Spot
Enumerator
TOP 
RIGHT 
LEFT 
BOTTOM 
ENTIRE 
30 {
31 TOP = 1,
32 RIGHT = 2,
33 LEFT = 3,
34 BOTTOM = 4,
35 ENTIRE = 5
36 };
@ ENTIRE
Definition TerrainBuilder.h:35
@ LEFT
Definition TerrainBuilder.h:33
@ RIGHT
Definition TerrainBuilder.h:32
@ BOTTOM
Definition TerrainBuilder.h:34
@ TOP
Definition TerrainBuilder.h:31

Function Documentation

◆ ComputeBaseUnitDim()

float MMAP::ComputeBaseUnitDim ( int  vertexPerMapEdge)
27 {
28 return GRID_SIZE / static_cast<float>(vertexPerMapEdge);
29 }

References GRID_SIZE.

Referenced by MMAP::Config::GetConfigForTile().

◆ executableDirectoryPath()

std::string MMAP::executableDirectoryPath ( )
inline
40 {
41 return boost::dll::program_location().parent_path().string();
42 }

Referenced by handleArgs(), and MMAP::Config::LoadConfig().

◆ getDirContents()

ListFilesResult MMAP::getDirContents ( std::vector< std::string > &  fileList,
std::string  dirpath = ".",
std::string  filter = "*" 
)
inline
83 {
84#ifdef WIN32
85 HANDLE hFind;
86 WIN32_FIND_DATA findFileInfo;
87 std::string directory;
88
89 directory = dirpath + "/" + filter;
90
91 hFind = FindFirstFile(directory.c_str(), &findFileInfo);
92
93 if (hFind == INVALID_HANDLE_VALUE)
95 do
96 {
97 if ((findFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
98 fileList.emplace_back(findFileInfo.cFileName);
99 } while (FindNextFile(hFind, &findFileInfo));
100
101 FindClose(hFind);
102
103#else
104 const char* p = dirpath.c_str();
105 DIR* dirp = opendir(p);
106 struct dirent* dp;
107
108 while (dirp)
109 {
110 errno = 0;
111 if ((dp = readdir(dirp)) != nullptr)
112 {
113 if (matchWildcardFilter(filter.c_str(), dp->d_name))
114 fileList.emplace_back(dp->d_name);
115 }
116 else
117 break;
118 }
119
120 if (dirp)
121 closedir(dirp);
122 else
124#endif
125
126 return LISTFILE_OK;
127 }

References LISTFILE_DIRECTORY_NOT_FOUND, LISTFILE_OK, and matchWildcardFilter().

Referenced by checkDirectories(), and MMAP::MapBuilder::discoverTiles().

◆ isCurrentDirectory()

bool MMAP::isCurrentDirectory ( const std::string &  pathStr)
36 {
37 try {
38 const std::filesystem::path givenPath = std::filesystem::canonical(std::filesystem::absolute(pathStr));
39 const std::filesystem::path currentPath = std::filesystem::canonical(std::filesystem::current_path());
40 return givenPath == currentPath;
41 } catch (const std::filesystem::filesystem_error& e) {
42 std::cerr << "Filesystem error: " << e.what() << "\n";
43 return false;
44 }
45 }

Referenced by MMAP::Config::LoadConfig().

◆ MakeTileKey()

std::pair< uint32, uint32 > MMAP::MakeTileKey ( uint32  x,
uint32  y 
)
32 {
33 return {x, y};
34 }

Referenced by MMAP::Config::GetConfigForTile().

◆ matchWildcardFilter()

bool MMAP::matchWildcardFilter ( const char *  filter,
const char *  str 
)
inline
45 {
46 if (!filter || !str)
47 return false;
48
49 // end on null character
50 while (*filter && *str)
51 {
52 if (*filter == '*')
53 {
54 if (*++filter == '\0') // wildcard at end of filter means all remaing chars match
55 return true;
56
57 for (;;)
58 {
59 if (*filter == *str)
60 break;
61 if (*str == '\0')
62 return false; // reached end of string without matching next filter character
63 str++;
64 }
65 }
66 else if (*filter != *str)
67 return false; // mismatch
68
69 filter++;
70 str++;
71 }
72
73 return ((*filter == '\0' || (*filter == '*' && *++filter == '\0')) && *str == '\0');
74 }

Referenced by getDirContents().

Variable Documentation

◆ g_MMapMgr

MMapMgr* MMAP::g_MMapMgr = nullptr

◆ GRID_PART_SIZE

◆ GRID_SIZE

◆ holetab_h

uint16 MMAP::holetab_h[4] = {0x1111, 0x2222, 0x4444, 0x8888}
static
647{0x1111, 0x2222, 0x4444, 0x8888};

Referenced by MMAP::TerrainBuilder::isHole().

◆ holetab_v

uint16 MMAP::holetab_v[4] = {0x000F, 0x00F0, 0x0F00, 0xF000}
static
648{0x000F, 0x00F0, 0x0F00, 0xF000};

Referenced by MMAP::TerrainBuilder::isHole().

◆ INVALID_MAP_LIQ_HEIGHT

const float MMAP::INVALID_MAP_LIQ_HEIGHT = -500.f
static

◆ INVALID_MAP_LIQ_HEIGHT_MAX

const float MMAP::INVALID_MAP_LIQ_HEIGHT_MAX = 5000.0f
static

◆ MAP_FILE_NAME_FORMAT [1/2]

char const* const MMAP::MAP_FILE_NAME_FORMAT = "{}/mmaps/{:03}.mmap"
static

◆ MAP_FILE_NAME_FORMAT [2/2]

char const* const MMAP::MAP_FILE_NAME_FORMAT = "{}/{:03}{:02}{:02}.map"
static

◆ MAP_VERSION_MAGIC

uint32 const MMAP::MAP_VERSION_MAGIC = 9

◆ TILE_FILE_NAME_FORMAT

char const* const MMAP::TILE_FILE_NAME_FORMAT = "{}/mmaps/{:03}{:02}{:02}.mmtile"
static

◆ V8_SIZE

◆ V8_SIZE_SQ

const int MMAP::V8_SIZE_SQ = V8_SIZE * V8_SIZE
static

◆ V9_SIZE

◆ V9_SIZE_SQ

const int MMAP::V9_SIZE_SQ = V9_SIZE * V9_SIZE
static