Songs can be in any of the following formats:
* song group/* group/song If we read in "song" don't write out "group/song". If we read in "group/song" make sure we set the course entry's group name.
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
#include "BannerCache.h"
|
||||
#include "RageFileManager.h"
|
||||
#include "CourseWriterCRS.h"
|
||||
#include "song.h"
|
||||
|
||||
const int MAX_EDIT_COURSE_SIZE_BYTES = 30*1024; // 30KB
|
||||
|
||||
@@ -175,7 +174,19 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
||||
else
|
||||
{
|
||||
RString sSong = sParams[1];
|
||||
new_entry.pSong = SONGMAN->FindSong( sSong );
|
||||
sSong.Replace( "\\", "/" );
|
||||
vector<RString> bits;
|
||||
split( sSong, "/", bits );
|
||||
|
||||
if( bits.size() == 2 )
|
||||
{
|
||||
new_entry.sSongGroup = bits[0];
|
||||
new_entry.pSong = SONGMAN->FindSong( bits[0], bits[1] );
|
||||
}
|
||||
else if( bits.size() == 1 )
|
||||
{
|
||||
new_entry.pSong = SONGMAN->FindSong( "", sSong );
|
||||
}
|
||||
|
||||
if( new_entry.pSong == NULL )
|
||||
{
|
||||
@@ -186,7 +197,6 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
||||
sPath.c_str(), sSong.c_str());
|
||||
continue; // skip this #SONG
|
||||
}
|
||||
new_entry.sSongGroup = new_entry.pSong->m_sGroupName;
|
||||
}
|
||||
|
||||
new_entry.baseDifficulty = StringToDifficulty( sParams[2] );
|
||||
|
||||
@@ -102,14 +102,12 @@ bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavin
|
||||
}
|
||||
else if( entry.pSong )
|
||||
{
|
||||
// strip off everything but the group name and song dir
|
||||
vector<RString> as;
|
||||
ASSERT( entry.pSong != NULL );
|
||||
split( entry.pSong->GetSongDir(), "/", as );
|
||||
ASSERT( as.size() >= 2 );
|
||||
RString sGroup = as[ as.size()-2 ];
|
||||
RString sSong = as[ as.size()-1 ];
|
||||
f.Write( "#SONG:" + sGroup + '/' + sSong );
|
||||
const RString &sSong = Basename( entry.pSong->GetSongDir() );
|
||||
|
||||
f.Write( "#SONG:" );
|
||||
if( !entry.sSongGroup.empty() )
|
||||
f.Write( entry.sSongGroup + '/' );
|
||||
f.Write( sSong );
|
||||
}
|
||||
else if( !entry.sSongGroup.empty() )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user