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:
parent
6f2a459096
commit
fde579bee8
@ -408,6 +408,14 @@ void Kart::reset()
|
|||||||
} // 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)
|
void Kart::raceFinished(float time)
|
||||||
{
|
{
|
||||||
m_finished_race = true;
|
m_finished_race = true;
|
||||||
|
@ -432,15 +432,16 @@ void LinearWorld::raceResultOrder( int* order )
|
|||||||
} // raceResultOrder
|
} // 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)
|
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()];
|
const KartInfo &kart_info = m_kart_info[kart->getWorldKartId()];
|
||||||
float distance_covered = kart_info.m_race_lap * m_track->getTrackLength()
|
float distance_covered = kart_info.m_race_lap * m_track->getTrackLength()
|
||||||
+ getDistanceDownTrackForKart(kart->getWorldKartId());
|
+ getDistanceDownTrackForKart(kart->getWorldKartId());
|
||||||
|
@ -36,7 +36,9 @@ using namespace irr::core;
|
|||||||
using namespace irr::gui;
|
using namespace irr::gui;
|
||||||
using namespace irr::video;
|
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
|
// Switch to barrier mode: server waits for ack from each client
|
||||||
network_manager->beginRaceResultBarrier();
|
network_manager->beginRaceResultBarrier();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user