Bugfix: using nitro while the speed is negative could cause a crash, since

the negative speed caused a huge number of prticles to be created (negative
signed int --> unsigned int).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4228 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2009-11-29 11:53:03 +00:00
parent ef53866460
commit a7e32c44d0

View File

@@ -1250,8 +1250,10 @@ void Kart::updateGraphics(const Vec3& off_xyz, const Vec3& off_hpr)
m_water_splash_system->setCreationRate(f);
}
if(m_nitro)
// fabs(speed) is important, otherwise the negative number will
// become a huge unsigned number in the particle scene node!
m_nitro->setCreationRate(m_controls.m_nitro && m_collected_energy>0
? (10.0f + getSpeed()*20.0f) : 0);
? (10.0f + fabsf(getSpeed())*20.0f) : 0);
float speed_ratio = getSpeed()/getMaxSpeed();
float offset_heading = getSteerPercent()*m_kart_properties->getSkidVisual()