This commit is contained in:
samuncle 2014-02-17 22:37:23 +01:00
commit 4a5f09dca3
20 changed files with 149 additions and 151 deletions

View File

@ -17,9 +17,9 @@ src/audio/music_ogg.cpp
src/audio/sfx_buffer.cpp
src/audio/sfx_manager.cpp
src/audio/sfx_openal.cpp
src/challenges/challenge.cpp
src/challenges/challenge_data.cpp
src/challenges/game_slot.cpp
src/challenges/challenge_status.cpp
src/challenges/story_mode_status.cpp
src/challenges/unlock_manager.cpp
src/config/device_config.cpp
src/config/player_manager.cpp
@ -346,9 +346,9 @@ src/audio/sfx_base.hpp
src/audio/sfx_buffer.hpp
src/audio/sfx_manager.hpp
src/audio/sfx_openal.hpp
src/challenges/challenge.hpp
src/challenges/challenge_data.hpp
src/challenges/game_slot.hpp
src/challenges/challenge_status.hpp
src/challenges/story_mode_status.hpp
src/challenges/unlock_manager.hpp
src/config/device_config.hpp
src/config/player_manager.hpp

View File

@ -24,7 +24,7 @@
#include <stdio.h>
#include <stdexcept>
#include "challenges/challenge.hpp"
#include "race/race_manager.hpp"
/**

View File

@ -16,7 +16,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "challenges/challenge.hpp"
#include "challenges/challenge_status.hpp"
#include "challenges/challenge_data.hpp"
#include "io/utf_writer.hpp"
@ -33,12 +33,12 @@
//-----------------------------------------------------------------------------
/** Loads the state for a challenge object (esp. m_state)
*/
void Challenge::load(const XMLNode* challengesNode)
void ChallengeStatus::load(const XMLNode* challenges_node)
{
const XMLNode* node = challengesNode->getNode( m_data->getId() );
const XMLNode* node = challenges_node->getNode( m_data->getId() );
if(node == NULL)
{
Log::info("Challenge", "Couldn't find node <%s> in challenge list."
Log::info("ChallengeStatus", "Couldn't find node <%s> in challenge list."
"(If this is the first time you play this is normal)\n",
m_data->getId().c_str());
return;
@ -76,7 +76,7 @@ void Challenge::load(const XMLNode* challengesNode)
//-----------------------------------------------------------------------------
void Challenge::setSolved(RaceManager::Difficulty d)
void ChallengeStatus::setSolved(RaceManager::Difficulty d)
{
// solve not only the current difficulty but all those before
// e.g. if you solved hard then you also get easy
@ -88,7 +88,7 @@ void Challenge::setSolved(RaceManager::Difficulty d)
//-----------------------------------------------------------------------------
void Challenge::save(UTFWriter& writer)
void ChallengeStatus::save(UTFWriter& writer)
{
writer << L" <"<< m_data->getId() << L">\n"
<< L" <easy solved=\""

View File

@ -16,8 +16,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_CHALLENGE_HPP
#define HEADER_CHALLENGE_HPP
#ifndef HEADER_CHALLENGE_STATUS_HPP
#define HEADER_CHALLENGE_STATUS_HPP
/**
* \defgroup challenges
@ -40,14 +40,20 @@ class XMLNode;
/**
* \brief The state of a challenge for one player.
* Each Challenge has one ChallengeData associcated, which stores
* the actual data about the challenge.
* Each ChallengeStatus has one ChallengeData associcated, which stores
* the actual data about the challenge. The ChallengeStatus stores if the
* challenge is not possible yet (inactive), active (i.e. user can try to
* solve it), or solved. This status is stored for each difficulty level.
* This data is saved to and loaded from the player.xml file.
* A PlayerProfile will store an array of ChallengeStatuses, one for each
* Challenge in STK.
*
* \ingroup challenges
*/
class Challenge : public NoCopy
class ChallengeStatus : public NoCopy
{
private:
/** The different states the challenge can be in. */
enum {CH_INACTIVE, // challenge not yet possible
CH_ACTIVE, // challenge possible, but not yet solved
CH_SOLVED} // challenge was solved
@ -57,14 +63,14 @@ private:
const ChallengeData* m_data;
public:
Challenge(const ChallengeData* data)
ChallengeStatus(const ChallengeData* data)
{
m_data = data;
m_state[RaceManager::DIFFICULTY_EASY] = CH_INACTIVE;
m_state[RaceManager::DIFFICULTY_MEDIUM] = CH_INACTIVE;
m_state[RaceManager::DIFFICULTY_HARD] = CH_INACTIVE;
}
virtual ~Challenge() {};
virtual ~ChallengeStatus() {};
void load(const XMLNode* config);
void save(UTFWriter& writer);
void setSolved(RaceManager::Difficulty d);
@ -102,5 +108,5 @@ public:
/** Returns a pointer to the actual Challenge data.
*/
const ChallengeData* getData() const { return m_data; }
}; // Challenge
}; // ChallengeStatus
#endif

View File

@ -17,9 +17,9 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "challenges/game_slot.hpp"
#include "challenges/story_mode_status.hpp"
#include "challenges/challenge.hpp"
#include "challenges/challenge_status.hpp"
#include "challenges/challenge_data.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
@ -27,7 +27,7 @@
#include "io/xml_node.hpp"
//-----------------------------------------------------------------------------
GameSlot::GameSlot(const XMLNode *node)
StoryModeStatus::StoryModeStatus(const XMLNode *node)
{
m_points = 0;
m_first_time = true;
@ -42,25 +42,25 @@ GameSlot::GameSlot(const XMLNode *node)
node->get("first-time", &m_first_time);
} // if node
} // GameSlot
} // StoryModeStatus
//-----------------------------------------------------------------------------
GameSlot::~GameSlot()
StoryModeStatus::~StoryModeStatus()
{
std::map<std::string, Challenge*>::iterator it;
std::map<std::string, ChallengeStatus*>::iterator it;
for (it = m_challenges_state.begin();it != m_challenges_state.end();it++)
{
delete it->second;
}
} // ~GameSlot
} // ~StoryModeStatus
//-----------------------------------------------------------------------------
bool GameSlot::isLocked(const std::string& feature)
bool StoryModeStatus::isLocked(const std::string& feature)
{
return m_locked_features.find(feature)!=m_locked_features.end();
} // featureIsLocked
//-----------------------------------------------------------------------------
void GameSlot::computeActive()
void StoryModeStatus::computeActive()
{
m_points = 0;
m_easy_challenges = 0;
@ -69,7 +69,7 @@ void GameSlot::computeActive()
m_locked_features.clear(); // start afresh
std::map<std::string, Challenge*>::const_iterator i;
std::map<std::string, ChallengeStatus*>::const_iterator i;
for(i = m_challenges_state.begin();
i != m_challenges_state.end(); i++)
{
@ -166,10 +166,10 @@ void GameSlot::computeActive()
//-----------------------------------------------------------------------------
void GameSlot::lockFeature(Challenge *challenge)
void StoryModeStatus::lockFeature(ChallengeStatus *challenge_status)
{
const std::vector<ChallengeData::UnlockableFeature>& features =
challenge->getData()->getFeatures();
challenge_status->getData()->getFeatures();
const unsigned int amount = (unsigned int)features.size();
for (unsigned int n=0; n<amount; n++)
@ -184,7 +184,7 @@ void GameSlot::lockFeature(Challenge *challenge)
* \param d Difficulty at which the challenge was solved.
* \param do_save If true update the challenge file on disk.
*/
void GameSlot::unlockFeature(Challenge* c, RaceManager::Difficulty d,
void StoryModeStatus::unlockFeature(ChallengeStatus* c, RaceManager::Difficulty d,
bool do_save)
{
const unsigned int amount=(unsigned int)c->getData()->getFeatures().size();
@ -213,17 +213,17 @@ void GameSlot::unlockFeature(Challenge* c, RaceManager::Difficulty d,
/** Set the current challenge (or NULL if no challenge is done).
* \param challenge Pointer to the challenge (or NULL)
*/
void GameSlot::setCurrentChallenge(const std::string &challenge_id)
void StoryModeStatus::setCurrentChallenge(const std::string &challenge_id)
{
m_current_challenge = challenge_id=="" ? NULL
: getChallenge(challenge_id);
: getChallengeStatus(challenge_id);
} // setCurrentChallenge
//-----------------------------------------------------------------------------
/** This is called when a race is finished. See if there is an active
* challenge that was fulfilled.
*/
void GameSlot::raceFinished()
void StoryModeStatus::raceFinished()
{
if(m_current_challenge &&
m_current_challenge->isActive(race_manager->getDifficulty()) &&
@ -232,7 +232,7 @@ void GameSlot::raceFinished()
// cast const away so that the challenge can be set to fulfilled.
// The 'clean' implementation would involve searching the challenge
// in m_challenges_state, which is a bit of an overkill
unlockFeature(const_cast<Challenge*>(m_current_challenge),
unlockFeature(const_cast<ChallengeStatus*>(m_current_challenge),
race_manager->getDifficulty());
} // if isActive && challenge solved
} // raceFinished
@ -241,13 +241,13 @@ void GameSlot::raceFinished()
/** This is called when a GP is finished. See if there is an active
* challenge that was fulfilled.
*/
void GameSlot::grandPrixFinished()
void StoryModeStatus::grandPrixFinished()
{
if(m_current_challenge &&
m_current_challenge->isActive(race_manager->getDifficulty()) &&
m_current_challenge->getData()->isGPFulfilled() )
{
unlockFeature(const_cast<Challenge*>(m_current_challenge),
unlockFeature(const_cast<ChallengeStatus*>(m_current_challenge),
race_manager->getDifficulty());
} // if isActive && challenge solved
@ -255,19 +255,18 @@ void GameSlot::grandPrixFinished()
} // grandPrixFinished
//-----------------------------------------------------------------------------
/** Writes the data of this GameSlot to the specified stream.
/** Writes the data of this StoryModeStatus to the specified stream.
* \param out UTF stream to write to.
*/
void GameSlot::save(UTFWriter &out)
void StoryModeStatus::save(UTFWriter &out)
{
out << " <game-slot playerID=\"" << m_player_unique_id
<< "\" first-time=\"" << m_first_time << L"\">\n";
std::map<std::string, Challenge*>::const_iterator i;
out << " <story-mode first-time=\"" << m_first_time << L"\">\n";
std::map<std::string, ChallengeStatus*>::const_iterator i;
for(i = m_challenges_state.begin();
i != m_challenges_state.end(); i++)
{
if (i->second != NULL)
i->second->save(out);
}
out << " </game-slot>\n";
out << " </story-mode>\n";
} // save

View File

@ -28,9 +28,8 @@ using namespace irr;
#include <map>
#include <vector>
class Challenge;
class ChallengeData;
class ChallengeStatus;
class UTFWriter;
class XMLNode;
@ -38,17 +37,11 @@ const int CHALLENGE_POINTS[] = { 8, 9, 10 };
/**
* \ingroup challenges
* This class contains the progression through challenges for one game slot
* This class contains the progression through challenges for the story mode.
*/
class GameSlot
class StoryModeStatus
{
/** Profile names can change, so rather than try to make sure all renames
* are done everywhere, assign a unique ID to each profiler.
* Will save much headaches.
*/
unsigned int m_player_unique_id;
/** Contains whether each feature of the challenge is locked or unlocked */
std::map<std::string, bool> m_locked_features;
@ -56,11 +49,11 @@ class GameSlot
* until they are shown to the user) */
std::vector<const ChallengeData*> m_unlocked_features;
std::map<std::string, Challenge*> m_challenges_state;
std::map<std::string, ChallengeStatus*> m_challenges_state;
/** A pointer to the current challenge, or NULL
* if no challenge is active. */
const Challenge *m_current_challenge;
const ChallengeStatus *m_current_challenge;
friend class UnlockManager;
@ -75,13 +68,13 @@ class GameSlot
public:
GameSlot(const XMLNode *node=NULL);
~GameSlot();
StoryModeStatus(const XMLNode *node=NULL);
~StoryModeStatus();
void computeActive();
bool isLocked (const std::string& feature);
void lockFeature (Challenge *challenge);
void unlockFeature (Challenge* c, RaceManager::Difficulty d,
void lockFeature (ChallengeStatus *challenge);
void unlockFeature (ChallengeStatus* c, RaceManager::Difficulty d,
bool do_save=true);
void raceFinished ();
void grandPrixFinished ();
@ -115,17 +108,20 @@ public:
/** Returns if this is the first time the intro is shown. */
bool isFirstTime() const { return m_first_time; }
// ------------------------------------------------------------------------
const Challenge *getCurrentChallenge() const { return m_current_challenge; }
const ChallengeStatus *getCurrentChallengeStatus() const
{
return m_current_challenge;
} // getCurrentChallengeStatus
// ------------------------------------------------------------------------
/** Returns a challenge given the challenge id.
*/
const Challenge* getChallenge(const std::string& id) const
const ChallengeStatus* getChallengeStatus(const std::string& id) const
{
std::map<std::string, Challenge*>::const_iterator it =
std::map<std::string, ChallengeStatus*>::const_iterator it =
m_challenges_state.find(id);
assert(it!=m_challenges_state.end());
return it->second;
} // getChallenge
}; // GameSlot
} // getChallengeStatus
}; // StoryModeStatus
#endif

View File

@ -18,11 +18,11 @@
#include "challenges/unlock_manager.hpp"
#include "achievements/achievements_manager.hpp"
#include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp"
#include "challenges/challenge_data.hpp"
#include "challenges/challenge_status.hpp"
#include "config/player_manager.hpp"
#include "config/player_profile.hpp"
#include "config/user_config.hpp"
@ -182,12 +182,12 @@ void UnlockManager::addChallenge(const std::string& filename)
* challenge exist.
* \param id Id of the challenge.
*/
const ChallengeData* UnlockManager::getChallenge(const std::string& id)
const ChallengeData* UnlockManager::getChallengeData(const std::string& id)
{
AllChallengesType::const_iterator it = m_all_challenges.find(id);
if(it==m_all_challenges.end()) return NULL;
return it->second;
} // getChallenge
} // getChallengeData
//-----------------------------------------------------------------------------
/** Creates a game slot. It initialises the game slot's status with the
@ -195,24 +195,24 @@ const ChallengeData* UnlockManager::getChallenge(const std::string& id)
* states for a player.
* \param node The XML game-slots node with all data for a player.
*/
GameSlot *UnlockManager::createGameSlot(const XMLNode *node)
StoryModeStatus* UnlockManager::createStoryModeStatus(const XMLNode *node)
{
GameSlot *slot = new GameSlot(node);
StoryModeStatus *status = new StoryModeStatus(node);
for(AllChallengesType::iterator i = m_all_challenges.begin();
i!=m_all_challenges.end(); i++)
{
ChallengeData* cd = i->second;
Challenge *challenge = new Challenge(cd);
ChallengeStatus *challenge_status = new ChallengeStatus(cd);
if(node)
challenge->load(node);
slot->m_challenges_state[cd->getId()] = challenge;
challenge_status->load(node);
status->m_challenges_state[cd->getId()] = challenge_status;
}
slot->computeActive();
return slot;
} // createGameSlot
status->computeActive();
return status;
} // createStoryModeStatus
//-----------------------------------------------------------------------------
void UnlockManager::playLockSound() const

View File

@ -24,7 +24,7 @@
#include "config/user_config.hpp"
#include "challenges/challenge_data.hpp"
#include "challenges/game_slot.hpp"
#include "challenges/story_mode_status.hpp"
#include "utils/no_copy.hpp"
#include "utils/ptr_vector.hpp"
@ -48,15 +48,13 @@ private:
void readAllChallengesInDirs(const std::vector<std::string>* all_dirs);
friend class GameSlot;
public:
UnlockManager ();
~UnlockManager ();
void addOrFreeChallenge(ChallengeData *c);
void addChallenge (const std::string& filename);
const ChallengeData *getChallenge (const std::string& id);
const ChallengeData *getChallengeData(const std::string& id);
bool isSupportedVersion(const ChallengeData &challenge);
@ -67,7 +65,7 @@ public:
std::vector<std::string>& tracks,
std::vector<std::string>& gps);
GameSlot *createGameSlot(const XMLNode *node=NULL);
StoryModeStatus *createStoryModeStatus(const XMLNode *node=NULL);
}; // UnlockManager

View File

@ -18,7 +18,6 @@
#include "config/player_profile.hpp"
#include "challenges/game_slot.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
#include "io/xml_node.hpp"
@ -38,11 +37,11 @@ PlayerProfile::PlayerProfile(const core::stringw& name, bool is_guest)
#ifdef DEBUG
m_magic_number = 0xABCD1234;
#endif
m_name = name;
m_is_guest_account = is_guest;
m_use_frequency = is_guest ? -1 : 0;
m_unique_id = PlayerManager::get()->getUniqueId();
m_game_slot = unlock_manager->createGameSlot();
m_name = name;
m_is_guest_account = is_guest;
m_use_frequency = is_guest ? -1 : 0;
m_unique_id = PlayerManager::get()->getUniqueId();
m_story_mode_status = unlock_manager->createStoryModeStatus();
} // PlayerProfile
@ -60,8 +59,8 @@ PlayerProfile::PlayerProfile(const XMLNode* node)
#ifdef DEBUG
m_magic_number = 0xABCD1234;
#endif
const XMLNode *xml_game_slot = node->getNode("game-slot");
m_game_slot = unlock_manager->createGameSlot(xml_game_slot);
const XMLNode *xml_game_slot = node->getNode("story-mode");
m_story_mode_status = unlock_manager->createStoryModeStatus(xml_game_slot);
} // PlayerProfile
@ -76,8 +75,8 @@ void PlayerProfile::save(UTFWriter &out)
<< L"\" use-frequency=\"" << m_use_frequency
<< L"\" is-default=\"" << m_is_default
<< L"\" unique-id=\"" << m_unique_id << L"\">\n";
assert(m_game_slot);
m_game_slot->save(out);
assert(m_story_mode_status);
m_story_mode_status->save(out);
out << L" </player>\n";
} // save

View File

@ -16,11 +16,10 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_PLAYER_HPP
#define HEADER_PLAYER_HPP
#include "challenges/game_slot.hpp"
#ifndef HEADER_PLAYER_PROFILE_HPP
#define HEADER_PLAYER_PROFILE_HPP
#include "challenges/story_mode_status.hpp"
#include "config/user_config.hpp"
#include "utils/no_copy.hpp"
#include "utils/types.hpp"
@ -30,7 +29,6 @@ using namespace irr;
#include <string>
class GameSlot;
class UTFWriter;
/**
@ -64,7 +62,7 @@ private:
bool m_is_default;
/** The complete challenge state. */
GameSlot *m_game_slot;
StoryModeStatus *m_story_mode_status;
public:
@ -129,64 +127,64 @@ public:
/** Returnes if the feature (kart, track) is locked. */
bool isLocked(const std::string &feature) const
{
return m_game_slot->isLocked(feature);
return m_story_mode_status->isLocked(feature);
} // isLocked
// ------------------------------------------------------------------------
/** Returns all active challenges. */
void computeActive() { m_game_slot->computeActive(); }
void computeActive() { m_story_mode_status->computeActive(); }
// ------------------------------------------------------------------------
/** Returns the list of recently completed challenges. */
std::vector<const ChallengeData*> getRecentlyCompletedChallenges()
{
return m_game_slot->getRecentlyCompletedChallenges();
return m_story_mode_status->getRecentlyCompletedChallenges();
} // getRecently Completed Challenges
// ------------------------------------------------------------------------
/** Sets the currently active challenge. */
void setCurrentChallenge(const std::string &name)
{
m_game_slot->setCurrentChallenge(name);
m_story_mode_status->setCurrentChallenge(name);
} // setCurrentChallenge
// ------------------------------------------------------------------------
/** Notification of a finished race, which can trigger fulfilling
* challenges. */
void raceFinished() { m_game_slot->raceFinished(); }
void raceFinished() { m_story_mode_status->raceFinished(); }
// ------------------------------------------------------------------------
/** Callback when a GP is finished (to test if a challenge was
* fulfilled). */
void grandPrixFinished() { m_game_slot->grandPrixFinished(); }
void grandPrixFinished() { m_story_mode_status->grandPrixFinished(); }
// ------------------------------------------------------------------------
unsigned int getPoints() const { return m_game_slot->getPoints(); }
unsigned int getPoints() const { return m_story_mode_status->getPoints(); }
// ------------------------------------------------------------------------
void setFirstTime(bool b) { m_game_slot->setFirstTime(b); }
void setFirstTime(bool b) { m_story_mode_status->setFirstTime(b); }
// ------------------------------------------------------------------------
bool isFirstTime() const { return m_game_slot->isFirstTime(); }
bool isFirstTime() const { return m_story_mode_status->isFirstTime(); }
// ------------------------------------------------------------------------
void clearUnlocked() { m_game_slot->clearUnlocked(); }
void clearUnlocked() { m_story_mode_status->clearUnlocked(); }
// ------------------------------------------------------------------------
/** Returns the current challenge for this player. */
const Challenge* getCurrentChallenge() const
const ChallengeStatus* getCurrentChallengeStatus() const
{
return m_game_slot->getCurrentChallenge();
} // getCurrentChallenge
return m_story_mode_status->getCurrentChallengeStatus();
} // getCurrentChallengeStatus
// ------------------------------------------------------------------------
const Challenge* getChallenge(const std::string &id)
const ChallengeStatus* getChallengeStatus(const std::string &id)
{
return m_game_slot->getChallenge(id);
} // getChallenge
return m_story_mode_status->getChallengeStatus(id);
} // getChallengeStatus
// ------------------------------------------------------------------------
unsigned int getNumEasyTrophies() const
{
return m_game_slot->getNumEasyTrophies();
return m_story_mode_status->getNumEasyTrophies();
} // getNumEasyTrophies
// ------------------------------------------------------------------------
unsigned int getNumMediumTrophies() const
{
return m_game_slot->getNumMediumTrophies();
return m_story_mode_status->getNumMediumTrophies();
} // getNumEasyTrophies
// -----------------------------------------------------------------------
unsigned int getNumHardTrophies() const
{
return m_game_slot->getNumHardTrophies();
return m_story_mode_status->getNumHardTrophies();
} // getNumHardTropies
}; // class PlayerProfile

View File

@ -533,7 +533,10 @@ void Camera::positionCamera(float dt, float above_kart, float cam_angle,
wanted_target - m_camera->getPosition());
}
}
// Rotate the up vector (0,1,0) by the rotation ... which is just column 1
Vec3 up = m_kart->getTrans().getBasis().getColumn(1);
m_camera->setUpVector(up.toIrrVector());
} // positionCamera
// ----------------------------------------------------------------------------

View File

@ -19,16 +19,10 @@
#include "karts/kart.hpp"
#include <math.h>
#include <iostream>
#include <algorithm> // for min and max
#include <ICameraSceneNode.h>
#include <ISceneManager.h>
#include "audio/music_manager.hpp"
#include "audio/sfx_manager.hpp"
#include "audio/sfx_base.hpp"
#include "challenges/challenge_status.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
#include "config/user_config.hpp"
@ -73,6 +67,12 @@
#include "utils/log.hpp" //TODO: remove after debugging is done
#include "utils/vs.hpp"
#include <ICameraSceneNode.h>
#include <ISceneManager.h>
#include <algorithm> // for min and max
#include <iostream>
#include <math.h>
#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
@ -806,7 +806,7 @@ void Kart::finishedRace(float time)
if (m_controller->isPlayerController()) // if player is on this computer
{
PlayerProfile *player = PlayerManager::get()->getCurrentPlayer();
const Challenge *challenge = player->getCurrentChallenge();
const ChallengeStatus *challenge = player->getCurrentChallengeStatus();
// In case of a GP challenge don't make the end animation depend
// on if the challenge is fulfilled
if(challenge && !challenge->getData()->isGrandPrix())

View File

@ -20,7 +20,6 @@
#include "animations/animation_base.hpp"
#include "animations/three_d_animation.hpp"
#include "audio/music_manager.hpp"
#include "challenges/game_slot.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
#include "graphics/irr_driver.hpp"

View File

@ -22,7 +22,6 @@
#include <string>
#include <iostream>
#include "challenges/game_slot.hpp"
#include "challenges/unlock_manager.hpp"
#include "audio/sfx_manager.hpp"
#include "states_screens/online_screen.hpp"

View File

@ -15,6 +15,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "states_screens/dialogs/select_challenge.hpp"
#include "challenges/challenge_status.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
#include "config/user_config.hpp"
@ -29,7 +32,6 @@
#include "network/network_manager.hpp"
#include "race/grand_prix_manager.hpp"
#include "race/race_manager.hpp"
#include "states_screens/dialogs/select_challenge.hpp"
#include "tracks/track_manager.hpp"
#include "tracks/track.hpp"
#include "utils/log.hpp"
@ -93,7 +95,8 @@ SelectChallengeDialog::SelectChallengeDialog(const float percentWidth,
break;
}
const Challenge* c = PlayerManager::get()->getCurrentPlayer()->getChallenge(challenge_id);
const ChallengeStatus* c = PlayerManager::get()->getCurrentPlayer()
->getChallengeStatus(challenge_id);
if (c->isSolved(RaceManager::DIFFICULTY_EASY))
{
@ -161,7 +164,7 @@ GUIEngine::EventPropagation SelectChallengeDialog::processEvent(const std::strin
if (eventSource == "novice" || eventSource == "intermediate" ||
eventSource == "expert")
{
const ChallengeData* challenge = unlock_manager->getChallenge(m_challenge_id);
const ChallengeData* challenge = unlock_manager->getChallengeData(m_challenge_id);
if (challenge == NULL)
{

View File

@ -22,7 +22,6 @@
#include "audio/music_manager.hpp"
#include "challenges/challenge_data.hpp"
#include "challenges/game_slot.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
#include "guiengine/engine.hpp"

View File

@ -19,9 +19,7 @@
#include "states_screens/main_menu_screen.hpp"
#include <string>
#include "challenges/game_slot.hpp"
#include "addons/news_manager.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
#include "graphics/irr_driver.hpp"
@ -46,20 +44,21 @@
#include "states_screens/online_screen.hpp"
#include "states_screens/options_screen_video.hpp"
#include "states_screens/state_manager.hpp"
#if DEBUG_MENU_ITEM
#include "states_screens/feature_unlocked.hpp"
#include "states_screens/grand_prix_lose.hpp"
#include "states_screens/grand_prix_win.hpp"
#endif
#include "states_screens/dialogs/message_dialog.hpp"
#include "addons/news_manager.hpp"
#include "tracks/track_manager.hpp"
#include "tracks/track.hpp"
#include "utils/string_utils.hpp"
#include <string>
using namespace GUIEngine;
using namespace Online;

View File

@ -22,7 +22,6 @@
#include <string>
#include <iostream>
#include "challenges/game_slot.hpp"
#include "challenges/unlock_manager.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/scalable_font.hpp"

View File

@ -19,10 +19,7 @@
#include "states_screens/race_gui_overworld.hpp"
using namespace irr;
#include <algorithm>
#include "challenges/challenge_status.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
#include "config/user_config.hpp"
@ -54,6 +51,9 @@ using namespace irr;
#include <ISceneCollisionManager.h>
#include <ISceneManager.h>
using namespace irr;
#include <algorithm>
const int LOCKED = 0;
const int OPEN = 1;
@ -398,9 +398,9 @@ void RaceGUIOverworld::drawGlobalMiniMap()
// bool locked = (m_locked_challenges.find(c) != m_locked_challenges.end());
int state = (challenges[n].getForceField().m_is_locked ? LOCKED : OPEN);
const Challenge* c = PlayerManager::get()->getCurrentPlayer()
->getChallenge(challenges[n].m_challenge_id);
if (c->isSolved(RaceManager::DIFFICULTY_HARD)) state = COMPLETED_HARD;
const ChallengeStatus* c = PlayerManager::get()->getCurrentPlayer()
->getChallengeStatus(challenges[n].m_challenge_id);
if (c->isSolved(RaceManager::DIFFICULTY_HARD)) state = COMPLETED_HARD;
else if (c->isSolved(RaceManager::DIFFICULTY_MEDIUM)) state = COMPLETED_MEDIUM;
else if (c->isSolved(RaceManager::DIFFICULTY_EASY)) state = COMPLETED_EASY;
@ -460,7 +460,8 @@ void RaceGUIOverworld::drawGlobalMiniMap()
continue;
}
const ChallengeData* challenge = unlock_manager->getChallenge(challenges[n].m_challenge_id);
const ChallengeData* challenge =
unlock_manager->getChallengeData(challenges[n].m_challenge_id);
if (challenge == NULL)
{

View File

@ -21,7 +21,7 @@
#include "addons/addon.hpp"
#include "audio/music_manager.hpp"
#include "challenges/challenge.hpp"
#include "challenges/challenge_status.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
#include "config/stk_config.hpp"
@ -164,7 +164,7 @@ unsigned int Track::getNumOfCompletedChallenges()
unlocked_challenges++;
continue;
}
if (player->getChallenge(m_challenges[i].m_challenge_id)
if (player->getChallengeStatus(m_challenges[i].m_challenge_id)
->isSolvedAtAnyDifficulty())
{
unlocked_challenges++;
@ -947,7 +947,7 @@ bool Track::loadMainTrack(const XMLNode &root)
assert(closest_challenge_id < (int)m_challenges.size());
const std::string &s = m_challenges[closest_challenge_id].m_challenge_id;
const ChallengeData* challenge = unlock_manager->getChallenge(s);
const ChallengeData* challenge = unlock_manager->getChallengeData(s);
if (challenge == NULL)
{
if (s != "tutorial")
@ -1126,7 +1126,7 @@ bool Track::loadMainTrack(const XMLNode &root)
if (challenge != "tutorial")
{
c = unlock_manager->getChallenge(challenge);
c = unlock_manager->getChallengeData(challenge);
if (c == NULL)
{
Log::error("track", "Cannot find challenge named <%s>\n",