add GoalCalories

This commit is contained in:
Chris Danford
2005-02-15 22:08:42 +00:00
parent 48911f1572
commit 146dbea98d
4 changed files with 29 additions and 11 deletions
+13
View File
@@ -50,6 +50,7 @@ void GameCommand::Init()
m_vsScreensToPrepare.clear();
m_bDeletePreparedScreens = false;
m_iWeightPounds = -1;
m_iGoalCalories = -1;
m_iStopCourseAtSeconds = -1;
m_bClearBookkeepingData = false;
@@ -125,6 +126,8 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const
return false;
if( m_iWeightPounds != -1 && PROFILEMAN->IsUsingProfile(pn) && PROFILEMAN->GetProfile(pn)->m_iWeightPounds != m_iWeightPounds )
return false;
if( m_iGoalCalories != -1 && PROFILEMAN->IsUsingProfile(pn) && PROFILEMAN->GetProfile(pn)->m_iGoalCalories != m_iGoalCalories )
return false;
if( m_iStopCourseAtSeconds != -1 && GAMESTATE->m_iStopCourseAtSeconds != m_iStopCourseAtSeconds )
return false;
@@ -304,6 +307,11 @@ void GameCommand::Load( int iIndex, const Commands& cmds )
m_iWeightPounds = atoi( sValue );
}
else if( sName == "goalcalories" )
{
m_iGoalCalories = atoi( sValue );
}
else if( sName == "stopcourseatseconds" )
{
m_iStopCourseAtSeconds = atoi( sValue );
@@ -644,6 +652,10 @@ void GameCommand::Apply( const vector<PlayerNumber> &vpns ) const
FOREACH_CONST( PlayerNumber, vpns, pn )
if( PROFILEMAN->IsUsingProfile(*pn) )
PROFILEMAN->GetProfile(*pn)->m_iWeightPounds = m_iWeightPounds;
if( m_iGoalCalories != -1 )
FOREACH_CONST( PlayerNumber, vpns, pn )
if( PROFILEMAN->IsUsingProfile(*pn) )
PROFILEMAN->GetProfile(*pn)->m_iGoalCalories = m_iGoalCalories;
if( m_iStopCourseAtSeconds != -1 )
GAMESTATE->m_iStopCourseAtSeconds = m_iStopCourseAtSeconds;
@@ -787,6 +799,7 @@ bool GameCommand::IsZero() const
!m_sSongGroup.empty() ||
m_SortOrder != SORT_INVALID ||
m_iWeightPounds != -1 ||
m_iGoalCalories != -1 ||
m_iStopCourseAtSeconds != -1
)
return false;
+1
View File
@@ -60,6 +60,7 @@ public:
vector<CString> m_vsScreensToPrepare;
bool m_bDeletePreparedScreens;
int m_iWeightPounds; // -1 == none specified
int m_iGoalCalories; // -1 == none specified
int m_iStopCourseAtSeconds; // -1 == none specified
bool m_bClearBookkeepingData;
+13 -10
View File
@@ -77,6 +77,7 @@ void Profile::InitGeneralData()
m_iTotalGameplaySeconds = 0;
m_iCurrentCombo = 0;
m_fTotalCaloriesBurned = 0;
m_iGoalCalories = 0;
m_iTotalDancePoints = 0;
m_iNumExtraStagesPassed = 0;
m_iNumExtraStagesFailed = 0;
@@ -787,6 +788,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
pGeneralDataNode->AppendChild( "TotalGameplaySeconds", m_iTotalGameplaySeconds );
pGeneralDataNode->AppendChild( "CurrentCombo", m_iCurrentCombo );
pGeneralDataNode->AppendChild( "TotalCaloriesBurned", m_fTotalCaloriesBurned );
pGeneralDataNode->AppendChild( "GoalCalories", m_iGoalCalories );
pGeneralDataNode->AppendChild( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid );
pGeneralDataNode->AppendChild( "LastPlayedDate", m_LastPlayedDate );
pGeneralDataNode->AppendChild( "TotalDancePoints", m_iTotalDancePoints );
@@ -862,16 +864,6 @@ XNode* Profile::SaveGeneralDataCreateNode() const
}
}
{
XNode* pNumStagesPassedByGrade = pGeneralDataNode->AppendChild("NumStagesPassedByGrade");
FOREACH_Grade( g )
{
if( !m_iNumStagesPassedByGrade[g] )
continue;
pNumStagesPassedByGrade->AppendChild( GradeToString(g), m_iNumStagesPassedByGrade[g] );
}
}
{
XNode* pNumStagesPassedByPlayMode = pGeneralDataNode->AppendChild("NumStagesPassedByPlayMode");
FOREACH_PlayMode( pm )
@@ -883,6 +875,16 @@ XNode* Profile::SaveGeneralDataCreateNode() const
}
}
{
XNode* pNumStagesPassedByGrade = pGeneralDataNode->AppendChild("NumStagesPassedByGrade");
FOREACH_Grade( g )
{
if( !m_iNumStagesPassedByGrade[g] )
continue;
pNumStagesPassedByGrade->AppendChild( GradeToString(g), m_iNumStagesPassedByGrade[g] );
}
}
return pGeneralDataNode;
}
@@ -936,6 +938,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
pNode->GetChildValue( "TotalGameplaySeconds", m_iTotalGameplaySeconds );
pNode->GetChildValue( "CurrentCombo", m_iCurrentCombo );
pNode->GetChildValue( "TotalCaloriesBurned", m_fTotalCaloriesBurned );
pNode->GetChildValue( "GoalCalories", m_iGoalCalories );
pNode->GetChildValue( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid );
pNode->GetChildValue( "LastPlayedDate", m_LastPlayedDate );
pNode->GetChildValue( "TotalDancePoints", m_iTotalDancePoints );
+2 -1
View File
@@ -86,7 +86,7 @@ public:
//
CString m_sDisplayName;
CString m_sLastUsedHighScoreName; // this doesn't really belong in "editable", but we need it in the smaller editable file so that it can be ready quickly.
int m_iWeightPounds; // 0 == invalid
int m_iWeightPounds; // 0 == not set
//
// General data
@@ -103,6 +103,7 @@ public:
int m_iTotalGameplaySeconds;
int m_iCurrentCombo;
float m_fTotalCaloriesBurned;
int m_iGoalCalories;
int m_iTotalDancePoints;
int m_iNumExtraStagesPassed;
int m_iNumExtraStagesFailed;