Fix for a crash in path queue. Bail out if cannot init obstacle query.

This commit is contained in:
Mikko Mononen 2011-01-30 20:43:16 +00:00
parent 6c6a62e3b1
commit 1f2aea55f5
3 changed files with 5 additions and 1 deletions

View File

@ -217,6 +217,7 @@ void dtCrowd::purge()
dtFree(m_moveRequests);
m_moveRequests = 0;
m_moveRequestCount = 0;
dtFreeProximityGrid(m_grid);
m_grid = 0;
@ -246,7 +247,8 @@ bool dtCrowd::init(const int maxAgents, const float maxAgentRadius, dtNavMesh* n
m_obstacleQuery = dtAllocObstacleAvoidanceQuery();
if (!m_obstacleQuery)
return false;
m_obstacleQuery->init(6, 8);
if (!m_obstacleQuery->init(6, 8))
return false;
m_obstacleQuery->setDesiredVelocityWeight(2.0f);
m_obstacleQuery->setCurrentVelocityWeight(0.75f);

View File

@ -30,6 +30,8 @@ dtPathQueue::dtPathQueue() :
m_queueHead(0),
m_navquery(0)
{
for (int i = 0; i < MAX_QUEUE; ++i)
m_queue[i].path = 0;
}
dtPathQueue::~dtPathQueue()