From bbe90468b42c6e69dc10e0447606404f14cb3955 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Fri, 29 Apr 2011 13:24:50 -0400 Subject: [PATCH] Enforce difficulty meter ranges. WARNING! This invalidates the cache! TODO: Make MAX_METER a common metric? --- src/NotesWriterSM.cpp | 2 +- src/NotesWriterSSC.cpp | 2 +- src/Song.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NotesWriterSM.cpp b/src/NotesWriterSM.cpp index 920081509a..23f9a646ce 100644 --- a/src/NotesWriterSM.cpp +++ b/src/NotesWriterSM.cpp @@ -261,7 +261,7 @@ static RString GetSMNotesTag( const Song &song, const Steps &in ) RString desc = (USE_CREDIT ? in.GetCredit() : in.GetDescription()); lines.push_back( ssprintf( " %s:", SmEscape(desc).c_str() ) ); lines.push_back( ssprintf( " %s:", DifficultyToString(in.GetDifficulty()).c_str() ) ); - lines.push_back( ssprintf( " %d:", in.GetMeter() ) ); + lines.push_back( ssprintf( " %d:", clamp( in.GetMeter(), MIN_METER, MAX_METER ) ) ); vector asRadarValues; // SM files don't use fakes for radar data. Keep it that way. diff --git a/src/NotesWriterSSC.cpp b/src/NotesWriterSSC.cpp index ca681fe307..3b19eb4270 100644 --- a/src/NotesWriterSSC.cpp +++ b/src/NotesWriterSSC.cpp @@ -282,7 +282,7 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa lines.push_back( ssprintf( "#DESCRIPTION:%s;", SmEscape(in.GetDescription()).c_str() ) ); lines.push_back( ssprintf( "#CHARTSTYLE:%s;", SmEscape(in.GetChartStyle()).c_str() ) ); lines.push_back( ssprintf( "#DIFFICULTY:%s;", DifficultyToString(in.GetDifficulty()).c_str() ) ); - lines.push_back( ssprintf( "#METER:%d;", in.GetMeter() ) ); + lines.push_back( ssprintf( "#METER:%d;", clamp( in.GetMeter(), MIN_METER, MAX_METER ) ) ); vector asRadarValues; FOREACH_PlayerNumber( pn ) diff --git a/src/Song.cpp b/src/Song.cpp index 224fa855bd..96d74b4d57 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -41,7 +41,7 @@ * @brief The internal version of the cache for StepMania. * * Increment this value to invalidate the current cache. */ -const int FILE_CACHE_VERSION = 167; +const int FILE_CACHE_VERSION = 168; /** @brief How long does a song sample last by default? */ const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;