Don't remove a level 2 skid bonus when getting a level 1 (#3410)

This commit is contained in:
Alayan-stk-2 2018-08-30 00:33:37 +02:00 committed by auriamg
parent 80555f4905
commit 8249266338
3 changed files with 12 additions and 1 deletions

View File

@ -323,6 +323,14 @@ void MaxSpeed::update(int ticks)
m_current_max_speed += speedup.getSpeedIncrease();
m_add_engine_force += speedup.getEngineForce();
}
if (getSpeedIncreaseTicksLeft(MS_INCREASE_SKIDDING) > 0 &&
getSpeedIncreaseTicksLeft(MS_INCREASE_RED_SKIDDING) > 0)
{
SpeedIncrease &speedup = m_speed_increase[MS_INCREASE_SKIDDING];
m_current_max_speed -= speedup.getSpeedIncrease();
m_add_engine_force -= speedup.getEngineForce();
}
m_current_max_speed *= slowdown_factor;
// Then cap the current speed of the kart

View File

@ -37,6 +37,7 @@ public:
MS_INCREASE_NITRO,
MS_INCREASE_RUBBER,
MS_INCREASE_SKIDDING,
MS_INCREASE_RED_SKIDDING,
MS_INCREASE_MAX};
/** The categories to use for decreasing the speed of a kart:

View File

@ -503,8 +503,10 @@ void Skidding::update(int ticks, bool is_on_ground,
->setCreationRateRelative(KartGFX::KGFX_SKIDL, 1.0f);
m_kart->getKartGFX()
->setCreationRateRelative(KartGFX::KGFX_SKIDR, 1.0f);
unsigned int bonus_cat = (level == 1) ? MaxSpeed::MS_INCREASE_SKIDDING :
MaxSpeed::MS_INCREASE_RED_SKIDDING;
m_kart->m_max_speed->
instantSpeedIncrease(MaxSpeed::MS_INCREASE_SKIDDING,
instantSpeedIncrease(bonus_cat,
bonus_speed, bonus_speed,
bonus_force,
stk_config->time2Ticks(bonus_time),