mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-23 20:09:46 +03:00
* Add PathFinder and friends.
This commit is contained in:
36
source/world/level/path/Path.cpp
Normal file
36
source/world/level/path/Path.cpp
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user