Merge branch 'master' of https://github.com/whichrakesh/stk-code into whichrakesh-master

Fix counting of bananas only for current player. Fixed conflicts.
Conflicts:
	src/achievements/achievement_info.hpp
This commit is contained in:
hiker 2014-04-22 17:20:40 +10:00
commit 2e3adee1a2
5 changed files with 28 additions and 15 deletions

BIN
data/.achievements.xml.swp Normal file

Binary file not shown.

View File

@ -18,15 +18,15 @@
<ball goal="10"/> <ball goal="10"/>
</achievement> </achievement>
<achievement id="3" check-type="one-at-least" reset-type="race" <achievement id="3" check-type="one-at-least" reset-type="race"
title="Arch Enemy" description="Hit the same kart at least 5 times in one race"> title="Arch Enemy" description="Hit the same kart at least 5 times in one race.">
<hit goal="5"/> <hit goal="5"/>
</achievement> </achievement>
<achievement id="4" check-type="all-at-least" reset-type="race" <achievement id="4" check-type="all-at-least" reset-type="race"
title="Marathoner" description="Make a race with 5 laps or more"> title="Marathoner" description="Make a race with 5 laps or more.">
<laps goal="5"/> <laps goal="5"/>
</achievement> </achievement>
<achievement id="5" check-type="all-at-least" reset-type="lap" <achievement id="5" check-type="all-at-least" reset-type="lap"
title="Skid-row" description="Make 5 skidding in a single lap"> title="Skid-row" description="Make 5 skidding in a single lap.">
<skidding goal="5"/> <skidding goal="5"/>
</achievement> </achievement>
<achievement id="6" check-type="all-at-least" reset-type="never" <achievement id="6" check-type="all-at-least" reset-type="never"
@ -37,11 +37,15 @@
<opponents goal="3"/> <opponents goal="3"/>
</achievement> </achievement>
<achievement id="7" check-type="all-at-least" reset-type="race" <achievement id="7" check-type="all-at-least" reset-type="race"
title="Powerup Love" description="Use 10 or more powerups in a race"> title="Powerup Love" description="Use 10 or more powerups in a race.">
<poweruplover goal="10"/> <poweruplover goal="10"/>
</achievement> </achievement>
<achievement id="8" check-type="all-at-least" reset-type="never" <achievement id="8" check-type="all-at-least" reset-type="never"
title="Unstoppable" description="Win 5 single races in a row"> title="Unstoppable" description="Win 5 single races in a row.">
<wins goal="5"/> <wins goal="5"/>
</achievement> </achievement>
</achievements> <achievement id="9" check-type="all-at-least" reset-after-race="yes"
title="Banana Lover" description="Collect at least 5 bananas in one race.">
<banana goal="5"/>
</achievement>
</achievements>

View File

@ -147,7 +147,7 @@ bool AchievementInfo::checkCompletion(Achievement * achievement) const
return false; return false;
} }
default: default:
Log::fatal("AchievementInfo", "Missing check for tpye %d.", Log::fatal("AchievementInfo", "Missing check for type %d.",
m_check_type); m_check_type);
} // switch } // switch

View File

@ -42,16 +42,18 @@ class AchievementInfo
{ {
public: public:
/** Some handy names for the various achievements. */ /** Some handy names for the various achievements. */
enum { ACHIEVE_COLUMBUS = 1, enum { ACHIEVE_COLUMBUS = 1,
ACHIEVE_FIRST = ACHIEVE_COLUMBUS, ACHIEVE_FIRST = ACHIEVE_COLUMBUS,
ACHIEVE_STRIKE = 2, ACHIEVE_STRIKE = 2,
ACHIEVE_ARCH_ENEMY = 3, ACHIEVE_ARCH_ENEMY = 3,
ACHIEVE_MARATHONER = 4, ACHIEVE_MARATHONER = 4,
ACHIEVE_SKIDDING = 5, ACHIEVE_SKIDDING = 5,
ACHIEVE_GOLD_DRIVER = 6, ACHIEVE_GOLD_DRIVER = 6,
ACHIEVE_POWERUP_LOVER = 7, ACHIEVE_POWERUP_LOVER = 7,
ACHIEVE_UNSTOPPABLE = 8 ACHIEVE_UNSTOPPABLE = 8,
ACHIEVE_BANANA = 9
}; };
/** Achievement check type: /** Achievement check type:
* ALL_AT_LEAST: All goal values must be reached (or exceeded). * ALL_AT_LEAST: All goal values must be reached (or exceeded).
* ONE_AT_LEAST: At least one current value reaches or exceedes the goal. * ONE_AT_LEAST: At least one current value reaches or exceedes the goal.

View File

@ -19,7 +19,9 @@
#include "items/attachment.hpp" #include "items/attachment.hpp"
#include <algorithm> #include <algorithm>
#include "achievements/achievement_info.hpp"
#include "audio/sfx_base.hpp" #include "audio/sfx_base.hpp"
#include "config/player_manager.hpp"
#include "config/stk_config.hpp" #include "config/stk_config.hpp"
#include "config/user_config.hpp" #include "config/user_config.hpp"
#include "graphics/explosion.hpp" #include "graphics/explosion.hpp"
@ -223,6 +225,11 @@ void Attachment::clear()
*/ */
void Attachment::hitBanana(Item *item, int new_attachment) void Attachment::hitBanana(Item *item, int new_attachment)
{ {
const StateManager::ActivePlayer *const ap = m_kart->getController()
->getPlayer();
if(ap && ap->getConstProfile()==PlayerManager::getCurrentPlayer())
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_BANANA,
"banana",1 );
//Bubble gum shield effect: //Bubble gum shield effect:
if(m_type == ATTACH_BUBBLEGUM_SHIELD || if(m_type == ATTACH_BUBBLEGUM_SHIELD ||
m_type == ATTACH_NOLOK_BUBBLEGUM_SHIELD) m_type == ATTACH_NOLOK_BUBBLEGUM_SHIELD)