2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-24 05:32:06 +00:00

Refactor to improve C++ and safe code use

This commit is contained in:
LJW-Dev
2025-10-26 18:20:04 +08:00
parent 173565c7b3
commit 9d4c32b6b4
10 changed files with 285 additions and 261 deletions

View File

@@ -21,12 +21,10 @@ namespace BSP
gameWorldMp->path.smoothBytes = 0;
gameWorldMp->path.nodeTreeCount = 0;
int nodeCount = gameWorldMp->path.nodeCount + 128;
gameWorldMp->path.nodes = m_memory.Alloc<pathnode_t>(nodeCount);
gameWorldMp->path.basenodes = m_memory.Alloc<pathbasenode_t>(nodeCount);
memset(gameWorldMp->path.nodes, 0, nodeCount * sizeof(pathnode_t));
memset(gameWorldMp->path.basenodes, 0, nodeCount * sizeof(pathbasenode_t));
// The game has 128 empty nodes allocated
int extraNodeCount = gameWorldMp->path.nodeCount + 128;
gameWorldMp->path.nodes = m_memory.Alloc<pathnode_t>(extraNodeCount);
gameWorldMp->path.basenodes = m_memory.Alloc<pathbasenode_t>(extraNodeCount);
gameWorldMp->path.pathVis = nullptr;
gameWorldMp->path.smoothCache = nullptr;
gameWorldMp->path.nodeTree = nullptr;