Merge pull request #28 from hgaiser/master

Change active type from unsigned char to bool
This commit is contained in:
Mikko Mononen 2014-04-27 20:01:06 +03:00
commit a38f83afec
2 changed files with 9 additions and 9 deletions

View File

@ -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;

View File

@ -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;