Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/whichrakesh/stk-code into…
Browse files Browse the repository at this point in the history
… whichrakesh-master

Fix counting of bananas only for current player. Fixed conflicts.
Conflicts:
	src/achievements/achievement_info.hpp
  • Loading branch information
hiker committed Apr 22, 2014
2 parents 469ac9c + 9b50c9f commit 2e3adee
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
Binary file added data/.achievements.xml.swp
Binary file not shown.
16 changes: 10 additions & 6 deletions data/achievements.xml
Expand Up @@ -18,15 +18,15 @@
<ball goal="10"/>
</achievement>
<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"/>
</achievement>
<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"/>
</achievement>
<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"/>
</achievement>
<achievement id="6" check-type="all-at-least" reset-type="never"
Expand All @@ -37,11 +37,15 @@
<opponents goal="3"/>
</achievement>
<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"/>
</achievement>
<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"/>
</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>
2 changes: 1 addition & 1 deletion src/achievements/achievement_info.cpp
Expand Up @@ -147,7 +147,7 @@ bool AchievementInfo::checkCompletion(Achievement * achievement) const
return false;
}
default:
Log::fatal("AchievementInfo", "Missing check for tpye %d.",
Log::fatal("AchievementInfo", "Missing check for type %d.",
m_check_type);
} // switch

Expand Down
18 changes: 10 additions & 8 deletions src/achievements/achievement_info.hpp
Expand Up @@ -42,16 +42,18 @@ class AchievementInfo
{
public:
/** Some handy names for the various achievements. */
enum { ACHIEVE_COLUMBUS = 1,
ACHIEVE_FIRST = ACHIEVE_COLUMBUS,
ACHIEVE_STRIKE = 2,
ACHIEVE_ARCH_ENEMY = 3,
ACHIEVE_MARATHONER = 4,
ACHIEVE_SKIDDING = 5,
ACHIEVE_GOLD_DRIVER = 6,
enum { ACHIEVE_COLUMBUS = 1,
ACHIEVE_FIRST = ACHIEVE_COLUMBUS,
ACHIEVE_STRIKE = 2,
ACHIEVE_ARCH_ENEMY = 3,
ACHIEVE_MARATHONER = 4,
ACHIEVE_SKIDDING = 5,
ACHIEVE_GOLD_DRIVER = 6,
ACHIEVE_POWERUP_LOVER = 7,
ACHIEVE_UNSTOPPABLE = 8
ACHIEVE_UNSTOPPABLE = 8,
ACHIEVE_BANANA = 9
};

/** Achievement check type:
* ALL_AT_LEAST: All goal values must be reached (or exceeded).
* ONE_AT_LEAST: At least one current value reaches or exceedes the goal.
Expand Down
7 changes: 7 additions & 0 deletions src/items/attachment.cpp
Expand Up @@ -19,7 +19,9 @@
#include "items/attachment.hpp"

#include <algorithm>
#include "achievements/achievement_info.hpp"
#include "audio/sfx_base.hpp"
#include "config/player_manager.hpp"
#include "config/stk_config.hpp"
#include "config/user_config.hpp"
#include "graphics/explosion.hpp"
Expand Down Expand Up @@ -223,6 +225,11 @@ void Attachment::clear()
*/
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:
if(m_type == ATTACH_BUBBLEGUM_SHIELD ||
m_type == ATTACH_NOLOK_BUBBLEGUM_SHIELD)
Expand Down

0 comments on commit 2e3adee

Please sign in to comment.