From 973f0e2c2b6112d0439cc300c1f40432a6dec96e Mon Sep 17 00:00:00 2001 From: Hans Gaiser Date: Sun, 27 Apr 2014 18:57:03 +0200 Subject: [PATCH] Change active type from unsigned char to bool --- DetourCrowd/Include/DetourCrowd.h | 6 +++--- DetourCrowd/Source/DetourCrowd.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DetourCrowd/Include/DetourCrowd.h b/DetourCrowd/Include/DetourCrowd.h index d265493..b3ec3e1 100644 --- a/DetourCrowd/Include/DetourCrowd.h +++ b/DetourCrowd/Include/DetourCrowd.h @@ -115,8 +115,8 @@ enum MoveRequestState /// @ingroup crowd struct dtCrowdAgent { - /// 1 if the agent is active, or 0 if the agent is in an unused slot in the agent pool. - unsigned char active; + /// True if the agent is active, false if the agent is in an unused slot in the agent pool. + bool active; /// The type of mesh polygon the agent is traversing. (See: #CrowdAgentState) unsigned char state; @@ -173,7 +173,7 @@ struct dtCrowdAgent struct dtCrowdAgentAnimation { - unsigned char active; + bool active; float initPos[3], startPos[3], endPos[3]; dtPolyRef polyRef; float t, tmax; diff --git a/DetourCrowd/Source/DetourCrowd.cpp b/DetourCrowd/Source/DetourCrowd.cpp index 35f8ebc..9548c7b 100644 --- a/DetourCrowd/Source/DetourCrowd.cpp +++ b/DetourCrowd/Source/DetourCrowd.cpp @@ -441,14 +441,14 @@ bool dtCrowd::init(const int maxAgents, const float maxAgentRadius, dtNavMesh* n for (int i = 0; i < m_maxAgents; ++i) { new(&m_agents[i]) dtCrowdAgent(); - m_agents[i].active = 0; + m_agents[i].active = false; if (!m_agents[i].corridor.init(m_maxPathResult)) return false; } for (int i = 0; i < m_maxAgents; ++i) { - m_agentAnims[i].active = 0; + m_agentAnims[i].active = false; } // The navquery is mostly used for local searches, no need for large node pool. @@ -560,7 +560,7 @@ int dtCrowd::addAgent(const float* pos, const dtCrowdAgentParams* params) ag->targetState = DT_CROWDAGENT_TARGET_NONE; - ag->active = 1; + ag->active = true; return idx; } @@ -573,7 +573,7 @@ void dtCrowd::removeAgent(const int idx) { if (idx >= 0 && idx < m_maxAgents) { - m_agents[idx].active = 0; + m_agents[idx].active = false; } } @@ -1158,7 +1158,7 @@ void dtCrowd::update(const float dt, dtCrowdAgentDebugInfo* debug) { dtVcopy(anim->initPos, ag->npos); anim->polyRef = refs[1]; - anim->active = 1; + anim->active = true; anim->t = 0.0f; anim->tmax = (dtVdist2D(anim->startPos, anim->endPos) / ag->params.maxSpeed) * 0.5f; @@ -1418,7 +1418,7 @@ void dtCrowd::update(const float dt, dtCrowdAgentDebugInfo* debug) if (anim->t > anim->tmax) { // Reset animation - anim->active = 0; + anim->active = false; // Prepare agent for walking. ag->state = DT_CROWDAGENT_STATE_WALKING; continue;