Revert "Preserve Steps of unknown Style."

This reverts commit 8edd929e24.

This also updates the song cache.
This commit is contained in:
Jason Felds
2014-10-19 10:06:40 -04:00
parent a09e3477b2
commit 395107d3d5
8 changed files with 10 additions and 54 deletions
+1 -2
View File
@@ -73,7 +73,7 @@ void SMLoader::LoadFromTokens(
Trim( sDifficulty );
Trim( sNoteData );
// LOG->Trace( "Steps::LoadFromTokens(), %s", sStepsType.c_str() );
// LOG->Trace( "Steps::LoadFromTokens()" );
// backwards compatibility hacks:
// HACK: We eliminated "ez2-single-hard", but we should still handle it.
@@ -85,7 +85,6 @@ void SMLoader::LoadFromTokens(
sStepsType = "para-single";
out.m_StepsType = GAMEMAN->StringToStepsType( sStepsType );
out.m_StepsTypeStr = sStepsType;
out.SetDescription( sDescription );
out.SetCredit( sDescription ); // this is often used for both.
out.SetChartName(sDescription); // yeah, one more for good measure.
-2
View File
@@ -643,7 +643,6 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
if( sValueName=="STEPSTYPE" )
{
pNewNotes->m_StepsType = GAMEMAN->StringToStepsType( sParams[1] );
pNewNotes->m_StepsTypeStr= sParams[1];
}
else if( sValueName=="CHARTSTYLE" )
@@ -966,7 +965,6 @@ bool SSCLoader::LoadEditFromMsd(const MsdFile &msd,
if( sValueName=="STEPSTYPE" )
{
pNewNotes->m_StepsType = GAMEMAN->StringToStepsType( sParams[1] );
pNewNotes->m_StepsTypeStr= sParams[1];
bSSCFormat = true;
}
+2 -2
View File
@@ -206,9 +206,9 @@ static RString GetSMNotesTag( const Song &song, const Steps &in )
lines.push_back( "" );
// Escape to prevent some clown from making a comment of "\r\n;"
lines.push_back( ssprintf("//---------------%s - %s----------------",
in.m_StepsTypeStr.c_str(), SmEscape(in.GetDescription()).c_str()) );
GAMEMAN->GetStepsTypeInfo(in.m_StepsType).szName, SmEscape(in.GetDescription()).c_str()) );
lines.push_back( song.m_vsKeysoundFile.empty() ? "#NOTES:" : "#NOTES2:" );
lines.push_back( ssprintf( " %s:", in.m_StepsTypeStr.c_str() ) );
lines.push_back( ssprintf( " %s:", GAMEMAN->GetStepsTypeInfo(in.m_StepsType).szName ) );
RString desc = (USE_CREDIT ? in.GetCredit() : in.GetChartName());
lines.push_back( ssprintf( " %s:", SmEscape(desc).c_str() ) );
lines.push_back( ssprintf( " %s:", DifficultyToString(in.GetDifficulty()).c_str() ) );
+2 -2
View File
@@ -349,10 +349,10 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa
lines.push_back( "" );
// Escape to prevent some clown from making a comment of "\r\n;"
lines.push_back( ssprintf("//---------------%s - %s----------------",
in.m_StepsTypeStr.c_str(), SmEscape(in.GetDescription()).c_str()) );
GAMEMAN->GetStepsTypeInfo(in.m_StepsType).szName, SmEscape(in.GetDescription()).c_str()) );
lines.push_back( "#NOTEDATA:;" ); // our new separator.
lines.push_back( ssprintf( "#CHARTNAME:%s;", SmEscape(in.GetChartName()).c_str()));
lines.push_back( ssprintf( "#STEPSTYPE:%s;", in.m_StepsTypeStr.c_str() ) );
lines.push_back( ssprintf( "#STEPSTYPE:%s;", GAMEMAN->GetStepsTypeInfo(in.m_StepsType).szName ) );
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() ) );
+4 -33
View File
@@ -42,7 +42,7 @@
* @brief The internal version of the cache for StepMania.
*
* Increment this value to invalidate the current cache. */
const int FILE_CACHE_VERSION = 218;
const int FILE_CACHE_VERSION = 220;
/** @brief How long does a song sample last by default? */
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
@@ -89,11 +89,6 @@ Song::~Song()
FOREACH( Steps*, m_vpSteps, s )
SAFE_DELETE( *s );
m_vpSteps.clear();
FOREACH(Steps*, m_UnknownStyleSteps, s)
{
SAFE_DELETE(*s);
}
m_UnknownStyleSteps.clear();
// It's the responsibility of the owner of this Song to make sure
// that all pointers to this Song and its Steps are invalidated.
@@ -104,7 +99,6 @@ void Song::DetachSteps()
m_vpSteps.clear();
FOREACH_ENUM( StepsType, st )
m_vpStepsByType[st].clear();
m_UnknownStyleSteps.clear();
}
float Song::GetFirstSecond() const
@@ -160,11 +154,6 @@ void Song::Reset()
m_vpSteps.clear();
FOREACH_ENUM( StepsType, st )
m_vpStepsByType[st].clear();
FOREACH(Steps*, m_UnknownStyleSteps, s)
{
SAFE_DELETE(*s);
}
m_UnknownStyleSteps.clear();
Song empty;
*this = empty;
@@ -1034,10 +1023,6 @@ bool Song::SaveToSMFile()
vpStepsToSave.push_back( pSteps );
}
FOREACH_CONST(Steps*, m_UnknownStyleSteps, s)
{
vpStepsToSave.push_back(*s);
}
return NotesWriterSM::Write( sPath, *this, vpStepsToSave );
@@ -1070,10 +1055,6 @@ bool Song::SaveToSSCFile( RString sPath, bool bSavingCache )
pSteps->SetFilename(path);
vpStepsToSave.push_back( pSteps );
}
FOREACH_CONST(Steps*, m_UnknownStyleSteps, s)
{
vpStepsToSave.push_back(*s);
}
if (bSavingCache)
{
@@ -1523,19 +1504,9 @@ RString Song::GetTranslitFullTitle() const
void Song::AddSteps( Steps* pSteps )
{
// Songs of unknown stepstype are saved as a forwards compatibility feature
// so that editing a simfile made by a future version that has a new style
// won't delete those steps. -Kyz
if(pSteps->m_StepsType != StepsType_Invalid)
{
m_vpSteps.push_back( pSteps );
ASSERT_M( pSteps->m_StepsType < NUM_StepsType, ssprintf("%i", pSteps->m_StepsType) );
m_vpStepsByType[pSteps->m_StepsType].push_back( pSteps );
}
else
{
m_UnknownStyleSteps.push_back(pSteps);
}
m_vpSteps.push_back( pSteps );
ASSERT_M( pSteps->m_StepsType < NUM_StepsType, ssprintf("%i", pSteps->m_StepsType) );
m_vpStepsByType[pSteps->m_StepsType].push_back( pSteps );
}
void Song::DeleteSteps( const Steps* pSteps, bool bReAutoGen )
-2
View File
@@ -447,8 +447,6 @@ private:
vector<Steps*> m_vpSteps;
/** @brief the Steps of a particular StepsType that belong to this Song. */
vector<Steps*> m_vpStepsByType[NUM_StepsType];
/** @brief the Steps that are of unrecognized Styles. */
vector<Steps*> m_UnknownStyleSteps;
};
#endif
+1 -9
View File
@@ -258,16 +258,8 @@ float Steps::PredictMeter() const
void Steps::TidyUpData()
{
// Don't set the StepsType to dance single if it's invalid. That just
// causes unrecognized charts to end up where they don't belong.
// Leave it as StepsType_Invalid so the Song can handle it specially. This
// is a forwards compatibility feature, so that if a future version adds a
// new style, editing a simfile with unrecognized Steps won't silently
// delete them. -Kyz
if( m_StepsType == StepsType_Invalid )
{
LOG->Warn("Detected steps with unknown style '%s' in '%s'", m_StepsTypeStr.c_str(), m_pSong->m_sSongFileName.c_str());
}
m_StepsType = StepsType_dance_single;
if( GetDifficulty() == Difficulty_Invalid )
SetDifficulty( StringToDifficulty(GetDescription()) );
-2
View File
@@ -177,8 +177,6 @@ public:
void PushSelf( lua_State *L );
StepsType m_StepsType;
/** @brief The string form of the StepsType, for dealing with unrecognized styles. */
RString m_StepsTypeStr;
/** @brief The Song these Steps are associated with */
Song *m_pSong;