1) Fixed counting of explosion for statistics.

2) Fixed layout of result table in case of
   profile-laps.
3) Fixed average speed computation.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9404 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-08-01 07:10:33 +00:00
parent 63b3ecacb7
commit e0d34ffdcd
2 changed files with 12 additions and 7 deletions

View File

@ -68,10 +68,12 @@ void KartWithStats::handleExplosion(const Vec3& pos, bool direct_hit)
{
bool is_new_explosion = !playingEmergencyAnimation() && !isInvulnerable();
Kart::handleExplosion(pos, direct_hit);
if(is_new_explosion)
// If a kart is too far away from an explosion to be affected, its timer
// will be 0, and this should then not be counted as an explosion.
if(is_new_explosion && EmergencyAnimation::m_timer>0)
{
m_explosion_count ++;
m_explosion_time +=EmergencyAnimation::m_timer;
m_explosion_time += EmergencyAnimation::m_timer;
}
} // handleExplosion

View File

@ -198,10 +198,13 @@ void ProfileWorld::enterRaceOverState()
float min_t=999999.9f, max_t=0.0, av_t=0.0;
printf("Name\t\tstart\tend\ttime\t");
if(m_profile_mode==PROFILE_LAPS)
printf("av.speed\t");
printf("aver.\t");
printf("top\tskid\trescue\trescue\t"
"expl.\texpl.\n");
printf("\t\t\t\t\tspeed\ttime\ttime\tcount\ttime\tcount\n");
printf("\t\t\t\t\t");
if(m_profile_mode==PROFILE_LAPS)
printf("speed\t");
printf("speed\ttime\ttime\tcount\ttime\tcount\n");
for ( KartList::size_type i = 0; i < m_karts.size(); ++i)
{
max_t = std::max(max_t, m_karts[i]->getFinishTime());
@ -211,14 +214,14 @@ void ProfileWorld::enterRaceOverState()
m_karts[i]->getIdent().size()<8 ? "\t" : "");
printf("%d\t%d\t", 1 + (int)i, m_karts[i]->getPosition());
printf("%4.2f\t", m_karts[i]->getFinishTime());
printf("%3.2f\t", dynamic_cast<KartWithStats*>
(m_karts[i])->getTopSpeed());
if(m_profile_mode==PROFILE_LAPS)
{
float distance = race_manager->getNumLaps()
* m_track->getTrackLength();
printf("\t%4.2f\t",m_karts[i]->getFinishTime()/distance);
printf("%4.2f\t",distance/m_karts[i]->getFinishTime());
}
printf("%3.2f\t", dynamic_cast<KartWithStats*>
(m_karts[i])->getTopSpeed());
printf("%4.2f\t", dynamic_cast<KartWithStats*>
(m_karts[i])->getSkiddingTime());
printf("%4.2f\t%d\t", dynamic_cast<KartWithStats*>