Simplify achievement data enum names
This commit is contained in:
parent
a90890d0b3
commit
2b49f0da20
@ -281,44 +281,44 @@ void AchievementsStatus::updateAchievementsProgress(unsigned int achieve_data_id
|
|||||||
if (!beyond_luck->isAchieved())
|
if (!beyond_luck->isAchieved())
|
||||||
{
|
{
|
||||||
beyond_luck->reset();
|
beyond_luck->reset();
|
||||||
beyond_luck->increase("wins", "wins", m_variables[ACHIEVE_CONS_WON_RACES].counter);
|
beyond_luck->increase("wins", "wins", m_variables[CONS_WON_RACES].counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
Achievement *unstoppable = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_UNSTOPPABLE);
|
Achievement *unstoppable = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_UNSTOPPABLE);
|
||||||
if (!unstoppable->isAchieved())
|
if (!unstoppable->isAchieved())
|
||||||
{
|
{
|
||||||
unstoppable->reset();
|
unstoppable->reset();
|
||||||
unstoppable->increase("wins", "wins", m_variables[ACHIEVE_CONS_WON_RACES_HARD].counter);
|
unstoppable->increase("wins", "wins", m_variables[CONS_WON_RACES_HARD].counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
Achievement *gold_driver = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_GOLD_DRIVER);
|
Achievement *gold_driver = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_GOLD_DRIVER);
|
||||||
if (!gold_driver->isAchieved())
|
if (!gold_driver->isAchieved())
|
||||||
{
|
{
|
||||||
gold_driver->reset();
|
gold_driver->reset();
|
||||||
gold_driver->increase("standard", "standard", m_variables[ACHIEVE_WON_NORMAL_RACES].counter);
|
gold_driver->increase("standard", "standard", m_variables[WON_NORMAL_RACES].counter);
|
||||||
gold_driver->increase("std_timetrial", "std_timetrial", m_variables[ACHIEVE_WON_TT_RACES].counter);
|
gold_driver->increase("std_timetrial", "std_timetrial", m_variables[WON_TT_RACES].counter);
|
||||||
gold_driver->increase("follow_leader", "follow_leader", m_variables[ACHIEVE_WON_FTL_RACES].counter);
|
gold_driver->increase("follow_leader", "follow_leader", m_variables[WON_FTL_RACES].counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
Achievement *powerup_lover = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_POWERUP_LOVER);
|
Achievement *powerup_lover = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::POWERUP_LOVER);
|
||||||
if (!powerup_lover->isAchieved())
|
if (!powerup_lover->isAchieved())
|
||||||
{
|
{
|
||||||
powerup_lover->reset();
|
powerup_lover->reset();
|
||||||
powerup_lover->increase("poweruplover", "poweruplover", m_variables[ACHIEVE_POWERUP_USED_1RACE].counter);
|
powerup_lover->increase("poweruplover", "poweruplover", m_variables[POWERUP_USED_1RACE].counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
Achievement *banana_lover = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_BANANA);
|
Achievement *banana_lover = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::BANANA);
|
||||||
if (!banana_lover->isAchieved())
|
if (!banana_lover->isAchieved())
|
||||||
{
|
{
|
||||||
banana_lover->reset();
|
banana_lover->reset();
|
||||||
banana_lover->increase("banana", "banana", m_variables[ACHIEVE_BANANA_1RACE].counter);
|
banana_lover->increase("banana", "banana", m_variables[BANANA_1RACE].counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
Achievement *skidding = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_SKIDDING);
|
Achievement *skidding = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::SKIDDING);
|
||||||
if (!skidding->isAchieved())
|
if (!skidding->isAchieved())
|
||||||
{
|
{
|
||||||
skidding->reset();
|
skidding->reset();
|
||||||
skidding->increase("skidding", "skidding", m_variables[ACHIEVE_SKIDDING_1LAP].counter);
|
skidding->increase("skidding", "skidding", m_variables[SKIDDING_1LAP].counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
Achievement *strike = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_STRIKE);
|
Achievement *strike = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_STRIKE);
|
||||||
@ -416,9 +416,9 @@ void AchievementsStatus::onRaceEnd(bool aborted)
|
|||||||
iter->second->onRaceEnd();
|
iter->second->onRaceEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_variables[ACHIEVE_POWERUP_USED_1RACE].counter = 0;
|
m_variables[POWERUP_USED_1RACE].counter = 0;
|
||||||
m_variables[ACHIEVE_BANANA_1RACE].counter = 0;
|
m_variables[BANANA_1RACE].counter = 0;
|
||||||
m_variables[ACHIEVE_SKIDDING_1RACE].counter = 0;
|
m_variables[SKIDDING_1RACE].counter = 0;
|
||||||
m_variables[BOWLING_HIT_1RACE].counter = 0;
|
m_variables[BOWLING_HIT_1RACE].counter = 0;
|
||||||
m_variables[SWATTER_HIT_1RACE].counter = 0;
|
m_variables[SWATTER_HIT_1RACE].counter = 0;
|
||||||
|
|
||||||
@ -426,8 +426,8 @@ void AchievementsStatus::onRaceEnd(bool aborted)
|
|||||||
// Prevent restart from being abused to get consecutive wins achievement
|
// Prevent restart from being abused to get consecutive wins achievement
|
||||||
if (aborted)
|
if (aborted)
|
||||||
{
|
{
|
||||||
m_variables[ACHIEVE_CONS_WON_RACES].counter = 0;
|
m_variables[CONS_WON_RACES].counter = 0;
|
||||||
m_variables[ACHIEVE_CONS_WON_RACES_HARD].counter = 0;
|
m_variables[CONS_WON_RACES_HARD].counter = 0;
|
||||||
}
|
}
|
||||||
} // onRaceEnd
|
} // onRaceEnd
|
||||||
|
|
||||||
@ -442,7 +442,7 @@ void AchievementsStatus::onLapEnd()
|
|||||||
iter->second->onLapEnd();
|
iter->second->onLapEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_variables[ACHIEVE_SKIDDING_1LAP].counter = 0;
|
m_variables[SKIDDING_1LAP].counter = 0;
|
||||||
} // onLapEnd
|
} // onLapEnd
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -46,16 +46,16 @@ public :
|
|||||||
enum AchievementData {
|
enum AchievementData {
|
||||||
// Won races values share the following properties :
|
// Won races values share the following properties :
|
||||||
// 1. Only races with at least 3 AI count unless otherwise specified.
|
// 1. Only races with at least 3 AI count unless otherwise specified.
|
||||||
ACHIEVE_WON_RACES = 0, // Normal, time-trial and FTL
|
WON_RACES = 0, // Normal, time-trial and FTL
|
||||||
ACHIEVE_WON_NORMAL_RACES = 1, // Normal race only
|
WON_NORMAL_RACES = 1, // Normal race only
|
||||||
ACHIEVE_WON_TT_RACES = 2, // Time-trial race only
|
WON_TT_RACES = 2, // Time-trial race only
|
||||||
ACHIEVE_WON_FTL_RACES = 3, // Follow-the-leader race only
|
WON_FTL_RACES = 3, // Follow-the-leader race only
|
||||||
// Consecutive won race values :
|
// Consecutive won race values :
|
||||||
// 1. Ignore races with not enough AIs for incrementation
|
// 1. Ignore races with not enough AIs for incrementation
|
||||||
// 2. Reset the counter in case of loss against any number of AIs
|
// 2. Reset the counter in case of loss against any number of AIs
|
||||||
ACHIEVE_CONS_WON_RACES = 4,
|
CONS_WON_RACES = 4,
|
||||||
// Won races in (at least) hard requires at least 5 AI opponents
|
// Won races in (at least) hard requires at least 5 AI opponents
|
||||||
ACHIEVE_CONS_WON_RACES_HARD = 5,
|
CONS_WON_RACES_HARD = 5,
|
||||||
// Count how many normal, TT & FTL races were started and finished by difficulty
|
// Count how many normal, TT & FTL races were started and finished by difficulty
|
||||||
EASY_STARTED = 6,
|
EASY_STARTED = 6,
|
||||||
EASY_FINISHED = 7,
|
EASY_FINISHED = 7,
|
||||||
@ -66,15 +66,15 @@ public :
|
|||||||
BEST_STARTED = 12,
|
BEST_STARTED = 12,
|
||||||
BEST_FINISHED = 13,
|
BEST_FINISHED = 13,
|
||||||
// Count the number of powerups used by the player.
|
// Count the number of powerups used by the player.
|
||||||
ACHIEVE_POWERUP_USED = 14,
|
POWERUP_USED = 14,
|
||||||
ACHIEVE_POWERUP_USED_1RACE = 15,
|
POWERUP_USED_1RACE = 15,
|
||||||
// Count the number of bananas hit
|
// Count the number of bananas hit
|
||||||
ACHIEVE_BANANA = 16,
|
BANANA = 16,
|
||||||
ACHIEVE_BANANA_1RACE = 17,
|
BANANA_1RACE = 17,
|
||||||
// Count how many times the player skidded
|
// Count how many times the player skidded
|
||||||
ACHIEVE_SKIDDING_1LAP = 18,
|
SKIDDING_1LAP = 18,
|
||||||
ACHIEVE_SKIDDING_1RACE = 19,
|
SKIDDING_1RACE = 19,
|
||||||
ACHIEVE_SKIDDING = 20,
|
SKIDDING = 20,
|
||||||
// Count how many times a bowling ball from the player hit a kart
|
// Count how many times a bowling ball from the player hit a kart
|
||||||
BOWLING_HIT = 21,
|
BOWLING_HIT = 21,
|
||||||
BOWLING_HIT_1RACE = 22,
|
BOWLING_HIT_1RACE = 22,
|
||||||
|
@ -329,8 +329,8 @@ void Attachment::hitBanana(ItemState *item_state)
|
|||||||
{
|
{
|
||||||
if (m_kart->getController()->canGetAchievements())
|
if (m_kart->getController()->canGetAchievements())
|
||||||
{
|
{
|
||||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_BANANA, 1);
|
PlayerManager::increaseAchievement(AchievementsStatus::BANANA, 1);
|
||||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_BANANA_1RACE, 1);
|
PlayerManager::increaseAchievement(AchievementsStatus::BANANA_1RACE, 1);
|
||||||
}
|
}
|
||||||
//Bubble gum shield effect:
|
//Bubble gum shield effect:
|
||||||
if(m_type == ATTACH_BUBBLEGUM_SHIELD ||
|
if(m_type == ATTACH_BUBBLEGUM_SHIELD ||
|
||||||
|
@ -254,8 +254,8 @@ void Powerup::use()
|
|||||||
if (m_type != PowerupManager::POWERUP_NOTHING &&
|
if (m_type != PowerupManager::POWERUP_NOTHING &&
|
||||||
m_kart->getController()->canGetAchievements() )
|
m_kart->getController()->canGetAchievements() )
|
||||||
{
|
{
|
||||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_POWERUP_USED, 1);
|
PlayerManager::increaseAchievement(AchievementsStatus::POWERUP_USED, 1);
|
||||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_POWERUP_USED_1RACE, 1);
|
PlayerManager::increaseAchievement(AchievementsStatus::POWERUP_USED_1RACE, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play custom kart sound when collectible is used //TODO: what about the bubble gum?
|
// Play custom kart sound when collectible is used //TODO: what about the bubble gum?
|
||||||
|
@ -516,11 +516,11 @@ void Skidding::update(int ticks, bool is_on_ground,
|
|||||||
if (m_kart->getController()->canGetAchievements())
|
if (m_kart->getController()->canGetAchievements())
|
||||||
{
|
{
|
||||||
PlayerManager::increaseAchievement(
|
PlayerManager::increaseAchievement(
|
||||||
AchievementsStatus::ACHIEVE_SKIDDING_1LAP, 1);
|
AchievementsStatus::SKIDDING_1LAP, 1);
|
||||||
PlayerManager::increaseAchievement(
|
PlayerManager::increaseAchievement(
|
||||||
AchievementsStatus::ACHIEVE_SKIDDING_1RACE, 1);
|
AchievementsStatus::SKIDDING_1RACE, 1);
|
||||||
PlayerManager::increaseAchievement(
|
PlayerManager::increaseAchievement(
|
||||||
AchievementsStatus::ACHIEVE_SKIDDING, 1);
|
AchievementsStatus::SKIDDING, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1624,25 +1624,25 @@ void World::updateAchievementDataEndRace()
|
|||||||
PlayerManager::trackEvent(race_manager->getTrackName(), AchievementsStatus::TR_FINISHED_ALONE);
|
PlayerManager::trackEvent(race_manager->getTrackName(), AchievementsStatus::TR_FINISHED_ALONE);
|
||||||
if (race_manager->getNumberOfAIKarts() >= 3)
|
if (race_manager->getNumberOfAIKarts() >= 3)
|
||||||
{
|
{
|
||||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_WON_RACES,1);
|
PlayerManager::increaseAchievement(AchievementsStatus::WON_RACES,1);
|
||||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_CONS_WON_RACES,1);
|
PlayerManager::increaseAchievement(AchievementsStatus::CONS_WON_RACES,1);
|
||||||
if (race_manager->isTimeTrialMode())
|
if (race_manager->isTimeTrialMode())
|
||||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_WON_TT_RACES,1);
|
PlayerManager::increaseAchievement(AchievementsStatus::WON_TT_RACES,1);
|
||||||
else if (race_manager->isFollowMode())
|
else if (race_manager->isFollowMode())
|
||||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_WON_FTL_RACES,1);
|
PlayerManager::increaseAchievement(AchievementsStatus::WON_FTL_RACES,1);
|
||||||
else // normal race
|
else // normal race
|
||||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_WON_NORMAL_RACES,1);
|
PlayerManager::increaseAchievement(AchievementsStatus::WON_NORMAL_RACES,1);
|
||||||
}
|
}
|
||||||
if (race_manager->getNumberOfAIKarts() >= 5 &&
|
if (race_manager->getNumberOfAIKarts() >= 5 &&
|
||||||
(race_manager->getDifficulty() == RaceManager::DIFFICULTY_HARD ||
|
(race_manager->getDifficulty() == RaceManager::DIFFICULTY_HARD ||
|
||||||
race_manager->getDifficulty() == RaceManager::DIFFICULTY_BEST))
|
race_manager->getDifficulty() == RaceManager::DIFFICULTY_BEST))
|
||||||
PlayerManager::increaseAchievement(AchievementsStatus::ACHIEVE_CONS_WON_RACES_HARD,1);
|
PlayerManager::increaseAchievement(AchievementsStatus::CONS_WON_RACES_HARD,1);
|
||||||
}
|
}
|
||||||
// Race lost, reset the consecutive wins counters
|
// Race lost, reset the consecutive wins counters
|
||||||
else if (m_karts[i]->getPosition() > winner_position)
|
else if (m_karts[i]->getPosition() > winner_position)
|
||||||
{
|
{
|
||||||
PlayerManager::resetAchievementData(AchievementsStatus::ACHIEVE_CONS_WON_RACES);
|
PlayerManager::resetAchievementData(AchievementsStatus::CONS_WON_RACES);
|
||||||
PlayerManager::resetAchievementData(AchievementsStatus::ACHIEVE_CONS_WON_RACES_HARD);
|
PlayerManager::resetAchievementData(AchievementsStatus::CONS_WON_RACES_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // for i<kart_amount
|
} // for i<kart_amount
|
||||||
|
Loading…
Reference in New Issue
Block a user