From 181f37cccd0b679f1fe3c58467a8353c22c13250 Mon Sep 17 00:00:00 2001 From: Exynox Date: Sat, 12 Mar 2022 12:02:56 +0200 Subject: [PATCH] Fixed sectree map attribute loading --- game/src/sectree_manager.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/game/src/sectree_manager.cpp b/game/src/sectree_manager.cpp index bc5bd32..ece852c 100644 --- a/game/src/sectree_manager.cpp +++ b/game/src/sectree_manager.cpp @@ -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 uiSize; + int32_t uiSize; lzo_uint uiDestSize; - BYTE* abComp = M2_NEW BYTE[maxMemSize]; - DWORD * attr = M2_NEW DWORD[maxMemSize]; + auto * abComp = new BYTE[maxMemSize]; + auto * attr = new DWORD[maxMemSize]; for (int y = 0; y < iHeight; ++y) 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); // 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))", 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(abComp, sizeof(BYTE), uiSize, fp); + fread(abComp, sizeof(uint8_t), uiSize, fp); //LZOManager::instance().Decompress(abComp, uiSize, (BYTE *) tree->GetAttributePointer(), &uiDestSize); 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)) { - 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); fclose(fp);