Added comments, minor cosmetic changes.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4663 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-02-07 21:57:10 +00:00
parent 6f2a459096
commit fde579bee8
3 changed files with 19 additions and 8 deletions

View File

@ -408,6 +408,14 @@ void Kart::reset()
} // reset
//-----------------------------------------------------------------------------
/** Sets that this kart has finished the race and finishing time. It also
* notifies the race_manager about the race completion for this kart.
* \param time The finishing time for this kart. It can either be the
* actual time when the kart finished (in which case time() =
* world->getTime()), or the estimated time in case that all
* player kart have finished the race and all AI karts get
* an estimated finish time set.
*/
void Kart::raceFinished(float time)
{
m_finished_race = true;

View File

@ -432,15 +432,16 @@ void LinearWorld::raceResultOrder( int* order )
} // raceResultOrder
//-----------------------------------------------------------------------------
/** Estimate the arrival time of any karts that haven't arrived yet by using
* their average speed up to now and the distance still to race. This
* approach guarantees that the order of the karts won't change anymore
* (karts ahead will have a higher average speed and therefore finish the
* race earlier than karts further behind), so the position doesn't have to
* be updated to get the correct scoring.
* \param kart The kart for which to estimate the finishing times.
*/
float LinearWorld::estimateFinishTimeForKart(Kart* kart)
{
// Estimate the arrival time of any karts that haven't arrived
// yet by using their average speed up to now and the distance
// still to race. This approach guarantees that the order of
// the karts won't change anymore (karts ahead will have a
// higher average speed and therefore finish the race earlier
// than karts further behind), so the position doesn't have to
// be updated to get the correct scoring.
const KartInfo &kart_info = m_kart_info[kart->getWorldKartId()];
float distance_covered = kart_info.m_race_lap * m_track->getTrackLength()
+ getDistanceDownTrackForKart(kart->getWorldKartId());

View File

@ -36,7 +36,9 @@ using namespace irr::core;
using namespace irr::gui;
using namespace irr::video;
RaceOverDialog::RaceOverDialog(const float percentWidth, const float percentHeight) : ModalDialog(percentWidth, percentHeight)
RaceOverDialog::RaceOverDialog(const float percentWidth,
const float percentHeight)
: ModalDialog(percentWidth, percentHeight)
{
// Switch to barrier mode: server waits for ack from each client
network_manager->beginRaceResultBarrier();