Tools/ Vmap4assembler rework PR
This commit is contained in:
@@ -288,25 +288,34 @@ namespace VMAP
|
||||
|
||||
uint32 x, y;
|
||||
StaticMapTree::unpackTileID(tileId, x, y);
|
||||
auto tileFile = OpenFile(mapDestDir / Trinity::StringFormat("{:04}_{:02}_{:02}.vmtile", data.MapId, x, y), "wb");
|
||||
auto tileSpawnIndicesFile = OpenFile(mapDestDir / Trinity::StringFormat("{:04}_{:02}_{:02}.vmtileidx", data.MapId, x, y), "wb");
|
||||
if (tileSpawnIndicesFile)
|
||||
if (tileFile && tileSpawnIndicesFile)
|
||||
{
|
||||
uint32 nSpawns = spawns.size();
|
||||
|
||||
// file header
|
||||
if (fwrite(VMAP_MAGIC, 1, 8, tileFile.get()) != 8)
|
||||
return false;
|
||||
if (fwrite(VMAP_MAGIC, 1, 8, tileSpawnIndicesFile.get()) != 8)
|
||||
return false;
|
||||
|
||||
// write number of tile spawns
|
||||
if (fwrite(&nSpawns, sizeof(uint32), 1, tileFile.get()) != 1)
|
||||
return false;
|
||||
if (fwrite(&nSpawns, sizeof(uint32), 1, tileSpawnIndicesFile.get()) != 1)
|
||||
return false;
|
||||
|
||||
// write tile spawns
|
||||
for (uint32 spawnId : spawns)
|
||||
{
|
||||
if (!ModelSpawn::writeToFile(tileFile.get(), data.UniqueEntries[spawnId]))
|
||||
return false;
|
||||
if (fwrite(&modelNodeIdx[spawnId], sizeof(uint32), 1, tileSpawnIndicesFile.get()) != 1)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user