From f3bfc4117297d74855e9d1228c5ebf8830883314 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 23 Feb 2004 04:53:02 +0000 Subject: [PATCH] change player weight to int --- stepmania/src/Profile.cpp | 30 ++++++++++++++---------------- stepmania/src/Profile.h | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 73e3096a2f..3deb93fff0 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -60,7 +60,7 @@ void Profile::InitEditableData() { m_sDisplayName = ""; m_sLastUsedHighScoreName = ""; - m_fWeightPounds = 0; + m_iWeightPounds = 0; } void Profile::InitGeneralData() @@ -136,7 +136,7 @@ CString Profile::GetDisplayName() const CString Profile::GetDisplayTotalCaloriesBurned() const { - if( m_fWeightPounds == 0 ) // weight not entered + if( m_iWeightPounds == 0 ) // weight not entered return "N/A"; else return Commify((int)m_fTotalCaloriesBurned) + " Cal"; @@ -464,7 +464,7 @@ void Profile::LoadProfileDataFromDirSM390a12( CString sDir ) ini.GetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds ); ini.GetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds ); ini.GetValue( "Profile", "CurrentCombo", m_iCurrentCombo ); - ini.GetValue( "Profile", "WeightPounds", m_fWeightPounds ); + ini.GetValue( "Profile", "WeightPounds", m_iWeightPounds ); ini.GetValue( "Profile", "CaloriesBurned", m_fTotalCaloriesBurned ); ini.GetValue( "Profile", "LastPlayedMachineName", m_sLastPlayedMachineName ); @@ -487,7 +487,7 @@ void Profile::SaveEditableDataToDir( CString sDir ) const ini.SetValue( "Editable", "DisplayName", m_sDisplayName ); ini.SetValue( "Editable", "LastUsedHighScoreName", m_sLastUsedHighScoreName ); - ini.SetValue( "Editable", "WeightPounds", m_fWeightPounds ); + ini.SetValue( "Editable", "WeightPounds", m_iWeightPounds ); ini.WriteFile(); } @@ -615,7 +615,7 @@ void Profile::LoadEditableDataFromDir( CString sDir ) ini.GetValue("Editable","DisplayName", m_sDisplayName); ini.GetValue("Editable","LastUsedHighScoreName", m_sLastUsedHighScoreName); - ini.GetValue("Editable","WeightPounds", m_fWeightPounds); + ini.GetValue("Editable","WeightPounds", m_iWeightPounds); // This is data that the user can change, so we have to validate it. wstring wstr = CStringToWstring(m_sDisplayName); @@ -623,8 +623,8 @@ void Profile::LoadEditableDataFromDir( CString sDir ) wstr = wstr.substr(0, 12); m_sDisplayName = WStringToCString(wstr); // TODO: strip invalid chars? - if( m_fWeightPounds != 0 ) - CLAMP( m_fWeightPounds, 50, 500 ); + if( m_iWeightPounds != 0 ) + CLAMP( m_iWeightPounds, 50, 500 ); } void Profile::LoadGeneralDataFromNode( const XNode* pNode ) @@ -732,14 +732,14 @@ void Profile::AddStepTotals( int iTotalTapsAndHolds, int iTotalJumps, int iTotal m_iTotalMines += iTotalMines; m_iTotalHands += iTotalHands; - if( m_fWeightPounds != 0 ) + if( m_iWeightPounds != 0 ) { float fCals = - SCALE( m_fWeightPounds, 100.f, 200.f, 0.029f, 0.052f ) * iTotalTapsAndHolds + - SCALE( m_fWeightPounds, 100.f, 200.f, 0.111f, 0.193f ) * iTotalJumps + - SCALE( m_fWeightPounds, 100.f, 200.f, 0.029f, 0.052f ) * iTotalHolds + - SCALE( m_fWeightPounds, 100.f, 200.f, 0.000f, 0.000f ) * iTotalMines + - SCALE( m_fWeightPounds, 100.f, 200.f, 0.222f, 0.386f ) * iTotalHands; + SCALE( m_iWeightPounds, 100.f, 200.f, 0.029f, 0.052f ) * iTotalTapsAndHolds + + SCALE( m_iWeightPounds, 100.f, 200.f, 0.111f, 0.193f ) * iTotalJumps + + SCALE( m_iWeightPounds, 100.f, 200.f, 0.029f, 0.052f ) * iTotalHolds + + SCALE( m_iWeightPounds, 100.f, 200.f, 0.000f, 0.000f ) * iTotalMines + + SCALE( m_iWeightPounds, 100.f, 200.f, 0.222f, 0.386f ) * iTotalHands; m_fTotalCaloriesBurned += fCals; tm cur_tm = GetLocalTime(); @@ -1359,9 +1359,7 @@ void Profile::SaveStatsWebPageToDir( CString sDir ) const { ASSERT( PROFILEMAN ); - // UGLY... - bool bThisIsMachineProfile = (this == PROFILEMAN->GetMachineProfile()); - // Profile* pMachineProfile = PROFILEMAN->GetMachineProfile(); + bool bThisIsMachineProfile = (this == PROFILEMAN->GetMachineProfile()); // UGLY SaveStatsWebPage( sDir, diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index 883857cd49..b8ff547994 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -80,7 +80,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. - float m_fWeightPounds; + int m_iWeightPounds; // // General data