Fix for google code Issue 221
- fixed agent idx bound checks
This commit is contained in:
parent
990b245179
commit
991c08f222
@ -489,7 +489,7 @@ const dtCrowdAgent* dtCrowd::getAgent(const int idx)
|
|||||||
|
|
||||||
void dtCrowd::updateAgentParameters(const int idx, const dtCrowdAgentParams* params)
|
void dtCrowd::updateAgentParameters(const int idx, const dtCrowdAgentParams* params)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx > m_maxAgents)
|
if (idx < 0 || idx >= m_maxAgents)
|
||||||
return;
|
return;
|
||||||
memcpy(&m_agents[idx].params, params, sizeof(dtCrowdAgentParams));
|
memcpy(&m_agents[idx].params, params, sizeof(dtCrowdAgentParams));
|
||||||
}
|
}
|
||||||
@ -567,7 +567,7 @@ void dtCrowd::removeAgent(const int idx)
|
|||||||
|
|
||||||
bool dtCrowd::requestMoveTargetReplan(const int idx, dtPolyRef ref, const float* pos)
|
bool dtCrowd::requestMoveTargetReplan(const int idx, dtPolyRef ref, const float* pos)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx > m_maxAgents)
|
if (idx < 0 || idx >= m_maxAgents)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
dtCrowdAgent* ag = &m_agents[idx];
|
dtCrowdAgent* ag = &m_agents[idx];
|
||||||
@ -594,7 +594,7 @@ bool dtCrowd::requestMoveTargetReplan(const int idx, dtPolyRef ref, const float*
|
|||||||
/// The request will be processed during the next #update().
|
/// The request will be processed during the next #update().
|
||||||
bool dtCrowd::requestMoveTarget(const int idx, dtPolyRef ref, const float* pos)
|
bool dtCrowd::requestMoveTarget(const int idx, dtPolyRef ref, const float* pos)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx > m_maxAgents)
|
if (idx < 0 || idx >= m_maxAgents)
|
||||||
return false;
|
return false;
|
||||||
if (!ref)
|
if (!ref)
|
||||||
return false;
|
return false;
|
||||||
@ -616,7 +616,7 @@ bool dtCrowd::requestMoveTarget(const int idx, dtPolyRef ref, const float* pos)
|
|||||||
|
|
||||||
bool dtCrowd::requestMoveVelocity(const int idx, const float* vel)
|
bool dtCrowd::requestMoveVelocity(const int idx, const float* vel)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx > m_maxAgents)
|
if (idx < 0 || idx >= m_maxAgents)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
dtCrowdAgent* ag = &m_agents[idx];
|
dtCrowdAgent* ag = &m_agents[idx];
|
||||||
@ -633,7 +633,7 @@ bool dtCrowd::requestMoveVelocity(const int idx, const float* vel)
|
|||||||
|
|
||||||
bool dtCrowd::resetMoveTarget(const int idx)
|
bool dtCrowd::resetMoveTarget(const int idx)
|
||||||
{
|
{
|
||||||
if (idx < 0 || idx > m_maxAgents)
|
if (idx < 0 || idx >= m_maxAgents)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
dtCrowdAgent* ag = &m_agents[idx];
|
dtCrowdAgent* ag = &m_agents[idx];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user