From 5ea5b692002a239c4f73a9ca90461b9491417d61 Mon Sep 17 00:00:00 2001 From: Alayan Date: Fri, 23 Nov 2018 16:57:19 +0100 Subject: [PATCH] Fix the possibility to get 1 lap/race achievements in battle/soccer/egg hunt --- src/items/attachment.cpp | 3 ++- src/items/flyable.cpp | 3 ++- src/items/powerup.cpp | 3 ++- src/items/swatter.cpp | 7 +++++-- src/karts/skidding.cpp | 11 +++++++---- src/physics/physics.cpp | 3 ++- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/items/attachment.cpp b/src/items/attachment.cpp index 0dbea36f0..88b7c703a 100644 --- a/src/items/attachment.cpp +++ b/src/items/attachment.cpp @@ -330,7 +330,8 @@ void Attachment::hitBanana(ItemState *item_state) if (m_kart->getController()->canGetAchievements()) { PlayerManager::increaseAchievement(AchievementsStatus::BANANA, 1); - PlayerManager::increaseAchievement(AchievementsStatus::BANANA_1RACE, 1); + if (race_manager->isLinearRaceMode()) + PlayerManager::increaseAchievement(AchievementsStatus::BANANA_1RACE, 1); } //Bubble gum shield effect: if(m_type == ATTACH_BUBBLEGUM_SHIELD || diff --git a/src/items/flyable.cpp b/src/items/flyable.cpp index 61fd226b4..b9319a224 100644 --- a/src/items/flyable.cpp +++ b/src/items/flyable.cpp @@ -571,7 +571,8 @@ void Flyable::explode(AbstractKart *kart_hit, PhysicalObject *object, if (m_owner->getWorldKartId() != kart->getWorldKartId()) PlayerManager::addKartHit(kart->getWorldKartId()); PlayerManager::increaseAchievement(AchievementsStatus::ALL_HITS, 1); - PlayerManager::increaseAchievement(AchievementsStatus::ALL_HITS_1RACE, 1); + if (race_manager->isLinearRaceMode()) + PlayerManager::increaseAchievement(AchievementsStatus::ALL_HITS_1RACE, 1); } } } diff --git a/src/items/powerup.cpp b/src/items/powerup.cpp index 43a74e0a0..d014aaa06 100644 --- a/src/items/powerup.cpp +++ b/src/items/powerup.cpp @@ -253,7 +253,8 @@ void Powerup::use() m_kart->getController()->canGetAchievements() ) { PlayerManager::increaseAchievement(AchievementsStatus::POWERUP_USED, 1); - PlayerManager::increaseAchievement(AchievementsStatus::POWERUP_USED_1RACE, 1); + if (race_manager->isLinearRaceMode()) + PlayerManager::increaseAchievement(AchievementsStatus::POWERUP_USED_1RACE, 1); } // Play custom kart sound when collectible is used //TODO: what about the bubble gum? diff --git a/src/items/swatter.cpp b/src/items/swatter.cpp index 93abb885d..b25206f76 100644 --- a/src/items/swatter.cpp +++ b/src/items/swatter.cpp @@ -375,9 +375,12 @@ void Swatter::squashThingsAround() { PlayerManager::addKartHit(m_closest_kart->getWorldKartId()); PlayerManager::increaseAchievement(AchievementsStatus::SWATTER_HIT, 1); - PlayerManager::increaseAchievement(AchievementsStatus::SWATTER_HIT_1RACE, 1); PlayerManager::increaseAchievement(AchievementsStatus::ALL_HITS, 1); - PlayerManager::increaseAchievement(AchievementsStatus::ALL_HITS_1RACE, 1); + if (race_manager->isLinearRaceMode()) + { + PlayerManager::increaseAchievement(AchievementsStatus::SWATTER_HIT_1RACE, 1); + PlayerManager::increaseAchievement(AchievementsStatus::ALL_HITS_1RACE, 1); + } } } diff --git a/src/karts/skidding.cpp b/src/karts/skidding.cpp index 9c0df0c2f..b38e62894 100644 --- a/src/karts/skidding.cpp +++ b/src/karts/skidding.cpp @@ -556,10 +556,13 @@ void Skidding::update(int ticks, bool is_on_ground, if (m_kart->getController()->canGetAchievements()) { - PlayerManager::increaseAchievement( - AchievementsStatus::SKIDDING_1LAP, 1); - PlayerManager::increaseAchievement( - AchievementsStatus::SKIDDING_1RACE, 1); + if (race_manager->isLinearRaceMode()) + { + PlayerManager::increaseAchievement( + AchievementsStatus::SKIDDING_1LAP, 1); + PlayerManager::increaseAchievement( + AchievementsStatus::SKIDDING_1RACE, 1); + } PlayerManager::increaseAchievement( AchievementsStatus::SKIDDING, 1); } diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index 33bebceeb..022e24814 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -363,7 +363,8 @@ void Physics::update(int ticks) if (type == PowerupManager::POWERUP_BOWLING) { PlayerManager::increaseAchievement(AchievementsStatus::BOWLING_HIT, 1); - PlayerManager::increaseAchievement(AchievementsStatus::BOWLING_HIT_1RACE, 1); + if (race_manager->isLinearRaceMode()) + PlayerManager::increaseAchievement(AchievementsStatus::BOWLING_HIT_1RACE, 1); } // is bowling ball } // if target_kart != kart && is a player kart and is current player }