mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/MMaps: fixed loading parent maps
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
#include <limits.h>
|
||||
|
||||
#define MMAP_MAGIC 0x4d4d4150 // 'MMAP'
|
||||
#define MMAP_VERSION 8
|
||||
#define MMAP_VERSION 7
|
||||
|
||||
struct MmapTileHeader
|
||||
{
|
||||
@@ -843,6 +843,7 @@ namespace MMAP
|
||||
// DT_TILE_FREE_DATA tells detour to unallocate memory when the tile
|
||||
// is removed via removeTile()
|
||||
dtStatus dtResult = navMesh->addTile(navData, navDataSize, DT_TILE_FREE_DATA, 0, &tileRef);
|
||||
|
||||
if (!tileRef || dtResult != DT_SUCCESS)
|
||||
{
|
||||
printf("%s Failed adding tile to navmesh! \n", tileString.c_str());
|
||||
|
||||
@@ -28,14 +28,8 @@
|
||||
|
||||
using namespace MMAP;
|
||||
|
||||
bool checkDirectories(bool debugOutput, std::vector<std::string>& dbcLocales)
|
||||
bool checkDirectories(bool debugOutput)
|
||||
{
|
||||
if (getDirContents(dbcLocales, "dbc") == LISTFILE_DIRECTORY_NOT_FOUND || dbcLocales.empty())
|
||||
{
|
||||
printf("'dbc' directory is empty or does not exist\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> dirFiles;
|
||||
|
||||
if (getDirContents(dirFiles, "maps") == LISTFILE_DIRECTORY_NOT_FOUND || dirFiles.empty())
|
||||
@@ -44,6 +38,13 @@ bool checkDirectories(bool debugOutput, std::vector<std::string>& dbcLocales)
|
||||
return false;
|
||||
}
|
||||
|
||||
dirFiles.clear();
|
||||
if (getDirContents(dirFiles, "dbc") == LISTFILE_DIRECTORY_NOT_FOUND || dirFiles.empty())
|
||||
{
|
||||
printf("'dbc' directory is empty or does not exist\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
dirFiles.clear();
|
||||
if (getDirContents(dirFiles, "vmaps", "*.vmtree") == LISTFILE_DIRECTORY_NOT_FOUND || dirFiles.empty())
|
||||
{
|
||||
@@ -293,8 +294,8 @@ int main(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<std::string> dbcLocales;
|
||||
if (!checkDirectories(debugOutput, dbcLocales))
|
||||
|
||||
if (!checkDirectories(debugOutput))
|
||||
return silent ? -3 : finish("Press ENTER to close...", -3);
|
||||
|
||||
std::string mapPath = (boost::filesystem::path("dbc") / "Map.dbc").string();
|
||||
@@ -302,15 +303,16 @@ int main(int argc, char** argv)
|
||||
std::unordered_map<uint32, std::vector<uint32>> mapData;
|
||||
{
|
||||
DBCFileLoader* loader = new DBCFileLoader();
|
||||
if (!loader->Load(mapPath.c_str(), "x"))
|
||||
char const* mapFmt = "nxxxxxxxxxxxxxxxxxxi";
|
||||
if (!loader->Load(mapPath.c_str(), mapFmt))
|
||||
{
|
||||
delete loader;
|
||||
return silent ? -4 : finish("Failed to load Map.dbc", -4);
|
||||
}
|
||||
for (uint32 x = 0; x < loader->GetRowSize(); ++x)
|
||||
for (uint32 x = 0; x < loader->GetNumRows(); ++x)
|
||||
{
|
||||
mapData.emplace(std::piecewise_construct, std::forward_as_tuple(loader->getRecord(x).getUInt(0)), std::forward_as_tuple());
|
||||
int16 parentMapId = int16(loader->getRecord(x).getInt(19));
|
||||
int16 parentMapId = int16(loader->getRecord(x).getUInt(19));
|
||||
if (parentMapId != -1)
|
||||
mapData[parentMapId].push_back(loader->getRecord(x).getUInt(0));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
@@ -786,7 +786,7 @@ namespace MMAP
|
||||
}
|
||||
while (false);
|
||||
|
||||
vmapManager->unloadMap(mapID, tileX, tileY);
|
||||
vmapManager->unloadSingleMap(mapID, tileX, tileY);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user