TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MMAP Namespace Reference

Classes

struct  IntermediateValues
 
class  MapBuilder
 
struct  MapTiles
 
struct  MeshData
 
class  MMapData
 
class  MMapFactory
 
class  MMapManager
 
struct  NavMeshHolder
 
struct  PhasedTile
 
class  TerrainBuilder
 
struct  Tile
 

Typedefs

typedef std::unordered_map
< uint32, dtTileRef
MMapTileSet
 
typedef std::unordered_map
< uint32, dtNavMeshQuery * > 
NavMeshQuerySet
 
typedef std::set< uint32TerrainSet
 
typedef std::unordered_map
< uint32, PhasedTile * > 
PhaseTileContainer
 
typedef std::unordered_map
< uint32, PhaseTileContainer
PhaseTileMap
 
typedef std::unordered_map
< uint32, TerrainSet
TerrainSetMap
 
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 }
 
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

bool matchWildcardFilter (const char *filter, const char *str)
 
ListFilesResult getDirContents (std::vector< std::string > &fileList, std::string dirpath=".", std::string filter="*")
 

Variables

MMapManagerg_MMapManager = NULL
 
static char const *const MAP_FILE_NAME_FORMAT = "%s/mmaps/%04i.mmap"
 
static char const *const TILE_FILE_NAME_FORMAT = "%s/mmaps/%04i%02i%02i.mmtile"
 
char constMAP_VERSION_MAGIC = "v1.8"
 
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

typedef std::unordered_map<uint32, MMapData*> MMAP::MMapDataSet
typedef std::unordered_map<uint32, dtTileRef> MMAP::MMapTileSet
typedef std::unordered_map<uint32, dtNavMeshQuery*> MMAP::NavMeshQuerySet
typedef std::unordered_map<uint32, PhasedTile*> MMAP::PhaseTileContainer
typedef std::unordered_map<uint32, PhaseTileContainer> MMAP::PhaseTileMap
typedef std::set<uint32> MMAP::TerrainSet
typedef std::unordered_map<uint32, TerrainSet> MMAP::TerrainSetMap
typedef std::list<MapTiles> MMAP::TileList

Enumeration Type Documentation

enum MMAP::Grid
Enumerator
GRID_V8 
GRID_V9 
41  {
42  GRID_V8,
43  GRID_V9
44  };
Definition: TerrainBuilder.h:43
Definition: TerrainBuilder.h:42
Enumerator
LISTFILE_DIRECTORY_NOT_FOUND 
LISTFILE_OK 
85  {
87  LISTFILE_OK = 1
88  };
Definition: PathCommon.h:87
Definition: PathCommon.h:86
Enumerator
MMAP_LOAD_RESULT_ERROR 
MMAP_LOAD_RESULT_OK 
MMAP_LOAD_RESULT_IGNORED 
32  {
36  };
Definition: MMapFactory.h:33
Definition: MMapFactory.h:34
Definition: MMapFactory.h:35
enum MMAP::Spot
Enumerator
TOP 
RIGHT 
LEFT 
BOTTOM 
ENTIRE 
32  {
33  TOP = 1,
34  RIGHT = 2,
35  LEFT = 3,
36  BOTTOM = 4,
37  ENTIRE = 5
38  };
Definition: TerrainBuilder.h:35
Definition: TerrainBuilder.h:34
Definition: TerrainBuilder.h:37
Definition: TerrainBuilder.h:33
Definition: TerrainBuilder.h:36

Function Documentation

ListFilesResult MMAP::getDirContents ( std::vector< std::string > &  fileList,
std::string  dirpath = ".",
std::string  filter = "*" 
)
inline
91  {
92  #ifdef WIN32
93  HANDLE hFind;
94  WIN32_FIND_DATA findFileInfo;
95  std::string directory;
96 
97  directory = dirpath + "/" + filter;
98 
99  hFind = FindFirstFile(directory.c_str(), &findFileInfo);
100 
101  if (hFind == INVALID_HANDLE_VALUE)
103  do
104  {
105  if ((findFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
106  fileList.push_back(std::string(findFileInfo.cFileName));
107  }
108  while (FindNextFile(hFind, &findFileInfo));
109 
110  FindClose(hFind);
111 
112  #else
113  const char *p = dirpath.c_str();
114  DIR * dirp = opendir(p);
115  struct dirent * dp;
116 
117  while (dirp)
118  {
119  errno = 0;
120  if ((dp = readdir(dirp)) != NULL)
121  {
122  if (matchWildcardFilter(filter.c_str(), dp->d_name))
123  fileList.push_back(std::string(dp->d_name));
124  }
125  else
126  break;
127  }
128 
129  if (dirp)
130  closedir(dirp);
131  else
133  #endif
134 
135  return LISTFILE_OK;
136  }
void * HANDLE
Definition: CascPort.h:146
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: PathCommon.h:87
Definition: PathCommon.h:86
#define INVALID_HANDLE_VALUE
Definition: CascPort.h:169
bool matchWildcardFilter(const char *filter, const char *str)
Definition: PathCommon.h:52

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

+ Here is the caller graph for this function:

Variable Documentation

MMapManager* MMAP::g_MMapManager = NULL
const float MMAP::GRID_PART_SIZE = GRID_SIZE/V8_SIZE
static
const float MMAP::GRID_SIZE = 533.3333f
static
const float MMAP::INVALID_MAP_LIQ_HEIGHT = -500.f
static
const float MMAP::INVALID_MAP_LIQ_HEIGHT_MAX = 5000.0f
static
char const* const MMAP::MAP_FILE_NAME_FORMAT = "%s/mmaps/%04i.mmap"
static
char const* MMAP::MAP_VERSION_MAGIC = "v1.8"
char const* const MMAP::TILE_FILE_NAME_FORMAT = "%s/mmaps/%04i%02i%02i.mmtile"
static
const int MMAP::V8_SIZE = 128
static
const int MMAP::V8_SIZE_SQ = V8_SIZE*V8_SIZE
static
const int MMAP::V9_SIZE = 129
static
const int MMAP::V9_SIZE_SQ = V9_SIZE*V9_SIZE
static