From f4fd914858dbee2cf1b060022ce67a267c58104d Mon Sep 17 00:00:00 2001 From: Alayan <25536748+Alayan-stk-2@users.noreply.github.com> Date: Sat, 11 Nov 2023 01:32:31 +0100 Subject: [PATCH] Mostly revert #4632 and properly fix #4609 Not displaying a win message when there is only one kart was intended behaviour. A win requires the possibility of a loss. However, displaying the finishing rank with only one kart is ugly. --- src/karts/kart.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 66a3afb15..aef467d75 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1008,21 +1008,26 @@ void Kart::finishedRace(float time, bool from_server) RaceGUIBase* m = World::getWorld()->getRaceGUI(); if (m) { - bool won_the_race = false, too_slow = false; + bool won_the_race = false, too_slow = false, one_kart = false; unsigned int win_position = 1; if (RaceManager::get()->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER) win_position = 2; + // There is no win if there is no possibility of losing + if (RaceManager::get()->getNumberOfKarts() == 1) + one_kart = true; + if ((getPosition() == (int)win_position && - World::getWorld()->getNumKarts() > win_position) || RaceManager::get()->getNumberOfKarts() == 1) + World::getWorld()->getNumKarts() > win_position)) won_the_race = true; if (RaceManager::get()->hasTimeTarget() && m_finish_time > RaceManager::get()->getTimeTarget()) too_slow = true; - m->addMessage((too_slow ? _("You were too slow!") : - won_the_race ? _("You won the race!") : + m->addMessage((too_slow ? _("You were too slow!") : + one_kart ? _("You finished the race!") : + won_the_race ? _("You won the race!") : _("You finished the race in rank %d!", getPosition())), this, 2.0f, video::SColor(255, 255, 255, 255), true, true, true); }