Make Banana Lover use a generic counter
This commit is contained in:
parent
3427d21939
commit
09f5376312
@ -226,6 +226,14 @@ void AchievementsStatus::updateAchievementsProgress(unsigned int achieve_data_id
|
||||
powerup_lover->reset();
|
||||
powerup_lover->increase("poweruplover", "poweruplover", m_variables[ACHIEVE_POWERUP_USED_1RACE].counter);
|
||||
}
|
||||
|
||||
Achievement *banana_lover = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_BANANA);
|
||||
|
||||
if (!banana_lover->isAchieved())
|
||||
{
|
||||
banana_lover->reset();
|
||||
banana_lover->increase("banana", "banana", m_variables[ACHIEVE_BANANA_1RACE].counter);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -273,6 +281,7 @@ void AchievementsStatus::onRaceEnd(bool aborted)
|
||||
}
|
||||
|
||||
m_variables[ACHIEVE_POWERUP_USED_1RACE].counter = 0;
|
||||
m_variables[ACHIEVE_BANANA_1RACE].counter = 0;
|
||||
|
||||
// Prevent restart from being abused to get consecutive wins achievement
|
||||
if (aborted)
|
||||
|
@ -41,6 +41,8 @@ class XMLNode;
|
||||
class AchievementsStatus
|
||||
{
|
||||
public :
|
||||
// Warning : changing what an existing id does breaks
|
||||
// save-game compatibility. Bump version number if doing so.
|
||||
enum { // Won races values share the following properties :
|
||||
// 1. Only races with at least 3 AI count unless otherwise specified.
|
||||
ACHIEVE_WON_RACES = 0, // Normal, time-trial and FTL
|
||||
@ -56,8 +58,11 @@ public :
|
||||
// Count the number of powerups used by the player.
|
||||
ACHIEVE_POWERUP_USED = 6,
|
||||
ACHIEVE_POWERUP_USED_1RACE = 7,
|
||||
// Count the number of bananas hit
|
||||
ACHIEVE_BANANA = 8,
|
||||
ACHIEVE_BANANA_1RACE = 9,
|
||||
|
||||
ACHIEVE_DATA_NUM = 8
|
||||
ACHIEVE_DATA_NUM = 10
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "items/attachment.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include "achievements/achievement_info.hpp"
|
||||
#include "achievements/achievements_status.hpp"
|
||||
#include "audio/sfx_base.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "config/stk_config.hpp"
|
||||
@ -329,8 +329,8 @@ void Attachment::hitBanana(ItemState *item_state)
|
||||
{
|
||||
if (m_kart->getController()->canGetAchievements())
|
||||
{
|
||||
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_BANANA,
|
||||
"banana", 1);
|
||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_BANANA, 1);
|
||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_BANANA_1RACE, 1);
|
||||
}
|
||||
//Bubble gum shield effect:
|
||||
if(m_type == ATTACH_BUBBLEGUM_SHIELD ||
|
||||
|
Loading…
Reference in New Issue
Block a user