add a write-only copy of Coin data to stats.xml
This commit is contained in:
+10
-10
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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; i<NUM_LAST_DAYS; i++ )
|
||||
p->AppendChild( LastDayToString(i), coins[i] );
|
||||
}
|
||||
{
|
||||
int coins[NUM_LAST_WEEKS];
|
||||
BOOKKEEPER->GetCoinsLastWeeks( coins );
|
||||
XNode* p = pNode->AppendChild( "LastWeeks" );
|
||||
for( int i=0; i<NUM_LAST_WEEKS; i++ )
|
||||
p->AppendChild( LastWeekToString(i), coins[i] );
|
||||
}
|
||||
{
|
||||
int coins[DAYS_IN_WEEK];
|
||||
BOOKKEEPER->GetCoinsByDayOfWeek( coins );
|
||||
XNode* p = pNode->AppendChild( "DayOfWeek" );
|
||||
for( int i=0; i<DAYS_IN_WEEK; i++ )
|
||||
p->AppendChild( DayOfWeekToString(i), coins[i] );
|
||||
}
|
||||
{
|
||||
int coins[HOURS_IN_DAY];
|
||||
BOOKKEEPER->GetCoinsByHour( coins );
|
||||
XNode* p = pNode->AppendChild( "Hour" );
|
||||
for( int i=0; i<HOURS_IN_DAY; i++ )
|
||||
p->AppendChild( HourInDayToString(i), coins[i] );
|
||||
}
|
||||
|
||||
return pNode;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
|
||||
@@ -279,6 +279,8 @@ public:
|
||||
XNode* SaveRecentSongScoresCreateNode() const;
|
||||
XNode* SaveRecentCourseScoresCreateNode() const;
|
||||
|
||||
XNode* SaveCoinDataCreateNode() const;
|
||||
|
||||
void SaveStatsWebPageToDir( CString sDir ) const;
|
||||
void SaveMachinePublicKeyToDir( CString sDir ) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user