From 899de39e844142c4496360789a93f68be1493bd0 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 10 Mar 2005 20:49:06 +0000 Subject: [PATCH] add DifficultiesToHide tag to courses --- stepmania/src/Course.cpp | 23 +++++++++++++++++++++++ stepmania/src/Course.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index e5e7bdc3f0..3ee5a66eec 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -274,6 +274,15 @@ void Course::LoadFromCRSFile( CString sPath ) rv.FromString( sParams[3] ); m_RadarCache[CacheEntry(st, cd)] = rv; } + else if( !stricmp(sValueName, "DIFFICULTIESTOHIDE") ) + { + m_vDifficultiesToHide.clear(); + for( unsigned i=1; iTrace( "Unexpected value named '%s'", sValueName.c_str() ); @@ -353,6 +362,7 @@ void Course::Init() m_sBannerPath = ""; m_sCDTitlePath = ""; m_iTrailCacheSeed = 0; + m_vDifficultiesToHide.clear(); } void Course::Save( CString sPath, bool bSavingCache ) @@ -377,6 +387,15 @@ void Course::Save( CString sPath, bool bSavingCache ) f.PutLine( "#REPEAT:YES;" ); if( m_iLives != -1 ) f.PutLine( ssprintf("#LIVES:%i;", m_iLives) ); + + { + CString s; + FOREACHS_CONST( CourseDifficulty, m_vDifficultiesToHide, cd ) + s += CourseDifficultyToString( *cd ) + ','; + s.erase( s.end()-1 ); // erase last ',' + f.PutLine( "#DIFFICULTIESTOHIDE:" + s + ";" ); + } + FOREACH_CourseDifficulty( cd ) { if( m_iCustomMeter[cd] == -1 ) @@ -787,6 +806,10 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) case DIFFICULTY_BEGINNER: case DIFFICULTY_CHALLENGE: return false; + default: + if( m_vDifficultiesToHide.find(cd) != m_vDifficultiesToHide.end() ) // found a match + return false; + break; } // diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index 9d5fc1f3a7..2c70d02074 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -8,6 +8,7 @@ #include "Attack.h" #include #include "Trail.h" +#include struct PlayerOptions; struct SongOptions; @@ -162,6 +163,8 @@ private: bool GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const; bool GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const; + set m_vDifficultiesToHide; + typedef pair CacheEntry; struct CacheData {