diff options
| author | void_17 <61356189+void2012@users.noreply.github.com> | 2026-03-06 02:11:18 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-06 02:11:18 +0700 |
| commit | 55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b (patch) | |
| tree | 953c537a5c66e328e9f4ab29626cf738112d53c0 /Minecraft.World/PathFinder.cpp | |
| parent | 7d6658fe5b3095f35093701b5ab669ffc291e875 (diff) | |
Remove AUTO_VAR macro and _toString function (#592)
Diffstat (limited to 'Minecraft.World/PathFinder.cpp')
| -rw-r--r-- | Minecraft.World/PathFinder.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Minecraft.World/PathFinder.cpp b/Minecraft.World/PathFinder.cpp index 029cf582..2e11648f 100644 --- a/Minecraft.World/PathFinder.cpp +++ b/Minecraft.World/PathFinder.cpp @@ -26,14 +26,13 @@ PathFinder::~PathFinder() // references to the same things, so just need to destroy their containers delete [] neighbors->data; delete neighbors; - AUTO_VAR(itEnd, nodes.end()); - for( AUTO_VAR(it, nodes.begin()); it != itEnd; it++ ) + for(auto& node : nodes) { - delete it->second; + delete node.second; } } -Path *PathFinder::findPath(Entity *from, Entity *to, float maxDist) +Path *PathFinder::findPath(Entity *from, Entity *to, float maxDist) { return findPath(from, to->x, to->bb->y0, to->z, maxDist); } @@ -187,9 +186,9 @@ Node *PathFinder::getNode(Entity *entity, int x, int y, int z, Node *size, int j /*final*/ Node *PathFinder::getNode(int x, int y, int z) { int i = Node::createHash(x, y, z); - Node *node; - AUTO_VAR(it, nodes.find(i)); - if ( it == nodes.end() ) + Node *node = nullptr; + auto it = nodes.find(i); + if ( it == nodes.end() ) { MemSect(54); node = new Node(x, y, z); @@ -279,7 +278,7 @@ Path *PathFinder::reconstruct_path(Node *from, Node *to) NodeArray nodes = NodeArray(count); n = to; nodes.data[--count] = n; - while (n->cameFrom != NULL) + while (n->cameFrom != NULL) { n = n->cameFrom; nodes.data[--count] = n; |
