* Add PathFinder and friends.

This commit is contained in:
iProgramInCpp
2023-12-06 14:03:20 +02:00
parent 5554fc7c6a
commit 777bd6a3e2
13 changed files with 826 additions and 92 deletions

View File

@@ -0,0 +1,36 @@
/********************************************************************
Minecraft: Pocket Edition - Decompilation Project
Copyright (C) 2023 iProgramInCpp
The following code is licensed under the BSD 1 clause license.
SPDX-License-Identifier: BSD-1-Clause
********************************************************************/
#include "Path.hpp"
Path::Path()
{
m_numNodes = 0;
m_pNodes = nullptr;
field_8 = 0;
}
Path::~Path()
{
clear();
}
void Path::setNodes(Node** pNodes, int nodeCount)
{
clear();
m_numNodes = nodeCount;
m_pNodes = pNodes;
for (int i = 0; i < nodeCount; i++)
{
// TODO: We are using the pNodes array for storage but duplicating the pNodes?
// This might cause a memory leak?
Node* oldNode = pNodes[i];
m_pNodes[i] = new Node;
*m_pNodes[i] = *oldNode;
}
}