Skip to content

Commit

Permalink
add checkpoints to various profile operations
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jun 5, 2017
1 parent 18657d3 commit edb50a6
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1413,13 +1413,17 @@ XNode* Profile::SaveGeneralDataCreateNode() const
}

XNode* Profile::SaveFavoritesCreateNode() const {
CHECKPOINT_M("Saving the favorites node.");

XNode* favs = new XNode("Favorites");
FOREACH_CONST(string, FavoritedCharts, it)
favs->AppendChild(*it);
return favs;
}

XNode* Profile::SavePermaMirrorCreateNode() const {
CHECKPOINT_M("Saving the permamirror node.");

XNode* pmir = new XNode("PermaMirror");
FOREACH_CONST(string, PermaMirrorCharts, it)
pmir->AppendChild(*it);
Expand All @@ -1435,6 +1439,8 @@ XNode* GoalsForChart::CreateNode() const {
}

XNode* Profile::SaveScoreGoalsCreateNode() const {
CHECKPOINT_M("Saving the scoregoals node.");

XNode* goals = new XNode("ScoreGoals");
FOREACHUM_CONST(string, GoalsForChart, goalmap, i) {
const GoalsForChart& cg = i->second;
Expand All @@ -1444,6 +1450,8 @@ XNode* Profile::SaveScoreGoalsCreateNode() const {
}

XNode* Profile::SavePlaylistsCreateNode() const {
CHECKPOINT_M("Saving the playlists node.");

XNode* playlists = new XNode("Playlists");
auto& pls = SONGMAN->allplaylists;
FOREACHM(string, Playlist, pls, i)
Expand All @@ -1453,13 +1461,17 @@ XNode* Profile::SavePlaylistsCreateNode() const {
}

void Profile::LoadFavoritesFromNode(const XNode *pNode) {
CHECKPOINT_M("Loading the favorites node.");

FOREACH_CONST_Child(pNode, ck)
FavoritedCharts.emplace_back(SONGMAN->ReconcileBustedKeys(ck->GetName()));

SONGMAN->SetFavoritedStatus(FavoritedCharts);
}

void Profile::LoadPermaMirrorFromNode(const XNode *pNode) {
CHECKPOINT_M("Loading the permamirror node.");

FOREACH_CONST_Child(pNode, ck)
PermaMirrorCharts.emplace_back(SONGMAN->ReconcileBustedKeys(ck->GetName()));

Expand All @@ -1475,6 +1487,8 @@ void GoalsForChart::LoadFromNode(const XNode *pNode) {
}

void Profile::LoadScoreGoalsFromNode(const XNode *pNode) {
CHECKPOINT_M("Loading the scoregoals node.");

RString ck;
FOREACH_CONST_Child(pNode, chgoals) {
chgoals->GetAttrValue("Key", ck);
Expand All @@ -1484,6 +1498,8 @@ void Profile::LoadScoreGoalsFromNode(const XNode *pNode) {
}

void Profile::LoadPlaylistsFromNode(const XNode *pNode) {
CHECKPOINT_M("Loading the playlists node.");

auto& pls = SONGMAN->allplaylists;
FOREACH_CONST_Child(pNode, pl) {
Playlist tmp;
Expand All @@ -1494,8 +1510,9 @@ void Profile::LoadPlaylistsFromNode(const XNode *pNode) {
}


XNode* Profile::SaveEttGeneralDataCreateNode() const
{
XNode* Profile::SaveEttGeneralDataCreateNode() const {
CHECKPOINT_M("Saving the general node.");

XNode* pGeneralDataNode = new XNode("GeneralData");

// TRICKY: These are write-only elements that are normally never read again.
Expand Down Expand Up @@ -1745,8 +1762,8 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
}


void Profile::LoadEttGeneralDataFromNode(const XNode* pNode)
{
void Profile::LoadEttGeneralDataFromNode(const XNode* pNode) {
CHECKPOINT_M("Loading the general node.");
ASSERT(pNode->GetName() == "GeneralData");

RString s;
Expand Down Expand Up @@ -2200,6 +2217,8 @@ ScoreGoal& Profile::GetLowestGoalForRate(const string& ck, float rate) {
}

void Profile::SetAnyAchievedGoals(const string& ck, float& rate, const HighScore& pscore) {
CHECKPOINT_M("Scanning for any goals that may have been accomplished.");

if (!HasGoal(ck))
return;

Expand Down

0 comments on commit edb50a6

Please sign in to comment.