Debian Codegraph @

debian/patches/0001-Removed-fixupCorridor-and-replaced-with-dtMergeCorri.patch

raw
1 From 99b6c3306efd7ca8f204d1e1b39311ca5b783386 Mon Sep 17 00:00:00 2001
2 From: Josue Zamudio <[email protected]>
3 Date: Sun, 25 Jun 2023 12:50:50 -0700
4 Subject: [PATCH 01/36] Removed fixupCorridor and replaced with
5 dtMergeCorridorStartMoved (#637)
6
7 * removed fixupCorridor and replaced function calls with dtMergeCorridorStartMoved
8
9 * removed fixupCorridor and replaced function calls with dtMergeCorridorStartMoved in NavMeshTesterTool.cpp
10
11 Fix #634
12 ---
13 RecastDemo/Source/NavMeshTesterTool.cpp | 52 ++-----------------------
14 1 file changed, 4 insertions(+), 48 deletions(-)
15
16 diff --git a/RecastDemo/Source/NavMeshTesterTool.cpp b/RecastDemo/Source/NavMeshTesterTool.cpp
17 index 9f81c9f..cff9def 100644
18 --- a/RecastDemo/Source/NavMeshTesterTool.cpp
19 +++ b/RecastDemo/Source/NavMeshTesterTool.cpp
20 @@ -36,6 +36,7 @@
21 #include "DetourNavMeshBuilder.h"
22 #include "DetourDebugDraw.h"
23 #include "DetourCommon.h"
24 +#include "DetourPathCorridor.h"
25
26 #ifdef WIN32
27 # define snprintf _snprintf
28 @@ -59,52 +60,6 @@ inline bool inRange(const float* v1, const float* v2, const float r, const float
29 return (dx*dx + dz*dz) < r*r && fabsf(dy) < h;
30 }
31
32 -
33 -static int fixupCorridor(dtPolyRef* path, const int npath, const int maxPath,
34 - const dtPolyRef* visited, const int nvisited)
35 -{
36 - int furthestPath = -1;
37 - int furthestVisited = -1;
38 -
39 - // Find furthest common polygon.
40 - for (int i = npath-1; i >= 0; --i)
41 - {
42 - bool found = false;
43 - for (int j = nvisited-1; j >= 0; --j)
44 - {
45 - if (path[i] == visited[j])
46 - {
47 - furthestPath = i;
48 - furthestVisited = j;
49 - found = true;
50 - }
51 - }
52 - if (found)
53 - break;
54 - }
55 -
56 - // If no intersection found just return current path.
57 - if (furthestPath == -1 || furthestVisited == -1)
58 - return npath;
59 -
60 - // Concatenate paths.
61 -
62 - // Adjust beginning of the buffer to include the visited.
63 - const int req = nvisited - furthestVisited;
64 - const int orig = rcMin(furthestPath+1, npath);
65 - int size = rcMax(0, npath-orig);
66 - if (req+size > maxPath)
67 - size = maxPath-req;
68 - if (size)
69 - memmove(path+req, path+orig, size*sizeof(dtPolyRef));
70 -
71 - // Store visited
72 - for (int i = 0; i < req; ++i)
73 - path[i] = visited[(nvisited-1)-i];
74 -
75 - return req+size;
76 -}
77 -
78 // This function checks if the path has a small U-turn, that is,
79 // a polygon further in the path is adjacent to the first polygon
80 // in the path. If that happens, a shortcut is taken.
81 @@ -563,7 +518,8 @@ void NavMeshTesterTool::handleToggle()
82 int nvisited = 0;
83 m_navQuery->moveAlongSurface(m_pathIterPolys[0], m_iterPos, moveTgt, &m_filter,
84 result, visited, &nvisited, 16);
85 - m_pathIterPolyCount = fixupCorridor(m_pathIterPolys, m_pathIterPolyCount, MAX_POLYS, visited, nvisited);
86 + m_pathIterPolyCount = dtMergeCorridorStartMoved(m_pathIterPolys, m_pathIterPolyCount,
87 + MAX_POLYS, visited, nvisited);
88 m_pathIterPolyCount = fixupShortcuts(m_pathIterPolys, m_pathIterPolyCount, m_navQuery);
89
90 float h = 0;
91 @@ -762,7 +718,7 @@ void NavMeshTesterTool::recalc()
92 m_navQuery->moveAlongSurface(polys[0], iterPos, moveTgt, &m_filter,
93 result, visited, &nvisited, 16);
94
95 - npolys = fixupCorridor(polys, npolys, MAX_POLYS, visited, nvisited);
96 + npolys = dtMergeCorridorStartMoved(polys, npolys, MAX_POLYS, visited, nvisited);
97 npolys = fixupShortcuts(polys, npolys, m_navQuery);
98
99 float h = 0;
100 --
101 2.43.0
102