mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 12:32:36 +00:00
Check dtNavMeshQuery::findStraightPath status
This commit is contained in:
parent
793c30ab8d
commit
a54c4bc2e9
@ -105,7 +105,7 @@ namespace DetourNavigator
|
||||
return result;
|
||||
}
|
||||
|
||||
std::optional<SteerTarget> getSteerTarget(const dtNavMeshQuery& navQuery, const osg::Vec3f& startPos,
|
||||
std::optional<SteerTarget> getSteerTarget(const dtNavMeshQuery& navMeshQuery, const osg::Vec3f& startPos,
|
||||
const osg::Vec3f& endPos, const float minTargetDist, const std::vector<dtPolyRef>& path)
|
||||
{
|
||||
// Find steer target.
|
||||
@ -115,8 +115,11 @@ namespace DetourNavigator
|
||||
std::array<unsigned char, maxSteerPoints> steerPathFlags;
|
||||
std::array<dtPolyRef, maxSteerPoints> steerPathPolys;
|
||||
int nsteerPath = 0;
|
||||
navQuery.findStraightPath(startPos.ptr(), endPos.ptr(), path.data(), int(path.size()), steerPath.data(),
|
||||
steerPathFlags.data(), steerPathPolys.data(), &nsteerPath, maxSteerPoints);
|
||||
const dtStatus status = navMeshQuery.findStraightPath(startPos.ptr(), endPos.ptr(), path.data(),
|
||||
static_cast<int>(path.size()), steerPath.data(), steerPathFlags.data(), steerPathPolys.data(),
|
||||
&nsteerPath, maxSteerPoints);
|
||||
if (dtStatusFailed(status))
|
||||
return std::nullopt;
|
||||
assert(nsteerPath >= 0);
|
||||
if (!nsteerPath)
|
||||
return std::nullopt;
|
||||
|
Loading…
x
Reference in New Issue
Block a user