diff --git a/stepmania/src/NotesLoader.cpp b/stepmania/src/NotesLoader.cpp index babc09c8f1..6af7cca5de 100644 --- a/stepmania/src/NotesLoader.cpp +++ b/stepmania/src/NotesLoader.cpp @@ -4,6 +4,11 @@ #include "GameManager.h" #include "RageUtil.h" +#include "NotesLoaderSM.h" +#include "NotesLoaderDWI.h" +#include "NotesLoaderBMS.h" +#include "NotesLoaderKSF.h" + bool NotesLoader::Loadable( const RString &sPath ) { vector list; @@ -26,7 +31,34 @@ void NotesLoader::GetMainAndSubTitlesFromFullTitle( const RString &sFullTitle, R } sMainTitleOut = sFullTitle; sSubTitleOut = ""; -}; +}; + +NotesLoader *NotesLoader::MakeLoader( const RString &sDir ) +{ + NotesLoader *ret; + + /* Actually, none of these have any persistant data, so we + * could optimize this, but since they don't have any data, + * there's no real point ... */ + ret = new SMLoader; + if(ret->Loadable( sDir )) return ret; + delete ret; + + ret = new DWILoader; + if(ret->Loadable( sDir )) return ret; + delete ret; + + ret = new BMSLoader; + if(ret->Loadable( sDir )) return ret; + delete ret; + + ret = new KSFLoader; + if(ret->Loadable( sDir )) return ret; + delete ret; + + return NULL; +} + /* * (c) 2001-2004 Chris Danford, Glenn Maynard diff --git a/stepmania/src/NotesLoader.h b/stepmania/src/NotesLoader.h index 92004b0ddc..da387bcc9b 100644 --- a/stepmania/src/NotesLoader.h +++ b/stepmania/src/NotesLoader.h @@ -21,6 +21,8 @@ public: virtual bool LoadFromDir( const RString &sPath, Song &out ) = 0; virtual void TidyUpData( Song &song, bool cache ) { } bool Loadable( const RString &sPath ); + + static NotesLoader *MakeLoader( const RString& sDir ); }; #endif diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 0b544e6e97..0c7f8fc832 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -26,9 +26,6 @@ #include "SpecialFiles.h" #include "NotesLoaderSM.h" -#include "NotesLoaderDWI.h" -#include "NotesLoaderBMS.h" -#include "NotesLoaderKSF.h" #include "NotesWriterDWI.h" #include "NotesWriterSM.h" @@ -164,32 +161,6 @@ const RString &Song::GetSongFilePath() const return m_sSongFileName; } -NotesLoader *Song::MakeLoader( RString sDir ) const -{ - NotesLoader *ret; - - /* Actually, none of these have any persistant data, so we - * could optimize this, but since they don't have any data, - * there's no real point ... */ - ret = new SMLoader; - if(ret->Loadable( sDir )) return ret; - delete ret; - - ret = new DWILoader; - if(ret->Loadable( sDir )) return ret; - delete ret; - - ret = new BMSLoader; - if(ret->Loadable( sDir )) return ret; - delete ret; - - ret = new KSFLoader; - if(ret->Loadable( sDir )) return ret; - delete ret; - - return NULL; -} - /* Hack: This should be a parameter to TidyUpData, but I don't want to * pull in into Song.h, which is heavily used. */ static set BlacklistedImages; @@ -244,7 +215,7 @@ bool Song::LoadFromSongDir( RString sDir ) // Let's load it from a file, then write a cache entry. // - NotesLoader *ld = MakeLoader( sDir ); + NotesLoader *ld = NotesLoader::MakeLoader( sDir ); if( ld ) { bool success = ld->LoadFromDir( sDir, *this ); diff --git a/stepmania/src/song.h b/stepmania/src/song.h index cbd06ec908..ae860a13ee 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -58,8 +58,6 @@ public: void Reset(); void DetachSteps(); - NotesLoader *MakeLoader( RString sDir ) const; - bool LoadFromSongDir( RString sDir ); void TidyUpData(); // call after loading to clean up invalid data