mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: fix crash in dtPathCorridor
Must alloc the jumpTypes array, currently not fully implemented yet.
This commit is contained in:
parent
652d8f9da0
commit
afab9c2206
@ -1805,7 +1805,7 @@ dtStatus dtNavMeshQuery::findStraightPath(const float* startPos, const float* en
|
||||
|
||||
if (!startPos || !rdVisfinite(startPos) ||
|
||||
!endPos || !rdVisfinite(endPos) ||
|
||||
!path || pathSize <= 0 || !path[0] ||
|
||||
!path || !jumpTypes || pathSize <= 0 || !path[0] ||
|
||||
maxStraightPath <= 0)
|
||||
{
|
||||
return DT_FAILURE | DT_INVALID_PARAM;
|
||||
|
@ -221,6 +221,12 @@ bool dtPathCorridor::init(const int maxPath)
|
||||
m_path = (dtPolyRef*)rdAlloc(sizeof(dtPolyRef)*maxPath, RD_ALLOC_PERM);
|
||||
if (!m_path)
|
||||
return false;
|
||||
|
||||
rdAssert(!m_jumpTypes);
|
||||
m_jumpTypes = (unsigned char*)rdAlloc(sizeof(unsigned char)*maxPath, RD_ALLOC_PERM);
|
||||
if (!m_jumpTypes)
|
||||
return false;
|
||||
|
||||
m_npath = 0;
|
||||
m_maxPath = maxPath;
|
||||
return true;
|
||||
@ -233,9 +239,11 @@ bool dtPathCorridor::init(const int maxPath)
|
||||
void dtPathCorridor::reset(dtPolyRef ref, const float* pos)
|
||||
{
|
||||
rdAssert(m_path);
|
||||
rdAssert(m_jumpTypes);
|
||||
rdVcopy(m_pos, pos);
|
||||
rdVcopy(m_target, pos);
|
||||
m_path[0] = ref;
|
||||
m_jumpTypes[0] = DT_NULL_TRAVERSE_TYPE;
|
||||
m_npath = 1;
|
||||
}
|
||||
|
||||
@ -529,9 +537,9 @@ bool dtPathCorridor::fixPathStart(dtPolyRef safeRef, const float* safePos)
|
||||
rdVcopy(m_pos, safePos);
|
||||
if (m_npath < 3 && m_npath > 0)
|
||||
{
|
||||
m_path[2] = m_path[m_npath-1];
|
||||
m_path[0] = safeRef;
|
||||
m_path[1] = 0;
|
||||
m_path[2] = m_path[m_npath-1];
|
||||
m_npath = 3;
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user