diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 2d4cd4070..150bd204b 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -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; diff --git a/src/modes/linear_world.cpp b/src/modes/linear_world.cpp index f3183ad37..6258d37cf 100644 --- a/src/modes/linear_world.cpp +++ b/src/modes/linear_world.cpp @@ -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()); diff --git a/src/states_screens/dialogs/race_over_dialog.cpp b/src/states_screens/dialogs/race_over_dialog.cpp index 1ad0b3c14..440ce7b11 100644 --- a/src/states_screens/dialogs/race_over_dialog.cpp +++ b/src/states_screens/dialogs/race_over_dialog.cpp @@ -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();