Allow more than 1 player winning in FFA if a tie

This commit is contained in:
Benau 2018-09-30 14:38:18 +08:00
parent 6478a0714d
commit ab94fdfceb
3 changed files with 14 additions and 2 deletions

View File

@ -1078,9 +1078,8 @@ void Kart::setRaceResult()
}
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_FREE_FOR_ALL)
{
// the top kart wins
FreeForAll* ffa = dynamic_cast<FreeForAll*>(World::getWorld());
m_race_result = ffa->getKartAtPosition(1) == this;
m_race_result = ffa->getKartFFAResult(getWorldKartId());
}
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_CAPTURE_THE_FLAG)
{

View File

@ -196,3 +196,14 @@ video::SColor FreeForAll::getColor(unsigned int kart_id) const
{
return GUIEngine::getSkin()->getColor("font::normal");
} // getColor
// ----------------------------------------------------------------------------
bool FreeForAll::getKartFFAResult(int kart_id) const
{
// the kart(s) which has the top score wins
AbstractKart* k = getKartAtPosition(1);
if (!k)
return false;
int top_score = getKartScore(k->getWorldKartId());
return getKartScore(kart_id) == top_score;
} // getKartFFAResult

View File

@ -66,6 +66,8 @@ public:
void setKartScoreFromServer(NetworkString& ns);
// ------------------------------------------------------------------------
int getKartScore(int kart_id) const { return m_scores.at(kart_id); }
// ------------------------------------------------------------------------
bool getKartFFAResult(int kart_id) const;
}; // FreeForAll