Browse Source

Initialize all class members in DetourCrowd

cosmy 9 years ago
parent
commit
918f3fdcc6

+ 4 - 1
Source/ThirdParty/DetourCrowd/source/DetourCrowd.cpp

@@ -16,7 +16,7 @@
 // 3. This notice may not be removed or altered from any source distribution.
 //
 
-// Modified by Lasse Oorni and Yao Wei Tjong for Urho3D
+// Modified by Lasse Oorni, Yao Wei Tjong and cosmy1 for Urho3D
 
 #define _USE_MATH_DEFINES
 #include <string.h>
@@ -346,6 +346,9 @@ dtCrowd::dtCrowd() :
 	m_velocitySampleCount(0),
 	m_navquery(0)
 {
+	// Urho3D: initialize all class members
+	memset(&m_ext, 0, sizeof(m_ext));
+	memset(&m_obstacleQueryParams, 0, sizeof(m_obstacleQueryParams));
 }
 
 dtCrowd::~dtCrowd()

+ 6 - 0
Source/ThirdParty/DetourCrowd/source/DetourLocalBoundary.cpp

@@ -16,6 +16,8 @@
 // 3. This notice may not be removed or altered from any source distribution.
 //
 
+// Modified by cosmy1 for Urho3D
+
 #include <float.h>
 #include <string.h>
 #include "DetourLocalBoundary.h"
@@ -29,6 +31,10 @@ dtLocalBoundary::dtLocalBoundary() :
 	m_npolys(0)
 {
 	dtVset(m_center, FLT_MAX,FLT_MAX,FLT_MAX);
+
+	// Urho3D: initialize all class members
+	memset(&m_segs, 0, sizeof(m_segs));
+	memset(&m_polys, 0, sizeof(m_polys));
 }
 
 dtLocalBoundary::~dtLocalBoundary()

+ 8 - 2
Source/ThirdParty/DetourCrowd/source/DetourObstacleAvoidance.cpp

@@ -16,6 +16,8 @@
 // 3. This notice may not be removed or altered from any source distribution.
 //
 
+// Modified by cosmy1 for Urho3D
+
 #include "DetourObstacleAvoidance.h"
 #include "DetourCommon.h"
 #include "DetourMath.h"
@@ -205,15 +207,19 @@ void dtFreeObstacleAvoidanceQuery(dtObstacleAvoidanceQuery* ptr)
 	dtFree(ptr);
 }
 
-
+// Urho3D: initialize all class members
 dtObstacleAvoidanceQuery::dtObstacleAvoidanceQuery() :
 	m_maxCircles(0),
 	m_circles(0),
 	m_ncircles(0),
 	m_maxSegments(0),
 	m_segments(0),
-	m_nsegments(0)
+	m_nsegments(0),
+	m_invHorizTime(0), // Urho3D
+	m_vmax(0), // Urho3D
+	m_invVmax(0) // Urho3D
 {
+	memset(&m_params, 0, sizeof(m_params)); // Urho3D
 }
 
 dtObstacleAvoidanceQuery::~dtObstacleAvoidanceQuery()

+ 5 - 0
Source/ThirdParty/DetourCrowd/source/DetourPathCorridor.cpp

@@ -16,6 +16,8 @@
 // 3. This notice may not be removed or altered from any source distribution.
 //
 
+// Modified by cosmy1 for Urho3D
+
 #include <string.h>
 #include "DetourPathCorridor.h"
 #include "DetourNavMeshQuery.h"
@@ -202,6 +204,9 @@ dtPathCorridor::dtPathCorridor() :
 	m_npath(0),
 	m_maxPath(0)
 {
+	// Urho3D: initialize all class members
+	memset(&m_pos, 0, sizeof(m_pos));
+	memset(&m_target, 0, sizeof(m_target));
 }
 
 dtPathCorridor::~dtPathCorridor()

+ 6 - 2
Source/ThirdParty/DetourCrowd/source/DetourProximityGrid.cpp

@@ -16,6 +16,8 @@
 // 3. This notice may not be removed or altered from any source distribution.
 //
 
+// Modified by cosmy1 for Urho3D
+
 #include <string.h>
 #include <new>
 #include "DetourProximityGrid.h"
@@ -45,7 +47,7 @@ inline int hashPos2(int x, int y, int n)
 	return ((x*73856093) ^ (y*19349663)) & (n-1);
 }
 
-
+// Urho3D: initialize all class members
 dtProximityGrid::dtProximityGrid() :
 	m_maxItems(0),
 	m_cellSize(0),
@@ -53,8 +55,10 @@ dtProximityGrid::dtProximityGrid() :
 	m_poolHead(0),
 	m_poolSize(0),
 	m_buckets(0),
-	m_bucketsSize(0)
+	m_bucketsSize(0),
+	m_invCellSize(0) // Urho3D
 {
+	memset(&m_bounds, 0, sizeof(m_bounds));	// Urho3D
 }
 
 dtProximityGrid::~dtProximityGrid()