From e6f37dbee824510842d10474a8a96161f4dbcd07 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 26 Mar 2005 22:18:28 +0000 Subject: [PATCH] Don't fill in new Profiles with a hard-coded "NoName". Let ScreenSystemLayer fill in blank name from metrics. --- stepmania/src/Profile.cpp | 2 +- stepmania/src/ProfileManager.h | 2 +- stepmania/src/ScreenSystemLayer.cpp | 34 ++++++++++++++++++----------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index ebd0c84dcf..c6cfc4c3e5 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -156,7 +156,7 @@ CString Profile::GetDisplayName() const else if( !m_sLastUsedHighScoreName.empty() ) return m_sLastUsedHighScoreName; else - return "NoName"; + return ""; } static CString FormatCalories( float fCals ) diff --git a/stepmania/src/ProfileManager.h b/stepmania/src/ProfileManager.h index c1b0e244a5..4ac3c580a1 100644 --- a/stepmania/src/ProfileManager.h +++ b/stepmania/src/ProfileManager.h @@ -96,7 +96,7 @@ private: bool m_bWasLoadedFromMemoryCard[NUM_PLAYERS]; bool m_bLastLoadWasTamperedOrCorrupt[NUM_PLAYERS]; // true if Stats.xml was present, but failed to load (probably because of a signature failure) - bool m_bLastLoadWasFromLastGood[NUM_PLAYERS]; + bool m_bLastLoadWasFromLastGood[NUM_PLAYERS]; // if true, then m_bLastLoadWasTamperedOrCorrupt is also true // actual loaded profile data Profile m_Profile[NUM_PLAYERS]; diff --git a/stepmania/src/ScreenSystemLayer.cpp b/stepmania/src/ScreenSystemLayer.cpp index e58005ab13..cd6f2d019a 100644 --- a/stepmania/src/ScreenSystemLayer.cpp +++ b/stepmania/src/ScreenSystemLayer.cpp @@ -150,20 +150,28 @@ CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const case MEMORY_CARD_STATE_CHECKING: return CREDITS_CARD_CHECKING.GetValue(); case MEMORY_CARD_STATE_REMOVED: return CREDITS_CARD_REMOVED.GetValue(); case MEMORY_CARD_STATE_READY: - if( PROFILEMAN->LastLoadWasFromLastGood(pn) && pProfile ) - return pProfile->GetDisplayName() + CREDITS_LOADED_FROM_LAST_GOOD_APPEND.GetValue(); - else if( PROFILEMAN->LastLoadWasTamperedOrCorrupt(pn) ) - return CREDITS_LOAD_FAILED.GetValue(); - // Prefer the name of the profile over the name of the card. - else if( pProfile ) - return pProfile->GetDisplayName(); - else if( !MEMCARDMAN->IsNameAvailable(pn) ) - return CREDITS_CARD_READY.GetValue(); - else if( !MEMCARDMAN->GetName(pn).empty() ) - return MEMCARDMAN->GetName(pn); - else - return CREDITS_CARD_NO_NAME.GetValue(); + { + // If the profile failed to load and there was no usable backup... + if( PROFILEMAN->LastLoadWasTamperedOrCorrupt(pn) && !PROFILEMAN->LastLoadWasFromLastGood(pn) ) + return CREDITS_LOAD_FAILED.GetValue(); + // If there is a local profile loaded, prefer it over the name of the memory card. + if( pProfile ) + { + CString s = pProfile->GetDisplayName(); + if( s.empty() ) + s = CREDITS_CARD_NO_NAME.GetValue(); + if( PROFILEMAN->LastLoadWasFromLastGood(pn) ) + s += CREDITS_LOADED_FROM_LAST_GOOD_APPEND.GetValue(); + return s; + } + else if( !MEMCARDMAN->IsNameAvailable(pn) ) + return CREDITS_CARD_READY.GetValue(); + else if( !MEMCARDMAN->GetName(pn).empty() ) + return MEMCARDMAN->GetName(pn); + else + return CREDITS_CARD_NO_NAME.GetValue(); + } default: FAIL_M( ssprintf("%i",mcs) ); }