Tools/ Vmap4assembler rework PR

This commit is contained in:
luis
2026-09-20 16:47:28 -03:00
parent 7ac30d7e38
commit bc3139d921
+10 -1
View File
@@ -288,23 +288,32 @@ 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;
}
}
}