diff --git a/stepmania/src/DateTime.cpp b/stepmania/src/DateTime.cpp index 3357141df2..742ae576a6 100644 --- a/stepmania/src/DateTime.cpp +++ b/stepmania/src/DateTime.cpp @@ -116,12 +116,12 @@ int StringToDayInYear( CString sDayInYear ) static const CString LAST_DAYS_NAME[NUM_LAST_DAYS] = { "Yesterday", - "2 Days Ago", - "3 Days Ago", - "4 Days Ago", - "5 Days Ago", - "6 Days Ago", - "7 Days Ago", + "Day2Ago", + "Day3Ago", + "Day4Ago", + "Day5Ago", + "Day6Ago", + "Day7Ago", }; CString LastDayToString( int iLastDayIndex ) @@ -147,7 +147,7 @@ CString DayOfWeekToString( int iDayOfWeekIndex ) CString HourInDayToString( int iHourInDayIndex ) { - return ssprintf("%02d:00", iHourInDayIndex); + return ssprintf("Hour%02d_00", iHourInDayIndex); } static const CString MONTH_TO_NAME[MONTHS_IN_YEAR] = @@ -175,9 +175,9 @@ CString LastWeekToString( int iLastWeekIndex ) { switch( iLastWeekIndex ) { - case 0: return "This week"; break; - case 1: return "Last week"; break; - default: return ssprintf("%d weeks ago",iLastWeekIndex); break; + case 0: return "ThisWeek"; break; + case 1: return "LastWeek"; break; + default: return ssprintf("Week%dAgo",iLastWeekIndex); break; } } diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index a4f0e8a8c3..69d7836abe 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -21,6 +21,7 @@ #include "XmlFile.h" #include "Foreach.h" #include "CatalogXml.h" +#include "Bookkeeper.h" // // Old file versions for backward compatibility @@ -647,6 +648,8 @@ bool Profile::SaveAllToDir( CString sDir, bool bSignData ) const xml.AppendChild( SaveCalorieDataCreateNode() ); xml.AppendChild( SaveRecentSongScoresCreateNode() ); xml.AppendChild( SaveRecentCourseScoresCreateNode() ); + if( IsMachine() ) + xml.AppendChild( SaveCoinDataCreateNode() ); DISP_OPT opts = optDefault; opts.stylesheet = STYLE_XSL; @@ -1496,6 +1499,50 @@ bool Profile::IsMachine() const return this == PROFILEMAN->GetMachineProfile(); } + +XNode* Profile::SaveCoinDataCreateNode() const +{ + CHECKPOINT; + + const Profile* pProfile = this; + ASSERT( pProfile ); + + XNode* pNode = new XNode; + pNode->name = "CoinData"; + + { + int coins[NUM_LAST_DAYS]; + BOOKKEEPER->GetCoinsLastDays( coins ); + XNode* p = pNode->AppendChild( "LastDays" ); + for( int i=0; iAppendChild( LastDayToString(i), coins[i] ); + } + { + int coins[NUM_LAST_WEEKS]; + BOOKKEEPER->GetCoinsLastWeeks( coins ); + XNode* p = pNode->AppendChild( "LastWeeks" ); + for( int i=0; iAppendChild( LastWeekToString(i), coins[i] ); + } + { + int coins[DAYS_IN_WEEK]; + BOOKKEEPER->GetCoinsByDayOfWeek( coins ); + XNode* p = pNode->AppendChild( "DayOfWeek" ); + for( int i=0; iAppendChild( DayOfWeekToString(i), coins[i] ); + } + { + int coins[HOURS_IN_DAY]; + BOOKKEEPER->GetCoinsByHour( coins ); + XNode* p = pNode->AppendChild( "Hour" ); + for( int i=0; iAppendChild( HourInDayToString(i), coins[i] ); + } + + return pNode; +} + + /* * (c) 2001-2004 Chris Danford * All rights reserved. diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index 34f0f4482a..b22333dd86 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -279,6 +279,8 @@ public: XNode* SaveRecentSongScoresCreateNode() const; XNode* SaveRecentCourseScoresCreateNode() const; + XNode* SaveCoinDataCreateNode() const; + void SaveStatsWebPageToDir( CString sDir ) const; void SaveMachinePublicKeyToDir( CString sDir ) const;