mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
Core/Maps: Added optional *.tilelist file to map_extractor output which contains a list of existing tiles to speed up map creation in worldserver
This commit is contained in:
@@ -98,6 +98,29 @@ Map::~Map()
|
||||
|
||||
void Map::DiscoverGridMapFiles()
|
||||
{
|
||||
std::string tileListName = Trinity::StringFormat("%smaps/%03u.tilelist", sWorld->GetDataPath().c_str(), GetId());
|
||||
// tile list is optional
|
||||
if (FILE* tileList = fopen(tileListName.c_str(), "rb"))
|
||||
{
|
||||
u_map_magic mapMagic;
|
||||
u_map_magic versionMagic;
|
||||
uint32 build;
|
||||
char tilesData[MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS];
|
||||
if (fread(&mapMagic.asUInt, sizeof(u_map_magic), 1, tileList) == 1
|
||||
&& mapMagic.asUInt == MapMagic.asUInt
|
||||
&& fread(&versionMagic.asUInt, sizeof(u_map_magic), 1, tileList) == 1
|
||||
&& versionMagic.asUInt == MapVersionMagic.asUInt
|
||||
&& fread(&build, sizeof(build), 1, tileList) == 1
|
||||
&& fread(&tilesData[0], MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS, 1, tileList) == 1)
|
||||
{
|
||||
i_gridFileExists = std::bitset<MAX_NUMBER_OF_GRIDS* MAX_NUMBER_OF_GRIDS>(tilesData, Trinity::Containers::Size(tilesData));
|
||||
fclose(tileList);
|
||||
return;
|
||||
}
|
||||
|
||||
fclose(tileList);
|
||||
}
|
||||
|
||||
for (uint32 gx = 0; gx < MAX_NUMBER_OF_GRIDS; ++gx)
|
||||
for (uint32 gy = 0; gy < MAX_NUMBER_OF_GRIDS; ++gy)
|
||||
i_gridFileExists[gx * MAX_NUMBER_OF_GRIDS + gy] = ExistMap(GetId(), gx, gy, false);
|
||||
|
||||
Reference in New Issue
Block a user