136 if (mmap->loadedTileRefs.find(packedGridPos) != mmap->loadedTileRefs.end())
141 FILE* file = fopen(fileName.c_str(),
"rb");
144 TC_LOG_DEBUG(
"maps",
"MMAP:loadMap: Could not open mmtile file '%s'", fileName.c_str());
152 TC_LOG_ERROR(
"maps",
"MMAP:loadMap: Bad header in mmap %04u%02i%02i.mmtile", mapId, x,
y);
159 TC_LOG_ERROR(
"maps",
"MMAP:loadMap: %04u%02i%02i.mmtile was built with generator v%i, expected v%i",
168 size_t result = fread(data, fileHeader.
size, 1, file);
171 TC_LOG_ERROR(
"maps",
"MMAP:loadMap: Bad header or data in mmap %04u%02i%02i.mmtile", mapId, x,
y);
184 mmap->loadedTileRefs.insert(std::pair<uint32, dtTileRef>(packedGridPos, tileRef));
186 TC_LOG_DEBUG(
"maps",
"MMAP:loadMap: Loaded mmtile %04i[%02i, %02i] into %04i[%02i, %02i]", mapId, x,
y, mapId, header->
x, header->
y);
188 PhaseChildMapContainer::const_iterator phasedMaps =
phaseMapData.find(mapId);
195 TC_LOG_ERROR(
"maps",
"MMAP:loadMap: Could not load %04u%02i%02i.mmtile into navmesh", mapId, x,
y);
The navigation mesh owns the tile memory and is responsible for freeing it.
Definition: DetourNavMesh.h:104
void * dtAlloc(int size, dtAllocHint hint)
Definition: DetourAlloc.cpp:41
uint64_d dtTileRef
Definition: DetourNavMesh.h:53
bool loadMapData(uint32 mapId)
Definition: MMapManager.cpp:66
Memory persist after a function call.
Definition: DetourAlloc.h:26
#define sConfigMgr
Definition: Config.h:61
uint32 packTileID(int32 x, int32 y)
Definition: MMapManager.cpp:119
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
PhaseChildMapContainer phaseMapData
Definition: MMapManager.h:129
static char const *const TILE_FILE_NAME_FORMAT
Definition: MMapManager.cpp:27
uint32 loadedTiles
Definition: MMapManager.h:130
bool dtStatusSucceed(dtStatus status)
Definition: DetourStatus.h:41
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
MMapDataSet loadedMMaps
Definition: MMapManager.h:128
void LoadPhaseTiles(PhaseChildMapContainer::const_iterator phasedMapData, int32 x, int32 y)
Definition: MMapManager.cpp:249
std::string StringFormat(Format &&fmt, Args &&...args)
Default TC string format function.
Definition: StringFormat.h:28
#define ASSERT
Definition: Errors.h:55
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
const uint32 MMAP_MAGIC
Definition: MapDefines.h:7
G3D::int16 x
Definition: Vector2int16.h:37
#define MMAP_VERSION
Definition: MapDefines.h:8
void dtFree(void *ptr)
Definition: DetourAlloc.cpp:46