Renamed GameSlot to StoryModeStatus to better describe its function.
This commit is contained in:
parent
f2e6126f8d
commit
94da45238c
@ -19,7 +19,7 @@ src/audio/sfx_manager.cpp
|
||||
src/audio/sfx_openal.cpp
|
||||
src/challenges/challenge_data.cpp
|
||||
src/challenges/challenge_status.cpp
|
||||
src/challenges/game_slot.cpp
|
||||
src/challenges/story_mode_status.cpp
|
||||
src/challenges/unlock_manager.cpp
|
||||
src/config/device_config.cpp
|
||||
src/config/player_manager.cpp
|
||||
@ -348,7 +348,7 @@ src/audio/sfx_manager.hpp
|
||||
src/audio/sfx_openal.hpp
|
||||
src/challenges/challenge_data.hpp
|
||||
src/challenges/challenge_status.hpp
|
||||
src/challenges/game_slot.hpp
|
||||
src/challenges/story_mode_status.hpp
|
||||
src/challenges/unlock_manager.hpp
|
||||
src/config/device_config.hpp
|
||||
src/config/player_manager.hpp
|
||||
|
@ -17,7 +17,7 @@
|
||||
// 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_status.hpp"
|
||||
#include "challenges/challenge_data.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, 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;
|
||||
@ -166,7 +166,7 @@ void GameSlot::computeActive()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GameSlot::lockFeature(ChallengeStatus *challenge_status)
|
||||
void StoryModeStatus::lockFeature(ChallengeStatus *challenge_status)
|
||||
{
|
||||
const std::vector<ChallengeData::UnlockableFeature>& features =
|
||||
challenge_status->getData()->getFeatures();
|
||||
@ -184,7 +184,7 @@ void GameSlot::lockFeature(ChallengeStatus *challenge_status)
|
||||
* \param d Difficulty at which the challenge was solved.
|
||||
* \param do_save If true update the challenge file on disk.
|
||||
*/
|
||||
void GameSlot::unlockFeature(ChallengeStatus* 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,7 +213,7 @@ void GameSlot::unlockFeature(ChallengeStatus* 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
|
||||
: getChallengeStatus(challenge_id);
|
||||
@ -223,7 +223,7 @@ void GameSlot::setCurrentChallenge(const std::string &challenge_id)
|
||||
/** 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()) &&
|
||||
@ -241,7 +241,7 @@ 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()) &&
|
||||
@ -255,10 +255,10 @@ 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";
|
@ -40,7 +40,7 @@ const int CHALLENGE_POINTS[] = { 8, 9, 10 };
|
||||
* This class contains the progression through challenges for one game slot
|
||||
*/
|
||||
|
||||
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.
|
||||
@ -74,8 +74,8 @@ class GameSlot
|
||||
|
||||
public:
|
||||
|
||||
GameSlot(const XMLNode *node=NULL);
|
||||
~GameSlot();
|
||||
StoryModeStatus(const XMLNode *node=NULL);
|
||||
~StoryModeStatus();
|
||||
|
||||
void computeActive();
|
||||
bool isLocked (const std::string& feature);
|
||||
@ -128,6 +128,6 @@ public:
|
||||
assert(it!=m_challenges_state.end());
|
||||
return it->second;
|
||||
} // getChallengeStatus
|
||||
}; // GameSlot
|
||||
}; // StoryModeStatus
|
||||
|
||||
#endif
|
@ -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,10 +195,10 @@ 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++)
|
||||
@ -207,12 +207,12 @@ GameSlot *UnlockManager::createGameSlot(const XMLNode *node)
|
||||
ChallengeStatus *challenge_status = new ChallengeStatus(cd);
|
||||
if(node)
|
||||
challenge_status->load(node);
|
||||
slot->m_challenges_state[cd->getId()] = challenge_status;
|
||||
status->m_challenges_state[cd->getId()] = challenge_status;
|
||||
}
|
||||
|
||||
slot->computeActive();
|
||||
return slot;
|
||||
} // createGameSlot
|
||||
status->computeActive();
|
||||
return status;
|
||||
} // createStoryModeStatus
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void UnlockManager::playLockSound() const
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
@ -61,7 +60,7 @@ PlayerProfile::PlayerProfile(const XMLNode* node)
|
||||
m_magic_number = 0xABCD1234;
|
||||
#endif
|
||||
const XMLNode *xml_game_slot = node->getNode("game-slot");
|
||||
m_game_slot = unlock_manager->createGameSlot(xml_game_slot);
|
||||
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
|
||||
|
||||
|
@ -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 ChallengeStatus* getCurrentChallengeStatus() const
|
||||
{
|
||||
return m_game_slot->getCurrentChallengeStatus();
|
||||
return m_story_mode_status->getCurrentChallengeStatus();
|
||||
} // getCurrentChallengeStatus
|
||||
// ------------------------------------------------------------------------
|
||||
const ChallengeStatus* getChallengeStatus(const std::string &id)
|
||||
{
|
||||
return m_game_slot->getChallengeStatus(id);
|
||||
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
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -164,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)
|
||||
{
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user