diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 795d2e9ecd..6a08cd0aa8 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -660,8 +660,9 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode ) CString sStyle; if( !style->GetAttrValue( "Style", sStyle ) ) WARN_AND_CONTINUE; - Style s = GAMEMAN->GameAndStringToStyle( g, sStyle ); + if( s == STYLE_INVALID ) + WARN_AND_CONTINUE; style->GetValue( m_iNumSongsPlayedByStyle[s] ); } @@ -1355,13 +1356,16 @@ void Profile::LoadScreenshotDataFromNode( const XNode* pNode ) Screenshot ss; if( !(*screenshot)->GetChildValue("FileName",ss.sFileName) ) - WARN_AND_CONTINUE; + WARN; if( !(*screenshot)->GetChildValue("MD5",ss.sMD5) ) - WARN_AND_CONTINUE; + WARN; if( !(*screenshot)->GetChildValue("Time",(int&)ss.time) ) // time_t is a signed long on Win32. Is this ok on other platforms? - WARN_AND_CONTINUE; + WARN; + + if( !(*screenshot)->GetChildValue("Location",ss.sLocation) ) + WARN; m_vScreenshots.push_back( ss ); } @@ -1386,6 +1390,7 @@ XNode* Profile::SaveScreenshotDataCreateNode() const pScreenshotNode->AppendChild( "FileName", ss.sFileName ); pScreenshotNode->AppendChild( "MD5", ss.sMD5); pScreenshotNode->AppendChild( "Time", (int) ss.time); + pScreenshotNode->AppendChild( "Location", ss.sLocation); } return pNode; diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index 02f7e2df77..1ebf080633 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -155,8 +155,9 @@ public: struct Screenshot { CString sFileName; // no directory part - just the file name - CString sMD5; // MD5 hash of the screenshot file - time_t time; // return value of time() when screenshot was taken + CString sMD5; // MD5 hash of the screenshot file + time_t time; // return value of time() when screenshot was taken + CString sLocation; // location name where this screenshot was taken }; vector m_vScreenshots; void AddScreenshot( Screenshot screenshot ); diff --git a/stepmania/src/ProfileHtml.cpp b/stepmania/src/ProfileHtml.cpp index f3a8c73a5f..b6b76ee9d1 100644 --- a/stepmania/src/ProfileHtml.cpp +++ b/stepmania/src/ProfileHtml.cpp @@ -911,6 +911,7 @@ void PrintScreenshot( RageFile &f, const Profile::Screenshot &ss ) TABLE_LINE2( "File", ss.sFileName ); TABLE_LINE2( "MD5", ss.sMD5 ); TABLE_LINE2( "Time", (CString)ctime(&ss.time) ); + TABLE_LINE2( "Location", ss.sLocation ); END_TABLE; @@ -923,15 +924,39 @@ void PrintScreenshots( RageFile &f, const Profile *pProfile, CString sTitle, CSt { PRINT_OPEN(f, sTitle ); { - PRINT_OPEN(f, "Less Than 1 Month Old" ); + CString sCurrentMonth; + bool bFirstMonth = true; + + for( int i = (int)pProfile->m_vScreenshots.size()-1; i >= 0; i-- ) { - for( unsigned i=0; im_vScreenshots.size(); i++ ) + Profile::Screenshot ss = pProfile->m_vScreenshots[i]; + tm* new_time = localtime( &ss.time ); + int iYear = new_time->tm_year+1900; + int iMonth = new_time->tm_mon+1; + CString sNewMonth = ssprintf("%02d/%d", iMonth, iYear ); + + if( sNewMonth != sCurrentMonth ) { - const Profile::Screenshot &ss = pProfile->m_vScreenshots[i]; - PrintScreenshot( f, ss ); + if( !bFirstMonth ) + PRINT_CLOSE(f); + PRINT_OPEN(f, sNewMonth, bFirstMonth); } + PrintScreenshot( f, ss ); + + sCurrentMonth = sNewMonth; + bFirstMonth = false; + } + + if( pProfile->m_vScreenshots.empty() ) + { + BEGIN_TABLE(1); + TABLE_LINE1("empty"); + END_TABLE; + } + else + { + PRINT_CLOSE(f); } - PRINT_CLOSE(f); } PRINT_CLOSE(f); } diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index a52d6658e6..c11db864b2 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -1284,6 +1284,7 @@ void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType t screenshot.sFileName = sFileName; screenshot.sMD5 = CRYPTMAN->GetMD5( sPath ); screenshot.time = time(NULL); + screenshot.sLocation = PREFSMAN->m_sMachineName; pProfile->AddScreenshot( screenshot ); }