Move MakeLoader to NotesLoader. It doesn't make sense for it to be a member function of Song.
This commit is contained in:
@@ -4,6 +4,11 @@
|
|||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
|
||||||
|
#include "NotesLoaderSM.h"
|
||||||
|
#include "NotesLoaderDWI.h"
|
||||||
|
#include "NotesLoaderBMS.h"
|
||||||
|
#include "NotesLoaderKSF.h"
|
||||||
|
|
||||||
bool NotesLoader::Loadable( const RString &sPath )
|
bool NotesLoader::Loadable( const RString &sPath )
|
||||||
{
|
{
|
||||||
vector<RString> list;
|
vector<RString> list;
|
||||||
@@ -28,6 +33,33 @@ void NotesLoader::GetMainAndSubTitlesFromFullTitle( const RString &sFullTitle, R
|
|||||||
sSubTitleOut = "";
|
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
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ public:
|
|||||||
virtual bool LoadFromDir( const RString &sPath, Song &out ) = 0;
|
virtual bool LoadFromDir( const RString &sPath, Song &out ) = 0;
|
||||||
virtual void TidyUpData( Song &song, bool cache ) { }
|
virtual void TidyUpData( Song &song, bool cache ) { }
|
||||||
bool Loadable( const RString &sPath );
|
bool Loadable( const RString &sPath );
|
||||||
|
|
||||||
|
static NotesLoader *MakeLoader( const RString& sDir );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-30
@@ -26,9 +26,6 @@
|
|||||||
#include "SpecialFiles.h"
|
#include "SpecialFiles.h"
|
||||||
|
|
||||||
#include "NotesLoaderSM.h"
|
#include "NotesLoaderSM.h"
|
||||||
#include "NotesLoaderDWI.h"
|
|
||||||
#include "NotesLoaderBMS.h"
|
|
||||||
#include "NotesLoaderKSF.h"
|
|
||||||
#include "NotesWriterDWI.h"
|
#include "NotesWriterDWI.h"
|
||||||
#include "NotesWriterSM.h"
|
#include "NotesWriterSM.h"
|
||||||
|
|
||||||
@@ -164,32 +161,6 @@ const RString &Song::GetSongFilePath() const
|
|||||||
return m_sSongFileName;
|
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
|
/* Hack: This should be a parameter to TidyUpData, but I don't want to
|
||||||
* pull in <set> into Song.h, which is heavily used. */
|
* pull in <set> into Song.h, which is heavily used. */
|
||||||
static set<RString> BlacklistedImages;
|
static set<RString> BlacklistedImages;
|
||||||
@@ -244,7 +215,7 @@ bool Song::LoadFromSongDir( RString sDir )
|
|||||||
// Let's load it from a file, then write a cache entry.
|
// Let's load it from a file, then write a cache entry.
|
||||||
//
|
//
|
||||||
|
|
||||||
NotesLoader *ld = MakeLoader( sDir );
|
NotesLoader *ld = NotesLoader::MakeLoader( sDir );
|
||||||
if( ld )
|
if( ld )
|
||||||
{
|
{
|
||||||
bool success = ld->LoadFromDir( sDir, *this );
|
bool success = ld->LoadFromDir( sDir, *this );
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ public:
|
|||||||
void Reset();
|
void Reset();
|
||||||
void DetachSteps();
|
void DetachSteps();
|
||||||
|
|
||||||
NotesLoader *MakeLoader( RString sDir ) const;
|
|
||||||
|
|
||||||
bool LoadFromSongDir( RString sDir );
|
bool LoadFromSongDir( RString sDir );
|
||||||
|
|
||||||
void TidyUpData(); // call after loading to clean up invalid data
|
void TidyUpData(); // call after loading to clean up invalid data
|
||||||
|
|||||||
Reference in New Issue
Block a user