Merge branch 'master' of https://github.com/gupascal/stk-code into gupascal-master
Fixed some merging issues. Conflicts: data/achievements.xml src/achievements/achievement_info.hpp
This commit is contained in:
commit
3d5fbaa92f
@ -29,5 +29,12 @@
|
|||||||
title="Skid-row" description="Make 5 skidding in a single race">
|
title="Skid-row" description="Make 5 skidding in a single race">
|
||||||
<skidding goal="5"/>
|
<skidding goal="5"/>
|
||||||
</achievement>
|
</achievement>
|
||||||
|
<achievement id="6" check-type="all-at-least" reset-after-race="no"
|
||||||
|
title="Gold driver" description="Win in all single player modes, against at least 3 opponents.">
|
||||||
|
<standard goal="1"/>
|
||||||
|
<std_timetrial goal="1"/>
|
||||||
|
<follow_leader goal="1"/>
|
||||||
|
<opponents goal="3"/>
|
||||||
|
</achievement>
|
||||||
</achievements>
|
</achievements>
|
||||||
|
|
||||||
|
@ -42,12 +42,13 @@ 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
|
||||||
};
|
};
|
||||||
/** 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).
|
||||||
|
@ -445,6 +445,7 @@ void World::terminateRace()
|
|||||||
&best_player);
|
&best_player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check achievements
|
||||||
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_COLUMBUS,
|
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_COLUMBUS,
|
||||||
getTrack()->getIdent(), 1);
|
getTrack()->getIdent(), 1);
|
||||||
if (raceHasLaps())
|
if (raceHasLaps())
|
||||||
@ -452,6 +453,39 @@ void World::terminateRace()
|
|||||||
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_MARATHONER,
|
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_MARATHONER,
|
||||||
"laps", race_manager->getNumLaps());
|
"laps", race_manager->getNumLaps());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Achievement *achiev = PlayerManager::getCurrentAchievementsStatus()->getAchievement(AchievementInfo::ACHIEVE_GOLD_DRIVER);
|
||||||
|
if (achiev)
|
||||||
|
{
|
||||||
|
std::string mode_name = getIdent(); // Get the race mode name
|
||||||
|
int winner_position = 1;
|
||||||
|
int opponents = achiev->getInfo()->getGoalValue("opponents"); // Get the required opponents number
|
||||||
|
if (mode_name == IDENT_FTL)
|
||||||
|
{
|
||||||
|
winner_position = 2;
|
||||||
|
opponents++;
|
||||||
|
}
|
||||||
|
for(unsigned int i = 0; i < kart_amount; i++)
|
||||||
|
{
|
||||||
|
// Retrieve the current player
|
||||||
|
StateManager::ActivePlayer* p = m_karts[i]->getController()->getPlayer();
|
||||||
|
if (p && p->getConstProfile() == PlayerManager::get()->getCurrentPlayer())
|
||||||
|
{
|
||||||
|
// Check if the player has won
|
||||||
|
if (m_karts[i]->getPosition() == winner_position && kart_amount > opponents )
|
||||||
|
{
|
||||||
|
// Update the achievement
|
||||||
|
mode_name = StringUtils::toLowerCase(mode_name);
|
||||||
|
if (achiev->getValue("opponents") <= 0)
|
||||||
|
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_GOLD_DRIVER,
|
||||||
|
"opponents", opponents);
|
||||||
|
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_GOLD_DRIVER,
|
||||||
|
mode_name, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // for i < kart_amount
|
||||||
|
} // if (achiev)
|
||||||
|
|
||||||
PlayerManager::get()->getCurrentPlayer()->raceFinished();
|
PlayerManager::get()->getCurrentPlayer()->raceFinished();
|
||||||
|
|
||||||
if (m_race_gui) m_race_gui->clearAllMessages();
|
if (m_race_gui) m_race_gui->clearAllMessages();
|
||||||
|
Loading…
Reference in New Issue
Block a user