Bugfix: distance-from-start calculations could become inconsistent at places where two drivelines

merge together, resulting in kart-order changing more or less randomly.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4272 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2009-12-08 12:13:30 +00:00
parent e75cfe25ba
commit 9e133ac141

View File

@@ -85,9 +85,14 @@ void GraphNode::addSuccessor(unsigned int to)
// The distance from start for the successor node
if(to!=0)
{
m_all_nodes->getNode(to).m_distance_from_start =
std::max(m_all_nodes->getNode(to).m_distance_from_start,
m_distance_from_start+distance_to_next);
// Do not change an existing, already set distance on another
// node (since this would mean that we then have to change all
// other nodes following that node, too).
if(m_all_nodes->getNode(to).m_distance_from_start==0)
{
m_all_nodes->getNode(to).m_distance_from_start =
m_distance_from_start+distance_to_next;
}
}
} // addSuccessor