Count braking in profile mode.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11388 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2012-07-12 07:04:01 +00:00
parent 7a8b27ae76
commit 8b5ee80e55
3 changed files with 13 additions and 3 deletions

View File

@ -46,6 +46,7 @@ void KartWithStats::reset()
m_small_nitro_count = 0;
m_large_nitro_count = 0;
m_bubblegum_count = 0;
m_brake_count = 0;
Kart::reset();
} // reset
@ -60,6 +61,8 @@ void KartWithStats::update(float dt)
if(getSpeed()>m_top_speed) m_top_speed = getSpeed();
if(getControls().m_skid)
m_skidding_time += dt;
if(getControls().m_brake)
m_brake_count ++;
} // update
// ----------------------------------------------------------------------------

View File

@ -58,6 +58,9 @@ private:
/** How many bubblegums were taken */
unsigned int m_bubblegum_count;
/** How often the kart braked. */
unsigned int m_brake_count;
/** How much time was spent in rescue. */
float m_rescue_time;
@ -86,6 +89,9 @@ public:
/** Returns how much time this kart spent skidding. */
float getSkiddingTime() const { return m_skidding_time; }
// ------------------------------------------------------------------------
/** Returns how often the kart braked. */
unsigned int getBrakeCount() const { return m_brake_count; }
// ------------------------------------------------------------------------
/** Returns how often a kart was rescued. */
unsigned int getRescueCount() const { return m_rescue_count; }
// ------------------------------------------------------------------------

View File

@ -212,9 +212,9 @@ void ProfileWorld::enterRaceOverState()
printf("average_speed,");
}
printf("top_speed,skid_time,rescue_time,rescue_count,explosion_time,"
"explosion_count,bonus_count,banana_count,small_nitro_count,"
"large_nitro_count,bubblegum_count\n");
printf("top_speed,skid_time,rescue_time,rescue_count,brake_count,"
"explosion_time,explosion_count,bonus_count,banana_count,"
"small_nitro_count,large_nitro_count,bubblegum_count\n");
for ( KartList::size_type i = 0; i < m_karts.size(); ++i)
{
@ -238,6 +238,7 @@ void ProfileWorld::enterRaceOverState()
printf("%4.2f,", kart->getSkiddingTime());
printf("%4.2f,%d,", kart->getRescueTime(),
kart->getRescueCount());
printf("%d,", kart->getBrakeCount());
printf("%4.2f,%d,", kart->getExplosionTime(),
kart->getExplosionCount() );
printf("%d,", kart->getBonusCount() );