File: 0013-fix-rcBuildLayerRegions-missing-areaType-470.patch

package info (click to toggle)
recastnavigation 1.6.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,928 kB
  • sloc: cpp: 50,116; ansic: 2,674; xml: 182; makefile: 16
file content (44 lines) | stat: -rw-r--r-- 1,615 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From ddaa361b0893ddc7602a3bd5c20ad2cfd0a8df7c Mon Sep 17 00:00:00 2001
From: shine <50074072+shineTeam7@users.noreply.github.com>
Date: Mon, 13 Nov 2023 05:30:28 +0800
Subject: [PATCH 13/36] fix:rcBuildLayerRegions missing areaType (#470)

Co-authored-by: sunming <359944951@qq.com>
Co-authored-by: Graham Pentheny <grahamboree@users.noreply.github.com>
---
 Recast/Source/RecastRegion.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Recast/Source/RecastRegion.cpp b/Recast/Source/RecastRegion.cpp
index bc08ecd..684987e 100644
--- a/Recast/Source/RecastRegion.cpp
+++ b/Recast/Source/RecastRegion.cpp
@@ -1072,12 +1072,14 @@ static bool mergeAndFilterLayerRegions(rcContext* ctx, int minRegionArea,
 			for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
 			{
 				const rcCompactSpan& s = chf.spans[i];
+				const unsigned char area = chf.areas[i];
 				const unsigned short ri = srcReg[i];
 				if (ri == 0 || ri >= nreg) continue;
 				rcRegion& reg = regions[ri];
 				
 				reg.spanCount++;
-				
+				reg.areaType = area;
+
 				reg.ymin = rcMin(reg.ymin, s.y);
 				reg.ymax = rcMax(reg.ymax, s.y);
 				
@@ -1157,6 +1159,9 @@ static bool mergeAndFilterLayerRegions(rcContext* ctx, int minRegionArea,
 				// Skip already visited.
 				if (regn.id != 0)
 					continue;
+				// Skip if different area type, do not connect regions with different area type.
+				if (reg.areaType != regn.areaType)
+					continue;
 				// Skip if the neighbour is overlapping root region.
 				bool overlap = false;
 				for (int k = 0; k < root.floors.size(); k++)
-- 
2.43.0