Skip to content

Commit

Permalink
FIXED segfault that could occur when end of path had been reached
Browse files Browse the repository at this point in the history
  • Loading branch information
ksterker committed Jul 14, 2012
1 parent 780ddbd commit 1cc099d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/world/pathfinding_manager.cc
Expand Up @@ -341,6 +341,12 @@ u_int8 pathfinding_manager::calc_distance(const world::coordinates & node, const

bool pathfinding_manager::move_chr(const s_int16 id)
{
// Check if we've finished the path
if (m_task[id].path->size() -1 <= m_task[id].actualNode)
{
return true;
}

s_int32 center_x = m_task[id].chr->x() + m_task[id].chr->placeable::length() / 2;
s_int32 center_y = m_task[id].chr->y() + m_task[id].chr->placeable::width() / 2;

Expand Down Expand Up @@ -392,12 +398,6 @@ bool pathfinding_manager::move_chr(const s_int16 id)
}
else
{
// Check if we've finished the path
if (m_task[id].path->size() -1 <= m_task[id].actualNode)
{
return true;
}

// Verify if we are stuck
if ((m_task[id].lastPos.x() == m_task[id].chr->x()) && (m_task[id].lastPos.y() == m_task[id].chr->y()))
{
Expand Down

0 comments on commit 1cc099d

Please sign in to comment.