Fix some breakage in challenges

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10354 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-12-06 00:01:48 +00:00
parent 57d85f1bf1
commit e61c4430b3
2 changed files with 4 additions and 12 deletions

View File

@ -67,16 +67,6 @@ public:
// ------------------------------------------------------------------------
void setActive() {m_state = CH_ACTIVE; }
// ------------------------------------------------------------------------
/** These functions are called when a race is finished. It allows
* the challenge to unlock features (when returning true), otherwise
* the feature remains locked. */
virtual bool raceFinished() {return false; }
// ------------------------------------------------------------------------
/** These functions are called when a grand prix is finished. It allows
* the challenge to unlock features (when returning true), otherwise
* the feature remains locked. */
virtual bool grandPrixFinished() {return false; }
ChallengeData* getData() { return m_data; }
};
#endif

View File

@ -171,11 +171,13 @@ std::vector<const ChallengeData*> GameSlot::getActiveChallenges()
*/
void GameSlot::raceFinished()
{
printf("=== Race finished ===\n");
std::map<std::string, Challenge*>::const_iterator i;
for(i = m_challenges_state.begin();
i != m_challenges_state.end(); i++)
{
if(i->second->isActive() && i->second->raceFinished())
if(i->second->isActive() && i->second->getData()->raceFinished())
{
unlockFeature(i->second);
} // if isActive && challenge solved
@ -191,7 +193,7 @@ void GameSlot::grandPrixFinished()
for(i = m_challenges_state.begin();
i != m_challenges_state.end(); i++)
{
if(i->second->isActive() && i->second->grandPrixFinished())
if(i->second->isActive() && i->second->getData()->grandPrixFinished())
{
printf("===== A FEATURE WAS UNLOCKED BECAUSE YOU WON THE GP!! ==\n");
unlockFeature(i->second);