Fixed #761: don't play win animation if challenge was started
but not fulfilled. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11926 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
e6ce0c80ac
commit
f532178d59
@ -138,6 +138,8 @@ public:
|
||||
/** Returns if this is the first time the intro is shown. */
|
||||
bool isFirstTime() const { return m_first_time; }
|
||||
// ------------------------------------------------------------------------
|
||||
const Challenge *getCurrentChallenge() const { return m_current_challenge; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a challenge given the challenge id.
|
||||
*/
|
||||
const Challenge* getChallenge(const std::string& id) const
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "audio/music_manager.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "audio/sfx_base.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/camera.hpp"
|
||||
#include "graphics/material_manager.hpp"
|
||||
@ -776,9 +777,19 @@ void Kart::finishedRace(float time)
|
||||
// in modes that support it, start end animation
|
||||
setController(new EndController(this, m_controller->getPlayer(),
|
||||
m_controller));
|
||||
if(m_race_position<=0.5f*race_manager->getNumberOfKarts() ||
|
||||
m_race_position==1)
|
||||
m_kart_model->setAnimation(KartModel::AF_WIN_START);
|
||||
GameSlot *slot = unlock_manager->getCurrentSlot();
|
||||
const Challenge *challenge = slot->getCurrentChallenge();
|
||||
if(challenge)
|
||||
{
|
||||
if(challenge->getData()->isChallengeFulfilled())
|
||||
m_kart_model->setAnimation(KartModel::AF_WIN_START);
|
||||
else
|
||||
m_kart_model->setAnimation(KartModel::AF_LOSE_START);
|
||||
|
||||
}
|
||||
else if(m_race_position<=0.5f*race_manager->getNumberOfKarts() ||
|
||||
m_race_position==1)
|
||||
m_kart_model->setAnimation(KartModel::AF_WIN_START);
|
||||
else
|
||||
m_kart_model->setAnimation(KartModel::AF_LOSE_START);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user