fixed bug 1791242 in robots/default_robot.cpp

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1233 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
ikework 2007-09-09 21:18:18 +00:00
parent 1bf479eeea
commit 754bd5275c

View File

@ -527,9 +527,15 @@ void DefaultRobot::check_crashes( const int STEPS, sgVec3 const pos )
//having karts too close in any direction. The crash with the track can
//tell when a kart is going to get out of the track so it steers.
sgVec2 vel_normal, step_coord;
sgVec2 vel_normal;
//in this func we use it as a 2d-vector, but later on it is passed
//to world->m_track->findRoadSector, there it is used as a 3d-vector
//to find distance to plane, so z must be initialized to zero
sgVec3 step_coord;
SGfloat kart_distance;
step_coord[2] = 0.0;
m_crashes.clear();
const size_t NUM_KARTS = world->getNumKarts();
@ -752,6 +758,7 @@ int DefaultRobot::calc_steps()
//mostly for curves.
if( fabsf(m_controls.lr) > 0.95 )
{
assert( m_future_sector > -1 );
const int WIDTH_STEPS = (int)( world->m_track->getWidth(
)[m_future_sector] / ( m_kart_properties->getKartLength() * 2.0 ));