Fixed sectree map attribute loading

This commit is contained in:
Exynox 2022-03-12 12:02:56 +02:00
parent a056345a7b
commit 181f37cccd

View File

@ -465,11 +465,11 @@ bool SECTREE_MANAGER::LoadAttribute(LPSECTREE_MAP pkMapSectree, const char * c_p
size_t maxMemSize = LZOManager::instance().GetMaxCompressedSize(sizeof(DWORD) * (SECTREE_SIZE / CELL_SIZE) * (SECTREE_SIZE / CELL_SIZE)); size_t maxMemSize = LZOManager::instance().GetMaxCompressedSize(sizeof(DWORD) * (SECTREE_SIZE / CELL_SIZE) * (SECTREE_SIZE / CELL_SIZE));
size_t uiSize; int32_t uiSize;
lzo_uint uiDestSize; lzo_uint uiDestSize;
BYTE* abComp = M2_NEW BYTE[maxMemSize]; auto * abComp = new BYTE[maxMemSize];
DWORD * attr = M2_NEW DWORD[maxMemSize]; auto * attr = new DWORD[maxMemSize];
for (int y = 0; y < iHeight; ++y) for (int y = 0; y < iHeight; ++y)
for (int x = 0; x < iWidth; ++x) for (int x = 0; x < iWidth; ++x)
@ -482,7 +482,7 @@ bool SECTREE_MANAGER::LoadAttribute(LPSECTREE_MAP pkMapSectree, const char * c_p
LPSECTREE tree = pkMapSectree->Find(id.package); LPSECTREE tree = pkMapSectree->Find(id.package);
// SERVER_ATTR_LOAD_ERROR // SERVER_ATTR_LOAD_ERROR
if (tree == NULL) if (tree == nullptr)
{ {
sys_err("FATAL ERROR! LoadAttribute(%s) - cannot find sectree(package=%x, coord=(%u, %u), map_index=%u, map_base=(%u, %u))", sys_err("FATAL ERROR! LoadAttribute(%s) - cannot find sectree(package=%x, coord=(%u, %u), map_index=%u, map_base=(%u, %u))",
c_pszFileName, id.package, id.coord.x, id.coord.y, r_setting.iIndex, r_setting.iBaseX, r_setting.iBaseY); c_pszFileName, id.package, id.coord.x, id.coord.y, r_setting.iIndex, r_setting.iBaseX, r_setting.iBaseY);
@ -512,7 +512,7 @@ bool SECTREE_MANAGER::LoadAttribute(LPSECTREE_MAP pkMapSectree, const char * c_p
} }
fread(&uiSize, sizeof(int32_t), 1, fp); fread(&uiSize, sizeof(int32_t), 1, fp);
fread(abComp, sizeof(BYTE), uiSize, fp); fread(abComp, sizeof(uint8_t), uiSize, fp);
//LZOManager::instance().Decompress(abComp, uiSize, (BYTE *) tree->GetAttributePointer(), &uiDestSize); //LZOManager::instance().Decompress(abComp, uiSize, (BYTE *) tree->GetAttributePointer(), &uiDestSize);
uiDestSize = sizeof(DWORD) * maxMemSize; uiDestSize = sizeof(DWORD) * maxMemSize;
@ -520,7 +520,7 @@ bool SECTREE_MANAGER::LoadAttribute(LPSECTREE_MAP pkMapSectree, const char * c_p
if (uiDestSize != sizeof(DWORD) * (SECTREE_SIZE / CELL_SIZE) * (SECTREE_SIZE / CELL_SIZE)) if (uiDestSize != sizeof(DWORD) * (SECTREE_SIZE / CELL_SIZE) * (SECTREE_SIZE / CELL_SIZE))
{ {
sys_err("SECTREE_MANAGER::LoadAttribte : %s : %d %d size mismatch! %d", sys_err("SECTREE_MANAGER::LoadAttribute : %s : %d %d size mismatch! %d",
c_pszFileName, tree->m_id.coord.x, tree->m_id.coord.y, uiDestSize); c_pszFileName, tree->m_id.coord.x, tree->m_id.coord.y, uiDestSize);
fclose(fp); fclose(fp);