Fix egg hunt finish time (#3402)

* Fix #3264

* Fix the fix
This commit is contained in:
Alayan-stk-2 2018-08-28 00:44:40 +02:00 committed by auriamg
parent d94383e307
commit ed8b1fc185
2 changed files with 8 additions and 1 deletions

View File

@ -33,6 +33,7 @@ EasterEggHunt::EasterEggHunt() : LinearWorld()
m_use_highscores = true; m_use_highscores = true;
m_eggs_found = 0; m_eggs_found = 0;
m_only_ghosts = false; m_only_ghosts = false;
m_finish_time = 0;
} // EasterEggHunt } // EasterEggHunt
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -191,7 +192,11 @@ void EasterEggHunt::update(int ticks)
bool EasterEggHunt::isRaceOver() bool EasterEggHunt::isRaceOver()
{ {
if(!m_only_ghosts && m_eggs_found == m_number_of_eggs) if(!m_only_ghosts && m_eggs_found == m_number_of_eggs)
{
if (m_finish_time == 0)
m_finish_time = getTime();
return true; return true;
}
else if (m_only_ghosts) else if (m_only_ghosts)
{ {
for (unsigned int i=0 ; i<m_eggs_collected.size();i++) for (unsigned int i=0 ; i<m_eggs_collected.size();i++)
@ -263,5 +268,5 @@ float EasterEggHunt::estimateFinishTimeForKart(AbstractKart* kart)
return gk->getGhostFinishTime(); return gk->getGhostFinishTime();
} }
return getTime(); return m_finish_time;
} // estimateFinishTimeForKart } // estimateFinishTimeForKart

View File

@ -45,6 +45,8 @@ private:
int m_eggs_found; int m_eggs_found;
bool m_only_ghosts; bool m_only_ghosts;
float m_finish_time;
public: public:
EasterEggHunt(); EasterEggHunt();
virtual ~EasterEggHunt(); virtual ~EasterEggHunt();