Achievements progress now actually gets saved.. how cool is that?
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13634 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d6f6383833
commit
c67c5a6fb1
@ -75,6 +75,8 @@ void Achievement::check()
|
|||||||
SingleAchievement::SingleAchievement(const AchievementInfo * info)
|
SingleAchievement::SingleAchievement(const AchievementInfo * info)
|
||||||
: Achievement(info)
|
: Achievement(info)
|
||||||
{
|
{
|
||||||
|
m_progress = 0;
|
||||||
|
m_achieved = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@ -92,7 +94,7 @@ void SingleAchievement::load(XMLNode * input)
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
void SingleAchievement::save(std::ofstream & out)
|
void SingleAchievement::save(std::ofstream & out)
|
||||||
{
|
{
|
||||||
out << "<achievement id=\"" << m_id << "\""
|
out << " <achievement id=\"" << m_id << "\""
|
||||||
<< "achieved=\"" << StringUtils::boolstr(m_achieved) << "\""
|
<< "achieved=\"" << StringUtils::boolstr(m_achieved) << "\""
|
||||||
<< "value=\"" << StringUtils::toString(m_progress) << "\""
|
<< "value=\"" << StringUtils::toString(m_progress) << "\""
|
||||||
<< "/>\n";
|
<< "/>\n";
|
||||||
@ -142,12 +144,12 @@ void MapAchievement::load(XMLNode * input)
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
void MapAchievement::save(std::ofstream & out)
|
void MapAchievement::save(std::ofstream & out)
|
||||||
{
|
{
|
||||||
out << "<achievement id=\"" << m_id << "\" achieved=\"" << StringUtils::boolstr(m_achieved) << "\">\n";
|
out << " <achievement id=\"" << m_id << "\" achieved=\"" << StringUtils::boolstr(m_achieved) << "\">\n";
|
||||||
std::map<std::string, int>::iterator iter;
|
std::map<std::string, int>::iterator iter;
|
||||||
for ( iter = m_progress_map.begin(); iter != m_progress_map.end(); ++iter ) {
|
for ( iter = m_progress_map.begin(); iter != m_progress_map.end(); ++iter ) {
|
||||||
out << " <entry key=\"" << iter->first.c_str() << "\" value=\"" << StringUtils::toString(iter->second) << "\"/>\n";
|
out << " <entry key=\"" << iter->first.c_str() << "\" value=\"" << StringUtils::toString(iter->second) << "\"/>\n";
|
||||||
}
|
}
|
||||||
out << "</achievement>\n";
|
out << " </achievement>\n";
|
||||||
} // save
|
} // save
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
@ -77,7 +77,6 @@ public:
|
|||||||
virtual ~MapAchievementInfo () {};
|
virtual ~MapAchievementInfo () {};
|
||||||
int getGoalValue (const std::string & key) { return m_goal_values[key];}
|
int getGoalValue (const std::string & key) { return m_goal_values[key];}
|
||||||
virtual bool checkCompletion (Achievement * achievement) const;
|
virtual bool checkCompletion (Achievement * achievement) const;
|
||||||
|
|
||||||
virtual Achievement::AchievementType getType() const { return Achievement::AT_MAP; };
|
virtual Achievement::AchievementType getType() const { return Achievement::AT_MAP; };
|
||||||
}; // class MapAchievementInfo
|
}; // class MapAchievementInfo
|
||||||
|
|
||||||
|
@ -152,14 +152,18 @@ void AchievementsManager::createSlotsIfNeeded()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(something_changed) save();
|
if(something_changed){
|
||||||
|
Log::warn("AchievementsManager::save",
|
||||||
|
"errueeeur");
|
||||||
|
save();
|
||||||
|
}
|
||||||
} // UnlockManager::createSlotsIfNeeded
|
} // UnlockManager::createSlotsIfNeeded
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
void AchievementsManager::save()
|
void AchievementsManager::save()
|
||||||
{
|
{
|
||||||
std::string filename = file_manager->getConfigFile("challenges.xml");
|
std::string filename = file_manager->getConfigFile("achievements.xml");
|
||||||
|
|
||||||
std::ofstream achievements_file(filename.c_str(), std::ios::out);
|
std::ofstream achievements_file(filename.c_str(), std::ios::out);
|
||||||
|
|
||||||
|
@ -1367,7 +1367,6 @@ int main(int argc, char *argv[] )
|
|||||||
file_manager->getGUIDir() + "options_video.png") );
|
file_manager->getGUIDir() + "options_video.png") );
|
||||||
kart_properties_manager -> loadAllKarts ();
|
kart_properties_manager -> loadAllKarts ();
|
||||||
unlock_manager = new UnlockManager();
|
unlock_manager = new UnlockManager();
|
||||||
AchievementsManager::get();
|
|
||||||
//m_tutorial_manager = new TutorialManager();
|
//m_tutorial_manager = new TutorialManager();
|
||||||
GUIEngine::addLoadingIcon( irr_driver->getTexture(
|
GUIEngine::addLoadingIcon( irr_driver->getTexture(
|
||||||
file_manager->getTextureFile("gui_lock.png")) );
|
file_manager->getTextureFile("gui_lock.png")) );
|
||||||
@ -1524,6 +1523,7 @@ int main(int argc, char *argv[] )
|
|||||||
// Go straight to the race
|
// Go straight to the race
|
||||||
StateManager::get()->enterGameState();
|
StateManager::get()->enterGameState();
|
||||||
}
|
}
|
||||||
|
AchievementsManager::get();
|
||||||
|
|
||||||
|
|
||||||
// If an important news message exists it is shown in a popup dialog.
|
// If an important news message exists it is shown in a popup dialog.
|
||||||
|
Loading…
Reference in New Issue
Block a user