add DifficultiesToHide tag to courses

This commit is contained in:
Chris Danford
2005-03-10 20:49:06 +00:00
parent 8b32383969
commit 899de39e84
2 changed files with 26 additions and 0 deletions
+23
View File
@@ -274,6 +274,15 @@ void Course::LoadFromCRSFile( CString sPath )
rv.FromString( sParams[3] ); rv.FromString( sParams[3] );
m_RadarCache[CacheEntry(st, cd)] = rv; m_RadarCache[CacheEntry(st, cd)] = rv;
} }
else if( !stricmp(sValueName, "DIFFICULTIESTOHIDE") )
{
m_vDifficultiesToHide.clear();
for( unsigned i=1; i<sParams.params.size(); i++ )
{
CourseDifficulty cd = StringToCourseDifficulty( sParams[i] );
m_vDifficultiesToHide.insert( cd );
}
}
else else
{ {
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() ); LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
@@ -353,6 +362,7 @@ void Course::Init()
m_sBannerPath = ""; m_sBannerPath = "";
m_sCDTitlePath = ""; m_sCDTitlePath = "";
m_iTrailCacheSeed = 0; m_iTrailCacheSeed = 0;
m_vDifficultiesToHide.clear();
} }
void Course::Save( CString sPath, bool bSavingCache ) void Course::Save( CString sPath, bool bSavingCache )
@@ -377,6 +387,15 @@ void Course::Save( CString sPath, bool bSavingCache )
f.PutLine( "#REPEAT:YES;" ); f.PutLine( "#REPEAT:YES;" );
if( m_iLives != -1 ) if( m_iLives != -1 )
f.PutLine( ssprintf("#LIVES:%i;", m_iLives) ); 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 ) FOREACH_CourseDifficulty( cd )
{ {
if( m_iCustomMeter[cd] == -1 ) if( m_iCustomMeter[cd] == -1 )
@@ -787,6 +806,10 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
case DIFFICULTY_BEGINNER: case DIFFICULTY_BEGINNER:
case DIFFICULTY_CHALLENGE: case DIFFICULTY_CHALLENGE:
return false; return false;
default:
if( m_vDifficultiesToHide.find(cd) != m_vDifficultiesToHide.end() ) // found a match
return false;
break;
} }
// //
+3
View File
@@ -8,6 +8,7 @@
#include "Attack.h" #include "Attack.h"
#include <map> #include <map>
#include "Trail.h" #include "Trail.h"
#include <set>
struct PlayerOptions; struct PlayerOptions;
struct SongOptions; struct SongOptions;
@@ -162,6 +163,8 @@ private:
bool GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const; bool GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;
bool GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const; bool GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;
set<CourseDifficulty> m_vDifficultiesToHide;
typedef pair<StepsType,Difficulty> CacheEntry; typedef pair<StepsType,Difficulty> CacheEntry;
struct CacheData struct CacheData
{ {